You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ZJIT: Keep a frame pointer and use it for memory params
Previously ZJIT miscomped the following program because of interference
on what native SP points to.
def a(n1,n2,n3,n4,n5,n6,n7,n8) = [n8]
a(0,0,0,0,0,0,0, :ok)
Commented problematic disassembly:
; call rb_ary_new_capa
0x90: mov x0, #1
0x94: mov x16, #0x1278
0x98: movk x16, #0x4bc, lsl #16
0x9c: movk x16, #1, lsl #32
0xa0: blr x16
; call rb_ary_push
0xa4: mov x1, x0
0xa8: str x1, [sp, #-0x10]! ; c_push() from alloc_regs()
0xac: mov x0, x1 ; arg0, the array
0xb0: ldur x1, [sp] ; arg1, meant to be n8, but sp just moved!
0xb4: mov x16, #0x3968
0xb8: movk x16, #0x4bc, lsl #16
0xbc: movk x16, #1, lsl #32
0xc0: blr x16
Since we never move the frame pointer, static offsets based on it don't
run the risk of being invalidated by SP movements.
Pass the registers to preserve through `FrameSetup`. This allows ARM to
use STP and waste no gaps between EC, SP, and CFP.
x86 now preserves and restores RBP since we use it as the frame pointer.
Because both platforms keep a frame pointer, there is now no need to
move SP in the epilogue, as we can restore register using the frame
pointer.
0 commit comments