diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-10-03 14:54:25 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-10-03 14:54:25 -0300 |
commit | 788a0ecd27f1841ff572ba3950a12235aec1f551 (patch) | |
tree | c6925f40bbe0e9d434a27aa612100124b2d9ec00 /lgc.c | |
parent | 6d86b937e48718c9f6a7dd0af0ad9f0112002d9f (diff) | |
download | lua-788a0ecd27f1841ff572ba3950a12235aec1f551.tar.gz lua-788a0ecd27f1841ff572ba3950a12235aec1f551.tar.bz2 lua-788a0ecd27f1841ff572ba3950a12235aec1f551.zip |
'luaC_separateudata' renamed to 'separatetobefnz' and called only
from 'lgc.c'
Diffstat (limited to 'lgc.c')
-rw-r--r-- | lgc.c | 19 |
1 files changed, 9 insertions, 10 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 2.112 2011/09/24 21:12:01 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.113 2011/10/03 16:22:05 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 | */ |
@@ -789,10 +789,10 @@ static void GCTM (lua_State *L, int propagateerrors) { | |||
789 | 789 | ||
790 | 790 | ||
791 | /* | 791 | /* |
792 | ** move all unreachable objects that need finalization from list 'finobj' | 792 | ** move all unreachable objects (or 'all' objects) that need |
793 | ** to list 'tobefnz' | 793 | ** finalization from list 'finobj' to list 'tobefnz' (to be finalized) |
794 | */ | 794 | */ |
795 | void luaC_separateudata (lua_State *L, int all) { | 795 | static void separatetobefnz (lua_State *L, int all) { |
796 | global_State *g = G(L); | 796 | global_State *g = G(L); |
797 | GCObject **p = &g->finobj; | 797 | GCObject **p = &g->finobj; |
798 | GCObject *curr; | 798 | GCObject *curr; |
@@ -888,14 +888,13 @@ static void callallpendingfinalizers (lua_State *L, int propagateerrors) { | |||
888 | void luaC_freeallobjects (lua_State *L) { | 888 | void luaC_freeallobjects (lua_State *L) { |
889 | global_State *g = G(L); | 889 | global_State *g = G(L); |
890 | int i; | 890 | int i; |
891 | separatetobefnz(L, 1); /* separate all objects with finalizers */ | ||
892 | lua_assert(g->finobj == NULL); | ||
891 | callallpendingfinalizers(L, 0); | 893 | callallpendingfinalizers(L, 0); |
892 | /* following "white" makes all objects look dead */ | 894 | g->currentwhite = WHITEBITS; /* this "white" makes all objects look dead */ |
893 | g->currentwhite = WHITEBITS; | ||
894 | g->gckind = KGC_NORMAL; | 895 | g->gckind = KGC_NORMAL; |
895 | sweepwholelist(L, &g->finobj); | 896 | sweepwholelist(L, &g->finobj); /* finalizers can create objs. in 'finobj' */ |
896 | lua_assert(g->finobj == NULL); | ||
897 | sweepwholelist(L, &g->allgc); | 897 | sweepwholelist(L, &g->allgc); |
898 | lua_assert(g->allgc == NULL); | ||
899 | for (i = 0; i < g->strt.size; i++) /* free all string lists */ | 898 | for (i = 0; i < g->strt.size; i++) /* free all string lists */ |
900 | sweepwholelist(L, &g->strt.hash[i]); | 899 | sweepwholelist(L, &g->strt.hash[i]); |
901 | lua_assert(g->strt.nuse == 0); | 900 | lua_assert(g->strt.nuse == 0); |
@@ -920,7 +919,7 @@ static void atomic (lua_State *L) { | |||
920 | clearvalues(g->weak, NULL); | 919 | clearvalues(g->weak, NULL); |
921 | clearvalues(g->allweak, NULL); | 920 | clearvalues(g->allweak, NULL); |
922 | origweak = g->weak; origall = g->allweak; | 921 | origweak = g->weak; origall = g->allweak; |
923 | luaC_separateudata(L, 0); /* separate objects to be finalized */ | 922 | separatetobefnz(L, 0); /* separate objects to be finalized */ |
924 | markbeingfnz(g); /* mark userdata that will be finalized */ | 923 | markbeingfnz(g); /* mark userdata that will be finalized */ |
925 | propagateall(g); /* remark, to propagate `preserveness' */ | 924 | propagateall(g); /* remark, to propagate `preserveness' */ |
926 | convergeephemerons(g); | 925 | convergeephemerons(g); |