]> granicus.if.org Git - php/commitdiff
[Observer+JIT] Save opline before calling begin/end handlers
authorDmitry Stogov <dmitry@zend.com>
Wed, 11 Nov 2020 10:50:53 +0000 (13:50 +0300)
committerDmitry Stogov <dmitry@zend.com>
Wed, 11 Nov 2020 10:50:53 +0000 (13:50 +0300)
ext/opcache/jit/zend_jit_vm_helpers.c
ext/opcache/jit/zend_jit_x86.dasc

index 6296532fdbfbaecacfb9f26f3c083bd901c9038b..898b7c1f42a3b3de2ba0740dcd1b708b9c445c92 100644 (file)
@@ -315,7 +315,7 @@ static zend_always_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_trace_c
                }
 #ifdef HAVE_GCC_GLOBAL_REGS
                execute_data = EG(current_execute_data);
-               opline = EX(opline);
+               opline = execute_data ? EX(opline) : NULL;
                return;
 #else
                return 1;
index c90dd6745738ff5725c122624ca0f9b2149cd0aa..7306ee2a3cb56cfcb78a8c3936d1c28d8882cb84 100644 (file)
@@ -9841,6 +9841,7 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
                                        if (!trace && op_array == &func->op_array) {
                                                /* recursive call */
                                                if (ZEND_OBSERVER_ENABLED) {
+                                                       |       SAVE_IP
                                                        |       mov FCARG1a, FP
                                                        |       EXT_CALL zend_observer_fcall_begin, r0
                                                }
@@ -9950,6 +9951,7 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
                }
 
                if (ZEND_OBSERVER_ENABLED) {
+                       |       SAVE_IP
                        |       mov FCARG1a, FP
                        |       EXT_CALL zend_observer_fcall_begin, r0
                }
@@ -11364,6 +11366,7 @@ static int zend_jit_return(dasm_State **Dst, const zend_op *opline, const zend_o
                if (ZEND_OBSERVER_ENABLED) {
                        |       xor FCARG2a, FCARG2a
                        |       mov FCARG1a, FP
+                       |       SET_EX_OPLINE opline, r0
                        |       EXT_CALL zend_observer_fcall_end, r0
                }
                return 1;
@@ -11437,6 +11440,7 @@ static int zend_jit_return(dasm_State **Dst, const zend_op *opline, const zend_o
        if (ZEND_OBSERVER_ENABLED) {
                |       LOAD_ZVAL_ADDR FCARG2a, ret_addr
                |       mov FCARG1a, FP
+               |       SET_EX_OPLINE opline, r0
                |       EXT_CALL zend_observer_fcall_end, r0
        }
        return 1;