diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-03-05 13:22:54 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-03-05 13:22:54 -0300 |
| commit | 457d88eaaa2ac32e4fa0b7c4310cda9bba95d154 (patch) | |
| tree | d6b17e7f6f91f4b218cbf40cde21d32c38067697 | |
| parent | 8a1a512c6484b93e8a4ad81f0bffe818a585c1ee (diff) | |
| download | lua-457d88eaaa2ac32e4fa0b7c4310cda9bba95d154.tar.gz lua-457d88eaaa2ac32e4fa0b7c4310cda9bba95d154.tar.bz2 lua-457d88eaaa2ac32e4fa0b7c4310cda9bba95d154.zip | |
configurable minimum size for the string table
| -rw-r--r-- | lgc.c | 4 | ||||
| -rw-r--r-- | llimits.h | 7 | ||||
| -rw-r--r-- | lstate.c | 4 |
3 files changed, 10 insertions, 5 deletions
| @@ -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 | ||
| @@ -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 |
| @@ -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; |
