diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-02-06 11:37:39 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-02-06 11:37:39 -0200 |
commit | 1ce57628b21433c0cf7e418b0359766e241106ce (patch) | |
tree | 1a2136b60f36549d3f7410fac1f100d71824c61b | |
parent | 181a837cac39fe9a411b64d67239d98785518c33 (diff) | |
download | lua-1ce57628b21433c0cf7e418b0359766e241106ce.tar.gz lua-1ce57628b21433c0cf7e418b0359766e241106ce.tar.bz2 lua-1ce57628b21433c0cf7e418b0359766e241106ce.zip |
comments
-rw-r--r-- | lparser.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 2.128 2012/05/20 14:51:23 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.129 2012/08/06 13:36:34 roberto Exp roberto $ |
3 | ** Lua Parser | 3 | ** Lua Parser |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -512,12 +512,15 @@ static Proto *addprototype (LexState *ls) { | |||
512 | 512 | ||
513 | 513 | ||
514 | /* | 514 | /* |
515 | ** codes instruction to create new closure in parent function | 515 | ** codes instruction to create new closure in parent function. |
516 | ** The OP_CLOSURE instruction must use the last available register, | ||
517 | ** so that, if it invokes the GC, the GC knows which registers | ||
518 | ** are in use at that time. | ||
516 | */ | 519 | */ |
517 | static void codeclosure (LexState *ls, expdesc *v) { | 520 | static void codeclosure (LexState *ls, expdesc *v) { |
518 | FuncState *fs = ls->fs->prev; | 521 | FuncState *fs = ls->fs->prev; |
519 | init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np - 1)); | 522 | init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np - 1)); |
520 | luaK_exp2nextreg(fs, v); /* fix it at stack top (for GC) */ | 523 | luaK_exp2nextreg(fs, v); /* fix it at the last register */ |
521 | } | 524 | } |
522 | 525 | ||
523 | 526 | ||