@@ -8734,7 +8734,7 @@ static int zend_jit_stack_check(dasm_State **Dst, const zend_op *opline, uint32_
8734
8734
return 1;
8735
8735
}
8736
8736
8737
- static int zend_jit_push_call_frame(dasm_State **Dst, const zend_op *opline, zend_function *func, zend_bool is_closure, zend_bool use_this, zend_bool stack_check)
8737
+ static int zend_jit_push_call_frame(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, zend_function *func, zend_bool is_closure, zend_bool use_this, zend_bool stack_check)
8738
8738
{
8739
8739
uint32_t used_stack;
8740
8740
@@ -8847,7 +8847,14 @@ static int zend_jit_push_call_frame(dasm_State **Dst, const zend_op *opline, zen
8847
8847
} else {
8848
8848
if (!is_closure) {
8849
8849
| // call->func = func;
8850
- | mov aword EX:RX->func, r0
8850
+ if (func
8851
+ && op_array == &func->op_array
8852
+ && (func->op_array.fn_flags & ZEND_ACC_IMMUTABLE)
8853
+ && (sizeof(void*) != 8 || IS_SIGNED_32BIT(func))) {
8854
+ | ADDR_OP2_2 mov, aword EX:RX->func, func, r1
8855
+ } else {
8856
+ | mov aword EX:RX->func, r0
8857
+ }
8851
8858
} else {
8852
8859
| // call->func = &closure->func;
8853
8860
| lea r1, aword [r0 + offsetof(zend_closure, func)]
@@ -9209,8 +9216,11 @@ static int zend_jit_init_fcall(dasm_State **Dst, const zend_op *opline, uint32_t
9209
9216
#endif
9210
9217
/* load constant address later */
9211
9218
} else if (func && op_array == &func->op_array) {
9212
- /* recursive call */
9213
- | mov r0, EX->func
9219
+ /* recursive call */
9220
+ if (!(func->op_array.fn_flags & ZEND_ACC_IMMUTABLE) ||
9221
+ (sizeof(void*) == 8 && !IS_SIGNED_32BIT(func))) {
9222
+ | mov r0, EX->func
9223
+ }
9214
9224
} else {
9215
9225
| // if (CACHED_PTR(opline->result.num))
9216
9226
| mov r0, EX->run_time_cache
@@ -9298,7 +9308,7 @@ static int zend_jit_init_fcall(dasm_State **Dst, const zend_op *opline, uint32_t
9298
9308
|3:
9299
9309
}
9300
9310
9301
- if (!zend_jit_push_call_frame(Dst, opline, func, 0, 0, stack_check)) {
9311
+ if (!zend_jit_push_call_frame(Dst, opline, op_array, func, 0, 0, stack_check)) {
9302
9312
return 0;
9303
9313
}
9304
9314
@@ -9543,7 +9553,7 @@ static int zend_jit_init_method_call(dasm_State **Dst,
9543
9553
}
9544
9554
9545
9555
if (!func || (func->common.fn_flags & ZEND_ACC_STATIC) == 0) {
9546
- if (!zend_jit_push_call_frame(Dst, opline, func, 0, use_this, stack_check)) {
9556
+ if (!zend_jit_push_call_frame(Dst, opline, NULL, func, 0, use_this, stack_check)) {
9547
9557
return 0;
9548
9558
}
9549
9559
}
@@ -9642,7 +9652,7 @@ static int zend_jit_init_closure_call(dasm_State **Dst,
9642
9652
}
9643
9653
}
9644
9654
9645
- if (!zend_jit_push_call_frame(Dst, opline, func, 1, 0, stack_check)) {
9655
+ if (!zend_jit_push_call_frame(Dst, opline, NULL, func, 1, 0, stack_check)) {
9646
9656
return 0;
9647
9657
}
9648
9658
0 commit comments