Commit Graph

161 Commits

Author SHA1 Message Date
Nikita Popov
60249f4390 Fix propagation of QM_ASSIGN into VERIFY_RETURN_TYPE
VERIFY_RETURN_TYPE uses different formats for the CONST/non-CONST
cases. If we progate a CONST operand into op1, op1 should be
moved to result.
2016-12-07 23:14:46 +01:00
Nikita Popov
8106c01afc Fix block pass leaks 2016-11-10 22:28:32 +01:00
Nikita Popov
3048428cf0 Don't elide undef var notice 2016-11-10 14:58:54 +01:00
Nikita Popov
4f76073b6d Set result of FREE to unused in block pass 2016-11-10 14:55:52 +01:00
Nikita Popov
766264f8d2 Merge branch 'PHP-7.0' into PHP-7.1 2016-09-09 16:02:59 +02:00
Nikita Popov
bbcf77c309 Fix some block_pass bugs 2016-09-09 15:58:36 +02:00
Dmitry Stogov
b5bab0fce8 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #72944 (Null pointer deref in zval_delref_p).
2016-08-29 12:07:54 +03:00
Dmitry Stogov
b66039db33 Fixed bug #72944 (Null pointer deref in zval_delref_p). 2016-08-29 12:02:50 +03:00
Dmitry Stogov
0da7c08e39 Prevent wrong optimization 2016-07-13 15:05:11 +03:00
Dmitry Stogov
2ae21abdf7 Fixed bug #72213 (Finally leaks on nested exceptions).
Squashed commit of the following:

commit 8461b0407f
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed May 25 00:34:42 2016 +0300

    Rmoved zend_try_catch_element.parent and walk through op_array.try_catch_array backward from the current try_cacth_offset.

commit 0c71e24964
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed May 25 00:04:53 2016 +0300

    Move SAVE_OPLINE() to its original place

commit 111432a4df
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed May 25 00:01:10 2016 +0300

    Separate the common part of ZEND_HANDLE_EXCEPTION and FAST_RET into zend_dispatch_try_catch_finally_helper.

commit 4f21c06c2e
Author: Nikita Popov <nikic@php.net>
Date:   Tue May 24 14:55:27 2016 +0200

    Improve finally fix

commit da5c727499
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue May 24 10:36:08 2016 +0300

    Fixed Zend/tests/try/bug70228_3.phpt and Zend/tests/try/bug70228_4.phpt

commit cfcedf2fb4
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue May 24 02:59:27 2016 +0300

    Added test

commit 4c6aa93d43
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue May 24 00:38:20 2016 +0300

    Added tests

commit 8a8f4704b0
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Mon May 23 23:27:34 2016 +0300

    Fixed bug #72213 (Finally leaks on nested exceptions)
2016-05-25 01:25:12 +03:00
Nikita Popov
e745b4cad8 Replace BB end with BB len
And support empty blocks everywhere.
2016-05-24 18:29:44 +02:00
Nikita Popov
35e7573a33 Merge branch 'PHP-7.0'
Conflicts:
	ext/opcache/Optimizer/block_pass.c
2016-05-05 00:01:56 +02:00
Nikita Popov
0691e7a8e1 Fix JMPZ, JMPZNZ_EX chain optimization
The result_type was not copied, resulting in a corrupted JMPZ_EX.
Fix can be verified by inspecting the opcodes of the following
function (it should not contain any _EX opcodes):

function test() {
    if ($a && $b) {
        echo "a";
    }

    if ($b || $c || $d) {
        echo "b";
    }
}

Conflicts:
	ext/opcache/Optimizer/block_pass.c
2016-05-05 00:00:56 +02:00
Nikita Popov
4a568dd7c9 Drop left-over debugging statement in block pass 2016-04-16 20:23:23 +02:00
Andrea Faulds
1e82ad8038 Warn about invalid strings in arithmetic
Squashed commit of the following:

commit e05d3b6732
Author: Andrea Faulds <ajf@ajf.me>
Date:   Wed Mar 30 01:43:35 2016 +0100

    UPGRADING and NEWS

commit 6caf1d4585
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sun Mar 20 21:18:33 2016 +0000

    Fixes

commit 6dadb1b0ef
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sun Feb 14 02:15:01 2016 +0000

    Add test for numeric string errors in assignment

commit bd5f04e8dd
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sat Feb 13 23:53:05 2016 +0000

    Add test for numeric string errors

commit c72e92f16d
Author: Andrea Faulds <ajf@ajf.me>
Date:   Tue Jan 26 23:28:33 2016 +0000

    Add test for scientific notation in integer operations

commit d94c08852d
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sun Feb 14 01:25:57 2016 +0000

    Disable optimiser evaluation for numeric string errors

commit 30ee954ed1
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sun Feb 14 01:46:25 2016 +0000

    fixup

commit a6403b79e0
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sat Feb 13 22:00:27 2016 +0000

    Do not convert error-causing numeric strings ahead-of-time

commit f9dc354014
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sat Feb 13 19:15:38 2016 +0000

    Disable compile-time evaluation for numeric string errors

commit e05b0cc849
Author: Andrea Faulds <ajf@ajf.me>
Date:   Fri Feb 5 11:42:26 2016 +0000

    Make _zval_get_long_func_noisy function for inlining

commit 84d66321a5
Author: Andrea Faulds <ajf@ajf.me>
Date:   Tue Jan 26 23:10:00 2016 +0000

    Update tests

commit 5ac4a0cc4b
Author: Andrea Faulds <ajf@ajf.me>
Date:   Tue Jan 26 22:08:19 2016 +0000

    Use is_numeric_string_ex for zval_get_long etc.

commit c21f088485
Author: Andrea Faulds <ajf@ajf.me>
Date:   Thu Jan 7 21:13:04 2016 +0000

    Update tests

commit 63e214cf81
Author: Andrea Faulds <ajf@ajf.me>
Date:   Wed Jan 6 00:28:01 2016 +0000

    Warn on non-/bad numeric strings in arithmetic
2016-03-30 01:44:27 +01:00
Nikita Popov
8e5b139732 Evaluate arguments of new for classes without ctor
ML: http://markmail.org/message/4b3mk7jid64zvz34
2016-03-25 19:11:37 +01:00
Xinchen Hui
adb82514eb Merge branch 'PHP-7.0'
* PHP-7.0:
  Remove unnecessary pattern
  Fixed for PHP7
  Fixed bug #71843 (null ptr deref ZEND_RETURN_SPEC_CONST_HANDLER)

Conflicts:
	ext/opcache/Optimizer/block_pass.c
2016-03-17 20:24:59 +08:00
Xinchen Hui
aef22ac1c1 Remove unnecessary pattern 2016-03-17 20:21:36 +08:00
Xinchen Hui
041a01fd6c Fixed for PHP7 2016-03-17 20:20:01 +08:00
Xinchen Hui
820b0aa2ab Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Fixed bug #71843 (null ptr deref ZEND_RETURN_SPEC_CONST_HANDLER)
2016-03-17 19:54:33 +08:00
Xinchen Hui
8e2f658f49 Fixed bug #71843 (null ptr deref ZEND_RETURN_SPEC_CONST_HANDLER) 2016-03-17 19:54:19 +08: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
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
Xinchen Hui
63fb2b7118 Improve the names 2016-01-25 16:00:10 +08: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
Dmitry Stogov
e82a73573b Remove live-range if the corresponding definition is deleted 2015-12-23 03:46:40 +03:00
Nikita Popov
88eae43ff9 Remove uses of VARs in extended_value
The DECLARE_(ANON_)INHERITED_CLASS(_DELAYED) opcodes were
referencing the parent ce VAR through extended_value. This is
hacky and we can't track the def-use chain in SSA.

To avoid this, the layout of declaration opcodes is changed
as follows: op1 points to the lcname and rtd_key literals, in
that order. (For anon/lambda declarations only one of lcname or
rtd_key is present.) This frees up op2, which is now used to
reference the parent ce VAR in inheriting declarations. The
jmp offset for anon class declarations is moved frop op2 to
extended_value.

The changes were applied both to class and function declarations
to keep everything symmetric.
2015-12-21 14:44:42 +01:00
Dmitry Stogov
c88ffa9a56 Added e-SSA based DFA optimisation framework (incomplete) 2015-12-16 00:49:44 +03:00
Sebastian Bergmann
29a2c64339 Fugbix typo 2015-12-15 09:16:46 +01:00
Bob Weinand
6694ecdb9d Fix live_range updates on ZEND(_FE)_FREE opcodes in block_pass 2015-12-14 23:40:28 +01:00
Dmitry Stogov
f243aaf985 Added e-SSA based DFA optimisation framework (incomplete) 2015-12-11 17:24:55 +03:00
Dmitry Stogov
3b5c844757 Initialize bitset before processing the seconf BB (we skip the first one) 2015-12-10 11:29:53 +03:00
Dmitry Stogov
fd20e6cee6 Apply local optimizatons to extended bacic block (this allows some optimizarions across few following BBs). 2015-12-10 01:17:35 +03:00
Dmitry Stogov
4fd30c9565 Improve debugging of non-local variables 2015-12-09 17:21:57 +03:00
Dmitry Stogov
d2597ad20b Improved optimizer dubugging facility 2015-12-09 14:52:00 +03:00
Dmitry Stogov
44c5fbbc07 Fixed other issues with empty block handling 2015-12-09 10:58:42 +03:00
Xinchen Hui
245a8c3cdf end is unsigned, this was broken if start == end == 0 2015-12-09 12:18:25 +08:00
Dmitry Stogov
404e003cf1 Delete empty live-ranges 2015-12-09 05:16:30 +03:00
Dmitry Stogov
2cc2396f84 Fixed compilation with enabled internal debuging 2015-12-08 18:12:02 +03:00
Dmitry Stogov
3d8fdd5d6e Fixed potential memory leaks 2015-12-07 18:25:25 +03:00
Xinchen Hui
1e9fcb49ac conflicts variable name 2015-11-20 19:03:18 -08:00
Dmitry Stogov
b3393baa5d Refactored CFG based optimization using new CFG representation.
Squashed commit of the following:

commit 907533390678f58eac738040ef62a40788048bef
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Nov 20 21:25:28 2015 +0300

    cleanup

commit 82f7e6f5bb434f12e9fdf45f597be351527f383c
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Nov 20 21:22:01 2015 +0300

    Update build system

commit 8fd83d843fde3f486692de4e2c6b7d64d4192704
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Nov 20 20:50:32 2015 +0300

    Reachable blocks can't be empty

commit 5822a36269833930a35cb3547222357118b11310
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Nov 20 19:11:02 2015 +0300

    added missing constraints

commit 2d0c00b243479924de0260ae8d80d624c36994a3
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Nov 20 19:03:12 2015 +0300

    optimization

commit 29d1e5eb210c51b052cac4d6c232aaa2c724dbbb
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Nov 20 18:34:11 2015 +0300

    Added missing optimization patterns

commit 38dd3b3f2459f5193c742633213f41d78326ea28
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Nov 20 17:47:06 2015 +0300

    zend_optimize_block() refactoring

commit 3dc97bd1f6d433dff0617338382347b6d0c08f84
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Nov 20 14:30:32 2015 +0300

    We don't use CFG back-references anymore

commit 2242c9e0aa741d287146ad43179650796f199f2d
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Nov 20 14:16:03 2015 +0300

    Consistent naming

commit 64f2856716069390ed7703ac88905cebf5e04023
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Nov 20 13:29:32 2015 +0300

    Optimization and separate building of direct CFG from predecessrs calculation

commit 9389be4869b13ec45df5dbd443015d2ac539a347
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Nov 20 10:44:19 2015 +0300

    Use CFG without back references (incomplete, but works)

commit 3d3ecd4b883959cf7b86c33622183295f913924e
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Nov 20 00:50:09 2015 +0300

    Fixed iteration in reverse order

commit 52f7fde0c3dfa4b4591519828ebdb238c2377936
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Nov 19 18:35:09 2015 +0300

    Separate debugging code into zend_dump.c

commit 4193a039ea96bae41baf97c6e458f419e8dbf9c5
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Nov 19 17:22:04 2015 +0300

    Remove unused code

commit 4228fdc57d8d120e1dad4e4d44045fa1a6f06fe0
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Nov 19 17:21:20 2015 +0300

    Remove dead live-ranges only on assembling basic blocks

commit 9a4a7966edf19b92678876f85565700694205598
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Nov 19 15:26:29 2015 +0300

    New CFG representation (incomplete)
2015-11-20 22:06:36 +03:00
Dmitry Stogov
d6308afce9 Proper optmisation of "goto" into the middle of "try" block. 2015-11-19 11:19:06 +03:00
Dmitry Stogov
df63ec564e minor fixes 2015-11-18 23:03:20 +03:00