@@ -2605,11 +2605,13 @@ static void zend_jit_init_ctx(zend_jit_ctx *jit, uint32_t flags)
26052605 /* Stack must be 16 byte aligned */
26062606 /* TODO: select stack size ??? */
26072607#if defined(IR_TARGET_AARCH64)
2608- jit->ctx.fixed_stack_frame_size = sizeof(void*) * 16;
2608+ jit->ctx.fixed_stack_frame_size = sizeof(void*) * 16; /* 10 saved registers and 6 spill slots (8 bytes) */
26092609#elif defined(_WIN64)
2610- jit->ctx.fixed_stack_frame_size = sizeof(void*) * 15;
2611- #else
2612- jit->ctx.fixed_stack_frame_size = sizeof(void*) * 7;
2610+ jit->ctx.fixed_stack_frame_size = sizeof(void*) * 11; /* 8 saved registers and 3 spill slots (8 bytes) */
2611+ #elif defined(IR_TARGET_X86_64)
2612+ jit->ctx.fixed_stack_frame_size = sizeof(void*) * 9; /* 6 saved registers and 3 spill slots (8 bytes) */
2613+ #else /* IR_TARGET_x86 */
2614+ jit->ctx.fixed_stack_frame_size = sizeof(void*) * 11; /* 4 saved registers and 7 spill slots (4 bytes) */
26132615#endif
26142616 if (GCC_GLOBAL_REGS) {
26152617 jit->ctx.fixed_save_regset = IR_REGSET_PRESERVED & ~((1<<ZREG_FP) | (1<<ZREG_IP));
@@ -2619,6 +2621,7 @@ static void zend_jit_init_ctx(zend_jit_ctx *jit, uint32_t flags)
26192621// jit->ctx.fixed_save_regset &= 0xffff; // TODO: don't save FP registers ???
26202622//#endif
26212623 }
2624+ jit->ctx.fixed_call_stack_size = 16;
26222625 } else {
26232626#ifdef ZEND_VM_HYBRID_JIT_RED_ZONE_SIZE
26242627 jit->ctx.fixed_stack_red_zone = ZEND_VM_HYBRID_JIT_RED_ZONE_SIZE;
@@ -2629,7 +2632,7 @@ static void zend_jit_init_ctx(zend_jit_ctx *jit, uint32_t flags)
26292632 jit->ctx.flags |= IR_MERGE_EMPTY_ENTRIES;
26302633#else
26312634 jit->ctx.fixed_stack_red_zone = 0;
2632- jit->ctx.fixed_stack_frame_size = 16;
2635+ jit->ctx.fixed_stack_frame_size = 32; /* 4 spill slots (8 bytes) or 8 spill slots (4 bytes) */
26332636 jit->ctx.fixed_call_stack_size = 16;
26342637#endif
26352638#if defined(IR_TARGET_X86) || defined(IR_TARGET_X64)
0 commit comments