mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Shrink slots for 'break' statement to help data-flow analysis.
This commit is contained in:
parent
18fbf86c9e
commit
7840d0b2b0
@ -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. */
|
||||
|
Loading…
Reference in New Issue
Block a user