Skip to content

Commit 6167c64

Browse files
authored
Backport JIT fix: set valid EX(opline) before calling gc_possible_root() (#16858)
1 parent fc1db70 commit 6167c64

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

+12
Original file line numberDiff line numberDiff line change
@@ -1548,6 +1548,9 @@ static bool logical_immediate_p(uint64_t value, uint32_t reg_size)
15481548
|| }
15491549
| IF_GC_MAY_NOT_LEAK FCARG1x, >4, Rw(tmp_reg1), Rw(tmp_reg2)
15501550
| // gc_possible_root(Z_COUNTED_P(z))
1551+
|| if (opline) {
1552+
| SET_EX_OPLINE opline, TMP1
1553+
|| }
15511554
| EXT_CALL gc_possible_root, Rx(tmp_reg1)
15521555
|| }
15531556
|| if (cold && ((op_info) & ((MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_INDIRECT|MAY_BE_GUARD)-(MAY_BE_OBJECT|MAY_BE_RESOURCE))) != 0) {
@@ -5944,6 +5947,9 @@ static int zend_jit_assign_to_variable(dasm_State **Dst,
59445947
if (RC_MAY_BE_N(var_info) && (var_info & (MAY_BE_ARRAY|MAY_BE_OBJECT)) != 0) {
59455948
|4:
59465949
| IF_GC_MAY_NOT_LEAK FCARG1x, >8, TMP1w, TMP2w
5950+
if (opline) {
5951+
| SET_EX_OPLINE opline, REG0
5952+
}
59475953
| EXT_CALL gc_possible_root, REG0
59485954
if (in_cold) {
59495955
| b >8
@@ -5971,6 +5977,9 @@ static int zend_jit_assign_to_variable(dasm_State **Dst,
59715977
| GET_ZVAL_PTR FCARG1x, var_use_addr, TMP1
59725978
| GC_DELREF FCARG1x, TMP1w
59735979
| IF_GC_MAY_NOT_LEAK FCARG1x, >5, TMP1w, TMP2w
5980+
if (opline) {
5981+
| SET_EX_OPLINE opline, TMP1
5982+
}
59745983
| EXT_CALL gc_possible_root, TMP1
59755984
if (Z_REG(var_use_addr) != ZREG_FP) {
59765985
| ldr Rx(Z_REG(var_use_addr)), T1 // restore
@@ -11831,6 +11840,9 @@ static int zend_jit_bind_global(dasm_State **Dst, const zend_op *opline, uint32_
1183111840
|3:
1183211841
| // GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr)
1183311842
| IF_GC_MAY_NOT_LEAK FCARG1x, >5, TMP1w, TMP2w
11843+
if (opline) {
11844+
| SET_EX_OPLINE opline, REG0
11845+
}
1183411846
| EXT_CALL gc_possible_root, REG0
1183511847
| b >5
1183611848
}

ext/opcache/jit/zend_jit_x86.dasc

+12
Original file line numberDiff line numberDiff line change
@@ -1443,6 +1443,9 @@ static size_t tsrm_tls_offset;
14431443
|1:
14441444
|| }
14451445
| IF_GC_MAY_NOT_LEAK FCARG1a, >4
1446+
|| if (opline) {
1447+
| SET_EX_OPLINE opline, r0
1448+
|| }
14461449
| // gc_possible_root(Z_COUNTED_P(z))
14471450
| EXT_CALL gc_possible_root, r0
14481451
|| }
@@ -6488,6 +6491,9 @@ static int zend_jit_assign_to_variable(dasm_State **Dst,
64886491
if (RC_MAY_BE_N(var_info) && (var_info & (MAY_BE_ARRAY|MAY_BE_OBJECT)) != 0) {
64896492
|4:
64906493
| IF_GC_MAY_NOT_LEAK FCARG1a, >8
6494+
if (opline) {
6495+
| SET_EX_OPLINE opline, r0
6496+
}
64916497
| EXT_CALL gc_possible_root, r0
64926498
if (in_cold) {
64936499
| jmp >8
@@ -6515,6 +6521,9 @@ static int zend_jit_assign_to_variable(dasm_State **Dst,
65156521
| GET_ZVAL_PTR FCARG1a, var_use_addr
65166522
| GC_DELREF FCARG1a
65176523
| IF_GC_MAY_NOT_LEAK FCARG1a, >5
6524+
if (opline) {
6525+
| SET_EX_OPLINE opline, r0
6526+
}
65186527
| EXT_CALL gc_possible_root, r0
65196528
if (Z_REG(var_use_addr) != ZREG_FP) {
65206529
| mov Ra(Z_REG(var_use_addr)), T1 // restore
@@ -12583,6 +12592,9 @@ static int zend_jit_bind_global(dasm_State **Dst, const zend_op *opline, uint32_
1258312592
|3:
1258412593
| // GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr)
1258512594
| IF_GC_MAY_NOT_LEAK FCARG1a, >5
12595+
if (opline) {
12596+
| SET_EX_OPLINE opline, r0
12597+
}
1258612598
| EXT_CALL gc_possible_root, r1
1258712599
| jmp >5
1258812600
}

0 commit comments

Comments
 (0)