From: Dmitry Stogov Date: Wed, 11 Nov 2020 10:50:53 +0000 (+0300) Subject: [Observer+JIT] Save opline before calling begin/end handlers X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=11c4821ba968d2a39310851ab89d673c553b72f3;p=php [Observer+JIT] Save opline before calling begin/end handlers --- diff --git a/ext/opcache/jit/zend_jit_vm_helpers.c b/ext/opcache/jit/zend_jit_vm_helpers.c index 6296532fdb..898b7c1f42 100644 --- a/ext/opcache/jit/zend_jit_vm_helpers.c +++ b/ext/opcache/jit/zend_jit_vm_helpers.c @@ -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; diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index c90dd67457..7306ee2a3c 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -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;