Commit Graph

146 Commits

Author SHA1 Message Date
Nikita Popov
3c8beb16c4 Allow early-binding of ZEND_NEW args 2016-11-10 22:52:15 +01:00
Dmitry Stogov
bdd3fec7f8 Fixed incorrec type usage 2016-10-25 22:12:34 +03:00
Dmitry Stogov
01bc515b4d Export zend_analyze_calls() to allow building call trees. 2016-10-25 17:20:27 +03:00
Dmitry Stogov
76707dc204 Don't keep dangling pointers. 2016-08-23 12:58:46 +03:00
Dmitry Stogov
f2e4fc307b Fixed ext/opcache/tests/bug70207.phpt 2016-06-30 21:50:57 +03:00
Dmitry Stogov
5ae07dc34a Fixed incorrect constant propagation 2016-06-30 20:48:16 +03:00
Dmitry Stogov
d898344663 Inline simple constant functions 2016-06-30 17:04:25 +03:00
Nikita Popov
3be92120ba Fix handling of parse_str() with unpack in optimizer 2016-06-05 22:16:15 +02:00
Nikita Popov
70f0546885 Don't optimize special dynamic calls to non-dynamic
As it drops the warning. This is more problematic with constant
propagation, as tests would fail.

Extract a zend_optimizer_classify_function() function, as its now
needed by zend_cfg and update_opN.
2016-06-05 22:04:36 +02:00
Sara Golemon
51b3be7e76 Correct inline comments regarding pass1/pass2 actions
BRK/CONT no longer reach the optimizing following 8542befa7b
Pre-evaluate constant function calls is in pass1, not pass2
2016-05-31 22:41:37 +00:00
Dmitry Stogov
b111da96d9 Split ZEND_SEND_VAR_NO_REF into ZEND_SEND_VAR_NO_REF and ZEND_SEND_VAR_NO_REF_EX (similar to ZEND_SEND_VAL) and remove ZEND_ARG_* flags. 2016-05-31 04:06:00 +03:00
Nikita Popov
d94b9545d6 Support known static/method calls in call graph
For this purpose extract the function lookup call into a helper
zend_optimizer_get_called_func().
2016-04-27 17:10:45 +02:00
Dmitry Stogov
3444c1ae24 Use return type hints for type inference and eliminate useless VERIFY_RETRUN_TYPE opcodes. 2016-04-07 17:34:53 +03:00
Dmitry Stogov
681de72554 Enable DFA pass by default 2016-03-17 22:37:20 +03:00
Dmitry Stogov
fc7cbdce61 Squashed commit of the following:
commit 98471821a8
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Mar 17 21:56:04 2016 +0300

    Fixed wrong constant usage

commit 8183b811e7
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Mar 17 21:10:23 2016 +0300

    Added ability to serialize and serialize opcode handlers for file-cache

commit 3516b261de
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Mar 17 10:11:59 2016 +0300

    Added missed file

commit f4475a2360
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Mar 17 10:00:45 2016 +0300

    Transparently introduce type-specialized opcode handlers.
    This affects only PHP VM, and doesn't change anything else.
2016-03-17 22:00:27 +03:00
Xinchen Hui
73e8c08788 Sorry for that... Merged by accident....
Revert "Transparently introduce type-specialized opcode handlers."

This reverts commit 59d00b8bcc.
2016-03-17 11:59:15 +08:00
Dmitry Stogov
59d00b8bcc Transparently introduce type-specialized opcode handlers.
This affects only PHP VM, and doesn't change anything else.
2016-03-16 03:36:58 +03:00
Xinchen Hui
14fec3adf9 Suppress warnings 2016-03-09 18:01:29 +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
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
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
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
d77b74a1f3 Use ZEND_HASH_FOREACH 2015-12-26 23:43:33 +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
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
Dmitry Stogov
f243aaf985 Added e-SSA based DFA optimisation framework (incomplete) 2015-12-11 17:24:55 +03:00
Nikita Popov
3d4a2d2002 Merge branch 'PHP-7.0'
Conflicts:
	Zend/zend_vm_def.h
	Zend/zend_vm_execute.h
2015-12-10 18:24:29 +01:00
Nikita Popov
798d168d73 Make update_opN_const implementation symmetric
So the main structure is the same...
2015-12-10 18:18:10 +01:00
Nikita Popov
37f3425263 Fix Foo::${42} and similar
Fixes segfault on direct use, segfault on opcache evaluated use,
leak on temporary use.

Fixes analogeous segfault for ${42} on opcache eval as well.
2015-12-10 18:14:40 +01:00
Dmitry Stogov
d2597ad20b Improved optimizer dubugging facility 2015-12-09 14:52:00 +03:00
Dmitry Stogov
3d8fdd5d6e Fixed potential memory leaks 2015-12-07 18:25:25 +03:00
Dmitry Stogov
104a597113 Eliminate unreachable live ranges 2015-11-18 18:04:02 +03:00
Dmitry Stogov
843c165735 Don't undo/redo "pass two" for jump targets in opcache optimizer. 2015-11-17 07:15:35 +03:00
Dmitry Stogov
3a5fa926bf Squashed commit of the following:
commit afe963e6cc289696e60c6c679796ba2197c52b3b
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Nov 13 15:32:29 2015 +0300

    Added news entry

commit a126b891c97848dd7ef8f1abf716328c46e0f19c
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Fri Nov 13 15:29:21 2015 +0300

    VERIFY_RETURN_TYPE doesn't have to cleanup operand on exception, bacause now, live temporary variables are released by exception unwinder.

commit 0db475e98786e6bcaa8401ee3e0b33743b9a2f2b
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Nov 12 22:55:39 2015 +0300

    Fixed copy/paste

commit 0ac73fe7174bec9de9a610319a98b259bea67f7f
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Nov 11 16:11:50 2015 +0300

    Fixed bug #62210 (Exceptions can leak temporary variables)
2015-11-13 15:35:07 +03:00
Dmitry Stogov
63c4414940 Initialize ctx->optimization_level 2015-11-12 02:46:41 +03:00
Dmitry Stogov
09aa68b294 Break dependency between opcache and optimizer. Remove copatibility macros. 2015-11-12 02:02:24 +03:00
Dmitry Stogov
948b7f5421 Changed ZEND_FREE.op2.num and ZEND_FE_FREE.op2.num back to use live_range_offset (try_catch_offset does't work) 2015-11-11 11:12:44 +03:00
Dmitry Stogov
baf97b1fcc We don't nees zend_op_array->brk_cont_array at run-time anymore.
Move zend_op_array->brk_cont_array into CG(context).brk_cont_array.
Use more compact zend_op_array->live_range instead of zend_op_array->brk_cont_array.
Semantic is kept unchanged.
2015-11-10 21:48:03 +03:00
Nikita Popov
83b1679b6f Merge branch 'PHP-7.0'
Conflicts:
	ext/opcache/Optimizer/zend_optimizer.c
2015-11-07 17:50:39 +01:00
Nikita Popov
bc3512c1d6 Fix various update_opN_const issues 2015-11-07 17:45:26 +01:00
Nikita Popov
9da456655c Refactor update_op2_const
Combines both switches into one, to avoid having to maintain the same
opcode list twice. This also makes most of the bugs fixed by the next
commit pretty obvious.

No functional change here.
2015-11-07 17:31:09 +01:00
Nikita Popov
603c172269 Merge branch 'PHP-7.0'
Conflicts:
	ext/opcache/Optimizer/zend_optimizer.c
2015-11-07 12:09:20 +01:00
Nikita Popov
99d818f1e9 Don't propagate into ops that error on non-string
To properly support this make update_opN_const fallible -- they
are not always called through replace_with_const.
2015-11-07 12:04:51 +01:00