summaryrefslogtreecommitdiff
path: root/Zend/zend_opcode.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2015-07-27 11:17:23 +0800
committerXinchen Hui <laruence@php.net>2015-07-27 11:17:23 +0800
commit9f56cfa9a18c3684306af501436c1bbcd1621820 (patch)
tree58357417459e87208d04a3299ed94e0ba6c4a3ed /Zend/zend_opcode.c
parent6aeee47b2cd47915ccfa3b41433a3f57aea24dd5 (diff)
parent70c6a6f624ec07be37ce90424d0765e3c78d1bf5 (diff)
downloadphp-git-9f56cfa9a18c3684306af501436c1bbcd1621820.tar.gz
Merge branch 'master' of git.php.net:php-src
Diffstat (limited to 'Zend/zend_opcode.c')
-rw-r--r--Zend/zend_opcode.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index 90afc6a985..da401e17b9 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -343,13 +343,14 @@ ZEND_API zend_bool destroy_op_array(zend_op_array *op_array)
if (op_array->static_variables &&
!(GC_FLAGS(op_array->static_variables) & IS_ARRAY_IMMUTABLE)) {
- if (--GC_REFCOUNT(op_array->static_variables) == 0) {
+ if (--GC_REFCOUNT(op_array->static_variables) == 0) {
zend_array_destroy(op_array->static_variables);
}
}
if (op_array->run_time_cache && !op_array->function_name) {
efree(op_array->run_time_cache);
+ op_array->run_time_cache = NULL;
}
if (!op_array->refcount) {
@@ -582,7 +583,7 @@ static void zend_resolve_finally_call(zend_op_array *op_array, uint32_t op_num,
fast_call_var = op_array->opcodes[op_array->try_catch_array[i].finally_end].op1.var;
/* generate a FAST_CALL to finally block */
- start_op = get_next_op_number(op_array);
+ start_op = get_next_op_number(op_array);
opline = get_next_op(op_array);
opline->opcode = ZEND_FAST_CALL;
@@ -692,7 +693,6 @@ static void zend_resolve_finally_calls(zend_op_array *op_array)
break;
case ZEND_GOTO:
if (Z_TYPE_P(CT_CONSTANT_EX(op_array, opline->op2.constant)) != IS_LONG) {
- ZEND_PASS_TWO_UPDATE_CONSTANT(op_array, opline->op2);
zend_resolve_goto_label(op_array, NULL, opline);
}
/* break omitted intentionally */
@@ -743,19 +743,6 @@ ZEND_API int pass_two(zend_op_array *op_array)
opline = op_array->opcodes;
end = opline + op_array->last;
while (opline < end) {
- if (opline->op1_type == IS_CONST) {
- ZEND_PASS_TWO_UPDATE_CONSTANT(op_array, opline->op1);
- } else if (opline->op1_type & (IS_VAR|IS_TMP_VAR)) {
- opline->op1.var = (uint32_t)(zend_intptr_t)ZEND_CALL_VAR_NUM(NULL, op_array->last_var + opline->op1.var);
- }
- if (opline->op2_type == IS_CONST) {
- ZEND_PASS_TWO_UPDATE_CONSTANT(op_array, opline->op2);
- } else if (opline->op2_type & (IS_VAR|IS_TMP_VAR)) {
- opline->op2.var = (uint32_t)(zend_intptr_t)ZEND_CALL_VAR_NUM(NULL, op_array->last_var + opline->op2.var);
- }
- if (opline->result_type & (IS_VAR|IS_TMP_VAR)) {
- opline->result.var = (uint32_t)(zend_intptr_t)ZEND_CALL_VAR_NUM(NULL, op_array->last_var + opline->result.var);
- }
switch (opline->opcode) {
case ZEND_DECLARE_ANON_INHERITED_CLASS:
ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op1);
@@ -775,7 +762,7 @@ ZEND_API int pass_two(zend_op_array *op_array)
}
break;
case ZEND_GOTO:
- if (Z_TYPE_P(RT_CONSTANT(op_array, opline->op2)) != IS_LONG) {
+ if (Z_TYPE_P(CT_CONSTANT_EX(op_array, opline->op2.constant)) != IS_LONG) {
zend_resolve_goto_label(op_array, NULL, opline);
}
/* break omitted intentionally */
@@ -806,6 +793,10 @@ ZEND_API int pass_two(zend_op_array *op_array)
break;
case ZEND_VERIFY_RETURN_TYPE:
if (op_array->fn_flags & ZEND_ACC_GENERATOR) {
+ if (opline->op1_type != IS_UNUSED) {
+ (opline + 1)->op1 = opline->op1;
+ (opline + 1)->op1_type = opline->op1_type;
+ }
MAKE_NOP(opline);
}
break;
@@ -816,6 +807,19 @@ ZEND_API int pass_two(zend_op_array *op_array)
}
break;
}
+ if (opline->op1_type == IS_CONST) {
+ ZEND_PASS_TWO_UPDATE_CONSTANT(op_array, opline->op1);
+ } else if (opline->op1_type & (IS_VAR|IS_TMP_VAR)) {
+ opline->op1.var = (uint32_t)(zend_intptr_t)ZEND_CALL_VAR_NUM(NULL, op_array->last_var + opline->op1.var);
+ }
+ if (opline->op2_type == IS_CONST) {
+ ZEND_PASS_TWO_UPDATE_CONSTANT(op_array, opline->op2);
+ } else if (opline->op2_type & (IS_VAR|IS_TMP_VAR)) {
+ opline->op2.var = (uint32_t)(zend_intptr_t)ZEND_CALL_VAR_NUM(NULL, op_array->last_var + opline->op2.var);
+ }
+ if (opline->result_type & (IS_VAR|IS_TMP_VAR)) {
+ opline->result.var = (uint32_t)(zend_intptr_t)ZEND_CALL_VAR_NUM(NULL, op_array->last_var + opline->result.var);
+ }
ZEND_VM_SET_OPCODE_HANDLER(opline);
opline++;
}