From 7c964b7ffab8d52b6d08d5c4181708d5d3ef5f4f Mon Sep 17 00:00:00 2001 From: Zhongwei Yao Date: Wed, 8 Nov 2023 15:15:52 -0800 Subject: [PATCH] Invalidate SCEV entry when it is out of scope. --- src/lj_record.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lj_record.c b/src/lj_record.c index 1dd310d4..e8aab17a 100644 --- a/src/lj_record.c +++ b/src/lj_record.c @@ -976,6 +976,8 @@ void lj_record_ret(jit_State *J, BCReg rbase, ptrdiff_t gotresults) emitir(IRTG(IR_RETF, IRT_PGC), trpt, trpc); J->retdepth++; J->needsnap = 1; + /* scev entry is invalid after returning to lower frame. */ + J->scev.idx = REF_NIL; lj_assertJ(J->baseslot == 1+LJ_FR2, "bad baseslot for return"); /* Shift result slots up and clear the slots of the new frame below. */ memmove(J->base + cbase, J->base-1-LJ_FR2, sizeof(TRef)*nresults);