From 1ce57628b21433c0cf7e418b0359766e241106ce Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 6 Feb 2013 11:37:39 -0200 Subject: [PATCH] comments --- lparser.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lparser.c b/lparser.c index ef3eedf8..b83b0c33 100644 --- a/lparser.c +++ b/lparser.c @@ -1,5 +1,5 @@ /* -** $Id: lparser.c,v 2.128 2012/05/20 14:51:23 roberto Exp roberto $ +** $Id: lparser.c,v 2.129 2012/08/06 13:36:34 roberto Exp roberto $ ** Lua Parser ** See Copyright Notice in lua.h */ @@ -512,12 +512,15 @@ static Proto *addprototype (LexState *ls) { /* -** codes instruction to create new closure in parent function +** codes instruction to create new closure in parent function. +** The OP_CLOSURE instruction must use the last available register, +** so that, if it invokes the GC, the GC knows which registers +** are in use at that time. */ static void codeclosure (LexState *ls, expdesc *v) { FuncState *fs = ls->fs->prev; init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np - 1)); - luaK_exp2nextreg(fs, v); /* fix it at stack top (for GC) */ + luaK_exp2nextreg(fs, v); /* fix it at the last register */ }