Commit graph

284 commits

Author SHA1 Message Date
Dmitry Stogov
97ccafd4c6 Live ranges construction optimization 2019-01-21 17:25:24 +03: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
Nikita Popov
e219ec144e Implement typed properties
RFC: https://wiki.php.net/rfc/typed_properties_v2

This is a squash of PR #3734, which is a squash of PR #3313.

Co-authored-by: Bob Weinand <bobwei9@hotmail.com>
Co-authored-by: Joe Watkins <krakjoe@php.net>
Co-authored-by: Dmitry Stogov <dmitry@zend.com>
2019-01-11 15:49:06 +01:00
Xinchen Hui
b1a4f90ea9 Merge branch 'PHP-7.3'
* PHP-7.3:
  Incase of invalid read
2019-01-10 14:53:36 +08:00
Xinchen Hui
16176ad0e3 Incase of invalid read 2019-01-10 14:50:39 +08:00
Nikita Popov
a22881520c Merge branch 'PHP-7.3' 2019-01-09 09:28:04 +01:00
Nikita Popov
bf4dab0163 Make operator swapping depend on IGNORE_OVERLOADING flag
Add MUL back to the list and instead make the entire optimization
depend on IGNORE_OVERLOADING, which is there exactly so we can make
these kinds of assumptions.
2019-01-09 09:27:56 +01:00
Xinchen Hui
dd61845cf8 Merge branch 'PHP-7.3'
* PHP-7.3:
  Fixed bug #77266 (Assertion failed in dce_live_ranges)
2019-01-08 19:19:44 +08:00
Xinchen Hui
cd49db9d47 Fixed bug #77266 (Assertion failed in dce_live_ranges) 2019-01-08 19:19:01 +08:00
Dmitry Stogov
9bf80ef385 Respect static method visibility 2018-12-27 10:42:52 +03:00
Nikita Popov
6debea2fd8 Merge branch 'PHP-7.3' 2018-12-10 13:36:54 +01:00
Nikita Popov
93aabf1533 Fixed bug #77275
Instead of juggling with this problem during literal compaction,
make sure that we always initialize Z_EXTRA for literals, which
seems like the more robust solution.
2018-12-10 13:36:23 +01:00
Dmitry Stogov
ba99aa133c Fixed issues related to optimization and persitence of classes linked with interfaces, traits or internal classes. 2018-11-14 16:32:07 +03:00
Zeev Suraski
9afce019e0 Future-proof email addresses 2018-11-01 18:35:32 +02:00
Zeev Suraski
67e0138c0d Future-proof email addresses... 2018-11-01 18:30:28 +02:00
Dmitry Stogov
bf38e6c10a Keep original value of "prototype" 2018-10-30 16:13:45 +03:00
Dmitry Stogov
ebf44fbbda Reslove inherited op_array references once afrer all optimizations. 2018-10-30 13:16:49 +03:00
Nikita Popov
3d415644f7 Merge branch 'PHP-7.3' 2018-10-25 16:44:54 +02:00
Nikita Popov
b9431ef4d5 Don't optimize function if inference failed
This was respected only for the single-function optimizations, not
in func-info mode.
2018-10-25 16:44:24 +02:00
Dmitry Stogov
002aa30786 Added check for "user" method 2018-08-28 23:56:12 +03:00
Dmitry Stogov
d140df58e6 Keep information about unresolved interfaces in zend_class_entry->interface_names.
Move interface implementation code into ZEND_DECLARE_*CLASS opcodes.
Remove ZEND_ADD_INTERFACE and ZEND_VERIFY_ABSTRACT_CLASS opcodes.
2018-08-23 17:16:28 +03:00
Dmitry Stogov
67397970b2 Replace zend_class_entry->traits by persistent zend_class_entry->trait_names.
Move trait binding code into ZEND_DECLARE_*CLASS opcodes.
Remove ZEND_ADD_TRIAIT and ZEND_BIND_TRAITS opcodes.
2018-08-23 02:02:26 +03:00
Dmitry Stogov
f950128cd6 Encode parent class name as IS_CONST operand in DECLARE_INHERITED_CLASS and DECLARE_ANON_INHERITED_CLASS opcodes (eliminate FETCH_CLAS
S opcode).
2018-07-25 13:40:47 +03:00
Dmitry Stogov
004a0568f4 Eliminated REFCOUNTED checks on persistent constant operands in SEND_VAL[_EX] and QM_ASSIGN. 2018-07-03 13:10:22 +03:00
Dmitry Stogov
28b03f9605 Another fix for bug #63217 2018-07-03 01:09:58 +03:00
Dmitry Stogov
57af94c8b9 Partial revert of 30156d588c 2018-07-02 20:54:44 +03:00
Rudi Theunissen
30156d588c Fixed bug #63217
Don't automatically convert literal string keys to integers on
array access, as we may be dealing with an ArrayAccess object,
rather than a plain array.
2018-07-02 16:41:59 +02:00
Nikita Popov
60323906f9 Optimizer: Don't propagate constants into MAKE_REF
This occurs in Zend/tests/assign_ref_error_var_handling.phpt,
added in 95a0709935.
2018-06-10 00:10:32 +02:00
Dmitry Stogov
9e0f131d2b Fixed ISSET/ISEMPTY bit meaning to simplify run-time checks 2018-05-31 19:02:51 +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
Dmitry Stogov
ca035f26aa Moved "zval.u2.cache_slot" into free room of "zend_op" 2018-02-05 19:41:47 +03:00
Dmitry Stogov
3a794d39f0 Avoid repeatable ARG_SHOULD_BE_SENT_BY_REF() checks in FETCH_*FUNC_ARG and following SEND_VAR_EX. Perform the check once in a new CHECK_FUNC_ARG opcode and reuse in the following FETCH_*FUNC_ARG and SEND_FUNC_ARG (SEND_VAR_EX replacement). 2018-02-05 19:40:06 +03:00
Dmitry Stogov
ba298725d1 Changed CATCH instruction format (extended_value moved into op2, op2 into result, result into extended_value) 2018-01-31 22:39:30 +03:00
Dmitry Stogov
9c7fb529ce Changed FETCH_CONSTANT instruction format (extended_value moved into op1) 2018-01-31 18:15:25 +03:00
Dmitry Stogov
bf7176c70f Use reference-counting instead of duplication and separation, if really necessary. 2018-01-19 01:03:24 +03:00
Dmitry Stogov
c5c9a69447 Use ZVAL_DUP() instead of zval_copy_ctor() 2018-01-17 14:59:15 +03:00
Dmitry Stogov
c9034c3b33 Get rid of zend_op_array.early_binding 2018-01-11 19:15:52 +03:00
Xinchen Hui
729a6688af Optimized FETCH_CLASS before INSTANCEOF out if possible 2018-01-05 12:58:28 +08:00
Xinchen Hui
76d0e3d514 Enable replacing const to INSTANCEOF 2018-01-03 18:28:03 +08:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Nikita Popov
ffc0a17322 Fix typos 2017-12-30 23:40:33 +01: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
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
Xinchen Hui
3475197551 Merge branch 'PHP-7.2'
* PHP-7.2:
  Improved fix
2017-11-27 12:03:48 +08:00
Xinchen Hui
9d02227243 Improved fix 2017-11-27 12:03:37 +08:00
Xinchen Hui
a84c7050fd Merge branch 'PHP-7.2'
* PHP-7.2:
  Fixed bug #75556 (Invalid opcode 138/1/1)
2017-11-25 00:54:28 +08:00
Xinchen Hui
c412b8b384 Fixed bug #75556 (Invalid opcode 138/1/1) 2017-11-25 00:54:15 +08:00
Xinchen Hui
d042d1d8e0 Cleanup cfg flags & Added ZEND_FUNC_HAS_EXTENED_INFO 2017-10-18 17:03:07 +08:00
Dmitry Stogov
e70618aff6 Changed the way VM accesses constant operands in 64-bit builds. 2017-10-04 16:53:01 +03:00