aboutsummaryrefslogtreecommitdiff
path: root/lgc.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2003-11-17 17:50:05 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2003-11-17 17:50:05 -0200
commitab7d9bfd0c38f1dd8eda40ae3c1f1c686564a92d (patch)
treee7f5231cc02b89b2507ad846d5d547e35e9c4153 /lgc.h
parent921b1723e2fddde0382143b28b5be3b7128204b8 (diff)
downloadlua-ab7d9bfd0c38f1dd8eda40ae3c1f1c686564a92d.tar.gz
lua-ab7d9bfd0c38f1dd8eda40ae3c1f1c686564a92d.tar.bz2
lua-ab7d9bfd0c38f1dd8eda40ae3c1f1c686564a92d.zip
cleaner code for manipulation of `marked' field
Diffstat (limited to 'lgc.h')
-rw-r--r--lgc.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/lgc.h b/lgc.h
index 85f3b43e..29adec24 100644
--- a/lgc.h
+++ b/lgc.h
@@ -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