diff options
| author | Nikita Popov <nikic@php.net> | 2015-12-20 13:42:26 +0100 |
|---|---|---|
| committer | Nikita Popov <nikic@php.net> | 2015-12-21 14:44:42 +0100 |
| commit | 88eae43ff94ed3ba7eb663a896d65cece0113808 (patch) | |
| tree | 8fc5de5446f37c5d8c3fbb224e8649fb1c4f831d /Zend/zend_opcode.c | |
| parent | 1fe8a1dec9aae41ee2f8216179b33a59bccbd3eb (diff) | |
| download | php-git-88eae43ff94ed3ba7eb663a896d65cece0113808.tar.gz | |
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.
Diffstat (limited to 'Zend/zend_opcode.c')
| -rw-r--r-- | Zend/zend_opcode.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 0ce6b85938..a6dc49c10b 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -639,13 +639,6 @@ ZEND_API int pass_two(zend_op_array *op_array) case ZEND_FAST_RET: zend_resolve_finally_ret(op_array, opline - op_array->opcodes); break; - case ZEND_DECLARE_ANON_INHERITED_CLASS: - ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op1); - /* break omitted intentionally */ - case ZEND_DECLARE_INHERITED_CLASS: - case ZEND_DECLARE_INHERITED_CLASS_DELAYED: - opline->extended_value = (uint32_t)(zend_intptr_t)ZEND_CALL_VAR_NUM(NULL, op_array->last_var + opline->extended_value); - break; case ZEND_BRK: case ZEND_CONT: { @@ -667,13 +660,8 @@ ZEND_API int pass_two(zend_op_array *op_array) } /* break omitted intentionally */ case ZEND_JMP: - case ZEND_DECLARE_ANON_CLASS: ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op1); break; - case ZEND_CATCH: - /* absolute index to relative offset */ - opline->extended_value = ZEND_OPLINE_NUM_TO_OFFSET(op_array, opline, opline->extended_value); - break; case ZEND_JMPZNZ: /* absolute index to relative offset */ opline->extended_value = ZEND_OPLINE_NUM_TO_OFFSET(op_array, opline, opline->extended_value); @@ -696,8 +684,12 @@ ZEND_API int pass_two(zend_op_array *op_array) } ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op2); break; + case ZEND_DECLARE_ANON_CLASS: + case ZEND_DECLARE_ANON_INHERITED_CLASS: + case ZEND_CATCH: case ZEND_FE_FETCH_R: case ZEND_FE_FETCH_RW: + /* absolute index to relative offset */ opline->extended_value = ZEND_OPLINE_NUM_TO_OFFSET(op_array, opline, opline->extended_value); break; case ZEND_VERIFY_RETURN_TYPE: |
