diff --git a/ext/opcache/jit/zend_jit_arm64.dasc b/ext/opcache/jit/zend_jit_arm64.dasc index 0adc88ebd03..3b9fb72970b 100644 --- a/ext/opcache/jit/zend_jit_arm64.dasc +++ b/ext/opcache/jit/zend_jit_arm64.dasc @@ -99,6 +99,9 @@ const char* zend_reg_name[] = { #define ZREG_FCARG1x ZREG_X0 #define ZREG_FCARG2x ZREG_X1 +#define ZREG_FCARG1 ZREG_FCARG1x +#define ZREG_FCARG2 ZREG_FCARG2x + |.type EX, zend_execute_data, FP |.type OP, zend_op |.type ZVAL, zval diff --git a/ext/opcache/jit/zend_jit_trace.c b/ext/opcache/jit/zend_jit_trace.c index 609a11db699..3726b8f2bc4 100644 --- a/ext/opcache/jit/zend_jit_trace.c +++ b/ext/opcache/jit/zend_jit_trace.c @@ -4209,9 +4209,12 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par // case ZEND_DIV: // TODO: check for division by zero ??? op1_info = OP1_INFO(); op1_addr = OP1_REG_ADDR(); - if (opline->op1_type != IS_CONST - && orig_op1_type != IS_UNKNOWN - && (orig_op1_type & IS_TRACE_REFERENCE)) { + op2_info = OP2_INFO(); + op2_addr = OP2_REG_ADDR(); + if (orig_op1_type != IS_UNKNOWN + && (orig_op1_type & IS_TRACE_REFERENCE) + && (Z_MODE(op2_addr) != IS_REG || Z_REG(op2_addr) != ZREG_FCARG1) + && (orig_op2_type == IS_UNKNOWN || !(orig_op2_type & IS_TRACE_REFERENCE))) { if (!zend_jit_fetch_reference(&dasm_state, opline, orig_op1_type, &op1_info, &op1_addr, !ssa->var_info[ssa_op->op1_use].guarded_reference, 1)) { goto jit_failure; @@ -4223,11 +4226,10 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par } else { CHECK_OP1_TRACE_TYPE(); } - op2_info = OP2_INFO(); - op2_addr = OP2_REG_ADDR(); - if (opline->op2_type != IS_CONST - && orig_op2_type != IS_UNKNOWN - && (orig_op2_type & IS_TRACE_REFERENCE)) { + if (orig_op2_type != IS_UNKNOWN + && (orig_op2_type & IS_TRACE_REFERENCE) + && (Z_MODE(op1_addr) != IS_REG || Z_REG(op1_addr) != ZREG_FCARG1) + && (orig_op1_type == IS_UNKNOWN || !(orig_op1_type & IS_TRACE_REFERENCE))) { if (!zend_jit_fetch_reference(&dasm_state, opline, orig_op2_type, &op2_info, &op2_addr, !ssa->var_info[ssa_op->op2_use].guarded_reference, 1)) { goto jit_failure; diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index 8122e8796b1..547b72cde96 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -133,6 +133,9 @@ const char* zend_reg_name[] = { # define ZREG_FCARG2a ZREG_RDX #endif +#define ZREG_FCARG1 ZREG_FCARG1a +#define ZREG_FCARG2 ZREG_FCARG2a + |.type EX, zend_execute_data, FP |.type OP, zend_op |.type ZVAL, zval