summaryrefslogtreecommitdiff
path: root/apps/plugins/lua/lgc.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lua/lgc.h')
-rw-r--r--apps/plugins/lua/lgc.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/apps/plugins/lua/lgc.h b/apps/plugins/lua/lgc.h
index 5123ccb479..115008d6be 100644
--- a/apps/plugins/lua/lgc.h
+++ b/apps/plugins/lua/lgc.h
@@ -37,12 +37,30 @@
37#define test2bits(x,b1,b2) testbits(x, (bit2mask(b1, b2))) 37#define test2bits(x,b1,b2) testbits(x, (bit2mask(b1, b2)))
38 38
39 39
40/*
41** Possible Garbage Collector flags.
42** Layout for bit use in 'gsflags' field in global_State structure.
43** bit 0 - Protect GC from recursive calls.
44** bit 1 - Don't try to shrink string table if EGC was called during a string table resize.
45*/
46#define GCFlagsNone 0
47#define GCBlockGCBit 0
48#define GCResizingStringsBit 1
49
50
51#define is_block_gc(L) testbit(G(L)->gcflags, GCBlockGCBit)
52#define set_block_gc(L) l_setbit(G(L)->gcflags, GCBlockGCBit)
53#define unset_block_gc(L) resetbit(G(L)->gcflags, GCBlockGCBit)
54#define is_resizing_strings_gc(L) testbit(G(L)->gcflags, GCResizingStringsBit)
55#define set_resizing_strings_gc(L) l_setbit(G(L)->gcflags, GCResizingStringsBit)
56#define unset_resizing_strings_gc(L) resetbit(G(L)->gcflags, GCResizingStringsBit)
40 57
41/* 58/*
42** Layout for bit use in `marked' field: 59** Layout for bit use in `marked' field:
43** bit 0 - object is white (type 0) 60** bit 0 - object is white (type 0)
44** bit 1 - object is white (type 1) 61** bit 1 - object is white (type 1)
45** bit 2 - object is black 62** bit 2 - object is black
63** bit 3 - for thread: Don't resize thread's stack
46** bit 3 - for userdata: has been finalized 64** bit 3 - for userdata: has been finalized
47** bit 3 - for tables: has weak keys 65** bit 3 - for tables: has weak keys
48** bit 4 - for tables: has weak values 66** bit 4 - for tables: has weak values
@@ -54,6 +72,7 @@
54#define WHITE0BIT 0 72#define WHITE0BIT 0
55#define WHITE1BIT 1 73#define WHITE1BIT 1
56#define BLACKBIT 2 74#define BLACKBIT 2
75#define FIXEDSTACKBIT 3
57#define FINALIZEDBIT 3 76#define FINALIZEDBIT 3
58#define KEYWEAKBIT 3 77#define KEYWEAKBIT 3
59#define VALUEWEAKBIT 4 78#define VALUEWEAKBIT 4
@@ -76,6 +95,9 @@
76 95
77#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) 96#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS)
78 97
98#define isfixedstack(x) testbit((x)->marked, FIXEDSTACKBIT)
99#define fixedstack(x) l_setbit((x)->marked, FIXEDSTACKBIT)
100#define unfixedstack(x) resetbit((x)->marked, FIXEDSTACKBIT)
79 101
80#define luaC_checkGC(L) { \ 102#define luaC_checkGC(L) { \
81 condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); \ 103 condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); \
@@ -101,6 +123,8 @@ LUAI_FUNC void luaC_callGCTM (lua_State *L);
101LUAI_FUNC void luaC_freeall (lua_State *L); 123LUAI_FUNC void luaC_freeall (lua_State *L);
102LUAI_FUNC void luaC_step (lua_State *L); 124LUAI_FUNC void luaC_step (lua_State *L);
103LUAI_FUNC void luaC_fullgc (lua_State *L); 125LUAI_FUNC void luaC_fullgc (lua_State *L);
126LUAI_FUNC int luaC_sweepstrgc (lua_State *L);
127LUAI_FUNC void luaC_marknew (lua_State *L, GCObject *o);
104LUAI_FUNC void luaC_link (lua_State *L, GCObject *o, lu_byte tt); 128LUAI_FUNC void luaC_link (lua_State *L, GCObject *o, lu_byte tt);
105LUAI_FUNC void luaC_linkupval (lua_State *L, UpVal *uv); 129LUAI_FUNC void luaC_linkupval (lua_State *L, UpVal *uv);
106LUAI_FUNC void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v); 130LUAI_FUNC void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v);