diff options
-rw-r--r-- | lapi.c | 8 | ||||
-rw-r--r-- | lbaselib.c | 13 | ||||
-rw-r--r-- | lgc.c | 57 | ||||
-rw-r--r-- | llimits.h | 4 | ||||
-rw-r--r-- | lstate.c | 9 | ||||
-rw-r--r-- | lstate.h | 9 | ||||
-rw-r--r-- | ltests.c | 11 | ||||
-rw-r--r-- | lua.h | 4 |
8 files changed, 49 insertions, 66 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 2.24 2005/01/04 15:55:12 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.25 2005/01/07 19:53:32 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -872,9 +872,9 @@ LUA_API int lua_gc (lua_State *L, int what, int data) { | |||
872 | g->gcpace = data; | 872 | g->gcpace = data; |
873 | break; | 873 | break; |
874 | } | 874 | } |
875 | case LUA_GCSETINCMODE: { | 875 | case LUA_GCSETSTEPMUL: { |
876 | res = g->incgc; | 876 | res = g->gcstepmul; |
877 | g->incgc = data; | 877 | g->gcstepmul = data; |
878 | break; | 878 | break; |
879 | } | 879 | } |
880 | default: res = -1; /* invalid option */ | 880 | default: res = -1; /* invalid option */ |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbaselib.c,v 1.163 2004/12/13 12:15:11 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.164 2005/01/07 19:53:32 roberto Exp roberto $ |
3 | ** Basic library | 3 | ** Basic library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -182,13 +182,13 @@ static int luaB_gcinfo (lua_State *L) { | |||
182 | 182 | ||
183 | static int luaB_collectgarbage (lua_State *L) { | 183 | static int luaB_collectgarbage (lua_State *L) { |
184 | static const char *const opts[] = {"stop", "restart", "collect", | 184 | static const char *const opts[] = {"stop", "restart", "collect", |
185 | "count", "step", "setpace", "setincmode", NULL}; | 185 | "count", "step", "setpace", "setstepmul", NULL}; |
186 | static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT, | 186 | static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT, |
187 | LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPACE, LUA_GCSETINCMODE}; | 187 | LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPACE, LUA_GCSETSTEPMUL}; |
188 | int o = luaL_findstring(luaL_optstring(L, 1, "collect"), opts); | 188 | int o = luaL_findstring(luaL_optstring(L, 1, "collect"), opts); |
189 | int ex = luaL_optint(L, 2, 0); | 189 | lua_Number ex = luaL_optnumber(L, 2, 0); |
190 | luaL_argcheck(L, o >= 0, 1, "invalid option"); | 190 | luaL_argcheck(L, o >= 0, 1, "invalid option"); |
191 | lua_pushinteger(L, lua_gc(L, optsnum[o], ex)); | 191 | lua_pushinteger(L, lua_gc(L, optsnum[o], ex * 100)); |
192 | return 1; | 192 | return 1; |
193 | } | 193 | } |
194 | 194 | ||
@@ -620,9 +620,6 @@ static void base_open (lua_State *L) { | |||
620 | /* create register._LOADED to track loaded modules */ | 620 | /* create register._LOADED to track loaded modules */ |
621 | lua_newtable(L); | 621 | lua_newtable(L); |
622 | lua_setfield(L, LUA_REGISTRYINDEX, "_LOADED"); | 622 | lua_setfield(L, LUA_REGISTRYINDEX, "_LOADED"); |
623 | /* create register._PRELOAD to allow pre-loaded modules */ | ||
624 | lua_newtable(L); | ||
625 | lua_setfield(L, LUA_REGISTRYINDEX, "_PRELOAD"); | ||
626 | /* set global _G */ | 623 | /* set global _G */ |
627 | lua_pushvalue(L, LUA_GLOBALSINDEX); | 624 | lua_pushvalue(L, LUA_GLOBALSINDEX); |
628 | lua_setglobal(L, "_G"); | 625 | lua_setglobal(L, "_G"); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 2.19 2004/12/13 12:15:11 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.20 2005/01/05 18:20:51 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 | */ |
@@ -23,11 +23,10 @@ | |||
23 | #include "ltm.h" | 23 | #include "ltm.h" |
24 | 24 | ||
25 | 25 | ||
26 | #define GCSTEPSIZE 1000 | 26 | #define GCSTEPSIZE 1024u |
27 | #define GCSWEEPMAX 10 | 27 | #define GCSWEEPMAX 40 |
28 | #define GCSWEEPCOST 30 | 28 | #define GCSWEEPCOST 10 |
29 | #define GCFINALIZECOST 100 | 29 | #define GCFINALIZECOST 100 |
30 | #define GCSTEPMUL 8 | ||
31 | 30 | ||
32 | 31 | ||
33 | #define FIXEDMASK bitmask(FIXEDBIT) | 32 | #define FIXEDMASK bitmask(FIXEDBIT) |
@@ -411,12 +410,10 @@ static GCObject **sweeplist (lua_State *L, GCObject **p, lu_int32 count) { | |||
411 | global_State *g = G(L); | 410 | global_State *g = G(L); |
412 | int whitebit = otherwhite(g); | 411 | int whitebit = otherwhite(g); |
413 | int deadmask = whitebit | FIXEDMASK; | 412 | int deadmask = whitebit | FIXEDMASK; |
414 | int generational = g->gcgenerational; | ||
415 | while ((curr = *p) != NULL && count-- > 0) { | 413 | while ((curr = *p) != NULL && count-- > 0) { |
416 | if ((curr->gch.marked ^ whitebit) & deadmask) { | 414 | if ((curr->gch.marked ^ whitebit) & deadmask) { |
417 | lua_assert(!isdead(g, curr) || testbit(curr->gch.marked, FIXEDBIT)); | 415 | lua_assert(!isdead(g, curr) || testbit(curr->gch.marked, FIXEDBIT)); |
418 | if (!generational || isdead(g, curr)) | 416 | makewhite(g, curr); |
419 | makewhite(g, curr); | ||
420 | if (curr->gch.tt == LUA_TTHREAD) | 417 | if (curr->gch.tt == LUA_TTHREAD) |
421 | sweepwholelist(L, &gco2th(curr)->openupval); | 418 | sweepwholelist(L, &gco2th(curr)->openupval); |
422 | p = &curr->gch.next; | 419 | p = &curr->gch.next; |
@@ -532,7 +529,6 @@ static void remarkupvals (global_State *g) { | |||
532 | static void atomic (lua_State *L) { | 529 | static void atomic (lua_State *L) { |
533 | global_State *g = G(L); | 530 | global_State *g = G(L); |
534 | size_t udsize; /* total size of userdata to be finalized */ | 531 | size_t udsize; /* total size of userdata to be finalized */ |
535 | int aux; | ||
536 | /* remark objects cautch by write barrier */ | 532 | /* remark objects cautch by write barrier */ |
537 | propagateall(g); | 533 | propagateall(g); |
538 | /* remark occasional upvalues of (maybe) dead threads */ | 534 | /* remark occasional upvalues of (maybe) dead threads */ |
@@ -556,10 +552,6 @@ static void atomic (lua_State *L) { | |||
556 | g->sweepstrgc = 0; | 552 | g->sweepstrgc = 0; |
557 | g->sweepgc = &g->rootgc; | 553 | g->sweepgc = &g->rootgc; |
558 | g->gcstate = GCSsweepstring; | 554 | g->gcstate = GCSsweepstring; |
559 | aux = g->gcgenerational; | ||
560 | g->gcgenerational = g->incgc && (g->estimate/2 <= g->prevestimate); | ||
561 | if (!aux) /* last collection was full? */ | ||
562 | g->prevestimate = g->estimate; /* keep estimate of last full collection */ | ||
563 | g->estimate = g->totalbytes - udsize; /* first estimate */ | 555 | g->estimate = g->totalbytes - udsize; /* first estimate */ |
564 | } | 556 | } |
565 | 557 | ||
@@ -569,11 +561,7 @@ static l_mem singlestep (lua_State *L) { | |||
569 | /*lua_checkmemory(L);*/ | 561 | /*lua_checkmemory(L);*/ |
570 | switch (g->gcstate) { | 562 | switch (g->gcstate) { |
571 | case GCSpause: { | 563 | case GCSpause: { |
572 | /* start a new collection */ | 564 | markroot(L); /* start a new collection */ |
573 | if (g->gcgenerational) | ||
574 | atomic(L); | ||
575 | else | ||
576 | markroot(L); | ||
577 | return 0; | 565 | return 0; |
578 | } | 566 | } |
579 | case GCSpropagate: { | 567 | case GCSpropagate: { |
@@ -613,6 +601,7 @@ static l_mem singlestep (lua_State *L) { | |||
613 | } | 601 | } |
614 | else { | 602 | else { |
615 | g->gcstate = GCSpause; /* end collection */ | 603 | g->gcstate = GCSpause; /* end collection */ |
604 | g->gcdept = 0; | ||
616 | return 0; | 605 | return 0; |
617 | } | 606 | } |
618 | } | 607 | } |
@@ -623,25 +612,31 @@ static l_mem singlestep (lua_State *L) { | |||
623 | 612 | ||
624 | void luaC_step (lua_State *L) { | 613 | void luaC_step (lua_State *L) { |
625 | global_State *g = G(L); | 614 | global_State *g = G(L); |
626 | l_mem lim = (g->totalbytes - (g->GCthreshold - GCSTEPSIZE)) * GCSTEPMUL; | 615 | l_mem lim = (GCSTEPSIZE/100) * g->gcstepmul; |
616 | g->gcdept += g->totalbytes - g->GCthreshold; | ||
627 | do { | 617 | do { |
628 | lim -= singlestep(L); | 618 | lim -= singlestep(L); |
629 | if (g->gcstate == GCSpause) | 619 | if (g->gcstate == GCSpause) |
630 | break; | 620 | break; |
631 | } while (lim > 0 || !g->incgc); | 621 | } while (lim > 0); |
632 | if (g->gcstate != GCSpause) | 622 | if (g->gcstate != GCSpause) { |
633 | g->GCthreshold = g->totalbytes + GCSTEPSIZE; /* - lim/STEPMUL; */ | 623 | if (g->gcdept < GCSTEPSIZE) |
624 | g->GCthreshold = g->totalbytes + GCSTEPSIZE; /* - lim/g->gcstepmul;*/ | ||
625 | else { | ||
626 | g->gcdept -= GCSTEPSIZE; | ||
627 | g->GCthreshold = g->totalbytes; | ||
628 | } | ||
629 | } | ||
634 | else { | 630 | else { |
635 | lua_assert(g->totalbytes >= g->estimate); | 631 | lua_assert(g->totalbytes >= g->estimate); |
636 | g->GCthreshold = g->estimate + ((g->estimate/GCDIV) * g->gcpace); | 632 | g->GCthreshold = (g->estimate/100) * g->gcpace; |
637 | } | 633 | } |
638 | } | 634 | } |
639 | 635 | ||
640 | 636 | ||
641 | void luaC_fullgc (lua_State *L) { | 637 | void luaC_fullgc (lua_State *L) { |
642 | global_State *g = G(L); | 638 | global_State *g = G(L); |
643 | if (g->gcstate <= GCSpropagate || g->gcgenerational) { | 639 | if (g->gcstate <= GCSpropagate) { |
644 | g->gcgenerational = 0; | ||
645 | /* reset sweep marks to sweep all elements (returning them to white) */ | 640 | /* reset sweep marks to sweep all elements (returning them to white) */ |
646 | g->sweepstrgc = 0; | 641 | g->sweepstrgc = 0; |
647 | g->sweepgc = &g->rootgc; | 642 | g->sweepgc = &g->rootgc; |
@@ -657,10 +652,8 @@ void luaC_fullgc (lua_State *L) { | |||
657 | singlestep(L); | 652 | singlestep(L); |
658 | } | 653 | } |
659 | markroot(L); | 654 | markroot(L); |
660 | lua_assert(!g->gcgenerational); | ||
661 | while (g->gcstate != GCSpause) { | 655 | while (g->gcstate != GCSpause) { |
662 | singlestep(L); | 656 | singlestep(L); |
663 | g->gcgenerational = 0; /* keep it in this mode */ | ||
664 | } | 657 | } |
665 | g->GCthreshold = 2*g->estimate; | 658 | g->GCthreshold = 2*g->estimate; |
666 | } | 659 | } |
@@ -669,11 +662,10 @@ void luaC_fullgc (lua_State *L) { | |||
669 | void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v) { | 662 | void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v) { |
670 | global_State *g = G(L); | 663 | global_State *g = G(L); |
671 | lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); | 664 | lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); |
672 | lua_assert(g->gcgenerational || | 665 | lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); |
673 | (g->gcstate != GCSfinalize && g->gcstate != GCSpause)); | ||
674 | lua_assert(ttype(&o->gch) != LUA_TTABLE); | 666 | lua_assert(ttype(&o->gch) != LUA_TTABLE); |
675 | /* must keep invariant? */ | 667 | /* must keep invariant? */ |
676 | if (g->gcstate == GCSpropagate || g->gcgenerational) | 668 | if (g->gcstate == GCSpropagate) |
677 | reallymarkobject(g, v); /* restore invariant */ | 669 | reallymarkobject(g, v); /* restore invariant */ |
678 | else /* don't mind */ | 670 | else /* don't mind */ |
679 | makewhite(g, o); /* mark as white just to avoid other barriers */ | 671 | makewhite(g, o); /* mark as white just to avoid other barriers */ |
@@ -683,8 +675,7 @@ void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v) { | |||
683 | void luaC_barrierback (lua_State *L, GCObject *o, GCObject *v) { | 675 | void luaC_barrierback (lua_State *L, GCObject *o, GCObject *v) { |
684 | global_State *g = G(L); | 676 | global_State *g = G(L); |
685 | lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); | 677 | lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); |
686 | lua_assert(g->gcgenerational || | 678 | lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); |
687 | (g->gcstate != GCSfinalize && g->gcstate != GCSpause)); | ||
688 | black2gray(o); /* make table gray (again) */ | 679 | black2gray(o); /* make table gray (again) */ |
689 | gco2h(o)->gclist = g->grayagain; | 680 | gco2h(o)->gclist = g->grayagain; |
690 | g->grayagain = o; | 681 | g->grayagain = o; |
@@ -706,7 +697,7 @@ void luaC_linkupval (lua_State *L, UpVal *uv) { | |||
706 | o->gch.next = g->rootgc; /* link upvalue into `rootgc' list */ | 697 | o->gch.next = g->rootgc; /* link upvalue into `rootgc' list */ |
707 | g->rootgc = o; | 698 | g->rootgc = o; |
708 | if (isgray(o)) { | 699 | if (isgray(o)) { |
709 | if (g->gcstate == GCSpropagate || g->gcgenerational) { | 700 | if (g->gcstate == GCSpropagate) { |
710 | gray2black(o); /* closed upvalues need barrier */ | 701 | gray2black(o); /* closed upvalues need barrier */ |
711 | luaC_barrier(L, uv, uv->v); | 702 | luaC_barrier(L, uv, uv->v); |
712 | } | 703 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llimits.h,v 1.61 2004/11/24 18:55:56 roberto Exp roberto $ | 2 | ** $Id: llimits.h,v 1.62 2004/12/13 12:15:11 roberto Exp roberto $ |
3 | ** Limits, basic types, and some other `installation-dependent' definitions | 3 | ** Limits, basic types, and some other `installation-dependent' definitions |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -73,8 +73,6 @@ typedef LUA_UACNUMBER l_uacNumber; | |||
73 | typedef lu_int32 Instruction; | 73 | typedef lu_int32 Instruction; |
74 | 74 | ||
75 | 75 | ||
76 | /* divisor for GC pace */ | ||
77 | #define GCDIV 8 | ||
78 | 76 | ||
79 | /* maximum stack for a Lua function */ | 77 | /* maximum stack for a Lua function */ |
80 | #define MAXSTACK 250 | 78 | #define MAXSTACK 250 |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.c,v 2.20 2005/01/04 15:55:12 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 2.21 2005/01/05 18:20:51 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 | */ |
@@ -95,7 +95,6 @@ static void f_luaopen (lua_State *L, void *ud) { | |||
95 | luaX_init(L); | 95 | luaX_init(L); |
96 | luaS_fix(luaS_newliteral(L, MEMERRMSG)); | 96 | luaS_fix(luaS_newliteral(L, MEMERRMSG)); |
97 | g->GCthreshold = 4*g->totalbytes; | 97 | g->GCthreshold = 4*g->totalbytes; |
98 | g->prevestimate = g->estimate = g->totalbytes; | ||
99 | } | 98 | } |
100 | 99 | ||
101 | 100 | ||
@@ -180,7 +179,6 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { | |||
180 | luaZ_initbuffer(L, &g->buff); | 179 | luaZ_initbuffer(L, &g->buff); |
181 | g->panic = NULL; | 180 | g->panic = NULL; |
182 | g->gcstate = GCSpause; | 181 | g->gcstate = GCSpause; |
183 | g->gcgenerational = 0; | ||
184 | g->rootgc = obj2gco(L); | 182 | g->rootgc = obj2gco(L); |
185 | g->sweepstrgc = 0; | 183 | g->sweepstrgc = 0; |
186 | g->sweepgc = &g->rootgc; | 184 | g->sweepgc = &g->rootgc; |
@@ -190,8 +188,9 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { | |||
190 | g->weak = NULL; | 188 | g->weak = NULL; |
191 | g->tmudata = NULL; | 189 | g->tmudata = NULL; |
192 | g->totalbytes = sizeof(LG); | 190 | g->totalbytes = sizeof(LG); |
193 | g->gcpace = GCDIV; | 191 | g->gcpace = 200; /* 200% (wait memory to double before next collection) */ |
194 | g->incgc = 1; | 192 | g->gcstepmul = 200; /* GC runs `twice the speed' of memory allocation */ |
193 | g->gcdept = 0; | ||
195 | if (luaD_rawrunprotected(L, f_luaopen, NULL) != 0) { | 194 | if (luaD_rawrunprotected(L, f_luaopen, NULL) != 0) { |
196 | /* memory allocation error: free partial state */ | 195 | /* memory allocation error: free partial state */ |
197 | close_state(L); | 196 | close_state(L); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.h,v 2.10 2004/12/13 12:15:11 roberto Exp roberto $ | 2 | ** $Id: lstate.h,v 2.11 2005/01/05 18:20:51 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 | */ |
@@ -71,7 +71,6 @@ typedef struct global_State { | |||
71 | void *ud; /* auxiliary data to `realloc' */ | 71 | void *ud; /* auxiliary data to `realloc' */ |
72 | lu_byte currentwhite; | 72 | lu_byte currentwhite; |
73 | lu_byte gcstate; /* state of garbage collector */ | 73 | lu_byte gcstate; /* state of garbage collector */ |
74 | lu_byte gcgenerational; | ||
75 | GCObject *rootgc; /* list of all collectable objects */ | 74 | GCObject *rootgc; /* list of all collectable objects */ |
76 | GCObject *firstudata; /* udata go to the end of `rootgc' */ | 75 | GCObject *firstudata; /* udata go to the end of `rootgc' */ |
77 | GCObject **sweepgc; /* position of sweep in `rootgc' */ | 76 | GCObject **sweepgc; /* position of sweep in `rootgc' */ |
@@ -84,9 +83,9 @@ typedef struct global_State { | |||
84 | lu_mem GCthreshold; | 83 | lu_mem GCthreshold; |
85 | lu_mem totalbytes; /* number of bytes currently allocated */ | 84 | lu_mem totalbytes; /* number of bytes currently allocated */ |
86 | lu_mem estimate; /* an estimate of number of bytes actually in use */ | 85 | lu_mem estimate; /* an estimate of number of bytes actually in use */ |
87 | lu_mem prevestimate; /* previous estimate */ | 86 | lu_mem gcdept; /* how much GC is `behind schedule' */ |
88 | int gcpace; /* relative `speed' of the GC */ | 87 | int gcpace; /* size of pause between successive GCs */ |
89 | int incgc; /* 0 if GC is done non-incrementally */ | 88 | int gcstepmul; /* GC `granularity' */ |
90 | lua_CFunction panic; /* to be called in unprotected errors */ | 89 | lua_CFunction panic; /* to be called in unprotected errors */ |
91 | TValue _registry; | 90 | TValue _registry; |
92 | struct lua_State *mainthread; | 91 | struct lua_State *mainthread; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 2.15 2004/11/01 15:06:50 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.16 2005/01/05 18:20:51 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 | */ |
@@ -153,9 +153,9 @@ void *debug_realloc (void *ud, void *block, size_t oldsize, size_t size) { | |||
153 | 153 | ||
154 | static int testobjref1 (global_State *g, GCObject *f, GCObject *t) { | 154 | static int testobjref1 (global_State *g, GCObject *f, GCObject *t) { |
155 | if (isdead(g,t)) return 0; | 155 | if (isdead(g,t)) return 0; |
156 | if (g->gcstate == GCSpropagate || g->gcgenerational) | 156 | if (g->gcstate == GCSpropagate) |
157 | return !isblack(f) || !iswhite(t); | 157 | return !isblack(f) || !iswhite(t); |
158 | else if (g->gcstate == GCSfinalize && !g->gcgenerational) | 158 | else if (g->gcstate == GCSfinalize) |
159 | return iswhite(f); | 159 | return iswhite(f); |
160 | else | 160 | else |
161 | return 1; | 161 | return 1; |
@@ -175,8 +175,7 @@ static void printobj (global_State *g, GCObject *o) { | |||
175 | static int testobjref (global_State *g, GCObject *f, GCObject *t) { | 175 | static int testobjref (global_State *g, GCObject *f, GCObject *t) { |
176 | int r = testobjref1(g,f,t); | 176 | int r = testobjref1(g,f,t); |
177 | if (!r) { | 177 | if (!r) { |
178 | printf("%d(%02X) %c - ", g->gcstate, g->currentwhite, | 178 | printf("%d(%02X) - ", g->gcstate, g->currentwhite); |
179 | g->gcgenerational ? 'G' : ' '); | ||
180 | printobj(g, f); | 179 | printobj(g, f); |
181 | printf("\t-> "); | 180 | printf("\t-> "); |
182 | printobj(g, t); | 181 | printobj(g, t); |
@@ -295,7 +294,7 @@ static void checkobject (global_State *g, GCObject *o) { | |||
295 | printf(">>> %d %s %02x\n", g->gcstate, luaT_typenames[o->gch.tt], o->gch.marked); | 294 | printf(">>> %d %s %02x\n", g->gcstate, luaT_typenames[o->gch.tt], o->gch.marked); |
296 | } | 295 | } |
297 | else { | 296 | else { |
298 | if (g->gcstate == GCSfinalize && !g->gcgenerational) | 297 | if (g->gcstate == GCSfinalize) |
299 | lua_assert(iswhite(o)); | 298 | lua_assert(iswhite(o)); |
300 | switch (o->gch.tt) { | 299 | switch (o->gch.tt) { |
301 | case LUA_TUPVAL: { | 300 | case LUA_TUPVAL: { |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.h,v 1.198 2005/01/07 19:53:32 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.199 2005/01/10 17:31:50 roberto Exp roberto $ |
3 | ** Lua - An Extensible Extension Language | 3 | ** Lua - An Extensible Extension Language |
4 | ** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil | 4 | ** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil |
5 | ** http://www.lua.org mailto:info@lua.org | 5 | ** http://www.lua.org mailto:info@lua.org |
@@ -227,7 +227,7 @@ LUA_API int (lua_status) (lua_State *L); | |||
227 | #define LUA_GCCOUNT 3 | 227 | #define LUA_GCCOUNT 3 |
228 | #define LUA_GCSTEP 4 | 228 | #define LUA_GCSTEP 4 |
229 | #define LUA_GCSETPACE 5 | 229 | #define LUA_GCSETPACE 5 |
230 | #define LUA_GCSETINCMODE 6 | 230 | #define LUA_GCSETSTEPMUL 6 |
231 | 231 | ||
232 | LUA_API int (lua_gc) (lua_State *L, int what, int data); | 232 | LUA_API int (lua_gc) (lua_State *L, int what, int data); |
233 | 233 | ||