Skip to content

Commit c6c3d9f

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Backport JIT fix: set valid EX(opline) before calling gc_possible_root() (#16858)
2 parents 6a632a2 + 6167c64 commit c6c3d9f

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) {
@@ -5970,6 +5973,9 @@ static int zend_jit_assign_to_variable(dasm_State **Dst,
59705973
if (RC_MAY_BE_N(var_info) && (var_info & (MAY_BE_ARRAY|MAY_BE_OBJECT)) != 0) {
59715974
|4:
59725975
| IF_GC_MAY_NOT_LEAK FCARG1x, >8, TMP1w, TMP2w
5976+
if (opline) {
5977+
| SET_EX_OPLINE opline, REG0
5978+
}
59735979
| EXT_CALL gc_possible_root, REG0
59745980
if (in_cold) {
59755981
| b >8
@@ -5997,6 +6003,9 @@ static int zend_jit_assign_to_variable(dasm_State **Dst,
59976003
| GET_ZVAL_PTR FCARG1x, var_use_addr, TMP1
59986004
| GC_DELREF FCARG1x, TMP1w
59996005
| IF_GC_MAY_NOT_LEAK FCARG1x, >5, TMP1w, TMP2w
6006+
if (opline) {
6007+
| SET_EX_OPLINE opline, TMP1
6008+
}
60006009
| EXT_CALL gc_possible_root, TMP1
60016010
if (Z_REG(var_use_addr) != ZREG_FP) {
60026011
| ldr Rx(Z_REG(var_use_addr)), T1 // restore
@@ -11857,6 +11866,9 @@ static int zend_jit_bind_global(dasm_State **Dst, const zend_op *opline, uint32_
1185711866
|3:
1185811867
| // GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr)
1185911868
| IF_GC_MAY_NOT_LEAK FCARG1x, >5, TMP1w, TMP2w
11869+
if (opline) {
11870+
| SET_EX_OPLINE opline, REG0
11871+
}
1186011872
| EXT_CALL gc_possible_root, REG0
1186111873
| b >5
1186211874
}

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
|| }
@@ -6522,6 +6525,9 @@ static int zend_jit_assign_to_variable(dasm_State **Dst,
65226525
if (RC_MAY_BE_N(var_info) && (var_info & (MAY_BE_ARRAY|MAY_BE_OBJECT)) != 0) {
65236526
|4:
65246527
| IF_GC_MAY_NOT_LEAK FCARG1a, >8
6528+
if (opline) {
6529+
| SET_EX_OPLINE opline, r0
6530+
}
65256531
| EXT_CALL gc_possible_root, r0
65266532
if (in_cold) {
65276533
| jmp >8
@@ -6549,6 +6555,9 @@ static int zend_jit_assign_to_variable(dasm_State **Dst,
65496555
| GET_ZVAL_PTR FCARG1a, var_use_addr
65506556
| GC_DELREF FCARG1a
65516557
| IF_GC_MAY_NOT_LEAK FCARG1a, >5
6558+
if (opline) {
6559+
| SET_EX_OPLINE opline, r0
6560+
}
65526561
| EXT_CALL gc_possible_root, r0
65536562
if (Z_REG(var_use_addr) != ZREG_FP) {
65546563
| mov Ra(Z_REG(var_use_addr)), T1 // restore
@@ -12617,6 +12626,9 @@ static int zend_jit_bind_global(dasm_State **Dst, const zend_op *opline, uint32_
1261712626
|3:
1261812627
| // GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr)
1261912628
| IF_GC_MAY_NOT_LEAK FCARG1a, >5
12629+
if (opline) {
12630+
| SET_EX_OPLINE opline, r0
12631+
}
1262012632
| EXT_CALL gc_possible_root, r1
1262112633
| jmp >5
1262212634
}

0 commit comments

Comments
 (0)