diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2008-06-26 16:42:45 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2008-06-26 16:42:45 -0300 |
| commit | 0c8f5fc2fdcadc8fe6e89c32bf3a1f7456328899 (patch) | |
| tree | 3c62e2e59064196eca2fe662196e73e3c45b63cd /lgc.h | |
| parent | 1527d8f00d4a99997cf73f50fe159ddba8681f8f (diff) | |
| download | lua-0c8f5fc2fdcadc8fe6e89c32bf3a1f7456328899.tar.gz lua-0c8f5fc2fdcadc8fe6e89c32bf3a1f7456328899.tar.bz2 lua-0c8f5fc2fdcadc8fe6e89c32bf3a1f7456328899.zip | |
simplification in the handling of finalizers: no more 'tmudata' list +
no more GCSsweeptmu collector's state
Diffstat (limited to 'lgc.h')
| -rw-r--r-- | lgc.h | 30 |
1 files changed, 14 insertions, 16 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lgc.h,v 2.17 2007/10/29 16:51:20 roberto Exp roberto $ | 2 | ** $Id: lgc.h,v 2.18 2008/02/19 18:55:09 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 | */ |
| @@ -17,26 +17,24 @@ | |||
| 17 | #define GCSpause 0 | 17 | #define GCSpause 0 |
| 18 | #define GCSpropagate 1 | 18 | #define GCSpropagate 1 |
| 19 | #define GCSsweepstring 2 | 19 | #define GCSsweepstring 2 |
| 20 | #define GCSsweeptmu 3 | 20 | #define GCSsweep 3 |
| 21 | #define GCSsweep 4 | 21 | #define GCSfinalize 4 |
| 22 | #define GCSfinalize 5 | ||
| 23 | 22 | ||
| 24 | 23 | ||
| 25 | #define issweep(g) \ | 24 | #define issweep(g) (GCSsweepstring <= (g)->gcstate && (g)->gcstate <= GCSsweep) |
| 26 | (GCSsweepstring <= (g)->gcstate && (g)->gcstate <= GCSsweep) | ||
| 27 | 25 | ||
| 28 | 26 | ||
| 29 | /* | 27 | /* |
| 30 | ** some userful bit tricks | 28 | ** some userful bit tricks |
| 31 | */ | 29 | */ |
| 32 | #define resetbits(x,m) ((x) &= cast(lu_byte, ~(m))) | 30 | #define resetbits(x,m) ((x) &= cast(lu_byte, ~(m))) |
| 33 | #define setbits(x,m) ((x) |= (m)) | 31 | #define setbits(x,m) ((x) |= (m)) |
| 34 | #define testbits(x,m) ((x) & (m)) | 32 | #define testbits(x,m) ((x) & (m)) |
| 35 | #define bitmask(b) (1<<(b)) | 33 | #define bitmask(b) (1<<(b)) |
| 36 | #define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) | 34 | #define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) |
| 37 | #define l_setbit(x,b) setbits(x, bitmask(b)) | 35 | #define l_setbit(x,b) setbits(x, bitmask(b)) |
| 38 | #define resetbit(x,b) resetbits(x, bitmask(b)) | 36 | #define resetbit(x,b) resetbits(x, bitmask(b)) |
| 39 | #define testbit(x,b) testbits(x, bitmask(b)) | 37 | #define testbit(x,b) testbits(x, bitmask(b)) |
| 40 | #define set2bits(x,b1,b2) setbits(x, (bit2mask(b1, b2))) | 38 | #define set2bits(x,b1,b2) setbits(x, (bit2mask(b1, b2))) |
| 41 | #define reset2bits(x,b1,b2) resetbits(x, (bit2mask(b1, b2))) | 39 | #define reset2bits(x,b1,b2) resetbits(x, (bit2mask(b1, b2))) |
| 42 | 40 | ||
| @@ -48,7 +46,7 @@ | |||
| 48 | ** bit 1 - object is white (type 1) | 46 | ** bit 1 - object is white (type 1) |
| 49 | ** bit 2 - object is black | 47 | ** bit 2 - object is black |
| 50 | ** bit 3 - for userdata: has been finalized | 48 | ** bit 3 - for userdata: has been finalized |
| 51 | ** bit 4 - for userdata: it's not in rootgc list (it's in tmudata or tobefnz) | 49 | ** bit 4 - for userdata: it's in 2nd part of rootgc list or in tobefnz |
| 52 | ** bit 5 - object is fixed (should not be collected) | 50 | ** bit 5 - object is fixed (should not be collected) |
| 53 | ** bit 6 - object is "super" fixed (only the main thread) | 51 | ** bit 6 - object is "super" fixed (only the main thread) |
| 54 | */ | 52 | */ |
| @@ -99,7 +97,7 @@ | |||
| 99 | { if (iswhite(obj2gco(o)) && isblack(obj2gco(t))) luaC_barrierback(L,t); } | 97 | { if (iswhite(obj2gco(o)) && isblack(obj2gco(t))) luaC_barrierback(L,t); } |
| 100 | 98 | ||
| 101 | LUAI_FUNC size_t luaC_separateudata (lua_State *L, int all); | 99 | LUAI_FUNC size_t luaC_separateudata (lua_State *L, int all); |
| 102 | LUAI_FUNC void luaC_callGCTM (lua_State *L); | 100 | LUAI_FUNC void luaC_callAllGCTM (lua_State *L); |
| 103 | LUAI_FUNC void luaC_freeall (lua_State *L); | 101 | LUAI_FUNC void luaC_freeall (lua_State *L); |
| 104 | LUAI_FUNC void luaC_step (lua_State *L); | 102 | LUAI_FUNC void luaC_step (lua_State *L); |
| 105 | LUAI_FUNC void luaC_fullgc (lua_State *L, int isemergency); | 103 | LUAI_FUNC void luaC_fullgc (lua_State *L, int isemergency); |
