Commit Graph

17 Commits

Author SHA1 Message Date
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
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
28a016a6dc Fixed SSA construction for CFG with unreachable BB 2015-12-23 03:52:38 +03:00
Nikita Popov
fdfbeeb296 Always create ARRAY_ELEM ssa var for ELEM_REF 2015-12-22 23:08:26 +01:00
Dmitry Stogov
a75c6d5fb2 Skip "useless" SSA variables for INIT_ARRAY, ADD_ARRAY_ELEMENT, FE_RESET_R 2015-12-22 17:35:08 +03:00
Dmitry Stogov
b4b6d58990 Add ability to prevent "useless" SSA variable creation for "refcounting inference". 2015-12-22 16:43:37 +03:00
Nikita Popov
420ff42bc0 Protect against overflows in pi constraints 2015-12-20 12:56:05 +01:00
Nikita Popov
0da1378a88 long -> zend_long in range inference 2015-12-20 00:06:12 +01:00
Nikita Popov
549d7d4876 Fix Pi constraint for -LONG_MIN adjustments
-LONG_MIN == LONG_MIN so bad things will happen.
Example of JIT miscompile:

    function test($n) {
	if ($n + PHP_INT_MIN == 0) {
	    $n2 = (int) ($n + PHP_INT_MAX);
	    var_dump($n2);
	}
    }
    test(PHP_INT_MAX + 1);
2015-12-20 00:06:12 +01:00
Nikita Popov
c9ea8fef96 Extrace find_adjusted_tmp_var() function
This code was duplicated for op1 and op2
2015-12-20 00:06:12 +01:00
Nikita Popov
fc68094497 Simplify bf/bt computation in pi placement
The meaning of the successors is well-defined, no need to check it.
2015-12-20 00:03:52 +01:00
Nikita Popov
d7424a5b04 Fix typo in pi placement 2015-12-20 00:03:52 +01:00
Dmitry Stogov
74daa98974 Added simple DFA optimisation pattern (just to prove the concept) 2015-12-16 13:14:31 +03:00
Dmitry Stogov
9044f491cc Use do_alloca() instead of alloca() 2015-12-16 04:59:05 +03:00
Dmitry Stogov
c88ffa9a56 Added e-SSA based DFA optimisation framework (incomplete) 2015-12-16 00:49:44 +03:00
Dmitry Stogov
1fdb63fbd9 ws fixes 2015-12-11 17:40:23 +03:00
Dmitry Stogov
f243aaf985 Added e-SSA based DFA optimisation framework (incomplete) 2015-12-11 17:24:55 +03:00