]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Shrink slots for 'break' statement to help data-flow analysis.
authorMike Pall <mike>
Thu, 25 Nov 2010 11:09:21 +0000 (12:09 +0100)
committerMike Pall <mike>
Thu, 25 Nov 2010 11:13:23 +0000 (12:13 +0100)
src/lj_parse.c

index b063da25c722b2d02506345209631394c517be10..8a6eeec611b34756c0414ff3fd89ade540f641e2 100644 (file)
@@ -1752,14 +1752,18 @@ static void parse_break(LexState *ls)
 {
   FuncState *fs = ls->fs;
   FuncScope *bl;
+  BCReg savefr;
   int upval = 0;
   for (bl = fs->bl; bl && !bl->isbreakable; bl = bl->prev)
     upval |= bl->upval;  /* Collect upvalues in intervening scopes. */
   if (!bl)  /* Error if no breakable scope found. */
     err_syntax(ls, LJ_ERR_XBREAK);
+  savefr = fs->freereg;
+  fs->freereg = bl->nactvar;  /* Shrink slots to help data-flow analysis. */
   if (upval)
     bcemit_AJ(fs, BC_UCLO, bl->nactvar, 0);  /* Close upvalues. */
   jmp_append(fs, &bl->breaklist, bcemit_jmp(fs));
+  fs->freereg = savefr;
 }
 
 /* Check for end of block. */