Commit Graph

2179 Commits

Author SHA1 Message Date
Xinchen Hui
1e22c9a187 Merge branch 'instanceof-const' of https://github.com/nikic/php-src
* 'instanceof-const' of https://github.com/nikic/php-src:
  Return false for instanceof on literal
2018-01-03 16:08:20 +08:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +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
Nikita Popov
b6131364f9 Return false for instanceof on literal 2017-12-19 22:16:45 +01: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
6a9d2b2190 Cleanup type conversion 2017-12-07 19:24:55 +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
cc12acefcd Use cheaper functions 2017-12-04 13:21:35 +03:00
Dmitry Stogov
92cc7f9fab Merge branch 'PHP-7.2'
* PHP-7.2:
  Set trailing zero
2017-12-01 17:01:10 +03:00
Dmitry Stogov
01b85f0e17 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Set trailing zero
2017-12-01 17:00:51 +03:00
Dmitry Stogov
b73151845f Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Set trailing zero
2017-12-01 17:00:42 +03:00
Dmitry Stogov
24d5adbd5a Set trailing zero 2017-12-01 17:00:11 +03:00
Dmitry Stogov
f98721b4e0 Intern auto global name strings in first place 2017-11-29 17:10:51 +03:00
Nikita Popov
8795893f4f Make sure string property/class const values are interned
This was done for user-definde class constant values, however this
is also important for properties and internal classes.
2017-11-25 17:12:37 +01: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
Nikita Popov
9fbb019848 Move adjust_for_fetch_type directly after emission
And drop the distinction between compile_X and compile_X_common.
This avoids WTF moments like compile_simple_var_no_cv completely
ignoring the BP_VAR type passed to it...
2017-11-16 22:28:29 +01:00
Nikita Popov
d9da166649 Minor fetch type adjustment cleanup
No need to call adjust_fetch_type on FETCH_THIS, just to special
case it in adjust_fetch_type...
2017-11-16 22:13:07 +01:00
Dmitry Stogov
7fba7209e1 Fixed memory leak (Zend/tests/list_003.phpt) 2017-11-03 21:02:27 +03:00
Dmitry Stogov
990d8092a4 Reverted incomplete fix and too strict asserts. 2017-11-01 16:18:13 +03:00
Dmitry Stogov
02a05146fd Fixed string interning during constants substitution 2017-11-01 10:56:37 +03:00
Xinchen Hui
a8a17a72b0 RC manipulation cleanup 2017-11-01 10:25:10 +08:00
Dmitry Stogov
d481d495cc Fixed few inconsistent ZVALs in AST produced by compiler (REFCOUNTED and INTERNED strings) 2017-11-01 01:10:21 +03:00
Dmitry Stogov
5dbdc382af Intern file names and class constants in first place (they may be interned later during constant substitution) 2017-10-31 15:36:55 +03: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
9cf87aa196 Avoid HashTable allocations for empty arrays (using zend_empty_array). 2017-10-24 17:27:31 +03:00
Dmitry Stogov
edc7c8ccfa PHP must not create circular arrays when element is assigned by value. 2017-10-12 16:23:45 +03:00
Dmitry Stogov
ef5ea48741 Always use IS_CONSTANT_AST (IS_CONSTANT is removed). 2017-10-10 10:11:05 +03:00
Dmitry Stogov
39ded1d5f8 Changed zend_ast_ref structure to use only one allocation, removing dichotomy between heap/arena ASTs. 2017-10-09 16:57:51 +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
a80e462fbd Order live ranges according to "start" position 2017-08-14 12:21:07 +03:00
Dmitry Stogov
2fab62271a Revert "Fixed live_range removing (bug can be triggred by JIT)"
This reverts commit aecf996510.
2017-08-14 12:00:02 +03:00
Xinchen Hui
aecf996510 Fixed live_range removing (bug can be triggred by JIT) 2017-08-11 21:56:30 +08:00
Dmitry Stogov
1180d8c801 Separate ISSET_ISEMPTY_CV/UNSET_CV from ISSET_ISEMPTY_VAR/UNSET_VAR 2017-07-17 14:11:50 +03:00
Anatol Belski
bc5811f361 further sync for vim mode lines 2017-07-04 18:12:45 +02:00
Nikita Popov
e5741da85c Fix format arguments
Only dropped one before, both need to go...
2017-06-25 22:32:57 +02:00
Nikita Popov
9dfcb04f10 Fix typo 2017-06-25 22:28:56 +02:00
Michał Brzuchalski
8e10c9d373 Implement object type annotation
RFC: https://wiki.php.net/rfc/object-typehint
2017-06-25 21:49:41 +02:00
Dmitry Stogov
a916bed8f8 Fixed function name resolution 2017-05-30 21:48:16 +03:00
Dmitry Stogov
65edf44291 Check for possible run-time function name resolution 2017-05-30 17:37:54 +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
d32288b5bf Fixed copy-paste mistake 2017-05-25 20:20:57 +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
Dmitry Stogov
8203a175b1 Remove unused opcode handlers 2017-05-18 13:18:08 +03:00