Skip to content

Commit bc4201f

Browse files
committed
Cleanup abstract test usage
1 parent 8688206 commit bc4201f

File tree

1 file changed

+31
-39
lines changed

1 file changed

+31
-39
lines changed

ext/opcache/jit/zend_jit_trace.c

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -389,32 +389,20 @@ static zend_always_inline int zend_jit_var_may_be_modified_indirectly(const zend
389389
} \
390390
} while (0)
391391

392-
#define USE_OP_TRACE_TYPE(_type, _var, op_info) do { \
393-
if (_type & (IS_TMP_VAR|IS_VAR|IS_CV)) { \
394-
op_info = zend_jit_trace_type_to_info_ex(STACK_VAR_TYPE(_var), op_info); \
395-
} \
396-
} while (0)
397-
398392
#define ADD_OP1_TRACE_GUARD() \
399393
ADD_OP_GUARD(tssa->ops[idx].op1_use, op1_type)
400394
#define ADD_OP2_TRACE_GUARD() \
401395
ADD_OP_GUARD(tssa->ops[idx].op2_use, op2_type)
402396
#define ADD_OP1_DATA_TRACE_GUARD() \
403397
ADD_OP_GUARD(tssa->ops[idx+1].op1_use, op3_type)
398+
404399
#define CHECK_OP1_TRACE_TYPE() \
405400
CHECK_OP_TRACE_TYPE(opline->op1.var, ssa_op->op1_use, op1_info, op1_type)
406401
#define CHECK_OP2_TRACE_TYPE() \
407402
CHECK_OP_TRACE_TYPE(opline->op2.var, ssa_op->op2_use, op2_info, op2_type)
408403
#define CHECK_OP1_DATA_TRACE_TYPE() \
409404
CHECK_OP_TRACE_TYPE((opline+1)->op1.var, (ssa_op+1)->op1_use, op1_data_info, op3_type)
410-
#define USE_OP1_TRACE_TYPE() \
411-
USE_OP_TRACE_TYPE(opline->op1_type, opline->op1.var, op1_info)
412-
#define USE_OP2_TRACE_TYPE() \
413-
USE_OP_TRACE_TYPE(opline->op2_type, opline->op2.var, op2_info)
414-
#define USE_OP1_DATA_TRACE_TYPE() \
415-
USE_OP_TRACE_TYPE((opline+1)->op1_type, (opline+1)->op1.var, op1_data_info)
416-
#define USE_RES_TRACE_TYPE() \
417-
USE_OP_TRACE_TYPE(opline->result_type, opline->result.var, res_use_info)
405+
418406
#define SET_OP1_STACK_VAR_TYPE(_type) \
419407
SET_STACK_VAR_TYPE(opline->op1.var, _type)
420408
#define SET_OP2_STACK_VAR_TYPE( _type) \
@@ -3091,8 +3079,11 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
30913079
break;
30923080
}
30933081
if (opline->result_type != IS_UNUSED) {
3094-
res_use_info = RES_USE_INFO();
3095-
USE_RES_TRACE_TYPE();
3082+
if (opline->result_type == IS_CV) {
3083+
res_use_info = RES_USE_INFO();
3084+
} else {
3085+
res_use_info = zend_jit_trace_type_to_info(STACK_VAR_TYPE(opline->result.var));
3086+
}
30963087
res_info = RES_INFO();
30973088
res_addr = RES_REG_ADDR();
30983089
} else {
@@ -3163,8 +3154,11 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
31633154
res_addr = 0; /* set inside backend */
31643155
} else {
31653156
send_result = 0;
3166-
res_use_info = RES_USE_INFO();
3167-
USE_RES_TRACE_TYPE();
3157+
if (opline->result_type == IS_CV) {
3158+
res_use_info = RES_USE_INFO();
3159+
} else {
3160+
res_use_info = zend_jit_trace_type_to_info(STACK_VAR_TYPE(opline->result.var));
3161+
}
31683162
res_addr = RES_REG_ADDR();
31693163
}
31703164
res_info = RES_INFO();
@@ -3227,8 +3221,11 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
32273221
res_addr = 0; /* set inside backend */
32283222
} else {
32293223
send_result = 0;
3230-
res_use_info = RES_USE_INFO();
3231-
USE_RES_TRACE_TYPE();
3224+
if (opline->result_type == IS_CV) {
3225+
res_use_info = RES_USE_INFO();
3226+
} else {
3227+
res_use_info = zend_jit_trace_type_to_info(STACK_VAR_TYPE(opline->result.var));
3228+
}
32323229
res_addr = RES_REG_ADDR();
32333230
}
32343231
res_info = RES_INFO();
@@ -3426,19 +3423,17 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
34263423
op1_def_info = OP1_DEF_INFO();
34273424
op1_addr = OP1_REG_ADDR();
34283425
op1_def_addr = OP1_DEF_REG_ADDR();
3429-
if (orig_op1_type != IS_UNKNOWN
3430-
&& (orig_op1_type & IS_TRACE_REFERENCE)) {
3431-
if (!zend_jit_fetch_reference(&dasm_state, opline, orig_op1_type, &op1_info, &op1_addr, 0)) {
3432-
goto jit_failure;
3433-
}
3434-
if (!zend_jit_assign_to_typed_ref(&dasm_state, opline, op_array, opline->op2_type, op2_addr, 1)) {
3435-
goto jit_failure;
3436-
}
3437-
op1_def_addr = op1_addr;
3438-
} else {
3439-
USE_OP1_TRACE_TYPE();
3440-
if (orig_op1_type != IS_UNKNOWN
3441-
&& (op1_info & MAY_BE_REF)) {
3426+
if (orig_op1_type != IS_UNKNOWN) {
3427+
if (orig_op1_type & IS_TRACE_REFERENCE) {
3428+
if (!zend_jit_fetch_reference(&dasm_state, opline, orig_op1_type, &op1_info, &op1_addr, 0)) {
3429+
goto jit_failure;
3430+
}
3431+
if (!zend_jit_assign_to_typed_ref(&dasm_state, opline, op_array, opline->op2_type, op2_addr, 1)) {
3432+
goto jit_failure;
3433+
}
3434+
op1_def_addr = op1_addr;
3435+
op1_def_info &= ~MAY_BE_REF;
3436+
} else if (op1_info & MAY_BE_REF) {
34423437
if (!zend_jit_noref_guard(&dasm_state, opline, op1_addr)) {
34433438
goto jit_failure;
34443439
}
@@ -3470,7 +3465,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
34703465
op1_def_addr = op1_addr;
34713466
}
34723467
op1_info = OP1_INFO();
3473-
CHECK_OP1_TRACE_TYPE();//???USE_OP1_TRACE_TYPE();
3468+
CHECK_OP1_TRACE_TYPE();
34743469
res_info = RES_INFO();
34753470
if (!zend_jit_qm_assign(&dasm_state, opline, op_array,
34763471
op1_info, op1_addr, op1_def_addr,
@@ -3492,7 +3487,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
34923487
break;
34933488
}
34943489
op1_info = OP1_INFO();
3495-
CHECK_OP1_TRACE_TYPE(); //???USE_OP1_TRACE_TYPE();
3490+
CHECK_OP1_TRACE_TYPE();
34963491
if (!zend_jit_send_val(&dasm_state, opline, op_array,
34973492
op1_info, OP1_REG_ADDR())) {
34983493
goto jit_failure;
@@ -3512,7 +3507,6 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
35123507
goto done;
35133508
case ZEND_SEND_REF:
35143509
op1_info = OP1_INFO();
3515-
USE_OP1_TRACE_TYPE();
35163510
if (!zend_jit_send_ref(&dasm_state, opline, op_array,
35173511
op1_info, 0)) {
35183512
goto jit_failure;
@@ -3537,7 +3531,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
35373531
op1_def_addr = op1_addr;
35383532
}
35393533
op1_info = OP1_INFO();
3540-
CHECK_OP1_TRACE_TYPE(); //???USE_OP1_TRACE_TYPE();
3534+
CHECK_OP1_TRACE_TYPE();
35413535
if (!zend_jit_send_var(&dasm_state, opline, op_array,
35423536
op1_info, op1_addr, op1_def_addr)) {
35433537
goto jit_failure;
@@ -3674,7 +3668,6 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
36743668
break;
36753669
}
36763670
op1_info = OP1_INFO();
3677-
USE_OP1_TRACE_TYPE();
36783671
if ((opline->result_type & (IS_SMART_BRANCH_JMPZ|IS_SMART_BRANCH_JMPNZ)) != 0) {
36793672
zend_bool exit_if_true = 0;
36803673
const zend_op *exit_opline = zend_jit_trace_get_exit_opline(p + 1, opline + 1, &exit_if_true);
@@ -4038,7 +4031,6 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
40384031
case ZEND_FREE:
40394032
case ZEND_FE_FREE:
40404033
op1_info = OP1_INFO();
4041-
USE_OP1_TRACE_TYPE();
40424034
if (!zend_jit_free(&dasm_state, opline, op_array, op1_info,
40434035
zend_may_throw(opline, ssa_op, op_array, ssa))) {
40444036
goto jit_failure;

0 commit comments

Comments
 (0)