diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-08-15 16:41:58 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-08-15 16:41:58 -0300 |
commit | 51471ba74821d7caee9e4c9dd11faf70d614f533 (patch) | |
tree | 942a11c3bee4db530af5c42be43d0b0e316c8ae6 | |
parent | 0b65cb74cdf4ef6e6a33da6724610e506407df1a (diff) | |
download | lua-51471ba74821d7caee9e4c9dd11faf70d614f533.tar.gz lua-51471ba74821d7caee9e4c9dd11faf70d614f533.tar.bz2 lua-51471ba74821d7caee9e4c9dd11faf70d614f533.zip |
comments about use of 'luaH_set'
-rw-r--r-- | lcode.c | 4 | ||||
-rw-r--r-- | llex.c | 4 |
2 files changed, 6 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lcode.c,v 2.57 2011/07/15 12:50:29 roberto Exp roberto $ | 2 | ** $Id: lcode.c,v 2.58 2011/07/27 18:07:37 roberto Exp roberto $ |
3 | ** Code generator for Lua | 3 | ** Code generator for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -304,6 +304,8 @@ static int addk (FuncState *fs, TValue *key, TValue *v) { | |||
304 | /* constant not found; create a new entry */ | 304 | /* constant not found; create a new entry */ |
305 | oldsize = f->sizek; | 305 | oldsize = f->sizek; |
306 | k = fs->nk; | 306 | k = fs->nk; |
307 | /* numerical value does not need GC barrier; | ||
308 | table has no metatable, so it does not need to invalidate cache */ | ||
307 | setnvalue(idx, cast_num(k)); | 309 | setnvalue(idx, cast_num(k)); |
308 | luaM_growvector(L, f->k, k, f->sizek, TValue, MAXARG_Ax, "constants"); | 310 | luaM_growvector(L, f->k, k, f->sizek, TValue, MAXARG_Ax, "constants"); |
309 | while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]); | 311 | while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llex.c,v 2.56 2011/08/09 20:58:29 roberto Exp roberto $ | 2 | ** $Id: llex.c,v 2.57 2011/08/11 17:06:12 roberto Exp roberto $ |
3 | ** Lexical Analyzer | 3 | ** Lexical Analyzer |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -128,6 +128,8 @@ TString *luaX_newstring (LexState *ls, const char *str, size_t l) { | |||
128 | setsvalue2s(L, L->top++, ts); /* temporarily anchor it in stack */ | 128 | setsvalue2s(L, L->top++, ts); /* temporarily anchor it in stack */ |
129 | o = luaH_set(L, ls->fs->h, L->top - 1); | 129 | o = luaH_set(L, ls->fs->h, L->top - 1); |
130 | if (ttisnil(o)) { /* not in use yet? (see 'addK') */ | 130 | if (ttisnil(o)) { /* not in use yet? (see 'addK') */ |
131 | /* boolean value does not need GC barrier; | ||
132 | table has no metatable, so it does not need to invalidate cache */ | ||
131 | setbvalue(o, 1); /* t[string] = true */ | 133 | setbvalue(o, 1); /* t[string] = true */ |
132 | luaC_checkGC(L); | 134 | luaC_checkGC(L); |
133 | } | 135 | } |