aboutsummaryrefslogtreecommitdiff
path: root/lstring.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2004-08-24 17:12:06 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2004-08-24 17:12:06 -0300
commit32d4f304db365599a54b3eb30377ac6e20846749 (patch)
treeeac53658b7ed66e5fe1e96a1e7db93dfea782bbc /lstring.c
parent4b12eff8017f5e005a483f8097cdd64e9723a514 (diff)
downloadlua-32d4f304db365599a54b3eb30377ac6e20846749.tar.gz
lua-32d4f304db365599a54b3eb30377ac6e20846749.tar.bz2
lua-32d4f304db365599a54b3eb30377ac6e20846749.zip
first implementation of generational GC
Diffstat (limited to 'lstring.c')
-rw-r--r--lstring.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/lstring.c b/lstring.c
index 8ecfb44e..13b75086 100644
--- a/lstring.c
+++ b/lstring.c
@@ -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
22void 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
28void luaS_resize (lua_State *L, int newsize) { 22void 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;