Skip to content

Commit 817ae41

Browse files
committed
JIT for ASSIGN_DIM[_OP] with first IS_VAR + IS_INDIRECT operand
1 parent 68b2193 commit 817ae41

File tree

2 files changed

+255
-26
lines changed

2 files changed

+255
-26
lines changed

ext/opcache/jit/zend_jit_trace.c

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,11 +1415,17 @@ static zend_ssa *zend_jit_trace_build_tssa(zend_jit_trace_rec *trace_buffer, uin
14151415
}
14161416
/* break missing intentionally */
14171417
case ZEND_ASSIGN_DIM:
1418-
if (opline->op1_type != IS_CV) {
1419-
break;
1418+
if (opline->op1_type == IS_CV) {
1419+
ADD_OP1_DATA_TRACE_GUARD();
1420+
ADD_OP2_TRACE_GUARD();
1421+
ADD_OP1_TRACE_GUARD();
1422+
} else if (orig_op1_type != IS_UNKNOWN
1423+
&& (orig_op1_type & IS_TRACE_INDIRECT)
1424+
&& opline->result_type == IS_UNUSED) {
1425+
// ADD_OP1_DATA_TRACE_GUARD();
1426+
ADD_OP2_TRACE_GUARD();
14201427
}
1421-
ADD_OP1_DATA_TRACE_GUARD();
1422-
/* break missing intentionally */
1428+
break;
14231429
case ZEND_IS_EQUAL:
14241430
case ZEND_IS_NOT_EQUAL:
14251431
case ZEND_IS_SMALLER:
@@ -3661,11 +3667,21 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
36613667
// TODO: check for division by zero ???
36623668
break;
36633669
}
3664-
if (opline->op1_type != IS_CV || opline->result_type != IS_UNUSED) {
3670+
if (opline->result_type != IS_UNUSED) {
36653671
break;
36663672
}
36673673
op1_info = OP1_INFO();
36683674
op1_addr = OP1_REG_ADDR();
3675+
if (opline->op1_type == IS_VAR) {
3676+
if (orig_op1_type != IS_UNKNOWN
3677+
&& (orig_op1_type & IS_TRACE_INDIRECT)) {
3678+
if (!zend_jit_fetch_indirect_var(&dasm_state, opline, orig_op1_type, &op1_info, &op1_addr)) {
3679+
goto jit_failure;
3680+
}
3681+
} else {
3682+
break;
3683+
}
3684+
}
36693685
if (orig_op1_type != IS_UNKNOWN
36703686
&& (orig_op1_type & IS_TRACE_REFERENCE)) {
36713687
if (!zend_jit_fetch_reference(&dasm_state, opline, orig_op1_type, &op1_info, &op1_addr,
@@ -3692,11 +3708,19 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
36923708
}
36933709
goto done;
36943710
case ZEND_ASSIGN_DIM:
3695-
if (opline->op1_type != IS_CV) {
3696-
break;
3697-
}
36983711
op1_info = OP1_INFO();
36993712
op1_addr = OP1_REG_ADDR();
3713+
if (opline->op1_type == IS_VAR) {
3714+
if (orig_op1_type != IS_UNKNOWN
3715+
&& (orig_op1_type & IS_TRACE_INDIRECT)
3716+
&& opline->result_type == IS_UNUSED) {
3717+
if (!zend_jit_fetch_indirect_var(&dasm_state, opline, orig_op1_type, &op1_info, &op1_addr)) {
3718+
goto jit_failure;
3719+
}
3720+
} else {
3721+
break;
3722+
}
3723+
}
37003724
if (orig_op1_type != IS_UNKNOWN
37013725
&& (orig_op1_type & IS_TRACE_REFERENCE)) {
37023726
if (!zend_jit_fetch_reference(&dasm_state, opline, orig_op1_type, &op1_info, &op1_addr,

0 commit comments

Comments
 (0)