diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-03-25 10:42:19 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-03-25 10:42:19 -0300 |
commit | b436ed58a3416c2e1936bdce880ac09925401a87 (patch) | |
tree | e3c00e30d5260fc54076e8e247e19efc909e4279 /lgc.c | |
parent | 2b37f2150ef2630d594628d94b261cd9e6173e5a (diff) | |
download | lua-b436ed58a3416c2e1936bdce880ac09925401a87.tar.gz lua-b436ed58a3416c2e1936bdce880ac09925401a87.tar.bz2 lua-b436ed58a3416c2e1936bdce880ac09925401a87.zip |
'clearapihash' -> 'luaS_clearcache' and moved to 'lstring.c' (which
keeps all code related to this cache)
Diffstat (limited to 'lgc.c')
-rw-r--r-- | lgc.c | 17 |
1 files changed, 2 insertions, 15 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 2.203 2015/03/04 13:31:21 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.204 2015/03/04 13:51:55 roberto Exp roberto $ |
3 | ** Garbage Collector | 3 | ** Garbage Collector |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -977,19 +977,6 @@ void luaC_freeallobjects (lua_State *L) { | |||
977 | } | 977 | } |
978 | 978 | ||
979 | 979 | ||
980 | /* | ||
981 | ** Clear API string cache. (Entries cannot be empty, so fill them with | ||
982 | ** a non-collectable string.) | ||
983 | */ | ||
984 | static void clearapihash (global_State *g) { | ||
985 | int i; | ||
986 | for (i = 0; i < STRCACHE_SIZE; i++) { | ||
987 | if (iswhite(g->strcache[i])) /* will entry be collected? */ | ||
988 | g->strcache[i] = g->memerrmsg; /* replace it with something fixed */ | ||
989 | } | ||
990 | } | ||
991 | |||
992 | |||
993 | static l_mem atomic (lua_State *L) { | 980 | static l_mem atomic (lua_State *L) { |
994 | global_State *g = G(L); | 981 | global_State *g = G(L); |
995 | l_mem work; | 982 | l_mem work; |
@@ -1030,7 +1017,7 @@ static l_mem atomic (lua_State *L) { | |||
1030 | /* clear values from resurrected weak tables */ | 1017 | /* clear values from resurrected weak tables */ |
1031 | clearvalues(g, g->weak, origweak); | 1018 | clearvalues(g, g->weak, origweak); |
1032 | clearvalues(g, g->allweak, origall); | 1019 | clearvalues(g, g->allweak, origall); |
1033 | clearapihash(g); | 1020 | luaS_clearcache(g); |
1034 | g->currentwhite = cast_byte(otherwhite(g)); /* flip current white */ | 1021 | g->currentwhite = cast_byte(otherwhite(g)); /* flip current white */ |
1035 | work += g->GCmemtrav; /* complete counting */ | 1022 | work += g->GCmemtrav; /* complete counting */ |
1036 | return work; /* estimate of memory marked by 'atomic' */ | 1023 | return work; /* estimate of memory marked by 'atomic' */ |