aboutsummaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-02-07 16:13:49 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-02-07 16:13:49 -0200
commit7178a5e34aa56c09a01a6664bb7a61c6771700d4 (patch)
tree318a1dd14cd5a0497229183e56e29198b3b2016c /lgc.c
parent322b7b5fc55da0d166efc693cfe674220190b010 (diff)
downloadlua-7178a5e34aa56c09a01a6664bb7a61c6771700d4.tar.gz
lua-7178a5e34aa56c09a01a6664bb7a61c6771700d4.tar.bz2
lua-7178a5e34aa56c09a01a6664bb7a61c6771700d4.zip
new way to handle top x L->top
Diffstat (limited to 'lgc.c')
-rw-r--r--lgc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lgc.c b/lgc.c
index c8331b69..77927940 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 1.86 2001/02/02 16:23:20 roberto Exp roberto $ 2** $Id: lgc.c,v 1.87 2001/02/02 16:32:00 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*/
@@ -101,11 +101,14 @@ static void markobject (GCState *st, TObject *o) {
101static void markstacks (lua_State *L, GCState *st) { 101static void markstacks (lua_State *L, GCState *st) {
102 lua_State *L1 = L; 102 lua_State *L1 = L;
103 do { /* for each thread */ 103 do { /* for each thread */
104 StkId o; 104 StkId o, lim;
105 marktable(st, L1->gt); /* mark table of globals */ 105 marktable(st, L1->gt); /* mark table of globals */
106 for (o=L1->stack; o<L1->top; o++) 106 for (o=L1->stack; o<L1->top; o++)
107 markobject(st, o); 107 markobject(st, o);
108 lua_assert(L->previous->next == L && L->next->previous == L); 108 lim = (L1->stack_last - L1->top > MAXSTACK) ? L1->top+MAXSTACK
109 : L1->stack_last;
110 for (; o<=lim; o++) setnilvalue(o);
111 lua_assert(L1->previous->next == L1 && L1->next->previous == L1);
109 L1 = L1->next; 112 L1 = L1->next;
110 } while (L1 != L); 113 } while (L1 != L);
111} 114}