diff options
author | Mike Pall <mike> | 2010-11-25 12:09:21 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2010-11-25 12:13:23 +0100 |
commit | 7840d0b2b029fbcda65e5f65a201de321ae673bb (patch) | |
tree | eb918307dea72641d73fdf8c6a9dce2f5f811e38 /src | |
parent | 18fbf86c9e6cb370605087a163605ba53b140f47 (diff) | |
download | luajit-7840d0b2b029fbcda65e5f65a201de321ae673bb.tar.gz luajit-7840d0b2b029fbcda65e5f65a201de321ae673bb.tar.bz2 luajit-7840d0b2b029fbcda65e5f65a201de321ae673bb.zip |
Shrink slots for 'break' statement to help data-flow analysis.
Diffstat (limited to 'src')
-rw-r--r-- | src/lj_parse.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lj_parse.c b/src/lj_parse.c index b063da25..8a6eeec6 100644 --- a/src/lj_parse.c +++ b/src/lj_parse.c | |||
@@ -1752,14 +1752,18 @@ static void parse_break(LexState *ls) | |||
1752 | { | 1752 | { |
1753 | FuncState *fs = ls->fs; | 1753 | FuncState *fs = ls->fs; |
1754 | FuncScope *bl; | 1754 | FuncScope *bl; |
1755 | BCReg savefr; | ||
1755 | int upval = 0; | 1756 | int upval = 0; |
1756 | for (bl = fs->bl; bl && !bl->isbreakable; bl = bl->prev) | 1757 | for (bl = fs->bl; bl && !bl->isbreakable; bl = bl->prev) |
1757 | upval |= bl->upval; /* Collect upvalues in intervening scopes. */ | 1758 | upval |= bl->upval; /* Collect upvalues in intervening scopes. */ |
1758 | if (!bl) /* Error if no breakable scope found. */ | 1759 | if (!bl) /* Error if no breakable scope found. */ |
1759 | err_syntax(ls, LJ_ERR_XBREAK); | 1760 | err_syntax(ls, LJ_ERR_XBREAK); |
1761 | savefr = fs->freereg; | ||
1762 | fs->freereg = bl->nactvar; /* Shrink slots to help data-flow analysis. */ | ||
1760 | if (upval) | 1763 | if (upval) |
1761 | bcemit_AJ(fs, BC_UCLO, bl->nactvar, 0); /* Close upvalues. */ | 1764 | bcemit_AJ(fs, BC_UCLO, bl->nactvar, 0); /* Close upvalues. */ |
1762 | jmp_append(fs, &bl->breaklist, bcemit_jmp(fs)); | 1765 | jmp_append(fs, &bl->breaklist, bcemit_jmp(fs)); |
1766 | fs->freereg = savefr; | ||
1763 | } | 1767 | } |
1764 | 1768 | ||
1765 | /* Check for end of block. */ | 1769 | /* Check for end of block. */ |