aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-02-18 10:46:26 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-02-18 10:46:26 -0300
commit3f78de256e5759669460c6fa14455303762f2f53 (patch)
tree287ae3d2ccf441b4158f7a2e29feb21c39188711
parentd764cc552251fc69207c1bb4b34d3a6a5b7020c6 (diff)
downloadlua-3f78de256e5759669460c6fa14455303762f2f53.tar.gz
lua-3f78de256e5759669460c6fa14455303762f2f53.tar.bz2
lua-3f78de256e5759669460c6fa14455303762f2f53.zip
no need to keep threads in a different GC list, now that there is the
'twups' list
-rw-r--r--lgc.c6
-rw-r--r--lgc.h13
-rw-r--r--lstate.c8
-rw-r--r--lstate.h3
-rw-r--r--ltests.c20
5 files changed, 17 insertions, 33 deletions
diff --git a/lgc.c b/lgc.c
index 9471b894..c210b67e 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 2.175 2014/02/15 13:12:01 roberto Exp roberto $ 2** $Id: lgc.c,v 2.176 2014/02/18 13:39: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*/
@@ -954,7 +954,6 @@ void luaC_freeallobjects (lua_State *L) {
954 g->gckind = KGC_NORMAL; 954 g->gckind = KGC_NORMAL;
955 sweepwholelist(L, &g->finobj); 955 sweepwholelist(L, &g->finobj);
956 sweepwholelist(L, &g->allgc); 956 sweepwholelist(L, &g->allgc);
957 sweepwholelist(L, &g->mainthread->next);
958 sweepwholelist(L, &g->fixedgc); /* collect fixed objects */ 957 sweepwholelist(L, &g->fixedgc); /* collect fixed objects */
959 lua_assert(g->strt.nuse == 0); 958 lua_assert(g->strt.nuse == 0);
960} 959}
@@ -1046,9 +1045,6 @@ static lu_mem singlestep (lua_State *L) {
1046 return work + sw * GCSWEEPCOST; 1045 return work + sw * GCSWEEPCOST;
1047 } 1046 }
1048 case GCSswpallgc: { /* sweep "regular" objects */ 1047 case GCSswpallgc: { /* sweep "regular" objects */
1049 return sweepstep(L, g, GCSswpthreads, &g->mainthread->next);
1050 }
1051 case GCSswpthreads: { /* sweep threads */
1052 return sweepstep(L, g, GCSswpfinobj, &g->finobj); 1048 return sweepstep(L, g, GCSswpfinobj, &g->finobj);
1053 } 1049 }
1054 case GCSswpfinobj: { /* sweep objects with finalizers */ 1050 case GCSswpfinobj: { /* sweep objects with finalizers */
diff --git a/lgc.h b/lgc.h
index 0e24d2c3..958ca26b 100644
--- a/lgc.h
+++ b/lgc.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.h,v 2.79 2014/02/13 14:46:38 roberto Exp roberto $ 2** $Id: lgc.h,v 2.80 2014/02/14 16:43:14 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*/
@@ -39,12 +39,11 @@
39#define GCSpropagate 0 39#define GCSpropagate 0
40#define GCSatomic 1 40#define GCSatomic 1
41#define GCSswpallgc 2 41#define GCSswpallgc 2
42#define GCSswpthreads 3 42#define GCSswpfinobj 3
43#define GCSswpfinobj 4 43#define GCSswptobefnz 4
44#define GCSswptobefnz 5 44#define GCSswpend 5
45#define GCSswpend 6 45#define GCScallfin 6
46#define GCScallfin 7 46#define GCSpause 7
47#define GCSpause 8
48 47
49 48
50#define issweepphase(g) \ 49#define issweepphase(g) \
diff --git a/lstate.c b/lstate.c
index bc235941..123dd198 100644
--- a/lstate.c
+++ b/lstate.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.c,v 2.119 2014/02/13 14:46:38 roberto Exp roberto $ 2** $Id: lstate.c,v 2.120 2014/02/18 13:39:37 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*/
@@ -260,9 +260,9 @@ LUA_API lua_State *lua_newthread (lua_State *L) {
260 L1 = &cast(LX *, luaM_newobject(L, LUA_TTHREAD, sizeof(LX)))->l; 260 L1 = &cast(LX *, luaM_newobject(L, LUA_TTHREAD, sizeof(LX)))->l;
261 L1->marked = luaC_white(g); 261 L1->marked = luaC_white(g);
262 L1->tt = LUA_TTHREAD; 262 L1->tt = LUA_TTHREAD;
263 /* link it on list of threads */ 263 /* link it on list 'allgc' */
264 L1->next = g->mainthread->next; 264 L1->next = g->allgc;
265 g->mainthread->next = obj2gco(L1); 265 g->allgc = obj2gco(L1);
266 setthvalue(L, L->top, L1); 266 setthvalue(L, L->top, L1);
267 api_incr_top(L); 267 api_incr_top(L);
268 preinit_thread(L1, g); 268 preinit_thread(L1, g);
diff --git a/lstate.h b/lstate.h
index 9df36f32..a876f35f 100644
--- a/lstate.h
+++ b/lstate.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.h,v 2.100 2014/02/13 14:46:38 roberto Exp roberto $ 2** $Id: lstate.h,v 2.101 2014/02/18 13:39:37 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*/
@@ -21,7 +21,6 @@
21** belong to one (and only one) of these lists, using field 'next' of 21** belong to one (and only one) of these lists, using field 'next' of
22** the 'CommonHeader' for the link: 22** the 'CommonHeader' for the link:
23** 23**
24** mainthread->next: all threads;
25** allgc: all objects not marked for finalization; 24** allgc: all objects not marked for finalization;
26** finobj: all objects marked for finalization; 25** finobj: all objects marked for finalization;
27** tobefnz: all objects ready to be finalized; 26** tobefnz: all objects ready to be finalized;
diff --git a/ltests.c b/ltests.c
index 5abe598c..931fc1c8 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 2.164 2014/02/13 12:11:34 roberto Exp roberto $ 2** $Id: ltests.c,v 2.165 2014/02/15 13:12:01 roberto Exp roberto $
3** Internal Module for Debugging of the Lua Implementation 3** Internal Module for Debugging of the Lua Implementation
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -426,14 +426,6 @@ int lua_checkmemory (lua_State *L) {
426 checkobject(g, o, maybedead); 426 checkobject(g, o, maybedead);
427 lua_assert(!tofinalize(o)); 427 lua_assert(!tofinalize(o));
428 } 428 }
429 /* check thread list */
430 checkgray(g, obj2gco(g->mainthread));
431 maybedead = (GCSatomic < g->gcstate && g->gcstate <= GCSswpthreads);
432 for (o = obj2gco(g->mainthread); o != NULL; o = gch(o)->next) {
433 checkobject(g, o, maybedead);
434 lua_assert(!tofinalize(o));
435 lua_assert(gch(o)->tt == LUA_TTHREAD);
436 }
437 /* check 'finobj' list */ 429 /* check 'finobj' list */
438 checkgray(g, g->finobj); 430 checkgray(g, g->finobj);
439 for (o = g->finobj; o != NULL; o = gch(o)->next) { 431 for (o = g->finobj; o != NULL; o = gch(o)->next) {
@@ -615,12 +607,10 @@ static int gc_color (lua_State *L) {
615 607
616 608
617static int gc_state (lua_State *L) { 609static int gc_state (lua_State *L) {
618 static const char *statenames[] = {"propagate", "atomic", 610 static const char *statenames[] = {"propagate", "atomic", "sweepallgc",
619 "sweepallgc", "sweepthreads", "sweepfinobj", 611 "sweepfinobj", "sweeptobefnz", "sweepend", "pause", ""};
620 "sweeptobefnz", "sweepend", "pause", ""}; 612 static const int states[] = {GCSpropagate, GCSatomic, GCSswpallgc,
621 static const int states[] = {GCSpropagate, GCSatomic, 613 GCSswpfinobj, GCSswptobefnz, GCSswpend, GCSpause, -1};
622 GCSswpallgc, GCSswpthreads, GCSswpfinobj,
623 GCSswptobefnz, GCSswpend, GCSpause, -1};
624 int option = states[luaL_checkoption(L, 1, "", statenames)]; 614 int option = states[luaL_checkoption(L, 1, "", statenames)];
625 if (option == -1) { 615 if (option == -1) {
626 lua_pushstring(L, statenames[G(L)->gcstate]); 616 lua_pushstring(L, statenames[G(L)->gcstate]);