From 6b906158967920ca50328a1bf1ec82589068d89b Mon Sep 17 00:00:00 2001 From: dzaima Date: Sun, 24 Jul 2022 22:18:22 +0300 Subject: [PATCH] more correct stack height going negative check --- src/vm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vm.c b/src/vm.c index fb739b1a..c23f563e 100644 --- a/src/vm.c +++ b/src/vm.c @@ -362,8 +362,8 @@ Block* compileBlock(B block, Comp* comp, bool* bDone, u32* bc, usz bcIA, B allBl #undef A64 usz nlen = TSSIZE(newBC)-TSSIZE(mapBC); for (usz i = 0; i < nlen; i++) TSADD(mapBC, c-bc); + if (h-stackConsumed(c)<0) thrM("VM compiler: Stack size goes negative"); h+= stackDiff(c); - if (h<0) thrM("VM compiler: Stack size goes negative"); if (h>hM) hM = h; if (ret) break; c = n;