diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-08-24 17:12:06 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-08-24 17:12:06 -0300 |
commit | 32d4f304db365599a54b3eb30377ac6e20846749 (patch) | |
tree | eac53658b7ed66e5fe1e96a1e7db93dfea782bbc /lstring.c | |
parent | 4b12eff8017f5e005a483f8097cdd64e9723a514 (diff) | |
download | lua-32d4f304db365599a54b3eb30377ac6e20846749.tar.gz lua-32d4f304db365599a54b3eb30377ac6e20846749.tar.bz2 lua-32d4f304db365599a54b3eb30377ac6e20846749.zip |
first implementation of generational GC
Diffstat (limited to 'lstring.c')
-rw-r--r-- | lstring.c | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstring.c,v 2.1 2003/12/10 12:13:36 roberto Exp roberto $ | 2 | ** $Id: lstring.c,v 2.2 2004/04/30 20:13:38 roberto Exp roberto $ |
3 | ** String table (keeps all strings handled by Lua) | 3 | ** String table (keeps all strings handled by Lua) |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -19,17 +19,12 @@ | |||
19 | 19 | ||
20 | 20 | ||
21 | 21 | ||
22 | void luaS_freeall (lua_State *L) { | ||
23 | lua_assert(G(L)->strt.nuse==0); | ||
24 | luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size, TString *); | ||
25 | } | ||
26 | |||
27 | |||
28 | void luaS_resize (lua_State *L, int newsize) { | 22 | void luaS_resize (lua_State *L, int newsize) { |
29 | GCObject **newhash; | 23 | GCObject **newhash; |
30 | stringtable *tb; | 24 | stringtable *tb; |
31 | int i; | 25 | int i; |
32 | if (G(L)->sweepstrgc > 0) return; /* cannot resize during GC traverse */ | 26 | if (G(L)->gcstate == GCSsweepstring) |
27 | return; /* cannot resize during GC traverse */ | ||
33 | newhash = luaM_newvector(L, newsize, GCObject *); | 28 | newhash = luaM_newvector(L, newsize, GCObject *); |
34 | tb = &G(L)->strt; | 29 | tb = &G(L)->strt; |
35 | for (i=0; i<newsize; i++) newhash[i] = NULL; | 30 | for (i=0; i<newsize; i++) newhash[i] = NULL; |