1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 01:02:25 +01:00

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.
This commit is contained in:
Nikita Popov
2015-07-21 18:06:19 +02:00
parent 2141ab9be5
commit 7c661bd304
5 changed files with 4 additions and 32 deletions

View File

@@ -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)

View File

@@ -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 */

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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<FROM_FINALLY>");
}
break;
case ZEND_FAST_RET: