Commit Graph

195 Commits

Author SHA1 Message Date
Dmitry Stogov
bfa154448d VM refactoring, to avoid passing "execute_data" into helper functions that can access it using global register variable. 2017-06-16 01:42:49 +03:00
Dmitry Stogov
fc927dc263 Switch to HYBRID VM 2017-05-17 15:07:33 +03:00
Dmitry Stogov
7640e0a5f9 HYBRID VM cleanup 2017-05-16 09:24:23 +03:00
Dmitry Stogov
69b4f8ed79 Fixed USER_OPCODE handling in HYBRID VM. 2017-05-15 21:17:58 +03:00
Xinchen Hui
e1c32646b4 typo 2017-05-09 17:15:42 +08:00
Dmitry Stogov
2f9d72b309 Cleanup 2017-05-09 09:37:46 +03:00
Dmitry Stogov
71bfb430af Fixed zend_vm_call_opcode_handler(). Make phpdbg work with HYBRID VM. 2017-05-04 18:56:28 +03:00
Dmitry Stogov
b5e857b905 Added missing ZEND_VM_HOT define 2017-05-04 17:57:49 +03:00
Dmitry Stogov
27e01cd918 Implemented HYBRID VM instruction dispatch method that takes advantages of both CALL and GOTO VMs. 2017-05-03 10:01:22 +03:00
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Sara Golemon
16758a3c66 Merge branch 'PHP-7.1'
* PHP-7.1:
  Remove extraneous parentheses in conditions
2016-12-25 22:18:27 -08:00
Sébastien Santoro
5d7c774bea Remove extraneous parentheses in conditions
The zend_vm_gen.php generator now checks if the condition is already
enclosed by parentheses, and them only if needed.

This fixes nine clang/llvm parentheses-equality warnings.
2016-12-25 22:17:46 -08:00
Kalle Sommer Nielsen
cf24a61735 Disable C4101 warnings entirely on Windows 2016-12-08 03:50:31 +01:00
Bob Weinand
444d612b62 Use an inline handler instead of repeating logic for calling assign op helpers each time 2016-12-05 10:55:11 +01:00
Dmitry Stogov
22cebaf89a Revert "Fix return value memory leaks upon exceptions in opcode operand freeing"
This reverts commit 9ad9d7ae37.
2016-12-02 11:58:41 +03:00
Bob Weinand
9ad9d7ae37 Fix return value memory leaks upon exceptions in opcode operand freeing 2016-11-30 17:44:34 +01:00
Xinchen Hui
38f7d595c0 Remove redundant \t 2016-08-25 13:29:22 +08:00
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