From: Nikita Popov Date: Tue, 19 Jan 2021 09:07:32 +0000 (+0100) Subject: Observe unused return values in JIT X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fbd8e20ed5c6014b96c6f533e7f94b35789ac2f0;p=php Observe unused return values in JIT Even if the return value is not used, it should still be available to the observer. --- 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; }