Skip to content

Commit 9469ebe

Browse files
nielsdoscharmitro
authored andcommitted
Backport phpGH-17869 to PHP 8.3 JIT
Closes phpGH-17918.
1 parent 5844c6c commit 9469ebe

File tree

3 files changed

+24
-10
lines changed

3 files changed

+24
-10
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ PHP NEWS
4444
. Fixed bug GH-17577 (JIT packed type guard crash). (nielsdos, Dmitry)
4545
. Fixed bug GH-17899 (zend_test_compile_string with invalid path
4646
when opcache is enabled). (David Carlier)
47+
. Fixed bug GH-17868 (Cannot allocate memory with tracing JIT). (nielsdos)
4748

4849
- PDO_SQLite:
4950
. Fixed GH-17837 ()::getColumnMeta() on unexecuted statement segfaults).

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8629,11 +8629,18 @@ static int zend_jit_push_call_frame(dasm_State **Dst, const zend_op *opline, con
86298629
| str TMP1w, EX:RX->This.u1.type_info
86308630
| // Z_PTR(call->This) = object_or_called_scope;
86318631
| str REG1, EX:RX->This.value.ptr
8632-
| ldr TMP1, [REG0, #offsetof(zend_closure, func.op_array.run_time_cache__ptr)]
8633-
| cbnz TMP1, >1
8634-
| add FCARG1x, REG0, #offsetof(zend_closure, func)
8635-
| EXT_CALL zend_jit_init_func_run_time_cache_helper, REG0
8636-
|1:
8632+
if (!func) {
8633+
| ldrb TMP1w, [REG0, #offsetof(zend_closure, func.type)]
8634+
| cmp TMP1w, #ZEND_USER_FUNCTION
8635+
| beq >1
8636+
}
8637+
if (!func || func->common.type == ZEND_USER_FUNCTION) {
8638+
| add FCARG1x, REG0, #offsetof(zend_closure, func)
8639+
| EXT_CALL zend_jit_init_func_run_time_cache_helper, REG0
8640+
}
8641+
if (!func) {
8642+
|1:
8643+
}
86378644
}
86388645
| // ZEND_CALL_NUM_ARGS(call) = num_args;
86398646
| LOAD_32BIT_VAL TMP1w, opline->extended_value

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9221,11 +9221,17 @@ static int zend_jit_push_call_frame(dasm_State **Dst, const zend_op *opline, con
92219221
| or dword EX:RX->This.u1.type_info, edx
92229222
| // Z_PTR(call->This) = object_or_called_scope;
92239223
| mov aword EX:RX->This.value.ptr, r1
9224-
| cmp aword [r0 + offsetof(zend_closure, func.op_array.run_time_cache__ptr)], 0
9225-
| jnz >1
9226-
| lea FCARG1a, aword [r0 + offsetof(zend_closure, func)]
9227-
| EXT_CALL zend_jit_init_func_run_time_cache_helper, r0
9228-
|1:
9224+
if (!func) {
9225+
| cmp byte [r0 + offsetof(zend_closure, func.type)], ZEND_USER_FUNCTION
9226+
| jnz >1
9227+
}
9228+
if (!func || func->common.type == ZEND_USER_FUNCTION) {
9229+
| lea FCARG1a, aword [r0 + offsetof(zend_closure, func)]
9230+
| EXT_CALL zend_jit_init_func_run_time_cache_helper, r0
9231+
}
9232+
if (!func) {
9233+
|1:
9234+
}
92299235
}
92309236
| // ZEND_CALL_NUM_ARGS(call) = num_args;
92319237
| mov dword EX:RX->This.u2.num_args, opline->extended_value

0 commit comments

Comments
 (0)