Skip to content

Commit 90afef9

Browse files
dstogoviluuu1994
authored andcommitted
Backport JIT fix: set valid EX(opline) before calling gc_possible_root() (php#16858)
1 parent 2285d70 commit 90afef9

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,6 +1533,9 @@ static bool logical_immediate_p(uint64_t value, uint32_t reg_size)
15331533
|| }
15341534
| IF_GC_MAY_NOT_LEAK FCARG1x, >4, Rw(tmp_reg1), Rw(tmp_reg2)
15351535
| // gc_possible_root(Z_COUNTED_P(z))
1536+
|| if (opline) {
1537+
| SET_EX_OPLINE opline, TMP1
1538+
|| }
15361539
| EXT_CALL gc_possible_root, Rx(tmp_reg1)
15371540
|| }
15381541
|| if (cold && ((op_info) & ((MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_INDIRECT|MAY_BE_GUARD)-(MAY_BE_OBJECT|MAY_BE_RESOURCE))) != 0) {
@@ -5972,6 +5975,9 @@ static int zend_jit_assign_to_variable(dasm_State **Dst,
59725975
if (RC_MAY_BE_N(var_info) && (var_info & (MAY_BE_ARRAY|MAY_BE_OBJECT)) != 0) {
59735976
|4:
59745977
| IF_GC_MAY_NOT_LEAK FCARG1x, >8, TMP1w, TMP2w
5978+
if (opline) {
5979+
| SET_EX_OPLINE opline, REG0
5980+
}
59755981
| EXT_CALL gc_possible_root, REG0
59765982
if (in_cold) {
59775983
| b >8
@@ -5999,6 +6005,9 @@ static int zend_jit_assign_to_variable(dasm_State **Dst,
59996005
| GET_ZVAL_PTR FCARG1x, var_use_addr, TMP1
60006006
| GC_DELREF FCARG1x, TMP1w
60016007
| IF_GC_MAY_NOT_LEAK FCARG1x, >5, TMP1w, TMP2w
6008+
if (opline) {
6009+
| SET_EX_OPLINE opline, TMP1
6010+
}
60026011
| EXT_CALL gc_possible_root, TMP1
60036012
if (Z_REG(var_use_addr) != ZREG_FP) {
60046013
| ldr Rx(Z_REG(var_use_addr)), T1 // restore
@@ -11980,6 +11989,9 @@ static int zend_jit_bind_global(dasm_State **Dst, const zend_op *opline, uint32_
1198011989
|3:
1198111990
| // GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr)
1198211991
| IF_GC_MAY_NOT_LEAK FCARG1x, >5, TMP1w, TMP2w
11992+
if (opline) {
11993+
| SET_EX_OPLINE opline, REG0
11994+
}
1198311995
| EXT_CALL gc_possible_root, REG0
1198411996
| b >5
1198511997
}

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 12 additions & 0 deletions
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
|| }
@@ -6526,6 +6529,9 @@ static int zend_jit_assign_to_variable(dasm_State **Dst,
65266529
if (RC_MAY_BE_N(var_info) && (var_info & (MAY_BE_ARRAY|MAY_BE_OBJECT)) != 0) {
65276530
|4:
65286531
| IF_GC_MAY_NOT_LEAK FCARG1a, >8
6532+
if (opline) {
6533+
| SET_EX_OPLINE opline, r0
6534+
}
65296535
| EXT_CALL gc_possible_root, r0
65306536
if (in_cold) {
65316537
| jmp >8
@@ -6553,6 +6559,9 @@ static int zend_jit_assign_to_variable(dasm_State **Dst,
65536559
| GET_ZVAL_PTR FCARG1a, var_use_addr
65546560
| GC_DELREF FCARG1a
65556561
| IF_GC_MAY_NOT_LEAK FCARG1a, >5
6562+
if (opline) {
6563+
| SET_EX_OPLINE opline, r0
6564+
}
65566565
| EXT_CALL gc_possible_root, r0
65576566
if (Z_REG(var_use_addr) != ZREG_FP) {
65586567
| mov Ra(Z_REG(var_use_addr)), T1 // restore
@@ -12742,6 +12751,9 @@ static int zend_jit_bind_global(dasm_State **Dst, const zend_op *opline, uint32_
1274212751
|3:
1274312752
| // GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr)
1274412753
| IF_GC_MAY_NOT_LEAK FCARG1a, >5
12754+
if (opline) {
12755+
| SET_EX_OPLINE opline, r0
12756+
}
1274512757
| EXT_CALL gc_possible_root, r1
1274612758
| jmp >5
1274712759
}

0 commit comments

Comments
 (0)