diff options
-rw-r--r-- | lgc.c | 6 | ||||
-rw-r--r-- | lstate.c | 4 | ||||
-rw-r--r-- | lstate.h | 19 |
3 files changed, 16 insertions, 13 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 1.134 2002/04/05 18:54:31 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 1.135 2002/04/23 15:04:39 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 | */ |
@@ -100,7 +100,6 @@ static void marktable (GCState *st, Table *h) { | |||
100 | if (!ismarked(h)) { | 100 | if (!ismarked(h)) { |
101 | h->mark = st->tmark; /* chain it for later traversal */ | 101 | h->mark = st->tmark; /* chain it for later traversal */ |
102 | st->tmark = h; | 102 | st->tmark = h; |
103 | marktable(st, h->metatable); | ||
104 | } | 103 | } |
105 | } | 104 | } |
106 | 105 | ||
@@ -153,6 +152,9 @@ static void markstacks (GCState *st) { | |||
153 | luaE_closethread(st->L, L1->previous); /* collect it */ | 152 | luaE_closethread(st->L, L1->previous); /* collect it */ |
154 | continue; | 153 | continue; |
155 | } | 154 | } |
155 | markobject(st, defaultmeta(L1)); | ||
156 | markobject(st, gt(L1)); | ||
157 | markobject(st, registry(L1)); | ||
156 | for (o=L1->stack; o<L1->top; o++) | 158 | for (o=L1->stack; o<L1->top; o++) |
157 | markobject(st, o); | 159 | markobject(st, o); |
158 | lim = o; | 160 | lim = o; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.c,v 1.92 2002/05/01 20:40:42 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 1.93 2002/05/07 17:36:56 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -38,7 +38,7 @@ static int default_panic (lua_State *L) { | |||
38 | static void stack_init (lua_State *L, lua_State *OL) { | 38 | static void stack_init (lua_State *L, lua_State *OL) { |
39 | L->stack = luaM_newvector(OL, BASIC_STACK_SIZE, TObject); | 39 | L->stack = luaM_newvector(OL, BASIC_STACK_SIZE, TObject); |
40 | L->stacksize = BASIC_STACK_SIZE; | 40 | L->stacksize = BASIC_STACK_SIZE; |
41 | L->top = L->stack + RESERVED_STACK_PREFIX; | 41 | L->top = L->stack; |
42 | L->stack_last = L->stack+(BASIC_STACK_SIZE-EXTRA_STACK)-1; | 42 | L->stack_last = L->stack+(BASIC_STACK_SIZE-EXTRA_STACK)-1; |
43 | L->base_ci = luaM_newvector(OL, BASIC_CI_SIZE, CallInfo); | 43 | L->base_ci = luaM_newvector(OL, BASIC_CI_SIZE, CallInfo); |
44 | L->ci = L->base_ci; | 44 | L->ci = L->base_ci; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.h,v 1.83 2002/04/16 17:08:28 roberto Exp roberto $ | 2 | ** $Id: lstate.h,v 1.84 2002/04/23 15:04:39 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -50,23 +50,23 @@ struct lua_longjmp; /* defined in ldo.c */ | |||
50 | 50 | ||
51 | 51 | ||
52 | /* | 52 | /* |
53 | ** reserve init of stack to store some global values | 53 | ** array of `global' objects |
54 | */ | 54 | */ |
55 | 55 | ||
56 | #define NUMGLOBS 3 | ||
57 | |||
56 | /* default meta table (both for tables and udata) */ | 58 | /* default meta table (both for tables and udata) */ |
57 | #define defaultmeta(L) (L->stack) | 59 | #define defaultmeta(L) (L->globs) |
58 | 60 | ||
59 | /* table of globals */ | 61 | /* table of globals */ |
60 | #define gt(L) (L->stack + 1) | 62 | #define gt(L) (L->globs + 1) |
61 | 63 | ||
62 | /* registry */ | 64 | /* registry */ |
63 | #define registry(L) (L->stack + 2) | 65 | #define registry(L) (L->globs + 2) |
64 | |||
65 | #define RESERVED_STACK_PREFIX 3 | ||
66 | 66 | ||
67 | 67 | ||
68 | /* space to handle TM calls */ | 68 | /* space to handle TM calls and other temporary overflows */ |
69 | #define EXTRA_STACK 4 | 69 | #define EXTRA_STACK 5 |
70 | 70 | ||
71 | 71 | ||
72 | #define BASIC_CI_SIZE 8 | 72 | #define BASIC_CI_SIZE 8 |
@@ -130,6 +130,7 @@ struct lua_State { | |||
130 | CallInfo *end_ci; /* points after end of ci array*/ | 130 | CallInfo *end_ci; /* points after end of ci array*/ |
131 | CallInfo *base_ci; /* array of CallInfo's */ | 131 | CallInfo *base_ci; /* array of CallInfo's */ |
132 | global_State *l_G; | 132 | global_State *l_G; |
133 | TObject globs[NUMGLOBS]; /* registry, table of globals, etc. */ | ||
133 | struct lua_longjmp *errorJmp; /* current error recover point */ | 134 | struct lua_longjmp *errorJmp; /* current error recover point */ |
134 | UpVal *openupval; /* list of open upvalues in this stack */ | 135 | UpVal *openupval; /* list of open upvalues in this stack */ |
135 | lua_State *next; /* circular double linked list of states */ | 136 | lua_State *next; /* circular double linked list of states */ |