Skip to content

Commit 927c0e2

Browse files
committed
Increase preallocated spill stack size
1 parent 854d998 commit 927c0e2

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

Zend/zend_vm_gen.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2339,7 +2339,7 @@ function gen_vm_opcodes_header(
23392339
$str .= "\n";
23402340
$str .= "#if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID) && !defined(__SANITIZE_ADDRESS__)\n";
23412341
$str .= "# if ((defined(i386) && !defined(__PIC__)) || defined(__x86_64__) || defined(_M_X64))\n";
2342-
$str .= "# define ZEND_VM_HYBRID_JIT_RED_ZONE_SIZE 32\n";
2342+
$str .= "# define ZEND_VM_HYBRID_JIT_RED_ZONE_SIZE 48\n";
23432343
$str .= "# endif\n";
23442344
$str .= "#endif\n";
23452345
$str .= "\n";

Zend/zend_vm_opcodes.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/opcache/jit/zend_jit_ir.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)