]> granicus.if.org Git - php/commitdiff
Remove FAST_CALL_FROM_CATCH
authorNikita Popov <nikic@php.net>
Tue, 21 Jul 2015 16:06:19 +0000 (18:06 +0200)
committerNikita Popov <nikic@php.net>
Tue, 21 Jul 2015 19:13:34 +0000 (21:13 +0200)
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.

Zend/zend_compile.h
Zend/zend_opcode.c
Zend/zend_vm_def.h
Zend/zend_vm_execute.h
sapi/phpdbg/phpdbg_opcode.c

index 59ae7c92c1e933c8ed57561e3989da65206dcafe..06796aab831fc6d1362594041d649d44e1c440c7 100644 (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)
index 62b58b4e57b0bd4baa0c944bbd06f7c95aa36b89..62869373dd22539026d800be2a223bf38f1f1a65 100644 (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 */
index 8a6cd782feb1b18343e2f70ad7833c27bf1c1eb3..ac592197ee9cad7bcd2d16048feb81168e34ee35 100644 (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 {
index 2be1016018d751ffdb39240ae1375944f0e75801..9b4d2107fa5b1c22b2081dead3ab3bf68ed805d5 100644 (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 {
index 75c91e0cf555f72f025b1b39640b9b11f4e5d56d..b8a0dfebba1f679adf8dab35fae77a5a7baa471d 100644 (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: