From f91283fcd42b21063f9bcceecb930f18dbd29a88 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Wed, 27 May 2020 10:57:33 +0300 Subject: [PATCH] Fixed JIT for ext/opcache/tests/bool_not_cv.phpt with opcache.jit=1202 --- ext/opcache/jit/zend_jit_x86.dasc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index e7b17b0b8e0..abee45b95ce 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -7224,6 +7224,7 @@ static int zend_jit_bool_jmpznz(dasm_State **Dst, const zend_op *opline, const z uint32_t false_label = -1; zend_bool set_bool = 0; zend_bool set_bool_not = 0; + zend_bool set_delayed = 0; zend_bool jmp_done = 0; if (branch_opcode == ZEND_BOOL) { @@ -7393,7 +7394,11 @@ static int zend_jit_bool_jmpznz(dasm_State **Dst, const zend_op *opline, const z } else { | add eax, 2 } - | SET_ZVAL_TYPE_INFO res_addr, eax + if ((op1_info & MAY_BE_UNDEF) && (op1_info & MAY_BE_ANY)) { + set_delayed = 1; + } else { + | SET_ZVAL_TYPE_INFO res_addr, eax + } } } } @@ -7401,7 +7406,13 @@ static int zend_jit_bool_jmpznz(dasm_State **Dst, const zend_op *opline, const z /* It's FALSE, but may be UNDEF */ if (op1_info & MAY_BE_UNDEF) { if (op1_info & MAY_BE_ANY) { - | IF_ZVAL_TYPE op1_addr, IS_UNDEF, >1 + if (set_delayed) { + | CMP_ZVAL_TYPE op1_addr, IS_UNDEF + | SET_ZVAL_TYPE_INFO res_addr, eax + | jz >1 + } else { + | IF_ZVAL_TYPE op1_addr, IS_UNDEF, >1 + } |.cold_code |1: }