From: Nikita Popov Date: Tue, 21 Jul 2015 16:06:19 +0000 (+0200) Subject: Remove FAST_CALL_FROM_CATCH X-Git-Tag: php-7.0.0beta3~5^2~114 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7c661bd30408c4acbd623ee310e468b4e2bb97bb;p=php Remove FAST_CALL_FROM_CATCH This was generated for a return from a try block with both a catch and a finally. However at this point no exception can be active, because it either didn't exist in the first place or was explicitly discarded using DISCARD_EXCEPTION. --- diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 59ae7c92c1..06796aab83 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -945,8 +945,7 @@ static zend_always_inline int zend_check_arg_send_type(const zend_function *zf, #define ZEND_FAST_RET_TO_CATCH 1 #define ZEND_FAST_RET_TO_FINALLY 2 -#define ZEND_FAST_CALL_FROM_CATCH 1 -#define ZEND_FAST_CALL_FROM_FINALLY 2 +#define ZEND_FAST_CALL_FROM_FINALLY 1 #define ZEND_ARRAY_ELEMENT_REF (1<<0) #define ZEND_ARRAY_NOT_PACKED (1<<1) diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 62b58b4e57..62869373dd 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -587,21 +587,7 @@ static void zend_resolve_finally_call(zend_op_array *op_array, uint32_t op_num, zend_adjust_fast_call(op_array, start_op, op_array->try_catch_array[i].finally_op, op_array->try_catch_array[i].finally_end); - if (op_array->try_catch_array[i].catch_op) { - opline->extended_value = ZEND_FAST_CALL_FROM_CATCH; - opline->op2.opline_num = op_array->try_catch_array[i].catch_op; - opline->op1.opline_num = get_next_op_number(op_array); - /* generate a FAST_CALL to hole CALL_FROM_FINALLY */ - opline = get_next_op(op_array); - opline->opcode = ZEND_FAST_CALL; - opline->result_type = IS_TMP_VAR; - opline->result.var = fast_call_var; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - zend_resolve_fast_call(op_array, start_op + 1, op_array->try_catch_array[i].finally_op - 2); - } else { - zend_resolve_fast_call(op_array, start_op, op_array->try_catch_array[i].finally_op - 2); - } + zend_resolve_fast_call(op_array, start_op, op_array->try_catch_array[i].finally_op - 2); opline->op1.opline_num = op_array->try_catch_array[i].finally_op; /* generate a sequence of FAST_CALL to upward finally block */ diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 8a6cd782fe..ac592197ee 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -7492,12 +7492,6 @@ ZEND_VM_HANDLER(162, ZEND_FAST_CALL, ANY, ANY) USE_OPLINE zval *fast_call = EX_VAR(opline->result.var); - if ((opline->extended_value & ZEND_FAST_CALL_FROM_CATCH) && - UNEXPECTED(EG(prev_exception) != NULL)) { - /* in case of unhandled exception jump to catch block instead of finally */ - ZEND_VM_SET_OPCODE(&EX(func)->op_array.opcodes[opline->op2.opline_num]); - ZEND_VM_CONTINUE(); - } if (opline->extended_value == ZEND_FAST_CALL_FROM_FINALLY && UNEXPECTED(Z_OBJ_P(fast_call) != NULL)) { fast_call->u2.lineno = (uint32_t)-1; } else { diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 2be1016018..9b4d2107fa 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1609,12 +1609,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CALL_SPEC_HANDLER(ZEND_OP USE_OPLINE zval *fast_call = EX_VAR(opline->result.var); - if ((opline->extended_value & ZEND_FAST_CALL_FROM_CATCH) && - UNEXPECTED(EG(prev_exception) != NULL)) { - /* in case of unhandled exception jump to catch block instead of finally */ - ZEND_VM_SET_OPCODE(&EX(func)->op_array.opcodes[opline->op2.opline_num]); - ZEND_VM_CONTINUE(); - } if (opline->extended_value == ZEND_FAST_CALL_FROM_FINALLY && UNEXPECTED(Z_OBJ_P(fast_call) != NULL)) { fast_call->u2.lineno = (uint32_t)-1; } else { diff --git a/sapi/phpdbg/phpdbg_opcode.c b/sapi/phpdbg/phpdbg_opcode.c index 75c91e0cf5..b8a0dfebba 100644 --- a/sapi/phpdbg/phpdbg_opcode.c +++ b/sapi/phpdbg/phpdbg_opcode.c @@ -68,9 +68,8 @@ char *phpdbg_decode_opline(zend_op_array *ops, zend_op *op) /*{{{ */ /* EX */ switch (op->opcode) { case ZEND_FAST_CALL: - if (op->extended_value != 0) { - spprintf(&decode[0], 0, "FAST_CALL<%s>", - op->extended_value == ZEND_FAST_CALL_FROM_CATCH ? "FROM_CATCH" : "FROM_FINALLY"); + if (op->extended_value == ZEND_FAST_CALL_FROM_FINALLY) { + decode[0] = estrdup("FAST_CALL"); } break; case ZEND_FAST_RET: