]> granicus.if.org Git - php/commitdiff
Remove OP_RANGE_EX distinction
authorNikita Popov <nikita.ppv@gmail.com>
Wed, 15 Apr 2020 10:58:50 +0000 (12:58 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 15 Apr 2020 11:00:36 +0000 (13:00 +0200)
Only leave OP_RANGE macros, which always have the "EX" behavior.

This was already done for most other macros before, but these
were missed. This helps avoid mistakes by using the wrong macro.

ext/opcache/jit/zend_jit.c
ext/opcache/jit/zend_jit_trace.c

index 27f889f031d2d59866021156b1d40ef538ed14a3..9f03a118265c5ceebadc800451fa687d46c17c0b 100644 (file)
@@ -161,22 +161,15 @@ static zend_bool zend_long_is_power_of_two(zend_long x)
        return (x > 0) && !(x & (x - 1));
 }
 
-#define OP_RANGE_EX(ssa_op, opN) \
+#define OP_RANGE(ssa_op, opN) \
        (((opline->opN##_type & (IS_TMP_VAR|IS_VAR|IS_CV)) && \
          (ssa_op)->opN##_use >= 0 && \
          ssa->var_info[(ssa_op)->opN##_use].has_range) ? \
         &ssa->var_info[(ssa_op)->opN##_use].range : NULL)
 
-#define OP_RANGE(line, opN) \
-       (ssa->var_info ? OP_RANGE_EX(ssa->ops + (line), opN) : NULL)
-
-#define OP1_RANGE()      OP_RANGE(opline - op_array->opcodes, op1)
-#define OP2_RANGE()      OP_RANGE(opline - op_array->opcodes, op2)
-#define OP1_DATA_RANGE() OP_RANGE(opline - op_array->opcodes + 1, op1)
-
-#define OP1_RANGE_EX()      OP_RANGE_EX(ssa_op, op1)
-#define OP2_RANGE_EX()      OP_RANGE_EX(ssa_op, op2)
-#define OP1_DATA_RANGE_EX() OP_RANGE_EX(ssa_op + 1, op1)
+#define OP1_RANGE()      OP_RANGE(ssa_op, op1)
+#define OP2_RANGE()      OP_RANGE(ssa_op, op2)
+#define OP1_DATA_RANGE() OP_RANGE(ssa_op + 1, op1)
 
 #include "dynasm/dasm_x86.h"
 #include "jit/zend_jit_helpers.c"
index a819b08cd6ab3663b6af755945dba319349b0013..8034e408c18d062958c93a7899aa5b8b4e30fccb 100644 (file)
@@ -1952,8 +1952,8 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
                                                }
                                                res_info = RES_INFO();
                                                if (!zend_jit_long_math(&dasm_state, opline, op_array,
-                                                               op1_info, OP1_RANGE_EX(), OP1_REG_ADDR(),
-                                                               op2_info, OP2_RANGE_EX(), OP2_REG_ADDR(),
+                                                               op1_info, OP1_RANGE(), OP1_REG_ADDR(),
+                                                               op2_info, OP2_RANGE(), OP2_REG_ADDR(),
                                                                res_use_info, res_info, res_addr,
                                                                send_result,
                                                                zend_may_throw(opline, ssa_op, op_array, ssa))) {
@@ -2106,8 +2106,8 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
                                                }
                                                op1_def_info = OP1_DEF_INFO();
                                                if (!zend_jit_assign_op(&dasm_state, opline, op_array,
-                                                               op1_info, op1_def_info, OP1_RANGE_EX(),
-                                                               op2_info, OP2_RANGE_EX(),
+                                                               op1_info, op1_def_info, OP1_RANGE(),
+                                                               op2_info, OP2_RANGE(),
                                                                (op1_def_info & MAY_BE_LONG) && (op1_def_info & (MAY_BE_DOUBLE|MAY_BE_GUARD)) && zend_may_overflow_ex(opline, ssa_op, op_array, ssa),
                                                                zend_may_throw(opline, ssa_op, op_array, ssa))) {
                                                        goto jit_failure;
@@ -2137,7 +2137,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
                                                op1_def_info = OP1_DEF_INFO();
                                                if (!zend_jit_assign_dim_op(&dasm_state, opline, op_array,
                                                                op1_info, op1_def_info, op2_info,
-                                                               op1_data_info, OP1_DATA_RANGE_EX(),
+                                                               op1_data_info, OP1_DATA_RANGE(),
                                                                zend_may_throw(opline, ssa_op, op_array, ssa))) {
                                                        goto jit_failure;
                                                }