Skip to content

Commit 3b4a58d

Browse files
committed
Backport GH-17869 to PHP 8.3 JIT
Closes GH-17918.
1 parent a93ad36 commit 3b4a58d

File tree

3 files changed

+24
-10
lines changed

3 files changed

+24
-10
lines changed

Diff for: NEWS

+1
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).

Diff for: ext/opcache/jit/zend_jit_arm64.dasc

+12-5
Original file line numberDiff line numberDiff line change
@@ -8655,11 +8655,18 @@ static int zend_jit_push_call_frame(dasm_State **Dst, const zend_op *opline, con
86558655
| str TMP1w, EX:RX->This.u1.type_info
86568656
| // Z_PTR(call->This) = object_or_called_scope;
86578657
| str REG1, EX:RX->This.value.ptr
8658-
| ldr TMP1, [REG0, #offsetof(zend_closure, func.op_array.run_time_cache__ptr)]
8659-
| cbnz TMP1, >1
8660-
| add FCARG1x, REG0, #offsetof(zend_closure, func)
8661-
| EXT_CALL zend_jit_init_func_run_time_cache_helper, REG0
8662-
|1:
8658+
if (!func) {
8659+
| ldrb TMP1w, [REG0, #offsetof(zend_closure, func.type)]
8660+
| cmp TMP1w, #ZEND_USER_FUNCTION
8661+
| beq >1
8662+
}
8663+
if (!func || func->common.type == ZEND_USER_FUNCTION) {
8664+
| add FCARG1x, REG0, #offsetof(zend_closure, func)
8665+
| EXT_CALL zend_jit_init_func_run_time_cache_helper, REG0
8666+
}
8667+
if (!func) {
8668+
|1:
8669+
}
86638670
}
86648671
| // ZEND_CALL_NUM_ARGS(call) = num_args;
86658672
| LOAD_32BIT_VAL TMP1w, opline->extended_value

Diff for: ext/opcache/jit/zend_jit_x86.dasc

+11-5
Original file line numberDiff line numberDiff line change
@@ -9255,11 +9255,17 @@ static int zend_jit_push_call_frame(dasm_State **Dst, const zend_op *opline, con
92559255
| or dword EX:RX->This.u1.type_info, edx
92569256
| // Z_PTR(call->This) = object_or_called_scope;
92579257
| mov aword EX:RX->This.value.ptr, r1
9258-
| cmp aword [r0 + offsetof(zend_closure, func.op_array.run_time_cache__ptr)], 0
9259-
| jnz >1
9260-
| lea FCARG1a, aword [r0 + offsetof(zend_closure, func)]
9261-
| EXT_CALL zend_jit_init_func_run_time_cache_helper, r0
9262-
|1:
9258+
if (!func) {
9259+
| cmp byte [r0 + offsetof(zend_closure, func.type)], ZEND_USER_FUNCTION
9260+
| jnz >1
9261+
}
9262+
if (!func || func->common.type == ZEND_USER_FUNCTION) {
9263+
| lea FCARG1a, aword [r0 + offsetof(zend_closure, func)]
9264+
| EXT_CALL zend_jit_init_func_run_time_cache_helper, r0
9265+
}
9266+
if (!func) {
9267+
|1:
9268+
}
92639269
}
92649270
| // ZEND_CALL_NUM_ARGS(call) = num_args;
92659271
| mov dword EX:RX->This.u2.num_args, opline->extended_value

0 commit comments

Comments
 (0)