1
0
mirror of https://github.com/php/php-src.git synced 2026-04-27 18:23:26 +02:00
Commit Graph

393 Commits

Author SHA1 Message Date
Nikita Popov a1c48d5e3a Various SSA-related tweaks
* Add FETCH_LIST to inference
* Restrict JMP_SET/COALESCE result type
* Fix typos in range inference
* Add const annotations in zend_ssa.h
* For pi statements dump the associated predecessor block
* If type can be both true and false, dump bool instead
2016-02-28 21:38:34 +01:00
Nikita Popov 9a45e920aa Support dropping rc1/rcn from dumps
For non-JIT we're not interested in rc inference.
2016-02-27 15:36:04 +01:00
Nikita Popov 8d758e7be9 Fix dominator tree construction
The used dominator intersection algorithm assumes a postorder
numbering of the CFG. The reversal of our natural numbering is
quite similar to postorder, but not the same.

In the future we should precompute both preorder/postorder
numberings and orderings, as these are useful in many places.
2016-02-27 15:10:18 +01:00
Dmitry Stogov b8e30a492a Use more general optimisation patterns 2016-02-26 21:02:41 +03:00
Dmitry Stogov 791b8f0c89 Merge branch 'PHP-7.0'
* PHP-7.0:
  Set proper type flags (REFCOUNTED and COPYABLE) according to interned or regular string
2016-02-18 23:18:56 +03:00
Dmitry Stogov 796e1629b0 Set proper type flags (REFCOUNTED and COPYABLE) according to interned or regular string 2016-02-18 23:15:38 +03:00
Xinchen Hui ab5869400b Fixed another assertion fails due to live_range cleaned (ext/phar/tests/003a.phpt) 2016-02-15 14:38:20 +08:00
Xinchen Hui 49399359c6 Restore to the first version fix(sorry, mis-read the codes) 2016-02-15 13:47:52 +08:00
Xinchen Hui b3f5f5f1be Reset op_array->live_range if it is removed all by optimization 2016-02-15 12:09:52 +08:00
Xinchen Hui ab3a820aa3 Revert "Fixed segfault in file cache serialize if live range is empty after"
This reverts commit 2661a47479.
2016-02-15 12:09:13 +08:00
Xinchen Hui 2661a47479 Fixed segfault in file cache serialize if live range is empty after
optimiaztion
2016-02-15 12:07:43 +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
Dmitry Stogov 8c2d55962e Combine conditions 2016-02-11 23:11:19 +03: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 7174af4074 Support CFG construction without live range splitting
We must not split at live range boundaries for SSA constructions,
otherwise an OP_DATA instruction may be separated into new block
and not picked up during renaming.

It's also unnecessary for this use case and only blows up the CFG.
2016-02-09 13:02:33 +01:00
Dmitry Stogov 4095d5f245 Cleanup OP_DATA usage. Now only first operand of OP_DATA is used for ASSIGN_DIM, ASSIGN_OBJ and ASSIGN_OP (DIM/OBJ) instructions. 2016-02-09 13:12:57 +03:00
Dmitry Stogov f4bec6e137 After DFA pass result of FE_FETCH may be CV 2016-02-09 12:16:17 +03:00
Dmitry Stogov 1544fec94b Removed wrong (old) code 2016-02-08 12:20:37 +03:00
Nikita Popov 80c15ac784 Move pi placement into separate function
Non-functional change, just moving code. This makes it easier to
change the order of operations.
2016-02-02 17:39:59 +01:00
Xinchen Hui 63fb2b7118 Improve the names 2016-01-25 16:00:10 +08:00
Nikita Popov 319e82838a Remove dead code
OP_DATA isn't used in that way anymore
2016-01-24 23:04:15 +01:00
Nikita Popov c2fea2a46d Respect RC_INFERENCE during DFG construction
To avoid inserting phis that are only relevant with rc inference
enabled. Suprisingly, this affects only 0.8% of phis.
2016-01-24 23:04:06 +01:00
Nikita Popov 949aaea66e Don't insert duplicate predecessors
Otherwise we'll get corrupt phis
2016-01-24 23:03:57 +01:00
Nikita Popov cf6aa46dbd Fix SSA for ZEND_YIELD
Yield-by-ref defs a ref var, yield-by-var only defs an rc1/rcn var
if rc inference is used.

Also move BIND_LEXICAL where it belongs in DFG construction.
2016-01-24 23:03:50 +01:00
Dmitry Stogov 9b854ebab4 More accurate handling of isset() and unset() 2016-01-22 13:32:20 +03:00
Dmitry Stogov 79071fe227 Added optimization constraint (don't optimize result of NEW, because constructor may throw exception) 2016-01-22 13:30:34 +03:00
Nikita Popov b1e4883d26 Don't print try-catch offset for FAST_RET w/o ev 2016-01-21 21:53:13 +01:00
Nikita Popov 9b57e07298 Consolidate op1/op2 vm flags 2016-01-21 21:15:05 +01:00
Nikita Popov dcf3db6ac8 Mark isset($$var) as INDIRECT_VAR_ACCESS 2016-01-19 22:26:32 +01:00
Nikita Popov 5662d73528 Add support for Pi type constraints
Supports TYPE_CHECK and IS_IDENTICAL for now.
2016-01-19 22:09:29 +01:00
Dmitry Stogov a8900b5636 Typo (ASSESS->ACCESS) 2016-01-19 15:54:44 +03:00
Dmitry Stogov a2ff3a46a4 Use ZEND_FUNC_INDIRECT_VAR_ASSESS instead of ZEND_FUNC_TOO_DYNAMIC. Handle function with exceptions handlers and generators separately. 2016-01-19 15:33:08 +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
Nikita Popov 0e936db801 Make PI construction human-readable
Also makes it easy to add PIs for TI.
2016-01-11 21:53:22 +01:00
Nikita Popov c817ac4d52 Use worklist for DFG construction
About 40x faster.
2016-01-11 21:53:10 +01:00
Nikita Popov bb357e0617 Fix bitset initialization 2016-01-07 23:49:42 +01:00
Nikita Popov c602ac60b9 Fix CE fetching for NEW object type inference
Create a common function for getting a class entry.
2016-01-07 18:53:10 +01:00
Nikita Popov 04dc5d7420 Range&type inference for JMP_SET 2016-01-07 18:53:02 +01:00
Lior Kaplan 71c1980025 Happy new year (Update copyright to 2016) 2016-01-01 20:06:12 +02:00
Lior Kaplan 3d5438bf7b Merge branch 'PHP-7.0'
* PHP-7.0:
  Update header to PHP Version 7
  Happy new year (Update copyright to 2016)
  Happy new year (Update copyright to 2016)
2016-01-01 20:04:31 +02:00
Lior Kaplan 2eb1f38d24 Happy new year (Update copyright to 2016) 2016-01-01 20:03:16 +02:00
Lior Kaplan ed35de784f Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Happy new year (Update copyright to 2016)
2016-01-01 19:48:25 +02:00
Lior Kaplan 49493a2dcf Happy new year (Update copyright to 2016) 2016-01-01 19:21:47 +02:00
Nikita Popov 83c4417330 Mark uses of scope functions in namespaces as TOO_DYNAMIC
Of course they are not necessarily, but it's very likely and we have
to be conservative anyway.

Also use zend_string_equals_literal().
2015-12-30 23:38:03 +01: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
Nikita Popov d77b74a1f3 Use ZEND_HASH_FOREACH 2015-12-26 23:43:33 +01:00
Nikita Popov 33870c525a Don't reuse SSA var in UNSET_VAR
Instead use the SSA var that UNSET_VAR actually defines. Otherwise
we get issues trying to DCE unsets.
2015-12-26 23:33:58 +01:00
Dmitry Stogov b3d0178915 Rearrange code to enable inner precedure inference 2015-12-24 19:05:27 +03:00
Dmitry Stogov b4def0ee88 Added call-graph analyses 2015-12-24 14:30:41 +03:00
Dmitry Stogov 3d88a64e0c Add another DFA optimization pattern (ASSIGN -> QM_ASSING) 2015-12-24 11:06:02 +03:00