1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 15:08:16 +02:00
Commit Graph

56 Commits

Author SHA1 Message Date
Tyson Andre 543684e796 Optimize out no-op yield from statements
If the array is empty, then I'd expect that the generator is never left,
and that can be converted to a no-op and the return value would always be `null`.

Make `yield from [];` as efficient as `if (false) { yield null; }`
when opcache's sccp pass is enabled.

Closes GH-5679
2020-06-08 09:17:13 -04:00
Dmitry Stogov 0684b9fcdc Always print numeric opline numbers 2020-03-25 14:26:42 +03:00
Nikita Popov 1ba6e66c46 Improve type inference
After thinking about this a bit more, the code here was too
conservative. We know that everything but an object is going to
throw, so it's sufficient to restrict the type to MAY_BE_OBJECT.

The change in the test is weird but not incorrect, because it
operates on empty inferred types, in which case the code must be
dead (which it is). We should probably add a more explicit removal
of code working on empty types.
2020-03-17 15:41:47 +01:00
Nikita Popov d9c45d86f9 Improve type inference for COALESCE
Place a pi node on the non-null edge to remove a spurious
undef/null type.

Additionally, adjust the profitability heuristic to be more
accurate if the "other predecessor" writes to the variable.
Ideally this should not just consider the direct predecessors,
but it's sufficient for this case.

This partially addresses bug #79353 by removing the discrepancy
between ?? and ??=.
2020-03-09 16:19:48 +01:00
Nikita Popov f8d795820e Reindent phpt files 2020-02-03 22:52:20 +01:00
Tyson Andre 5f92a085cc Convert ZEND_ECHO operand to string after sccp
And filter out echoes of the empty string (e.g. false/null)

Split out of #5097 (on GitHub)

Closes GH-5118
2020-01-27 20:21:24 -05:00
Máté Kocsis afdaa91170 Fix #78880: Final spelling fixes 2020-01-16 19:14:31 +01:00
Máté Kocsis 0b4778c377 Fix #78880: Another bunch of spelling errors 2020-01-16 09:46:47 +01:00
Dmitry Stogov 0cb977a691 Fixed edge cases introduced by 170ed1f5a7 2019-10-10 11:48:31 +03:00
Nikita Popov 029b735a6e Merge branch 'PHP-7.3' into PHP-7.4 2019-05-29 16:48:28 +02:00
Nikita Popov 61a38bb274 SCCP: Fix leak when determining TYPE_CHECK from type info
As TYPE_CHECK is the only opcode where we do something like this,
I'm adding this hack.
2019-05-29 16:47:19 +02:00
Nikita Popov f19dd674e0 SCCP: Fix handling of ASSIGN_OBJ_REF
The generic BOT handling is not away of OP_DATA, so need to handle
this opcode before we get to that.
2019-05-28 16:15:37 +02:00
Nikita Popov 6893f1f98e SCCP: Don't perform partial object propagation for typed props 2019-05-28 15:46:03 +02:00
Dmitry Stogov 88a2268d6b Replace "ZEND_CALL_CTOR" hack by additional live-range 2019-04-12 00:49:45 +03:00
Dmitry Stogov c941f1d8c7 Fixed SCCP support for ZEND_ASSIGN_OBJ_REF 2019-04-03 11:22:59 +03:00
Nikita Popov dda2074bf7 Merge branch 'PHP-7.3' into PHP-7.4 2019-02-22 13:42:13 +01:00
Nikita Popov 66fda0cdb1 Remove result def during jmp_set optimization 2019-02-22 13:41:47 +01:00
Nikita Popov ea115a617f Fix removal of unreachable code in SCCP
Due to a wrongly placed check, we were only performing the
unreachable code removal if there were loop vars...
2019-02-22 12:44:36 +01:00
Dmitry Stogov 12edc453e5 Disable preloading for sensetive opcache tests 2019-02-20 11:47:19 +03:00
Dmitry Stogov 2f89baf5c7 Fixed 32/64-bit mismatch 2019-01-14 13:15:52 +03: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
Peter Kokot 782352c54a Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
Gabriel Caruso 9c144e0d82 Trim trailing whitespace in tests 2018-10-14 12:07:20 -03:00
Dmitry Stogov 8c22d3e729 Make FETCH_R/IS, FETCH_DIM_R/IS, FETCH_OBJ_R/IS, FETCH_STATIC_PROP_R/IS return TMP_VAR, instead of VAR. 2018-06-25 23:43:23 +03:00
Gabriel Caruso ded3d984c6 Use EXPECT instead of EXPECTF when possible
EXPECTF logic in run-tests.php is considerable, so let's avoid it.
2018-02-20 21:53:48 +01:00
Nikita Popov 705dc3f049 Fix DCE test
Without the type hint the previous optimization no longer applied,
as the result could be an (overloaded) object, which might have
caused dtor effect reordering.
2018-02-18 15:37:10 +01:00
Xinchen Hui 63a96ebf6a Fixed bug while dealing with ADD_ARRAY_ELEMENT against an existing const array 2018-01-07 14:17:47 +08:00
Xinchen Hui 729a6688af Optimized FETCH_CLASS before INSTANCEOF out if possible 2018-01-05 12:58:28 +08:00
Xinchen Hui c0913af570 Fixed test 2018-01-05 12:54:20 +08:00
Xinchen Hui 1db6c19365 Fixed wrongly const replacing on partial array 2018-01-05 12:29:39 +08:00
Rasmus Lerdorf 9fe6b29356 Add line numbers to Opcache's zend_dump_op() debug output 2017-10-06 11:03:07 -03:00
Dmitry Stogov 80abd81344 Fixed escape analysis for ASSIGN_DIM/ASSIGN_OBJ opcodes and improved DCE 2017-09-14 11:03:47 +03:00
Christoph M. Becker ee92aed06f [ci skip] Merge branch 'pull-request/2752'
* pull-request/2752:
  Fixed typo
2017-09-14 02:03:23 +02:00
Dmitry Stogov 0a86f159f4 Added test. Invalid usage doesn't affect escape_satte of arrays/objects and shouldn't prevent SCCP on "proper" paths. 2017-09-14 00:09:28 +03:00
Markus Staab ea4e3efa14 Fixed typo 2017-09-13 18:35:37 +02:00
Dmitry Stogov 93af905071 Improved reference dependencies analysis 2017-09-13 18:18:51 +03:00
Dmitry Stogov 9f45aaaac2 Fixed test 2017-09-12 21:41:29 +03:00
Xinchen Hui 07ed545abf Fixed memleak in SCCP 2017-09-12 21:35:30 +08:00
Dmitry Stogov 86dd321c0c Fixed yet another object aliasing problem 2017-09-11 23:19:03 +03:00
Dmitry Stogov 63b93b4a74 Fixed copy semantics in escape analysis 2017-09-11 20:59:40 +03:00
Dmitry Stogov d5c527c9db Fixed SCCP failure, because of aliased objects.
For now, mark aliased objects as "escaping".
A more clever solution would requitre Heap Array SSA + Definitely Same and Definitely Different sets construction.
2017-09-11 16:23:17 +03:00
Dmitry Stogov 76b2968a73 Improved JMP optimization 2017-09-11 14:40:15 +03:00
Dmitry Stogov 431ea10fb2 Remove unused temporary variables 2017-09-05 14:46:03 +03:00
Dmitry Stogov 39459114ff Replace used constant instructions by QM_ASSIGN 2017-09-05 11:43:33 +03:00
Xinchen Hui 4afe5a5cb2 Fixed SCCP rewinding on partial_array|object phi 2017-09-02 21:28:33 +08:00
Xinchen Hui 7c9556db99 Fixed SCCP on PHI(partial_object#1, partial_object#2) 2017-09-02 18:40:26 +08:00
Xinchen Hui 8a7ba133c3 Fixed SCCP on PHI(contant_array, partial_array) 2017-09-02 18:16:40 +08:00
Dmitry Stogov 59c5d81bab Added skipif.inc 2017-09-01 13:32:26 +03:00
Dmitry Stogov becb4d6d59 Remove dead allocations of non-escaping objects 2017-09-01 10:32:20 +03:00
Dmitry Stogov 6cc9e805cd Remove dead construction of non-escaping arrays and objects 2017-08-31 17:17:04 +03:00