aboutsummaryrefslogtreecommitdiff
path: root/lgc.h
diff options
context:
space:
mode:
Diffstat (limited to 'lgc.h')
-rw-r--r--lgc.h31
1 files changed, 11 insertions, 20 deletions
diff --git a/lgc.h b/lgc.h
index 43cfb851..c4e1f3b0 100644
--- a/lgc.h
+++ b/lgc.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.h,v 2.76 2013/09/11 20:15:31 roberto Exp roberto $ 2** $Id: lgc.h,v 2.77 2014/02/11 12:18:12 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*/
@@ -38,17 +38,16 @@
38*/ 38*/
39#define GCSpropagate 0 39#define GCSpropagate 0
40#define GCSatomic 1 40#define GCSatomic 1
41#define GCSswplocalgc 2 41#define GCSswpallgc 2
42#define GCSswpallgc 3 42#define GCSswpthreads 3
43#define GCSswpthreads 4 43#define GCSswpfinobj 4
44#define GCSswpfinobj 5 44#define GCSswptobefnz 5
45#define GCSswptobefnz 6 45#define GCSswpend 6
46#define GCSswpend 7 46#define GCSpause 7
47#define GCSpause 8
48 47
49 48
50#define issweepphase(g) \ 49#define issweepphase(g) \
51 (GCSswplocalgc <= (g)->gcstate && (g)->gcstate <= GCSswpend) 50 (GCSswpallgc <= (g)->gcstate && (g)->gcstate <= GCSswpend)
52 51
53 52
54/* 53/*
@@ -80,8 +79,6 @@
80#define WHITE1BIT 1 /* object is white (type 1) */ 79#define WHITE1BIT 1 /* object is white (type 1) */
81#define BLACKBIT 2 /* object is black */ 80#define BLACKBIT 2 /* object is black */
82#define FINALIZEDBIT 3 /* object has been marked for finalization */ 81#define FINALIZEDBIT 3 /* object has been marked for finalization */
83#define NOLOCALBIT 4 /* object is not local */
84#define LOCALMARK 5 /* object is 'locally marked' or out of local list */
85/* bit 7 is currently used by tests (luaL_checkmemory) */ 82/* bit 7 is currently used by tests (luaL_checkmemory) */
86 83
87#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) 84#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT)
@@ -91,7 +88,6 @@
91#define isblack(x) testbit((x)->gch.marked, BLACKBIT) 88#define isblack(x) testbit((x)->gch.marked, BLACKBIT)
92#define isgray(x) /* neither white nor black */ \ 89#define isgray(x) /* neither white nor black */ \
93 (!testbits((x)->gch.marked, WHITEBITS | bitmask(BLACKBIT))) 90 (!testbits((x)->gch.marked, WHITEBITS | bitmask(BLACKBIT)))
94#define islocal(x) (!testbit((x)->gch.marked, NOLOCALBIT))
95 91
96#define tofinalize(x) testbit((x)->gch.marked, FINALIZEDBIT) 92#define tofinalize(x) testbit((x)->gch.marked, FINALIZEDBIT)
97 93
@@ -102,9 +98,6 @@
102#define changewhite(x) ((x)->gch.marked ^= WHITEBITS) 98#define changewhite(x) ((x)->gch.marked ^= WHITEBITS)
103#define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT) 99#define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT)
104 100
105#define nolocal(x) l_setbit((x)->gch.marked, NOLOCALBIT)
106#define valnolocal(v) { if (iscollectable(v)) nolocal(gcvalue(v)); }
107
108#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) 101#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS)
109 102
110 103
@@ -114,17 +107,15 @@
114 107
115 108
116#define luaC_barrier(L,p,v) { \ 109#define luaC_barrier(L,p,v) { \
117 if (iscollectable(v) && \ 110 if (iscollectable(v) && isblack(obj2gco(p)) && iswhite(gcvalue(v))) \
118 (nolocal(gcvalue(v)), isblack(obj2gco(p)) && iswhite(gcvalue(v)))) \
119 luaC_barrier_(L,obj2gco(p),gcvalue(v)); } 111 luaC_barrier_(L,obj2gco(p),gcvalue(v)); }
120 112
121#define luaC_barrierback(L,p,v) { \ 113#define luaC_barrierback(L,p,v) { \
122 if (iscollectable(v) && \ 114 if (iscollectable(v) && isblack(obj2gco(p)) && iswhite(gcvalue(v))) \
123 (nolocal(gcvalue(v)), isblack(obj2gco(p)) && iswhite(gcvalue(v)))) \
124 luaC_barrierback_(L,obj2gco(p)); } 115 luaC_barrierback_(L,obj2gco(p)); }
125 116
126#define luaC_objbarrier(L,p,o) { \ 117#define luaC_objbarrier(L,p,o) { \
127 if (nolocal(obj2gco(o)), isblack(obj2gco(p)) && iswhite(obj2gco(o))) \ 118 if (isblack(obj2gco(p)) && iswhite(obj2gco(o))) \
128 luaC_barrier_(L,obj2gco(p),obj2gco(o)); } 119 luaC_barrier_(L,obj2gco(p),obj2gco(o)); }
129 120
130#define luaC_upvalbarrier(L,uv) \ 121#define luaC_upvalbarrier(L,uv) \