Dmitry Stogov
267b78550e
Use fastcall calling convention
2018-01-16 10:33:41 +03:00
Dmitry Stogov
12c386f5b9
Use ZEND_CLOSURE_OBJECT() macro to resolve closure op_array to closure object through address calculation, instead of op_array->prototype reuse. (reapply 781e1573af
, now it should be OK).
2018-01-11 22:15:45 +03:00
Dmitry Stogov
6ba10a03e7
Revert "Use ZEND_CLOSURE_OBJECT() macro to resolve closure op_array to closure object through address calculation, instead of op_array->prototype reuse." (this patch is incomplete or wrong)
...
This reverts commit 781e1573af
.
2018-01-11 17:27:26 +03:00
Dmitry Stogov
781e1573af
Use ZEND_CLOSURE_OBJECT() macro to resolve closure op_array to closure object through address calculation, instead of op_array->prototype reuse.
2018-01-11 16:25:28 +03:00
Dmitry Stogov
f09c012ebe
Mark FETCH_OBJ_R and INIT_METHOD_CALL as HOT_OBJ for (UNUSED+CONST and CV+CONST)
2018-01-10 19:14:52 +03:00
Dmitry Stogov
94508cdc3f
Fixed whitespaces
2018-01-10 02:22:07 +03:00
Nikita Popov
d9c706f28d
Merge branch 'PHP-7.2'
2018-01-09 20:25:19 +01:00
Nikita Popov
2dd80a0782
Merge branch 'PHP-7.1' into PHP-7.2
2018-01-09 20:24:48 +01:00
Nikita Popov
fd30c59e04
Fixed bug #75786
...
SEND_UNPACK on iterators was duplicating references in-place,
which effectively leaks the original value and causes an off-by-one
refcount on the duplicated value.
Replace this with a deref, as an actual duplication is not even
needed in this case.
2018-01-09 20:20:31 +01:00
Xinchen Hui
a6519d0514
year++
2018-01-02 12:57:58 +08:00
Xinchen Hui
7a7ec01a49
year++
2018-01-02 12:55:14 +08:00
Xinchen Hui
ccd4716ec7
year++
2018-01-02 12:53:31 +08:00
Dmitry Stogov
5c8f8f8fce
Use ZEND_FAST_CONCAT instead of ZEND_CONCAT for CONST operands.
2017-12-29 13:54:18 +03:00
Dmitry Stogov
f010423335
Use IS_EQUAL instead of CASE when first operand is CV or CONST. Removed CASE handlers that duplicated IS_EQUAL.
2017-12-29 12:57:58 +03:00
Dmitry Stogov
27206f9cc5
Removed useless specialization
2017-12-29 12:02:50 +03:00
Dmitry Stogov
6e4d18924b
Combine READY_TO_DESTROY, EXTRACT_ZVAL_PTR and FREE_OP_VAR_PTR into single, better optimized, macro.
2017-12-26 16:50:34 +03:00
Dmitry Stogov
6e23e84332
Use zval constructors instead ZVAL_COPY if we know the types
2017-12-26 16:49:34 +03:00
Dmitry Stogov
efcbea4345
Cheaper reference construction
2017-12-26 13:30:25 +03:00
Dmitry Stogov
35b3fdfd0a
Separate exceptional code into cold functions.
2017-12-22 16:35:52 +03:00
Dmitry Stogov
f860ae451a
fixed "unused function" compilation warning
2017-12-18 11:43:12 +03:00
Nikita Popov
93c7a3803f
Fix const qualifier warning
2017-12-15 21:58:52 +01:00
Dmitry Stogov
66a604171c
Array addition is not commutative
2017-12-15 14:40:19 +03:00
Dmitry Stogov
588f1df7a2
Remove duplicate handlers for commutative operations
2017-12-15 13:42:54 +03:00
Dmitry Stogov
9e709e2fa0
Move constants into read-only data segment
2017-12-14 18:43:44 +03:00
David Walker
6d4de4cf05
Implement list() reference assignments
...
Support list() reference assignments of the form:
list(&$a, list(&$b, $c)) = $d;
RFC: https://wiki.php.net/rfc/list_reference_assignment
2017-12-09 13:39:52 +01:00
Dmitry Stogov
2d8f238318
Avoid duplication
2017-12-07 14:59:42 +03:00
Dmitry Stogov
3f6b46f331
typo
2017-12-07 12:26:48 +03:00
Dmitry Stogov
2ded0d2c0e
Avoid unnecessary duplication
2017-12-07 12:00:41 +03:00
Dmitry Stogov
91507ba6e8
Reduced VM code size.
...
Made FETCH_DIM/OBJ_FUNC_ARG to dispatch ro corresponding FETCH_DIM/OBJ_R/_W handlers.
Merged TMP and VAR specializations of ZEND_FETCH_OBJ_R.
Allowed dispatching to less specialized handelrs and helpers. (e.g. from OP_TMP_CONST to OP_TMPVAR_CONST).
2017-12-07 01:52:27 +03:00
Dmitry Stogov
d1d1aff4e5
Optimization of init_func_execute_data()
2017-12-06 02:53:30 +03:00
Dmitry Stogov
7a136cd3dd
Removed useless LOAD_OPLINE()
2017-12-05 17:40:39 +03:00
Dmitry Stogov
74c84cd7f0
Use zend_string_equal*() API for zend_string equality check instead of direct memcmp() usage.
2017-12-04 17:17:02 +03:00
Dmitry Stogov
6a2738c713
CONCAT/FAST_CONCAT micro-optimization
2017-11-28 14:11:40 +03:00
Nikita Popov
828d8e635b
Fix ZEND_VM_SPEC=0 build
2017-11-24 23:06:01 +01:00
Dmitry Stogov
ec2dde0c0b
Introduced zend_hash_find_ex() that may avoid unnecessary hash value check.
2017-11-24 14:01:19 +03:00
Dmitry Stogov
33b094479b
TYPE_CHECK instruction changed. Now it keeps in extended_value a type mask.
...
This makes check for "boolean" cheaper and allows check combination e.g. (is_string($a) || is_null($a))
2017-11-23 15:58:34 +03:00
Dmitry Stogov
d5dd27987f
Don't mix TYPE and TYPE_INFO
2017-11-23 13:45:21 +03:00
Dmitry Stogov
8349268fa0
Delayed unlikely checks for uninitialized variables
2017-11-23 13:18:52 +03:00
Alessandro Chitolina
23b61f78a6
Fix segfault in token_get_all_variation19.phpt
2017-11-19 00:48:48 +01:00
Dmitry Stogov
aa7bf41502
Use cheaper checks
2017-11-17 13:23:22 +03:00
Dmitry Stogov
ccc12b82da
Avoid unnecessary reference-counting on strings.
2017-11-16 17:09:32 +03:00
Dmitry Stogov
ce18738a30
Removed "_" from API functions.
2017-11-16 17:09:01 +03:00
Nikita Popov
1e3f625aa5
Merge branch 'PHP-7.2'
2017-11-15 23:01:52 +01:00
Nikita Popov
6640e03df8
Merge branch 'PHP-7.1' into PHP-7.2
2017-11-15 23:01:25 +01:00
DanielCiochiu
dba5a798a2
Fixed #74862 : Unable to clone instance when private __clone defined
...
Even though __clone was implemented as private and called only from
parent class, child extending class instance could not be cloned.
2017-11-15 23:00:26 +01:00
Xinchen Hui
d56a534acc
RC manipulation cleanup 2
2017-11-02 12:13:35 +08:00
Xinchen Hui
a8a17a72b0
RC manipulation cleanup
2017-11-01 10:25:10 +08:00
Dmitry Stogov
fcc08ce19f
Prevent reference-counting on persistent zvals (internal constants, default properties and constants of internal classes).
...
New macro ZVAL_COPY_OR_DUP() is used perform duplication, if necessary.
This should eliminate related race-coditions in ZTS build and prevent reference-counting bugs after unclean shutdown.
2017-10-30 23:13:10 +03:00
Dmitry Stogov
49ea143bbd
Encapsulate reference-counting primitives.
...
Prohibit direct update of GC_REFCOUNT(), GC_SET_REFCOUNT(), GC_ADDREF() and GC_DELREF() shoukf be instead.
Added mactros to validate reference-counting (disabled for now).
These macros are going to be used to eliminate race-condintions during reference-counting on data shared between threads.
2017-10-27 01:28:58 +03:00
Dmitry Stogov
aeca761856
Removed useless reallocations
2017-10-26 19:13:53 +03:00
Dmitry Stogov
6a034be2c6
Fixed signed/unsigned comparisons
2017-10-25 11:45:17 +03:00
Dmitry Stogov
9cf87aa196
Avoid HashTable allocations for empty arrays (using zend_empty_array).
2017-10-24 17:27:31 +03:00
Dmitry Stogov
59a7944bc6
Made run_time_cache to keep "offset" to dynamic properties Buckets (instead of index).
2017-10-24 10:28:19 +03:00
Dmitry Stogov
193adbdf30
Use run-time cache to keep position of dynamic properties in HashTable to access them without hash lookup.
2017-10-23 18:29:13 +03:00
Dmitry Stogov
d0f4dbfd96
Make assertions in DO_ICALL and CALL_TRAMPOLINE to be consistent with DO_FCALL.
2017-10-17 13:35:59 +03:00
Dmitry Stogov
61ef91bf0d
Revert "Allow internal functions to return values by reference (this was disabled in implementation of DO_ICALL, but enabled in DO_FCALL)."
...
This reverts commit da781a5ac2
.
2017-10-17 13:25:19 +03:00
Dmitry Stogov
da781a5ac2
Allow internal functions to return values by reference (this was disabled in implementation of DO_ICALL, but enabled in DO_FCALL).
...
However, don't require internal functions returning by reference to return a reference.
Mark unserialize() as returning by reference and remove unwrap_reference hack, to allow proper returning of self referenced arrays using a reference.
Currently unserialize() is the only internal function that may return a reference.
2017-10-17 11:50:34 +03:00
Dmitry Stogov
ef5ea48741
Always use IS_CONSTANT_AST (IS_CONSTANT is removed).
2017-10-10 10:11:05 +03:00
Dmitry Stogov
fcccb0d6ea
Use zval_ptr_dtor_nogc() in places where circular zvals are not possible
2017-10-09 12:24:11 +03:00
Dmitry Stogov
e70618aff6
Changed the way VM accesses constant operands in 64-bit builds.
2017-10-04 16:53:01 +03:00
Dmitry Stogov
44e0b79ac6
Refactored array creation API. array_init() and array_init_size() are converted into macros calling zend_new_array(). They are not functions anymore and don't return any values.
2017-09-20 02:25:56 +03:00
Dmitry Stogov
0fb05f1487
Property access micro-optimization. (ZEND_WRONG_PROPERTY_OFFSET and ZEND_DYNAMIC_PROPERTY_OFFSET are hidden, use one comparison instead of two on fast paths. "Negative" offsets are reserved for future optimizations).
2017-09-18 13:13:24 +03:00
Dmitry Stogov
cd6893aed1
Fixed attempt to free invalid structure (result of ROPE_INIT is not a zval)
2017-08-14 12:11:25 +03:00
Xinchen Hui
9b87b73fec
Req #74963 (Improved error message on fetching property of non-object)
2017-07-31 11:51:23 +08:00
Dmitry Stogov
112eda7525
Separate the fast-patch
2017-07-19 15:42:32 +03:00
Nikita Popov
ecb67e59d7
Don't reuse compare_function operands
...
If the same zval is used for the result and one operand, then the
function thinks it is responsible for freeing the value in case of
a type conversion.
2017-07-19 01:04:36 +02:00
Dmitry Stogov
f49ee79e95
gc_check_possible_root() may throw exception.
2017-07-17 23:17:16 +03:00
Dmitry Stogov
1180d8c801
Separate ISSET_ISEMPTY_CV/UNSET_CV from ISSET_ISEMPTY_VAR/UNSET_VAR
2017-07-17 14:11:50 +03:00
Dmitry Stogov
02ef5d3803
Revert "Avoid run-time checks performed at compile-time."
...
This reverts commit 8fe47a47cf
.
2017-07-04 07:15:42 +03:00
Dmitry Stogov
bbb786c85b
Split zend_init_execute_data() into zend_init_func_execute_data() and zend_init_code_execute_data()
2017-06-29 10:10:57 +03:00
Tom Van Looy
60d032d65e
Remove unused variable op2. It is redeclared later.
2017-06-25 22:31:00 +02:00
Nikita Popov
c136afa2be
Fix FE_FETCH_* exception check
...
Only applying this for 7.2, because handling this would be ugly
under the old retval freeing semantics.
2017-06-25 16:45:17 +02:00
Nikita Popov
ed37ca7369
Fixed bug #74810
...
And also did some general cleanup in ZEND_FUNC_GET_ARGS.
2017-06-25 16:00:24 +02:00
Nikita Popov
191f154d40
Merge branch 'PHP-7.1'
2017-06-25 15:32:38 +02:00
Dmitry Stogov
7802cf8c1a
Added specialized FE_FETCH_R handler for iteration over array
2017-06-20 23:25:09 +03:00
Dmitry Stogov
31a2198fd9
FE_RESER/FE_FETCH optimisation
2017-06-20 22:26:46 +03:00
Dmitry Stogov
bfa154448d
VM refactoring, to avoid passing "execute_data" into helper functions that can access it using global register variable.
2017-06-16 01:42:49 +03:00
Dmitry Stogov
76db01d9ff
Moved "Using $this when not in object context" exception code into single VM helper.
2017-06-15 16:23:05 +03:00
Dmitry Stogov
8fe47a47cf
Avoid run-time checks performed at compile-time.
2017-06-13 13:48:58 +03:00
Dmitry Stogov
6a024146bb
Removed unused variable.
2017-06-06 16:08:44 +03:00
Dmitry Stogov
02e6c9c757
ZVAL_COPY_UNREF() micro-optimization
2017-06-02 00:38:09 +03:00
Dmitry Stogov
33d42802d3
Fixed support for C compilers that don't support global register variables.
2017-05-30 13:31:58 +03:00
Dmitry Stogov
6043f76ad7
Added ZEND_FUNC_NUM_ARGS, ZEND_FUNC_GET_ARGS instructions, to implement corresponding builtin functions.
...
Special optimisation for "array_slice(INT, func_get_args())" pattern.
2017-05-30 13:23:17 +03:00
Dmitry Stogov
017d65d74a
Extend ZEND_SEND_ARRAY to eliminate array_slice() call for "call_user_func_array(_, array_slice(_, LONG, _))" pattern.
2017-05-30 12:25:46 +03:00
Dmitry Stogov
f00d1c72b4
Added ZEND_GET_CLASS, ZEMD_GET_CALLED_CLASS, ZEND_GET_TYPE instructions, to implement corresponding builtin functions.
2017-05-25 18:41:28 +03:00
Dmitry Stogov
cd953269d3
Added ZEND_COUNT instruction, to implement corresponding builtin.
2017-05-25 12:52:34 +03:00
Dmitry Stogov
44ec732752
Fixed ZEND_IN_ARRAY related issues
2017-05-25 10:26:42 +03:00
Dmitry Stogov
7c7383067f
Added ZEND_IN_ARRAY instruction, implementing optimized in_array() builtin function, through hash lookup in flipped array
2017-05-24 23:00:48 +03:00
Xinchen Hui
26a6d20ab5
Fixed segfult in JIT (emalloc may trigger memory limitation)
...
Zend/tests/bug68412.phpt
2017-05-21 20:48:07 +08:00
Dmitry Stogov
8203a175b1
Remove unused opcode handlers
2017-05-18 13:18:08 +03:00
Dmitry Stogov
fc927dc263
Switch to HYBRID VM
2017-05-17 15:07:33 +03:00
Dmitry Stogov
7640e0a5f9
HYBRID VM cleanup
2017-05-16 09:24:23 +03:00
Dmitry Stogov
69b4f8ed79
Fixed USER_OPCODE handling in HYBRID VM.
2017-05-15 21:17:58 +03:00
Dmitry Stogov
c8f073d0d7
Avoid useless checks
2017-05-10 13:27:37 +03:00
Dmitry Stogov
27e01cd918
Implemented HYBRID VM instruction dispatch method that takes advantages of both CALL and GOTO VMs.
2017-05-03 10:01:22 +03:00
Nikita Popov
cfa6fa1525
Initialize retval in INCLUDE_OR_EVAL
...
In case the eval'd code throws.
2017-04-15 12:11:30 +02:00
Nikita Popov
ad8652818a
Implement jumptable optimization
2017-04-10 22:23:14 +02:00
Nikita Popov
3895aa2f77
Merge branch 'PHP-7.1'
2017-04-09 15:51:38 +02:00
Nikita Popov
515e1e0cea
Merge branch 'PHP-7.0' into PHP-7.1
2017-04-09 15:35:44 +02:00
Thomas Punt
744c4a5592
Resolve bug #74188 (undefined statics raising with ?? operator)
2017-04-09 15:29:31 +02:00
Rowan Collins
1b565f1393
Change 'undefined constant' from E_NOTICE to E_WARNING and mention deprecation
...
Implements RFC "Deprecate and Remove Bareword (Unquoted) Strings"
[https://wiki.php.net/rfc/deprecate-bareword-strings ]
2017-03-23 18:52:43 +01:00
Nikita Popov
6ad0a6fb04
Merge branch 'PHP-7.1'
2017-03-15 19:50:26 +01:00
Nikita Popov
2bba4a0d7f
Fix bug #69676
2017-03-15 19:49:02 +01:00
Anatol Belski
c698299550
Interned strings unification for TS/NTS
...
Hereby, interned strings are supported in thread safe PHP. The patch
implements two types of interned strings
- interning per process, strings are not freed till process end
- interning per request, strings are freed at request end
There is no runtime interning.
With Opcache, all the permanent iterned strings are copied into SHM on
startup, additional copying into SHM might happen on demand.
2017-03-04 10:39:13 +01:00
Xinchen Hui
6a584cf318
Fixed bug #74157 (Segfault with nested generators)
2017-02-26 12:05:56 +08:00
Dmitry Stogov
3d84aef55d
Separate zend_fetch_static_property_address() into an inline function
2017-01-17 11:11:12 +03:00
Bob Weinand
9e3c35b6d1
Fix small mistake in generator creation introduced in 9a159f37
2017-01-15 19:26:15 +01:00
Dmitry Stogov
141d1ba980
Introduced "zend_type" - an abstraction for type-hinting representation.
2017-01-13 11:37:46 +03:00
Dmitry Stogov
15040b47f0
Merge branch 'PHP-7.1'
...
* PHP-7.1:
Improved GENERATOR_CREATE opcode handler.
2017-01-09 22:25:25 +03:00
Dmitry Stogov
9a159f37e1
Improved GENERATOR_CREATE opcode handler.
2017-01-09 22:24:21 +03:00
Sammy Kaye Powers
dac6c639bb
Update copyright headers to 2017
2017-01-04 11:23:42 -06:00
Sammy Kaye Powers
478f119ab9
Update copyright headers to 2017
2017-01-04 11:14:55 -06:00
Sammy Kaye Powers
9e29f841ce
Update copyright headers to 2017
2017-01-02 09:30:12 -06:00
Sara Golemon
16758a3c66
Merge branch 'PHP-7.1'
...
* PHP-7.1:
Remove extraneous parentheses in conditions
2016-12-25 22:18:27 -08:00
Sébastien Santoro
5d7c774bea
Remove extraneous parentheses in conditions
...
The zend_vm_gen.php generator now checks if the condition is already
enclosed by parentheses, and them only if needed.
This fixes nine clang/llvm parentheses-equality warnings.
2016-12-25 22:17:46 -08:00
Dmitry Stogov
3c6a2fb08c
Fixed bug #73792 (invalid foreach loop hangs script)
2016-12-20 16:48:57 +03:00
Dmitry Stogov
fb73c1084c
Few micro-optimizations
2016-12-19 15:36:37 +03:00
Dmitry Stogov
fac95658b3
Improved VM stack unwinding on exception.
...
Now zend_throw_exception_hook() is going to be called only when exception is actually thrown and not going to be recalled for each unwinded finction.
2016-12-12 10:55:32 +03:00
Xinchen Hui
7695fba388
Merge branch 'PHP-7.1'
...
* PHP-7.1:
Fix the bug in ZEND_ASSIGN_DIM (as nikic suggest)
Revert "Refix bug #73686 "
2016-12-09 22:30:41 +08:00
Xinchen Hui
09b36113b0
Fix the bug in ZEND_ASSIGN_DIM (as nikic suggest)
2016-12-09 22:30:24 +08:00
Dmitry Stogov
a3526cd9b7
Regenerated zend_vm_execute.h (fixed white spaces)
2016-12-08 13:37:57 +03:00
Kalle Sommer Nielsen
cf24a61735
Disable C4101 warnings entirely on Windows
2016-12-08 03:50:31 +01:00
Dmitry Stogov
5011a11a6d
Fixed memory leaks caused by exceptions thrown from destructors (one more case).
2016-12-07 01:43:13 +03:00
Dmitry Stogov
e8109e09aa
Fixed memory leaks caused by exceptions thrown from destructors.
2016-12-07 00:41:07 +03:00
Dmitry Stogov
b4ad6d6d1b
COALESCE can't throw exception
2016-12-06 10:21:44 +03:00
Dmitry Stogov
a722970033
Merge branch 'PHP-7.1'
...
* PHP-7.1:
Micro optimizations
2016-12-06 10:01:38 +03:00
Dmitry Stogov
547b735d34
Micro optimizations
2016-12-06 10:01:18 +03:00
Bob Weinand
444d612b62
Use an inline handler instead of repeating logic for calling assign op helpers each time
2016-12-05 10:55:11 +01:00
Bob Weinand
46d708a1b6
Fix PHP-7.0 build (wrong fix for the branch)
2016-12-03 23:39:54 +01:00
Bob Weinand
f74890bcf5
Merge branch 'PHP-7.1'
2016-12-03 18:29:11 +01:00
Bob Weinand
146b68e022
Merge branch 'PHP-7.0' into PHP-7.1
2016-12-03 18:28:47 +01:00
Bob Weinand
ffc1ef1eed
Fix leak when using $this outside of object context
2016-12-03 18:28:08 +01:00
Dmitry Stogov
56fd01e230
Eliminated useless exception check
2016-12-02 16:04:18 +03:00
Dmitry Stogov
3e31ba8014
Eliminated useless exception checks (FE_RESET with array argument can't throw exception)
2016-12-02 15:58:47 +03:00
Dmitry Stogov
1660117799
Merge branch 'PHP-7.1'
...
* PHP-7.1:
Eliminated useless exception check
2016-12-02 15:40:11 +03:00
Dmitry Stogov
af2d47c9c7
Merge branch 'PHP-7.0' into PHP-7.1
...
* PHP-7.0:
Eliminated useless exception check
2016-12-02 15:40:04 +03:00
Dmitry Stogov
68558ab71d
Eliminated useless exception check
2016-12-02 15:39:33 +03:00
Dmitry Stogov
22cebaf89a
Revert "Fix return value memory leaks upon exceptions in opcode operand freeing"
...
This reverts commit 9ad9d7ae37
.
2016-12-02 11:58:41 +03:00
Dmitry Stogov
9c1920d9e8
Revert "Fix memory leaks with FE_RESET upon empty iterator"
...
This reverts commit 00e516e575
.
2016-12-02 11:58:36 +03:00
Dmitry Stogov
9774e32dbb
Revert "Fix accidental zval_ptr_dtor()ing of object"
...
This reverts commit ae2f68d8a5
.
2016-12-02 11:58:33 +03:00
Dmitry Stogov
8fa691ea8a
Revert "Fix a few valgrind warnings with undefing result"
...
This reverts commit 8f4e100f21
.
2016-12-02 11:58:25 +03:00
Bob Weinand
8f4e100f21
Fix a few valgrind warnings with undefing result
2016-12-01 10:15:07 +01:00
Bob Weinand
ae2f68d8a5
Fix accidental zval_ptr_dtor()ing of object
2016-11-30 23:57:22 +01:00
Bob Weinand
00e516e575
Fix memory leaks with FE_RESET upon empty iterator
...
Solved by manually freeing and jumping to the opcode *after* FE_FREE
2016-11-30 17:44:34 +01:00
Bob Weinand
9ad9d7ae37
Fix return value memory leaks upon exceptions in opcode operand freeing
2016-11-30 17:44:34 +01:00
Dmitry Stogov
3b4c9f18e0
Merge branch 'PHP-7.1'
...
* PHP-7.1:
Fixed calling generators through magic __call()
2016-11-28 12:30:16 +03:00
Dmitry Stogov
458c732ed4
Merge branch 'PHP-7.0' into PHP-7.1
...
* PHP-7.0:
Fixed calling generators through magic __call()
2016-11-28 12:30:01 +03:00
Dmitry Stogov
970f21be97
Fixed calling generators through magic __call()
2016-11-28 12:20:19 +03:00
Nikita Popov
7dbdf2db83
Fix foreach object property visibility checks
...
Again, check_property_access() does not correctly work for properties
that look like mangled private propert names (but aren't). Fix this
by only checking visibility for INDIRECT properties.
foreach currently still unmangles property names, even if they don't
correspond to declared properties. HHVM does not do this (and I think
this is correct.) As this is done consistently, leaving it alone
for now.
2016-11-22 21:01:15 +01:00
Dmitry Stogov
1ab44223bf
Export zend_do_fcall_overloaded()
2016-11-22 18:36:27 +03:00
Dmitry Stogov
e5fce51196
Merge branch 'PHP-7.1'
...
* PHP-7.1:
Micro-optimization
2016-11-22 12:07:06 +03:00
Dmitry Stogov
4495ea4740
Micro-optimization
2016-11-22 12:06:39 +03:00
Dmitry Stogov
653c9e1fa2
Merge branch 'PHP-7.1'
...
* PHP-7.1:
Removed useless (double) checks for EG(exception). (Bob)
2016-11-22 11:51:42 +03:00
Dmitry Stogov
8d70b04a1c
Removed useless (double) checks for EG(exception). (Bob)
2016-11-22 11:50:48 +03:00
Dmitry Stogov
d6c332eb51
Turn IS_TYPE_COLLECTABLE zval flag into GC_COLLECTABLE zend_refcounted flag.
...
This simplifies checks and allows reset this flag for "acyclic" arrays and objects.
2016-10-21 17:47:30 +03:00
Bob Weinand
2b246e2e38
Merge branch 'PHP-7.1'
2016-10-18 14:32:12 +02:00
Bob Weinand
58f3b9c0ef
Merge remote-tracking branch 'origin/PHP-7.0' into PHP-7.1
2016-10-18 14:31:49 +02:00
Bob Weinand
8b177f6a2a
Fixed bug #73338 (Exception thrown from error handler may crash)
2016-10-18 14:14:24 +02:00
Xinchen Hui
c9274d20b7
Fixed bug #73288 (Segfault in __clone > Exception.toString > __get)
...
Actually this is caused by optimization(opcache)
(cherry picked from commit d19898b298
)
2016-10-14 01:35:39 +02:00
Xinchen Hui
d19898b298
Fixed bug #73288 (Segfault in __clone > Exception.toString > __get)
...
Actually this is caused by optimization(opcache)
2016-10-12 16:07:56 +08:00
Xinchen Hui
ac7285dace
Merge branch 'PHP-7.1'
...
* PHP-7.1:
Cleanup exception handling after zend_fetch_class_by_name
fix user filter bug
2016-09-30 16:01:43 +08:00
Xinchen Hui
b28277db94
Cleanup exception handling after zend_fetch_class_by_name
2016-09-30 16:00:14 +08:00
Xinchen Hui
1bc3e1b4c3
Merge branch 'PHP-7.1'
...
* PHP-7.1:
Use smart branch
2016-09-30 13:19:39 +08:00
Xinchen Hui
f211614ba7
Use smart branch
2016-09-30 13:19:11 +08:00
Nikita Popov
5bdd732d21
Merge branch 'PHP-7.1'
2016-09-28 22:39:17 +02:00
Nikita Popov
97066792b7
Merge branch 'PHP-7.0' into PHP-7.1
2016-09-28 22:38:47 +02:00
Nikita Popov
437942d972
Merge branch 'PHP-5.6' into PHP-7.0
2016-09-28 22:36:58 +02:00
Nikita Popov
99bf19c177
Check next_index_insert failure in ADD_ARRAY_ELEMENT
2016-09-28 22:35:27 +02:00
Dmitry Stogov
97628da24a
Expose information about calls to "fake" closures (created through ReflectionFunction::getClosure), to allow extra specialization of RETRUN opcode handler.
2016-09-26 17:44:28 +03:00
Nikita Popov
ebaba26d39
Merge branch 'PHP-7.1'
2016-09-25 12:39:33 +02:00
Nikita Popov
bd893061d6
Use SEND_USER for CONST|TMP as well
...
Otherwise we're missing the "expected to be a reference, value
given" warning that appears for ordinary calls to call_user_func().
Also update an UPGRADING note with recent changes wrt
call_user_func().
2016-09-25 12:39:23 +02:00
Dmitry Stogov
ab1b32f81a
Removed redundand code
2016-09-23 12:26:30 +03:00
Dmitry Stogov
c7149b92d7
Micro-optimization
2016-09-13 17:10:30 +03:00
Nikita Popov
53b3ef54d2
Merge branch 'PHP-7.1'
2016-09-09 15:31:54 +02:00
Nikita Popov
b4213f0d0b
Add fast paths for bitwise operators
2016-09-09 15:30:41 +02:00
Nikita Popov
bbdff7ea24
Sync convert_to_null with VM cast behavior
...
Do not call cast_object, this is useless and we haven't been doing
it in the VM as of 7.0.
2016-09-04 12:36:16 +02:00
Xinchen Hui
aefd3e4d8b
Merge branch 'PHP-7.1'
...
* PHP-7.1:
Remove redundant \t
2016-08-25 13:29:55 +08:00
Xinchen Hui
38f7d595c0
Remove redundant \t
2016-08-25 13:29:22 +08:00
Dmitry Stogov
93b8592092
Merge branch 'PHP-7.1'
...
* PHP-7.1:
call_user_func(_array): Don't abort on reference warning
2016-08-23 10:56:55 +03:00
Nikita Popov
906456c410
call_user_func(_array): Don't abort on reference warning
...
Change zend_call_function() to not abort the call if a non-reference
is passed to a reference argument. The usual warning will still be
thrown, but the call will proceed as usual.
2016-08-23 10:29:15 +03:00
Xinchen Hui
b740bb3987
Fixed bug #72907 (null pointer deref, segfault in gc_remove_zval_from_buffer (zend_gc.c:260))
2016-08-21 17:10:10 +08:00
Nikita Popov
89f6377971
Return true for is_object() on Incomplete_Class
2016-08-15 23:13:09 +02:00
Nikita Popov
3b48c5a36f
Revert "Make call_user_func() on reference args consistent"
...
This reverts commit fafe01b07b
.
See bug #72698 , there is code using this behavior. Reverting for
PHP 7.0 *only*. The fix is still in PHP 7.1.
2016-07-28 18:45:44 +02:00
Xinchen Hui
5296853fff
Merge branch 'PHP-7.0'
...
* PHP-7.0:
Fixed typo
2016-07-20 17:01:53 +08:00
Xinchen Hui
cbbe17fb53
Fixed typo
2016-07-20 17:01:42 +08:00
Xinchen Hui
9254f5d5d3
Merge branch 'PHP-7.0'
...
* PHP-7.0:
Fixed bug #72629 (Caught exception assignment to variables ignores references).
Conflicts:
main/php_version.h
2016-07-20 17:00:09 +08:00
Xinchen Hui
97c0b133c5
Fixed bug #72629 (Caught exception assignment to variables ignores references).
2016-07-20 16:59:14 +08:00
Nikita Popov
cbba1fff3f
Fix leak if get_iterator throws but doesn't return NULL
2016-07-16 23:16:34 +02:00
Nikita Popov
a26748d7be
Fix bad merge
...
In master the operand is fetched earlier, I didn't account for
that.
2016-07-14 20:44:36 +02:00
Nikita Popov
37a2f3fe25
Fix leak if get_constructor returns NULL
2016-07-14 18:42:46 +02:00
Nikita Popov
eba5466f10
Fix leaks if update_constant fails
2016-07-14 18:42:45 +02:00
Nikita Popov
0bda0422af
Merge branch 'PHP-7.0'
...
Conflicts:
Zend/zend_vm_execute.h
2016-07-14 18:39:48 +02:00
Nikita Popov
c3804a2cf9
Fix leaks in yield from error conditions
...
Conflicts:
Zend/zend_vm_execute.h
2016-07-14 18:38:45 +02:00
Nikita Popov
d1f82bfeb2
Fix leak for by-ref assign to overloaded object
...
Conflicts:
Zend/zend_vm_execute.h
2016-07-14 18:38:04 +02:00
Dmitry Stogov
9a76189caf
Fixed memory leak
2016-07-14 13:14:15 +03:00
Dmitry Stogov
f80bb059b3
Fixed memory leak
2016-07-14 13:05:27 +03:00
Dmitry Stogov
e6f04d4c8e
Unified behavior of modification of returned by reference value in finnally code.
2016-07-13 20:35:53 +03:00
Dmitry Stogov
02dca0cf16
Removed wrong warning
2016-07-13 20:04:47 +03:00
Dmitry Stogov
afd3e39d66
Fixed bug #29368 (The destructor is called when an exception is thrown from the constructor).
2016-07-13 16:43:47 +03:00
Dmitry Stogov
3b8cb2119b
Fixed bug #72347 (VERIFY_RETURN type casts visible in finally)
...
Fixed bug #72216 (Return by reference with finally is not memory safe)
Fixed bug #72215 (Wrong return value if var modified in finally)
2016-07-13 15:08:28 +03:00
Dmitry Stogov
fbca255cd0
Fixed bug #71539 (Memory error on $arr[$a] =& $arr[$b] if RHS rehashes)
2016-07-07 00:59:44 +03:00
Dmitry Stogov
023b812593
Fixed bug #72543 (Different references behavior comparing to PHP 5)
2016-07-06 20:46:43 +03:00
Aaron Piotrowski
d9a9cf8eca
Merge branch 'master' into iterable
2016-07-03 22:42:10 -05:00
Xinchen Hui
d1dd474ff9
Fixed bug #72523 (dtrace issue with reflection (failed test))
2016-07-01 18:50:35 +08:00
Dmitry Stogov
1a14533806
Introduce new CHECK_VAR instruction to keep warnings about undefined variables.
2016-06-30 21:40:34 +03:00
Nikita Popov
45cfe7852a
Merge branch 'PHP-7.0'
...
Conflicts:
Zend/zend_vm_def.h
Zend/zend_vm_execute.h
2016-06-28 20:57:55 +02:00
Nikita Popov
fafe01b07b
Make call_user_func() on reference args consistent
...
Previously reference arguments were allowed if call_user_func()
was compiled to SEND_USER and not otherwise. Make it consistent
by always forbidding them.
2016-06-28 20:43:38 +02:00
Dmitry Stogov
044e2718fe
Fixed executor without global register variales (gcc warnings or clang errors)
2016-06-27 10:36:41 +03:00
Dmitry Stogov
a6387c0aa5
Added ability to make non-local control transfer through interrupt function
2016-06-24 12:20:41 +03:00
Dmitry Stogov
d0460d8f6b
Turn safe timeout handling into general interrupt handling ability.
2016-06-23 15:01:23 +03:00
Dmitry Stogov
ebb99a1a3a
Fixed compilation warnings
2016-06-21 16:55:17 +03:00
Dmitry Stogov
1616038698
Added ZEND_ATTRIBUTE_FORMAT to some middind functions.
...
"%p" replaced by ZEND_LONG_FMT to avoid compilation warnings.
Fixed most incorrect use cases of format specifiers.
2016-06-21 16:00:37 +03:00
Dmitry Stogov
ff363e2e7c
Implemented RFC: Replace "Missing argument" warning with "Too few arguments" exception
...
Squashed commit of the following:
commit 8b45fa2acb
Author: Dmitry Stogov <dmitry@zend.com>
Date: Thu Jun 16 01:52:50 2016 +0300
Separate slow path of ZEND_RECV into a cold function.
commit 9e18895ee5
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Jun 15 23:26:28 2016 +0300
Required argument can't be IS_UNDEF anymore.
commit 662db66e39
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue May 31 17:14:50 2016 +0300
Replace "Missing argument" warning by "Too few arguments" exception.
2016-06-16 02:32:02 +03:00
Dmitry Stogov
a9512af810
Implemented RFC: Fix inconsistent behavior of $this variable
...
Squashed commit of the following:
commit bdd3b6895c
Author: Dmitry Stogov <dmitry@zend.com>
Date: Thu Jun 16 00:19:42 2016 +0300
Fixed GOTO VM
commit 2f1d7c8b89
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Jun 15 21:01:57 2016 +0300
Removed unused variable
commit cf749c42b0
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Jun 15 19:06:16 2016 +0300
Protection from $this reassign through mb_parse_str()
commit 59a9a6c83c
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Jun 15 18:14:50 2016 +0300
Added type inference rule for FETCH_THIS opcode
commit 73f8d14a85
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed Jun 15 18:11:18 2016 +0300
Restored PHP-7 behavior of isset($this->foo).
It throws exception if not in object context.
Removed useless opcode handlers.
commit fa0881381e
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue May 31 12:25:47 2016 +0300
Changed "Notice: Undefined variable: this" into "Exception: Using $this when not in object context".
commit e32cc528c0
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue May 24 02:02:43 2016 +0300
Throw exception on attempt to re-assign $this through extract() and parse_str().
commit 41f1531b52
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon May 23 22:18:36 2016 +0300
Fixed inconsistent $this behavior
2016-06-16 02:30:23 +03:00
Dmitry Stogov
006b8417d1
Added specialized handlers for SEND_VAR/SEND_VAR_EX opcodes.
2016-06-15 23:07:46 +03:00
Dmitry Stogov
e7e79aa409
Delay IS_ERROR checks
2016-06-09 12:39:38 +03:00
Dmitry Stogov
a315842751
typo
2016-06-08 19:01:28 +03:00
Nikita Popov
766ad0d970
Followup for bug #53432
...
Assign-ops and nested accesses now get the same treatment.
2016-06-08 15:43:58 +02:00
Dmitry Stogov
0c79896208
cleanup
2016-06-08 12:55:31 +03:00
Dmitry Stogov
fc587c7c55
Removed useless reference counting
2016-06-08 11:24:53 +03:00
Dmitry Stogov
10f056255e
Better fix for bug #70228 (memleak if return in finally block)
2016-06-08 02:20:45 +03:00
Dmitry Stogov
2bae4e18a2
Fixed bug #70228 (Memleak if return in finally block)
2016-06-08 00:23:33 +03:00
Dmitry Stogov
421843977f
Fixed bug #71266 (Missing separation of properties HT in foreach etc).
2016-06-07 23:18:52 +03:00
Dmitry Stogov
214d4613f5
cleanup
2016-06-07 01:14:53 +03:00
Dmitry Stogov
cebb5cd46e
micro-optimization
2016-06-06 20:45:10 +03:00
Dmitry Stogov
58c083dfc9
simplification
2016-06-06 15:50:06 +03:00
Nikita Popov
945a83103d
Fixed bug #53432
...
This change was discussed a while ago in the "negative string
offsets" thread.
2016-06-04 19:20:07 +02:00
Aaron Piotrowski
72692e9a9c
Add iterable pseudo-type
2016-06-03 17:42:04 -05:00
Dmitry Stogov
6a32d44392
cleanup
2016-06-01 18:07:05 +03:00
Dmitry Stogov
b111da96d9
Split ZEND_SEND_VAR_NO_REF into ZEND_SEND_VAR_NO_REF and ZEND_SEND_VAR_NO_REF_EX (similar to ZEND_SEND_VAL) and remove ZEND_ARG_* flags.
2016-05-31 04:06:00 +03:00
Dmitry Stogov
f216176bc9
Initialize only the necessary fields.
2016-05-31 00:04:52 +03:00
Nikita Popov
921b3251b3
Fix bug #71604
...
Alternatively could throw some kind of uncatchable dummy exception
into the generator. Right now just checking for NULL in two places
seems simpler.
2016-05-28 14:40:32 +02:00
Nikita Popov
79de9fa4aa
Merge branch 'PHP-7.0'
...
Conflicts:
Zend/zend_vm_execute.h
2016-05-28 13:22:49 +02:00
Nikita Popov
4746e5efcb
Forbid "yield from" in force closed generators
...
Same check we do for "yield", was missed when "yield from" was
added. We could make this more granular by only forbidding to
actually yield values and still allow something like "yield from []",
but this does not seem worthwhile.
2016-05-28 13:21:05 +02:00
Dmitry Stogov
2ae21abdf7
Fixed bug #72213 (Finally leaks on nested exceptions).
...
Squashed commit of the following:
commit 8461b0407f
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed May 25 00:34:42 2016 +0300
Rmoved zend_try_catch_element.parent and walk through op_array.try_catch_array backward from the current try_cacth_offset.
commit 0c71e24964
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed May 25 00:04:53 2016 +0300
Move SAVE_OPLINE() to its original place
commit 111432a4df
Author: Dmitry Stogov <dmitry@zend.com>
Date: Wed May 25 00:01:10 2016 +0300
Separate the common part of ZEND_HANDLE_EXCEPTION and FAST_RET into zend_dispatch_try_catch_finally_helper.
commit 4f21c06c2e
Author: Nikita Popov <nikic@php.net>
Date: Tue May 24 14:55:27 2016 +0200
Improve finally fix
commit da5c727499
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue May 24 10:36:08 2016 +0300
Fixed Zend/tests/try/bug70228_3.phpt and Zend/tests/try/bug70228_4.phpt
commit cfcedf2fb4
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue May 24 02:59:27 2016 +0300
Added test
commit 4c6aa93d43
Author: Dmitry Stogov <dmitry@zend.com>
Date: Tue May 24 00:38:20 2016 +0300
Added tests
commit 8a8f4704b0
Author: Dmitry Stogov <dmitry@zend.com>
Date: Mon May 23 23:27:34 2016 +0300
Fixed bug #72213 (Finally leaks on nested exceptions)
2016-05-25 01:25:12 +03:00
Nikita Popov
91f5940329
Forbid dynamic calls to scope introspection functions
...
Per RFC:
https://wiki.php.net/rfc/forbid_dynamic_scope_introspection
2016-05-24 20:48:24 +02:00
Dmitry Stogov
88196e9151
Added specialized handler for ZEND_FETCH_DIM_R opcode with only numeric indexes.
2016-05-18 15:06:49 +03:00
Xinchen Hui
37b1226af1
Merge branch 'master' of git.php.net:/php-src
...
* 'master' of git.php.net:/php-src:
Inlined fast paths of the freqently execute handlers for FETCH_DIM_R.
2016-05-17 20:28:26 +08:00
Xinchen Hui
fad91468db
Revert "Fixed Bug #72213 (Finally leaks on nested exceptions)"
...
This reverts commit 5037ebf058
.
2016-05-17 20:27:16 +08:00
Dmitry Stogov
c466df6813
Inlined fast paths of the freqently execute handlers for FETCH_DIM_R.
2016-05-17 15:08:04 +03:00
Dmitry Stogov
34a6c93b25
Specialize ZEND_ASSIGN_ADD and family according to value of opline->extended_value
2016-05-17 11:46:25 +03:00
Xinchen Hui
5037ebf058
Fixed Bug #72213 (Finally leaks on nested exceptions)
2016-05-17 15:32:43 +08:00
Dmitry Stogov
8f7b1a3248
IS_CONST operands don't have to be separated. Use reference-counting instead of duplication.
...
- with opcache all IS_CONST operands are not refcounted (scalars, interned strings or immutable arrays)
- without opcache IS_CONST operands are not shared between processes or threads and may use common reference counters
2016-05-17 08:45:06 +03:00
Dmitry Stogov
1fe7b3bca1
micro-optimisation
2016-05-17 02:09:29 +03:00
Dmitry Stogov
97bf4e0b12
Check if generator object is created by GENERATOR_CREATE when throw exceptions from generator function
2016-05-16 12:42:13 +03:00
Dmitry Stogov
414c4c6776
Revert "Check if generator object is created by GENERATOR_CREATE when throw exceptions from generator function."
...
This reverts commit a9b517c614
.
2016-05-16 11:51:29 +03:00
Dmitry Stogov
a9b517c614
Check if generator object is created by GENERATOR_CREATE when throw exceptions from generator function.
2016-05-16 10:24:13 +03:00
Dmitry Stogov
be071702b3
Fixed bug #72188 (Nested try/finally blocks losing return value)
2016-05-13 14:38:43 +03:00
Dmitry Stogov
ccf18da450
Eliminated checks for (func->op_array.fn_flags & ZEND_ACC_GENERATOR) in fast path of DO_FCALL* handlers.
...
This slightly improves calls to regular function and method calls in cost of a bit slower generator initialization.
Separate call frame for generators, allocated on heap, now created by ZEND_GENERATOR_CREATE instruction.
2016-05-13 01:40:15 +03:00
Dmitry Stogov
7b94b958cc
Intern some known (and offten used) strings.
2016-05-12 13:47:22 +03:00
Dmitry Stogov
cca2c8ecc4
Reimplemented Bob's commit bac6fdb0c5
without insignificant renaming and white-space changes
2016-05-06 10:47:58 +03:00
Dmitry Stogov
c19cb70dac
Revert "Refactor zval cleanup into single function"
...
This reverts commit bac6fdb0c5
.
2016-05-06 10:47:58 +03:00
Bob Weinand
bac6fdb0c5
Refactor zval cleanup into single function
...
Also use zval_ptr_dtor_nogc() everywhere in Zend in favor of zval_dtor()
2016-05-05 23:31:57 +02:00
Dmitry Stogov
26adba38bc
Micro-optimization
2016-05-05 16:19:59 +03:00
Joe Watkins
c38310f25a
change fcall and statement handlers to accept frame
2016-05-04 09:28:13 +01:00
Nikita Popov
d06431bf1b
Merge branch 'PHP-7.0'
2016-05-03 18:15:29 +02:00
Nikita Popov
fbae590bf0
Fix leaks in QM_ASSIGN, JMP_SET and COALESCE
...
The QM_ASSIGN code was rewritten to use the standard pattern for
handling CVs and VARs.
2016-05-03 18:12:56 +02:00
Bob Weinand
7c174b6197
Fix use after free on AST expressions in constant declarations
2016-05-02 18:22:15 +02:00
Dmitry Stogov
3e9419dd28
Fixed compilation warnings
2016-04-29 14:03:33 +03:00
Dmitry Stogov
747a482b9c
Don't initialize EX(call)->symbol_table on each function call.
...
Keep it uninitialized, and check ZEND_CALL_HAS_SYMBOL_TABLE flag when necessary.
2016-04-28 15:17:24 +03:00
Dmitry Stogov
6499162ff0
- get rid of EG(scope). zend_get_executed_scope() should be used instead.
...
- ichanged zval_update_constant_ex(). Use IS_TYPE_IMMUTABLE flag on shared constants and AST, instead of "inline_change" parameter.
2016-04-28 04:13:34 +03:00
Dmitry Stogov
11e06e91ec
Merge branch 'PHP-7.0'
...
* PHP-7.0:
Fixed bug #72101 (crash on complex code)
2016-04-25 14:15:06 +03:00
Dmitry Stogov
92233dd736
Fixed bug #72101 (crash on complex code)
2016-04-25 14:11:46 +03:00
Nikita Nefedov
19759a5602
Fix RECV opcode to handle all kinds of exceptions
...
fix RECV opcode to handle exceptions thrown from user-defined error handler
as a result Notice error from failed type coercion
2016-04-20 08:40:44 -07:00
Xinchen Hui
f768a2ea3b
Merge branch 'fix-recv-opcode-handle-exception' of https://github.com/nikita2206/php-src
2016-04-20 08:40:11 -07:00
Nikita Nefedov
ed9a1a9d68
Fix RECV opcode to handle all kinds of exceptions
...
fix RECV opcode to handle exceptions thrown from user-defined error handler
as a result Notice error from failed type coercion
2016-04-20 11:56:07 +03:00
Dmitry Stogov
f484801483
Reduced amount of code generated for interrupt handling.
...
Improved ZEND_VM_INTERRUPT_CHECK() placement (always perform checks after opcode handler completion, when instruction pointer value is alredy changed to the next opcode).
2016-04-20 11:06:52 +03:00
Nikita Popov
d79288c6bb
Merge branch 'PHP-7.0'
2016-04-18 22:46:36 +02:00
Nikita Popov
73958ca62d
Fix SEND_USER as well
...
Missed copy&paste code here
2016-04-18 22:45:38 +02:00
Nikita Popov
5a538e1d82
Merge branch 'PHP-7.0'
2016-04-18 18:26:30 +02:00
Nikita Popov
a8792158bd
Fix SEND_ARRAY+PREFER_REF SHM corruption
...
Make the behavior consistent between namespaced and not and with
PHP 5.6.
2016-04-18 18:26:20 +02:00
Xinchen Hui
b5d01ab5a1
Merge branch 'PHP-7.0'
...
* PHP-7.0:
combine conditions
2016-04-18 19:14:30 +08:00
Xinchen Hui
aa9f8e695c
combine conditions
2016-04-18 19:13:54 +08:00
Nikita Popov
12f42346a8
Merge branch 'PHP-7.0'
2016-04-16 22:34:32 +02:00
Nikita Popov
d1a38743a5
Fix SEND_UNPACK array separation
...
Separating only immutable arrays is not enough.
2016-04-16 22:33:23 +02:00
Bob Weinand
3ed4a592aa
Merge branch 'PHP-7.0'
2016-04-16 20:38:10 +02:00
Bob Weinand
15d1d4f45b
Fixed bug #72038 (Function calls with values to a by-ref parameter don't always throw a notice)
2016-04-16 20:36:19 +02:00
Nikita Popov
dd6c6b1c48
Cleanup condition in SEND_VAR_NO_REF
...
Was overly convoluted after the IS_VAR_RET_REF removal.
2016-04-16 14:32:48 +02:00
Nikita Popov
64f91774f2
Remove IS_VAR_RET_REF flag
...
Instead decide whether a function returned by reference or by value
by checking whether the return value has REFERENCE type. This means
that functions returning by reference must always return a reference
and functions returning by value must not return a reference.
2016-04-15 15:32:20 +02:00
Dmitry Stogov
562d6315b1
Optimize zend_binary_assign_op_dim_helper()
2016-04-14 02:35:53 +03:00
Dmitry Stogov
e95efb6312
Move rare cases of DO_FCALL into separate helpers.
2016-04-13 20:13:17 +03:00
Dmitry Stogov
85f35a8fc1
Separate unspecializeble code of INCLIDE_OR_EVAL into helper functions
2016-04-13 15:29:01 +03:00
Dmitry Stogov
f48b20721c
ASSIGN_ADD micro optimization
2016-04-13 02:47:17 +03:00
Dmitry Stogov
a809444b64
Delay IS_UNDEF check for FETCH_DIM_W and family
2016-04-13 01:19:20 +03:00
Dmitry Stogov
0b3e2fe2b1
Delay IS_UNDEF check for FETCH_DIM_R and family
2016-04-13 00:05:19 +03:00
Dmitry Stogov
23b65bf732
Reuse zend_fetch_dimension_address_read() for FETCH_LIST
2016-04-12 22:53:01 +03:00
Dmitry Stogov
43b1618023
Added missing "goto"
2016-04-12 22:15:16 +03:00
Dmitry Stogov
eaf489ac2b
Optimize ASSIGN_DIM (separate common unspecializeble code into helper functions).
2016-04-12 19:36:24 +03:00
Nikita Popov
fea822fe1b
Merge branch 'PHP-7.0'
2016-04-12 14:44:43 +02:00
Nikita Popov
4e585eb429
Fix ZEND_SEPARATE for by-val func returning ref zval
2016-04-12 14:44:29 +02:00
Nikita Popov
6a2eee520a
Drop unnecessary ZEND_SEPARATE code
...
The following write ops will separate if necessary.
2016-04-12 14:44:29 +02:00
Dmitry Stogov
ef0099918f
Separate unspecializeble code of INIT_DYNAMIC_CALL into separate helper functions.
2016-04-12 14:41:06 +03:00
Dmitry Stogov
8453b78113
Improve zend_leave_helper() by checking all rare conditions at once.
2016-04-11 13:17:24 +03:00
Dmitry Stogov
513b9929a1
removed useless ckeck (ZEND_HANDLE_EXCEPTION never uses RETURN_VALUE)
2016-04-08 16:12:32 +03:00
Dmitry Stogov
a186ac0e47
IS_CONST operands don't have to be separated. Use reference-counting instead of duplication.
...
- with opcache all IS_CONST operands are not refcounted (scalars, interned strings or immutable arrays)
- without opcache IS_CONST operands are not shared between processes or threads and may use common reference counters
2016-04-05 20:09:14 +03:00
Dmitry Stogov
32d6ac4ddf
RETURN micro optimization
2016-04-05 16:45:15 +03:00
Dmitry Stogov
d0c6c179cd
Initialize op_array->run_time_cache on slow path of INIT_FCALL opcode and omit corresponding check on fast path of DO_FCALL.
2016-04-05 00:01:00 +03:00
Dmitry Stogov
7abfaac901
Merge zend_execute_data->called_scope into zend_execute_data->This.
...
"called_scope" made sense only for static method calls, for dynamic calls it was always equal to the class of $this.
Now EG(This) may store IS_OBJECT + $this or IS_UNUSED + "called_scope" (of course, "called_scope" may be NULL).
Some code might need to be adopted to support this change.
Checks (Z_OBJ(EX(This))) might need to be converted into (Z_TYPE(EX(This)) == IS_OBJECT).
2016-04-01 16:17:49 +03:00
Dmitry Stogov
86a1aeed22
Flags ZEND_CALL_RELEASE_THIS and ZEND_CALL_CLOSURE should never be set together.
...
Closures keep responsibility for releasing $this theirselves.
2016-03-31 18:58:13 +03:00
Dmitry Stogov
fcbe1e8edf
Use CALL_INFO flag to check if we need to destroy symbol_table.
...
This saves one memory load on most RETURN opcodes.
2016-03-31 18:47:25 +03:00
Xinchen Hui
0a2746fb4b
Merge branch 'PHP-7.0'
...
* PHP-7.0:
Fixed bug #71914 (Reference is lost in "switch")
2016-03-29 17:14:48 +08:00
Xinchen Hui
2e6d70787c
Fixed bug #71914 (Reference is lost in "switch")
2016-03-29 17:14:36 +08:00
Nikita Popov
8e5b139732
Evaluate arguments of new for classes without ctor
...
ML: http://markmail.org/message/4b3mk7jid64zvz34
2016-03-25 19:11:37 +01:00
Andrea Faulds
37c8bb5868
Allow specifying keys on list() elements
...
Squashed commit of the following:
commit 0361dbe356
Author: Andrea Faulds <ajf@ajf.me>
Date: Fri Mar 25 16:59:20 2016 +0000
UPGRADING and NEWS
commit dca9d4a36c
Author: Andrea Faulds <ajf@ajf.me>
Date: Fri Mar 25 16:45:18 2016 +0000
Add tests contributed by @jesseschalken
commit e557f77eab
Author: Andrea Faulds <ajf@ajf.me>
Date: Fri Mar 25 16:44:51 2016 +0000
Rebuild VM
commit 70942e4c3c
Author: Andrea Faulds <ajf@ajf.me>
Date: Wed Feb 24 13:12:26 2016 +0000
Add test for evaluation order of nested list() keys
commit ed3592e80c
Author: Andrea Faulds <ajf@ajf.me>
Date: Wed Feb 24 12:42:04 2016 +0000
Add test for evaluation order
commit 589756cbcc
Author: Andrea Faulds <ajf@ajf.me>
Date: Tue Jan 19 17:29:34 2016 +0000
Allow arbitrary expressions for key
commit 3f622077c3
Author: Andrea Faulds <ajf@ajf.me>
Date: Tue Jan 19 17:45:10 2016 +0000
Remove compile-time HANDLE_NUMERIC (see bug #63217 )
commit bab758119a
Author: Andrea Faulds <ajf@ajf.me>
Date: Sun Jan 17 01:20:26 2016 +0000
Handle numeric strings
commit 14bfe93ddc
Author: Andrea Faulds <ajf@ajf.me>
Date: Sun Jan 17 01:09:36 2016 +0000
Allow trailing comma
commit f4c8b2cb30
Author: Andrea Faulds <ajf@ajf.me>
Date: Sat Jan 16 23:47:11 2016 +0000
Add tests
commit 0085884a61
Author: Andrea Faulds <ajf@ajf.me>
Date: Sat Jan 16 22:24:23 2016 +0000
Handle non-integer/string opcodes
commit e572d2d0ad
Author: Andrea Faulds <ajf@ajf.me>
Date: Sat Jan 16 21:10:33 2016 +0000
Disallow mixing keyed and unkeyed list() elements
commit cede13ccfe
Author: Andrea Faulds <ajf@ajf.me>
Date: Sun Jan 10 20:46:44 2016 +0000
list() with keys (no foreach or tests)
2016-03-25 17:18:42 +00:00
Dmitry Stogov
60b72e434b
Avoid data bypass delays between integer and floating point execution units on x86 CPUs.
2016-03-21 13:03:30 +03:00
Dmitry Stogov
fc7cbdce61
Squashed commit of the following:
...
commit 98471821a8
Author: Dmitry Stogov <dmitry@zend.com>
Date: Thu Mar 17 21:56:04 2016 +0300
Fixed wrong constant usage
commit 8183b811e7
Author: Dmitry Stogov <dmitry@zend.com>
Date: Thu Mar 17 21:10:23 2016 +0300
Added ability to serialize and serialize opcode handlers for file-cache
commit 3516b261de
Author: Dmitry Stogov <dmitry@zend.com>
Date: Thu Mar 17 10:11:59 2016 +0300
Added missed file
commit f4475a2360
Author: Dmitry Stogov <dmitry@zend.com>
Date: Thu Mar 17 10:00:45 2016 +0300
Transparently introduce type-specialized opcode handlers.
This affects only PHP VM, and doesn't change anything else.
2016-03-17 22:00:27 +03:00
Xinchen Hui
f3dd50d650
Merge branch 'PHP-7.0'
...
* PHP-7.0:
Fixed test script
Update NEWS
Fixed bug #71841 (EG(error_zval) is not handled well)
Fixed bug #71840 (Unserialize accepts wrongly data)
Conflicts:
Zend/zend_vm_def.h
Zend/zend_vm_execute.h
2016-03-17 15:26:40 +08:00
Xinchen Hui
fe1a3fc08b
Merge branch 'PHP-5.6' into PHP-7.0
...
* PHP-5.6:
Fixed bug #71841 (EG(error_zval) is not handled well)
Fixed bug #71840 (Unserialize accepts wrongly data)
Conflicts:
Zend/zend_vm_def.h
Zend/zend_vm_execute.h
ext/standard/var_unserializer.c
2016-03-17 15:22:44 +08:00
Xinchen Hui
5546f8be56
Fixed bug #71841 (EG(error_zval) is not handled well)
2016-03-17 15:16:47 +08:00
Xinchen Hui
73e8c08788
Sorry for that... Merged by accident....
...
Revert "Transparently introduce type-specialized opcode handlers."
This reverts commit 59d00b8bcc
.
2016-03-17 11:59:15 +08:00
Xinchen Hui
a4b2f7f3a9
Revert "Taking into account "undefined" variables"
...
This reverts commit 9020086a13
.
2016-03-17 11:58:59 +08:00
Xinchen Hui
b9aed47a7a
Fixed Bug #71824 (null ptr deref _zval_get_string_func (zend_operators.c:851))
2016-03-17 11:56:32 +08:00
Dmitry Stogov
9020086a13
Taking into account "undefined" variables
2016-03-16 04:20:43 +03:00
Dmitry Stogov
59d00b8bcc
Transparently introduce type-specialized opcode handlers.
...
This affects only PHP VM, and doesn't change anything else.
2016-03-16 03:36:58 +03:00
Dmitry Stogov
827a7a180b
Added possibility for extra specialization for SMART_BRANCH (e.g. IS_EQUAL+JMPZ superinstruction).
2016-03-11 12:17:03 +03:00
Dmitry Stogov
ff8337b783
Merge branch 'PHP-7.0'
...
* PHP-7.0:
More effecient fix for bug #71756
2016-03-10 13:34:00 +03:00
Dmitry Stogov
f8506c062f
More effecient fix for bug #71756
2016-03-10 13:33:36 +03:00
Francois Laupretre
370b7039e4
Add support for negative string offsets (syntax)
2016-03-09 14:41:37 +01:00
Nikita Popov
55c0de8f95
Merge branch 'PHP-7.0'
2016-02-24 17:44:33 +01:00
Nikita Popov
3ea877ca15
Fix "Call to member function on unknown"
...
Should be "on null".
2016-02-24 17:00:25 +01:00
Dmitry Stogov
0f39f080d1
Fixed incorrrect merge (regenrate zend_vm_execute.h)
2016-02-19 00:09:17 +03:00
Dmitry Stogov
8a6c5be106
Merge branch 'PHP-7.0'
...
* PHP-7.0:
Better fix for bug #71622 (Strings used in pass-as-reference cannot be used to invoke C::$callable())
2016-02-18 23:15:28 +03:00
Dmitry Stogov
25fbb06e2d
Better fix for bug #71622 (Strings used in pass-as-reference cannot be used to invoke C::$callable())
2016-02-18 23:14:46 +03:00
Bob Weinand
2dc9aa9bea
Merge branch 'PHP-7.0'
2016-02-18 13:54:19 +01:00
Bob Weinand
3ce6ad9d13
Fixed bug #71622 (Strings used in pass-as-reference cannot be used to invoke C::$callable())
2016-02-18 13:53:15 +01:00
Xinchen Hui
4eb4a78bf0
Combine conditions (good for other VM kinds)
2016-02-15 11:12:04 +08:00
Nikita Popov
44ed1cb5c0
Remove ZEND_CALL_CTOR_RESULT_UNUSED
...
Instead emit a FREE on the result of NEW.
2016-02-11 22:15:11 +01:00
Nikita Popov
5faedf5b3e
Remove EXT_TYPE_UNUSED in favor of IS_UNUSED
...
This means we no longer allocate an unused VAR for the retval of
instructions that support unused results.
Nearly all instructions already used the result variable only if
it was used. The only exception to this was the return value
variable for internal function call results. I've adjusted the code
to use a stack zval for the unused return case now. As we have
retval specialization now, we know that it doesn't matter.
2016-02-11 18:02:19 +01:00
Nikita Popov
68516091c1
Merge branch 'PHP-7.0'
2016-02-11 16:33:23 +01:00
Nikita Popov
9cebdc5d47
Fix yield-by-ref of constant
...
Typo in the condition...
2016-02-11 16:32:45 +01:00
Nikita Popov
7453348ca8
Merge branch 'PHP-7.0'
2016-02-11 16:25:55 +01:00
Nikita Popov
1322672c0b
Fix dangling send target when using yield from
...
Also drop some unnecessary TRY_DELREFs -- leftovers from the days
when null was refcounted.
2016-02-11 16:25:16 +01:00
Dmitry Stogov
81721a7ddd
Specialize DO_FCALL (and variations) according to used/unused return value
2016-02-05 15:46:52 +03:00
Dmitry Stogov
2f5a119281
Use extra specialization to eliminate run-time checks for conditions known at compile time in SEND_VAL_EX and SEND_VAR_EX.
2016-02-05 15:07:58 +03:00
Dmitry Stogov
ef98adce30
Specialize ASSIGN according to used/unused return value
2016-02-05 13:18:58 +03:00
Bob Weinand
00a2c30c59
Add extra VM operand specialization
...
For now RETVAL and OP_DATA= are supported
2016-02-04 16:49:50 +01:00
Dmitry Stogov
d510255879
Rename IS_ERROR into _IS_ERROR (to prevent redefinition on Windows).
2016-02-01 11:12:28 +03:00
Xinchen Hui
08e5dc461d
Merge branch 'PHP-7.0'
2016-01-29 22:05:59 -08:00
Xinchen Hui
e062759401
Fixed bug #71485 (Return typehint on interanal func causes Fatal error when it throws exception).
2016-01-29 22:05:52 -08:00
Dmitry Stogov
86f54fcdf7
Use special type IS_ERROR instread of EG(error_zval). (we still need EG(error_zval) for SPL support).
2016-01-28 18:00:06 +03:00
Dmitry Stogov
e99fe9865e
Merge branch 'PHP-7.0'
...
* PHP-7.0:
Fixed bug #71474 (Crash because of VM stack corruption on Magento2).
2016-01-28 11:54:48 +03:00
Dmitry Stogov
6039d2d914
Fixed bug #71474 (Crash because of VM stack corruption on Magento2).
2016-01-28 11:41:15 +03:00
Dmitry Stogov
6579e48417
Introduced BIND_STATIC opcode instead of FETCH_R/FETCH_W(static)+ASSIGN/ASSIGN_REF (similar to BIND_GLOBAL).
...
In the future we may refer to static variable by index instead of name, to eliminate hash lookup.
2016-01-12 12:20:35 +03:00
Xinchen Hui
563659822d
Merge branch 'PHP-7.0'
2016-01-02 17:56:54 +08:00
Xinchen Hui
97a9470d97
bump year which is missed in rev 49493a2
2016-01-02 17:56:11 +08:00
Xinchen Hui
3537e95dae
bump year which is missed in rev 49493a2
2016-01-02 17:51:24 +08:00
Nikita Popov
65e456f364
Introduce BIND_LEXICAL
...
This opcodes inserts a local CV into the closure static variable
table. This replaces the previous mechanism of having static
variables marked as LEXICAL, which perform a symtable lookup
during copying.
This means a) functions which contain closures no longer have to
rebuild their symtable (better performance) and b) we can now track
used variables in SSA.
2015-12-29 23:14:53 +01:00
Dmitry Stogov
00a3714e05
Support for optimization introduced in DFA pass (it may change type of instruction return oprand to IS_CV)
2015-12-23 19:02:14 +03:00
Xinchen Hui
70f9ba00f7
This check become useless after 98885bfa1e
2015-12-23 20:56:49 +08:00
Dmitry Stogov
98885bfa1e
Consolidate indirect string offset modification checks (Nikita, Dmitry)
...
Check it once, instead of dozens of times.
2015-12-23 13:52:15 +03:00