Commit Graph

178 Commits

Author SHA1 Message Date
Aaron Piotrowski
3f108f50f9 Merge branch 'pull-request/1929' 2016-07-05 02:29:53 -05:00
Dmitry Stogov
044e2718fe Fixed executor without global register variales (gcc warnings or clang errors) 2016-06-27 10:36:41 +03:00
Dmitry Stogov
d0460d8f6b Turn safe timeout handling into general interrupt handling ability. 2016-06-23 15:01:23 +03:00
Dmitry Stogov
a9512af810 Implemented RFC: Fix inconsistent behavior of $this variable
Squashed commit of the following:

commit bdd3b6895c
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Jun 16 00:19:42 2016 +0300

    Fixed GOTO VM

commit 2f1d7c8b89
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jun 15 21:01:57 2016 +0300

    Removed unused variable

commit cf749c42b0
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jun 15 19:06:16 2016 +0300

    Protection from $this reassign through mb_parse_str()

commit 59a9a6c83c
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jun 15 18:14:50 2016 +0300

    Added type inference rule for FETCH_THIS opcode

commit 73f8d14a85
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jun 15 18:11:18 2016 +0300

    Restored PHP-7 behavior of isset($this->foo).
    It throws exception if not in object context.
    Removed useless opcode handlers.

commit fa0881381e
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue May 31 12:25:47 2016 +0300

    Changed "Notice: Undefined variable: this" into "Exception: Using $this when not in object context".

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

    Throw exception on attempt to re-assign $this through extract() and parse_str().

commit 41f1531b52
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Mon May 23 22:18:36 2016 +0300

    Fixed inconsistent $this behavior
2016-06-16 02:30:23 +03:00
Sammy Kaye Powers
6f10874bca Remove a few references to $GLOBALS and clean up a bit 2016-06-01 01:57:33 -05: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
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
Dmitry Stogov
34a6c93b25 Specialize ZEND_ASSIGN_ADD and family according to value of opline->extended_value 2016-05-17 11:46:25 +03:00
Dmitry Stogov
c19cb70dac Revert "Refactor zval cleanup into single function"
This reverts commit bac6fdb0c5.
2016-05-06 10:47:58 +03:00
Bob Weinand
bac6fdb0c5 Refactor zval cleanup into single function
Also use zval_ptr_dtor_nogc() everywhere in Zend in favor of zval_dtor()
2016-05-05 23:31:57 +02:00
Dmitry Stogov
f484801483 Reduced amount of code generated for interrupt handling.
Improved ZEND_VM_INTERRUPT_CHECK() placement (always perform checks after opcode handler completion, when instruction pointer value is alredy changed to the next opcode).
2016-04-20 11:06:52 +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
Dmitry Stogov
7f80514aa1 Added ability to avoid code generation for useless opcode handlers.
- SPEC(NO_CONST_CONST) may prevent codegeneration for handlers like ADD_SPEC_CONST_CONST. Compiler and optimizaer should care about constants folding.
- SPEC(COMMUTATIVE) generate only single handler instead of two eqivalents like ADD_SPEC_CONST_CV and ADD_SPEC_CV_CONST. Compiler and optimizer should care avout operands swapping.
2016-03-11 16:51:06 +03:00
Dmitry Stogov
afb80df631 Allow usage of "TMPVARCV" pattern for cases when there is no difference in handling for TMP, VAR and CV operands. 2016-03-11 13:38:53 +03:00
Dmitry Stogov
827a7a180b Added possibility for extra specialization for SMART_BRANCH (e.g. IS_EQUAL+JMPZ superinstruction). 2016-03-11 12:17:03 +03:00
Xinchen Hui
c4ff3e7990 It's better to support 5.3 as well 2016-02-15 11:05:01 +08: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
Dmitry Stogov
2f5a119281 Use extra specialization to eliminate run-time checks for conditions known at compile time in SEND_VAL_EX and SEND_VAR_EX. 2016-02-05 15:07:58 +03:00
Bob Weinand
00a2c30c59 Add extra VM operand specialization
For now RETVAL and OP_DATA= are supported
2016-02-04 16:49:50 +01:00
Nikita Popov
9b57e07298 Consolidate op1/op2 vm flags 2016-01-21 21:15:05 +01:00
Xinchen Hui
563659822d Merge branch 'PHP-7.0' 2016-01-02 17:56:54 +08:00
Xinchen Hui
97a9470d97 bump year which is missed in rev 49493a2 2016-01-02 17:56:11 +08: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
061a90f8d1 Describe special meaning of IS_UNUSED oprerand 2015-12-11 02:31:28 +03:00
Dmitry Stogov
dc36810993 Use more compact description encoding schema to free some bits 2015-12-11 01:45:26 +03:00
Dmitry Stogov
cba1a8498c Improve Optimizer debugging facility (print the meaning of extended_value) 2015-12-11 00:47:02 +03:00
Bob Weinand
7ea1cf2e57 Improved specializer:
- Allow dispatching from specialized handler to unspecialized one
2015-12-10 20:46:14 +03:00
Dmitry Stogov
6f966fad0d Improved specializer (Bob)
- All helpers now may be declatred and called without ZEND_VM_HELPER_EX() and ZEND_VM_DISPATCH_TO_HELPER_EX() macros
- ZEND_VM_HELPER() may declare few arguments
- ZEND_VM_DISPATCH_TO_HELPER() may pass few parameters
- ZEND_VM_INLINE_HELPER() may be used to declare inline helpers (it won't be inlined in SWITH/GOTO executors)
2015-12-10 17:17:59 +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
86a96f2cf1 Changed meaning of "op2" for ZEND_FREE, ZEND_FE_FREE, ZEND_FAST_CALL, ZEND_FAST_RET.
Previously it was an instruction number.
Now it's an index in op_array->try_cacth_array[].
2015-11-10 19:13:54 +03:00
Dmitry Stogov
3e89c883bb Changed ZEND_CLONE->extended_value meaning to relative offset (previously it was absolute opline number) 2015-10-30 14:53:53 +03:00
Dmitry Stogov
9ccb432cab Argument type renaming (ADDR->JMP_ADDR, OPLINE->JMP_ABS, REL_OPLINE->JMP_REL) 2015-10-30 07:18:44 +03:00
Dmitry Stogov
5c65fc29ad Fixed few issues:
- Added ZEND_VM_LAST_OPCODE macro
- Use better names LINE->OPLINE, REL_LINE->REL_OPLINE, FCALL->FAST_CALL, FRET->FAST_RET
- Added ISSET flag to extended value of ZEND_ISSET_ISEMPTY_VAR opcode
2015-10-30 07:18:44 +03:00
Dmitry Stogov
d83600a2d5 Added zend_get_opcode_flags() function to get information about opcode operands and extended_value meaning 2015-10-30 07:18:44 +03:00
Dmitry Stogov
7e797f1302 Allow an experimental VM with tail call dispatch technique (disabled by default).
This VM may work only if all tail calls are optimized, otherwaise it will crach because of stack overflow.
Unfortunately, we can't guarantee tail call optimization in C.
2015-09-25 12:54:51 +03:00
Xinchen Hui
517c59bfcb Suppressed warning -Wvolatile-register-var 2015-09-15 08:23:21 -07:00
Bob Weinand
c1e9bd27fe Fix zend_vm_call_opcode_handler (e.g. Generators throwing exceptions) with IP/FP registers 2015-08-26 00:25:25 +01:00
Dmitry Stogov
2482325b3d Assign CPU registers for GOTO and SWITCH executor as well 2015-08-25 02:38:06 +03:00
Dmitry Stogov
9b1570a378 Removed deprecated comments and added expectations (overloaded properties and array elements are less frequently used than regular ones) 2015-08-19 12:21:14 +03:00
Dmitry Stogov
fef086d113 Revert "Simplify ZEND_EXIT and count boolean values to it as exit status"
This reverts commit 7c003948c6.
2015-08-12 02:58:21 +03:00
Bob Weinand
7c003948c6 Simplify ZEND_EXIT and count boolean values to it as exit status 2015-08-11 22:36:47 +02:00
Dmitry Stogov
adcb1102e7 Fixed typo 2015-08-10 17:57:49 +03:00
Xinchen Hui
d0bea17d2e Improve the conditions(save one comparison) 2015-07-15 10:55:41 +08:00
Bob Weinand
82b1e22b57 Preserve return value in zend_vm_call_opcode_handler with global opline/ex registers enabled 2015-07-13 14:12:45 +02:00
Bogdan Andone
e27cbe6542 Hint label lookup table initialization branch on GOTO VM kind.
This initialization is performed only once so it shall be marked as unexpected.
2015-07-10 11:18:40 +03:00
Dmitry Stogov
301ee26568 Fixed situation, when CHECH_EXCEPTION() might change value of "opline" variable and the following "opline" useages would access elements of different opcode. That might lead to unpredictable behavior. (Only PHP-7 with GCC global register variables was affected).
CHECK_EXCEPTION() macro is removed. ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTIO() should be used instead. It's equivalent to old CHECK_EXCEPTION() + ZEND_VM_NEXT_OPCODE().
As a side effect, this also slightly improved performnce of builds with GCC >= 4.8.
2015-07-08 18:33:58 +03:00
Xinchen Hui
f70950d004 Fixed ZEND_VM_DEFINE_OP build when --without-specializer 2015-06-28 21:16:08 +08:00
Xinchen Hui
a486294e7d Unused ret 2015-06-28 19:16:00 +08:00