more correct stack height going negative check

This commit is contained in:
dzaima 2022-07-24 22:18:22 +03:00
parent c1b66c5982
commit 6b90615896

View File

@ -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;