From fbd8e20ed5c6014b96c6f533e7f94b35789ac2f0 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 19 Jan 2021 10:07:32 +0100 Subject: [PATCH] Observe unused return values in JIT Even if the return value is not used, it should still be available to the observer. --- ext/opcache/jit/zend_jit_x86.dasc | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index 79519d47e8..5ff3c05034 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -11431,6 +11431,13 @@ static int zend_jit_return(dasm_State **Dst, const zend_op *opline, const zend_o return_value_used = -1; } + if (ZEND_OBSERVER_ENABLED) { + | LOAD_ZVAL_ADDR FCARG2a, op1_addr + | mov FCARG1a, FP + | SET_EX_OPLINE opline, r0 + | EXT_CALL zend_observer_fcall_end, r0 + } + // if (!EX(return_value)) if (Z_MODE(op1_addr) == IS_REG && Z_REG(op1_addr) == ZREG_R1) { if (return_value_used != 0) { @@ -11497,12 +11504,6 @@ static int zend_jit_return(dasm_State **Dst, const zend_op *opline, const zend_o if (return_value_used == 0) { |9: - if (ZEND_OBSERVER_ENABLED) { - | xor FCARG2a, FCARG2a - | mov FCARG1a, FP - | SET_EX_OPLINE opline, r0 - | EXT_CALL zend_observer_fcall_end, r0 - } return 1; } @@ -11571,12 +11572,6 @@ static int zend_jit_return(dasm_State **Dst, const zend_op *opline, const zend_o } |9: - 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; } -- 2.50.1