diff options
-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 | ||