1
0
mirror of https://github.com/php/php-src.git synced 2026-04-24 16:38:25 +02:00
Commit Graph

254 Commits

Author SHA1 Message Date
Ilija Tovilo 9fa1d13301 Implement match expression
RFC: https://wiki.php.net/rfc/match_expression_v2

Closes GH-5371.
2020-07-09 23:52:17 +02:00
Tyson Andre d63eca285a Fix miscellaneous typos in code comments/var names
Closes GH-5501
2020-05-01 15:49:05 +02:00
Dmitry Stogov 64b40f69dc Make ASSIGN, ASSIGN_OP, INC and DEC opcodes to return IS_TMP_VAR instead of IS_VAR.
This helps to avoid unnecessary IS_REFERENCE checks.
This changes some notices "Only variables should be passed by reference" to exception "Cannot pass parameter %d by reference".

Also, for consistency, compile-time fatal error "Only variables can be passed by reference" was converted to exception "Cannot pass parameter %d by reference"
2020-02-07 13:36:52 +03:00
Nikita Popov 9ec1ee5976 Add support for deprecating constants
Internal constants can be marked as CONST_DEPRECATED, in which
case accessing them will throw a deprecation warning.

For now this is only supported on global constants, not class
constants. Complain to me if you need to deprecate a class
constant...

Closes GH-5072.
2020-01-17 10:05:06 +01:00
Máté Kocsis afdaa91170 Fix #78880: Final spelling fixes 2020-01-16 19:14:31 +01:00
Dmitry Stogov 3360d05f30 Don't keep QM_ASSIGN with IS_UNUSED result 2019-11-29 17:43:36 +03:00
Dmitry Stogov 5197d0cd5e Reduced number of CFG pass iterations 2019-10-14 11:37:10 +03:00
Dmitry Stogov 3db5dc44bc JMP optimization cleanup.
Make JMP optimisation in pass3 and JMP optimization from CFG pass to be almost identical.
2019-10-11 11:23:02 +03:00
Dmitry Stogov 0cb977a691 Fixed edge cases introduced by 170ed1f5a7 2019-10-10 11:48:31 +03:00
Dmitry Stogov fa0a17a76f Move ECHO handling into common switch 2019-10-09 23:24:41 +03:00
Dmitry Stogov fd69af38c8 Cleanup JMP optimization. Remove duplicate code (conditional jums with constant operand) and outdated commented code. 2019-10-09 23:07:32 +03:00
Dmitry Stogov f6f32f2cf0 SAMRT BRANCH improvement.
Avoid need of insertion NOP opcoes between unrelated SMART BRANCH instruction and following JMPZ/JMPNZ.
Now instead of checking the opcode of following instruction, the same information is encoded into SMART BRANH result_type.
2019-10-09 13:48:39 +03:00
Dmitry Stogov 170ed1f5a7 Otimize out useless QM_ASSIGN 2019-10-09 09:08:25 +03:00
Dmitry Stogov dc3c8c75da Prefer optimization without JMPZNZ instruction 2019-10-04 12:52:46 +03:00
Dmitry Stogov a5465728c2 Added missing rules 2019-10-03 14:56:02 +03:00
Dmitry Stogov 59c828a8c4 Added missing rules 2019-10-03 13:54:08 +03:00
Dmitry Stogov cf33837d75 Cleanup CFG optimization 2019-09-25 17:30:59 +03:00
Dmitry Stogov 78a890e45f Merge branch 'PHP-7.4'
* PHP-7.4:
  Make constant and copy propagation only for IS_TMP_VAR operands
2019-09-13 12:39:45 +03:00
Dmitry Stogov af9b127fed Make constant and copy propagation only for IS_TMP_VAR operands 2019-09-13 12:38:57 +03:00
Dmitry Stogov 5ac3580b9b Merge branch 'PHP-7.4'
* PHP-7.4:
  ZEND_DECLARE_ANON_CLASS doesn't need to skip anything now. It's immediatelly followed by ZEND_NEW.
2019-07-19 10:10:50 +03:00
Dmitry Stogov b065fbde19 ZEND_DECLARE_ANON_CLASS doesn't need to skip anything now. It's immediatelly followed by ZEND_NEW. 2019-07-19 10:09:26 +03:00
Dmitry Stogov 1b5b8175af Merge branch 'PHP-7.4'
* PHP-7.4:
  Replace ZEND_ASSIGN_ADD (and others) by ZEND_ASSIGN_OP, ZEND_ASSIGN_DIM_OP, ZEND_ASSGIN_OBJ_OP and ZEND_ASSIGN_STATIC_PROP_OP
2019-07-05 12:16:30 +03:00
Dmitry Stogov 48ca5a1e17 Replace ZEND_ASSIGN_ADD (and others) by ZEND_ASSIGN_OP, ZEND_ASSIGN_DIM_OP, ZEND_ASSGIN_OBJ_OP and ZEND_ASSIGN_STATIC_PROP_OP 2019-07-05 12:03:25 +03:00
Nikita Popov 681136212f Merge branch 'PHP-7.4' 2019-06-20 10:16:31 +02:00
Nikita Popov ccfe6c862a Avoid memset/memcpy null ub in block pass
The arena allocator has no problem with zero-size allocations (and
will just return the same pointer for each in this case), so just
do that to avoid null pointers.
2019-06-20 09:49:07 +02:00
Nikita Popov e4fae9c061 Merge branch 'PHP-7.4' 2019-06-11 13:16:38 +02:00
Nikita Popov 89b2d88659 Register class before fetching parent
We want the class declaration to be available while compiling the
parent class.
2019-06-11 13:09:33 +02:00
Nikita Popov f106f57164 Merge branch 'PHP-7.4' 2019-05-13 14:43:10 +02:00
CHU Zhaowei e829d08729 Implement spread operator in arrays
RFC: https://wiki.php.net/rfc/spread_operator_for_array

Closes GH-3640.
2019-05-13 14:42:43 +02:00
Nikita Popov 25859315b1 Merge branch 'PHP-7.4' 2019-02-28 16:43:24 +01:00
Nikita Popov 105a04aaac Don't remove CONST CAST in CONCAT operand
CONCAT assumes that CONST operands are strings, so we cannot
blindly remove CAST operands.
2019-02-28 16:42:30 +01:00
Nikita Popov 1b998bb9cb Remove unnecessary convert_to_string_safe macro
I'm assuming that the reason this existed was to avoid modifying
an interned string. However, the current code handles this case
fine already.
2019-02-28 16:30:05 +01:00
Dmitry Stogov cdade2e35d Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove copyright years.
2019-02-05 10:33:57 +03:00
Dmitry Stogov da919a8b65 Remove copyright years. 2019-02-05 10:33:28 +03:00
Nikita Popov 3d39479f4d Remove support for case-insensitive constants
The only remaining case-insensitive constants are null, true and
false, which are handled explicitly.

In the future we may convert them from constants to reserved keywords.
2019-01-31 13:52:06 +01:00
Nikita Popov a50198d0fe Implement ??= operator
RFC: https://wiki.php.net/rfc/null_coalesce_equal_operator

$a ??= $b is $a ?? ($a = $b), with the difference that $a is only
evaluated once, to the degree that this is possible. In particular
in $a[foo()] ?? $b function foo() is only ever called once.
However, the variable access themselves will be reevaluated.
2019-01-22 11:12:04 +01:00
Nikita Popov 3269e88468 Implement single-pass live range calculation
Instead of interleaving creation of live-ranges with the main
compiler code, compute them in a separate pass over the opcodes
as part of pass_two. Additionally, do not keep live ranges
synchronized during optimization in opcache and instead use the
same mechanism to recompute them after optimization.
2019-01-21 11:47:27 +01:00
Dmitry Stogov 8c7aa88e2d Fixed crash introduced by bfaf662ac2 2018-11-07 09:36:21 +03:00
Dmitry Stogov bfaf662ac2 Micro-optimization 2018-11-06 17:04:17 +03:00
Zeev Suraski 67e0138c0d Future-proof email addresses... 2018-11-01 18:30:28 +02:00
Dmitry Stogov ab8094c666 Pack zend_constant.flags and zend_constant.module_number into reserved space inside zend_constant.value. 2018-07-26 12:58:07 +03:00
Dmitry Stogov af341213f7 se zval_ptr_dtor_str() instead of zend_string_release_ex(Z_STR(*), 0) 2018-07-04 12:08:07 +03:00
Dmitry Stogov 5eb1f92f31 Use zend_string_release_ex() instread of zend_string_release() in places, where we sure about string persistence. 2018-05-28 16:27:12 +03:00
Dmitry Stogov 83f98f7340 Don't store values of PHP_SAPI and PHP_BINARY in file cache, because it may be used by different SAPI. 2018-04-28 01:20:49 +03:00
Nikita Popov 1c887eaf0d Merge branch 'PHP-7.2' 2018-04-27 17:02:40 +02:00
Nikita Popov 2c602be7c8 Merge branch 'PHP-7.1' into PHP-7.2 2018-04-27 17:02:01 +02:00
Nikita Popov 279ba58edb Fixed bug #76275
* Adjust IS_SERIALIZED() check to account for potential empty
  allocations at the end of the memory region.
* Deallocate empty allocation if all try/catch elements have been
  removed in the block pass (similar to what we do if all live
  ranges have been eliminated).
2018-04-27 17:01:35 +02:00
Dmitry Stogov 52fddfcca2 Avoid useless iterations 2018-03-13 16:07:18 +03:00
Nikita Popov b0af9ac733 Avoid live range references in opcodes
Don't store the live range of the freed variable for FREE_ON_RETURN
frees, instead look it up at runtime. As this is an extremely
unlikely codepath (in particular, it requires a loop variable with
a throwing destructor), saving the runtime lookup of the live range
is not worth the extra complexity this adds everywhere else.
2018-02-16 21:30:48 +01:00
Nikita Popov 07ad75ca96 Merge branch 'PHP-7.2' 2018-02-16 20:31:01 +01:00