From c75c62b489ebd0b4f9eb35af3b7d5a071939721e Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Fri, 28 Nov 2014 20:20:12 +0100 Subject: [PATCH] Fix snapshot #0 handling for traces with a stack check on entry. --- src/lj_asm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lj_asm.c b/src/lj_asm.c index 2afa92d0..f15458b9 100644 --- a/src/lj_asm.c +++ b/src/lj_asm.c @@ -1373,6 +1373,11 @@ static void asm_head_side(ASMState *as) int pass3 = 0; IRRef i; + if (as->snapno && as->topslot > as->parent->topslot) { + /* Force snap #0 alloc to prevent register overwrite in stack check. */ + as->snapno = 0; + asm_snap_alloc(as); + } allow = asm_head_side_base(as, irp, allow); /* Scan all parent SLOADs and collect register dependencies. */