aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-03-05 13:22:54 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-03-05 13:22:54 -0300
commit457d88eaaa2ac32e4fa0b7c4310cda9bba95d154 (patch)
treed6b17e7f6f91f4b218cbf40cde21d32c38067697
parent8a1a512c6484b93e8a4ad81f0bffe818a585c1ee (diff)
downloadlua-457d88eaaa2ac32e4fa0b7c4310cda9bba95d154.tar.gz
lua-457d88eaaa2ac32e4fa0b7c4310cda9bba95d154.tar.bz2
lua-457d88eaaa2ac32e4fa0b7c4310cda9bba95d154.zip
configurable minimum size for the string table
-rw-r--r--lgc.c4
-rw-r--r--llimits.h7
-rw-r--r--lstate.c4
3 files changed, 10 insertions, 5 deletions
diff --git a/lgc.c b/lgc.c
index 09293235..884f689f 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 1.127 2002/01/30 17:26:44 roberto Exp roberto $ 2** $Id: lgc.c,v 1.128 2002/03/04 21:32:34 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*/
@@ -366,7 +366,7 @@ static void collectstrings (lua_State *L, int all) {
366 } 366 }
367 } 367 }
368 if (G(L)->strt.nuse < cast(ls_nstr, G(L)->strt.size/4) && 368 if (G(L)->strt.nuse < cast(ls_nstr, G(L)->strt.size/4) &&
369 G(L)->strt.size > 4) 369 G(L)->strt.size > MINSTRTABSIZE*2)
370 luaS_resize(L, G(L)->strt.size/2); /* table is too big */ 370 luaS_resize(L, G(L)->strt.size/2); /* table is too big */
371} 371}
372 372
diff --git a/llimits.h b/llimits.h
index 7e158638..3f8f8139 100644
--- a/llimits.h
+++ b/llimits.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llimits.h,v 1.1 2001/11/29 22:14:34 rieru Exp rieru $ 2** $Id: llimits.h,v 1.37 2002/02/14 21:43:01 roberto Exp roberto $
3** Limits, basic types, and some other `installation-dependent' definitions 3** Limits, basic types, and some other `installation-dependent' definitions
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -108,5 +108,10 @@ typedef unsigned long Instruction;
108#endif 108#endif
109 109
110 110
111/* minimum size for the string table */
112#ifndef MINSTRTABSIZE
113#define MINSTRTABSIZE 20
114#endif
115
111 116
112#endif 117#endif
diff --git a/lstate.c b/lstate.c
index 4f89a892..ea625ccc 100644
--- a/lstate.c
+++ b/lstate.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.c,v 1.1 2001/11/29 22:14:34 rieru Exp rieru $ 2** $Id: lstate.c,v 1.84 2002/02/14 21:40:13 roberto Exp roberto $
3** Global State 3** Global State
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -65,7 +65,7 @@ static void f_luaopen (lua_State *L, void *ud) {
65 hvalue(defaultmeta(L))->metatable = hvalue(defaultmeta(L)); 65 hvalue(defaultmeta(L))->metatable = hvalue(defaultmeta(L));
66 sethvalue(gt(L), luaH_new(L, 0, 4)); /* table of globals */ 66 sethvalue(gt(L), luaH_new(L, 0, 4)); /* table of globals */
67 sethvalue(registry(L), luaH_new(L, 0, 0)); /* registry */ 67 sethvalue(registry(L), luaH_new(L, 0, 0)); /* registry */
68 luaS_resize(L, 4); /* initial size of string table */ 68 luaS_resize(L, MINSTRTABSIZE); /* initial size of string table */
69 luaT_init(L); 69 luaT_init(L);
70 luaX_init(L); 70 luaX_init(L);
71 G(L)->GCthreshold = 4*G(L)->nblocks; 71 G(L)->GCthreshold = 4*G(L)->nblocks;