1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix JIT stack setup on aarch64/clang

On aarch64 we must set IR_USE_FRAME_POINTER to ensure that LR/x30 is
saved. Also, fixed_stack_frame_size must be n*16, not n*16+8 like on x86.

Fixes GH-19601
Closes GH-19630
This commit is contained in:
Arnaud Le Blanc
2025-08-29 13:05:23 +02:00
parent 0b74e59d79
commit 95d52d52da
2 changed files with 9 additions and 0 deletions

1
NEWS
View File

@@ -8,6 +8,7 @@ PHP NEWS
- Opcache:
. Fixed bug GH-19486 (Incorrect opline after deoptimization). (Arnaud)
. Fixed bug GH-19601 (Wrong JIT stack setup on aarch64/clang). (Arnaud)
- PCRE:
. Upgraded to pcre2lib from 10.45 to 10.46. (nielsdos)

View File

@@ -2734,7 +2734,15 @@ static void zend_jit_init_ctx(zend_jit_ctx *jit, uint32_t flags)
/* Stack must be 16 byte aligned */
/* TODO: select stack size ??? */
#if ZEND_VM_KIND == ZEND_VM_KIND_TAILCALL
# if defined(IR_TARGET_AARCH64)
/* Must save LR */
jit->ctx.flags |= IR_USE_FRAME_POINTER;
/* Same as HYBRID VM */
jit->ctx.fixed_stack_frame_size = sizeof(void*) * 4; /* 4 spill slots */
# else
/* Same as HYBRID VM, plus 1 slot for re-alignment (caller pushes return address, frame is not aligned on entry) */
jit->ctx.fixed_stack_frame_size = sizeof(void*) * 5; /* 5 spill slots (8 bytes) or 10 spill slots (4 bytes) */
# endif
#elif defined(IR_TARGET_AARCH64)
jit->ctx.flags |= IR_USE_FRAME_POINTER;
jit->ctx.fixed_stack_frame_size = sizeof(void*) * 16; /* 10 saved registers and 6 spill slots (8 bytes) */