diff options
Diffstat (limited to 'lgc.h')
-rw-r--r-- | lgc.h | 31 |
1 files changed, 30 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.h,v 1.20 2003/07/16 20:49:02 roberto Exp roberto $ | 2 | ** $Id: lgc.h,v 1.21 2003/07/29 19:25:37 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 | */ |
@@ -11,6 +11,35 @@ | |||
11 | #include "lobject.h" | 11 | #include "lobject.h" |
12 | 12 | ||
13 | 13 | ||
14 | /* | ||
15 | * ** some userful bit tricks | ||
16 | * */ | ||
17 | #define bitmask(b) (1<<(b)) | ||
18 | #define setbit(x,b) ((x) |= bitmask(b)) | ||
19 | #define resetbit(x,b) ((x) &= cast(lu_byte, ~bitmask(b))) | ||
20 | #define testbit(x,b) ((x) & bitmask(b)) | ||
21 | |||
22 | |||
23 | |||
24 | /* | ||
25 | ** Layout for bit use in `marked' field: | ||
26 | ** bit 0 - object is white (not used yet) | ||
27 | ** bit 1 - object is black | ||
28 | ** bit 2 - For userdata: is finalized; | ||
29 | for tables: has weak keys | ||
30 | ** bit 3 - for tables: has weak values | ||
31 | ** bit 4 - for strings: is fixed (should not be collected) | ||
32 | */ | ||
33 | |||
34 | #define WHITEBIT 0 | ||
35 | #define BLACKBIT 1 | ||
36 | #define FINALIZEDBIT 2 | ||
37 | #define KEYWEAKBIT 2 | ||
38 | #define VALUEWEAKBIT 3 | ||
39 | #define FIXEDBIT 4 | ||
40 | |||
41 | |||
42 | |||
14 | #define luaC_checkGC(L) { if (G(L)->nblocks >= G(L)->GCthreshold) \ | 43 | #define luaC_checkGC(L) { if (G(L)->nblocks >= G(L)->GCthreshold) \ |
15 | luaC_collectgarbage(L); } | 44 | luaC_collectgarbage(L); } |
16 | 45 | ||