diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-04-05 11:15:35 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-04-05 11:15:35 -0300 |
commit | a09c8d7beb79611a7bc5f2b6f8255cc18b0feef3 (patch) | |
tree | 2a80acb08e4ac705d80be0d68a755cf925495498 | |
parent | f80ff7a336bc604feb410be691350c19edb3f00e (diff) | |
download | lua-a09c8d7beb79611a7bc5f2b6f8255cc18b0feef3.tar.gz lua-a09c8d7beb79611a7bc5f2b6f8255cc18b0feef3.tar.bz2 lua-a09c8d7beb79611a7bc5f2b6f8255cc18b0feef3.zip |
cannot sweep main thread in sweepstring phase
-rw-r--r-- | lgc.c | 23 |
1 files changed, 16 insertions, 7 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 2.75 2010/03/29 17:43:14 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.76 2010/04/02 14:37:41 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 | */ |
@@ -778,25 +778,34 @@ static l_mem singlestep (lua_State *L) { | |||
778 | sweepwholelist(L, &g->strt.hash[g->sweepstrgc++]); | 778 | sweepwholelist(L, &g->strt.hash[g->sweepstrgc++]); |
779 | } | 779 | } |
780 | else { /* no more strings to sweep */ | 780 | else { /* no more strings to sweep */ |
781 | /* sweep main thread */ | ||
782 | sweeplist(L, cast(GCObject **, &g->mainthread), 1); | ||
783 | g->sweepgc = &g->udgc; /* prepare to sweep userdata */ | 781 | g->sweepgc = &g->udgc; /* prepare to sweep userdata */ |
784 | g->gcstate = GCSsweepudata; | 782 | g->gcstate = GCSsweepudata; |
785 | } | 783 | } |
786 | return GCSWEEPCOST; | 784 | return GCSWEEPCOST; |
787 | } | 785 | } |
788 | case GCSsweepudata: | 786 | case GCSsweepudata: { |
789 | case GCSsweep: { | ||
790 | if (*g->sweepgc) { | 787 | if (*g->sweepgc) { |
791 | g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX); | 788 | g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX); |
792 | return GCSWEEPMAX*GCSWEEPCOST; | 789 | return GCSWEEPMAX*GCSWEEPCOST; |
793 | } | 790 | } |
794 | else { /* go to next phase */ | 791 | else { /* go to next phase */ |
795 | g->sweepgc = &g->allgc; /* useless (but harmless) in GCSsweep case */ | 792 | g->sweepgc = &g->allgc; |
796 | g->gcstate = (g->gcstate == GCSsweep) ? GCSfinalize : GCSsweep; | 793 | g->gcstate = GCSsweep; |
797 | return 0; | 794 | return 0; |
798 | } | 795 | } |
799 | } | 796 | } |
797 | case GCSsweep: { | ||
798 | if (*g->sweepgc) { | ||
799 | g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX); | ||
800 | return GCSWEEPMAX*GCSWEEPCOST; | ||
801 | } | ||
802 | else { | ||
803 | /* sweep main thread */ | ||
804 | sweeplist(L, cast(GCObject **, &g->mainthread), 1); | ||
805 | g->gcstate = GCSfinalize; /* go to next phase */ | ||
806 | return GCSWEEPCOST; | ||
807 | } | ||
808 | } | ||
800 | case GCSfinalize: { | 809 | case GCSfinalize: { |
801 | if (g->tobefnz) { | 810 | if (g->tobefnz) { |
802 | GCTM(L, 1); | 811 | GCTM(L, 1); |