diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2008-02-11 13:45:30 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2008-02-11 13:45:30 -0200 |
| commit | a73930228aada18cb9300f53dbcc6fafcb75caf9 (patch) | |
| tree | d3a63c01e23c1d3c2a930d7d2b4607aaf6cbe559 | |
| parent | a76fa251998ea83679cfad24542cf4c1aa3d6131 (diff) | |
| download | lua-a73930228aada18cb9300f53dbcc6fafcb75caf9.tar.gz lua-a73930228aada18cb9300f53dbcc6fafcb75caf9.tar.bz2 lua-a73930228aada18cb9300f53dbcc6fafcb75caf9.zip | |
more options for 'kinds' of Garbage Collection
| -rw-r--r-- | lstate.c | 4 | ||||
| -rw-r--r-- | lstate.h | 9 |
2 files changed, 9 insertions, 4 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstate.c,v 2.41 2007/10/29 16:51:20 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 2.42 2007/10/31 15:41:19 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 | */ |
| @@ -160,7 +160,7 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { | |||
| 160 | L->tt = LUA_TTHREAD; | 160 | L->tt = LUA_TTHREAD; |
| 161 | g->currentwhite = bit2mask(WHITE0BIT, FIXEDBIT); | 161 | g->currentwhite = bit2mask(WHITE0BIT, FIXEDBIT); |
| 162 | L->marked = luaC_white(g); | 162 | L->marked = luaC_white(g); |
| 163 | g->emergencygc = 0; | 163 | g->gckind = KGC_NORMAL; |
| 164 | g->nCcalls = 0; | 164 | g->nCcalls = 0; |
| 165 | set2bits(L->marked, FIXEDBIT, SFIXEDBIT); | 165 | set2bits(L->marked, FIXEDBIT, SFIXEDBIT); |
| 166 | preinit_state(L, g); | 166 | preinit_state(L, g); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstate.h,v 2.29 2007/10/29 16:51:20 roberto Exp roberto $ | 2 | ** $Id: lstate.h,v 2.30 2007/10/31 15:41:19 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 | */ |
| @@ -34,6 +34,11 @@ struct lua_longjmp; /* defined in ldo.c */ | |||
| 34 | #define BASIC_STACK_SIZE (2*LUA_MINSTACK) | 34 | #define BASIC_STACK_SIZE (2*LUA_MINSTACK) |
| 35 | 35 | ||
| 36 | 36 | ||
| 37 | /* kinds of Garbage Collection */ | ||
| 38 | #define KGC_NORMAL 0 | ||
| 39 | #define KGC_FORCED 1 /* gc was forced by the program */ | ||
| 40 | #define KGC_EMERGENCY 2 /* gc was forced by an allocation failure */ | ||
| 41 | |||
| 37 | 42 | ||
| 38 | typedef struct stringtable { | 43 | typedef struct stringtable { |
| 39 | GCObject **hash; | 44 | GCObject **hash; |
| @@ -72,7 +77,7 @@ typedef struct global_State { | |||
| 72 | unsigned short nCcalls; /* number of nested C calls */ | 77 | unsigned short nCcalls; /* number of nested C calls */ |
| 73 | lu_byte currentwhite; | 78 | lu_byte currentwhite; |
| 74 | lu_byte gcstate; /* state of garbage collector */ | 79 | lu_byte gcstate; /* state of garbage collector */ |
| 75 | lu_byte emergencygc; /* true when collect was trigged by alloc error */ | 80 | lu_byte gckind; /* kind of GC running */ |
| 76 | int sweepstrgc; /* position of sweep in `strt' */ | 81 | int sweepstrgc; /* position of sweep in `strt' */ |
| 77 | GCObject *rootgc; /* list of all collectable objects */ | 82 | GCObject *rootgc; /* list of all collectable objects */ |
| 78 | GCObject **sweepgc; /* position of sweep in `rootgc' */ | 83 | GCObject **sweepgc; /* position of sweep in `rootgc' */ |
