diff options
-rw-r--r-- | lapi.c | 6 | ||||
-rw-r--r-- | lgc.c | 14 | ||||
-rw-r--r-- | lgc.h | 4 |
3 files changed, 8 insertions, 16 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 2.158 2011/11/29 15:55:08 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.159 2011/11/30 12:32:05 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 | */ |
@@ -1046,11 +1046,11 @@ LUA_API int lua_gc (lua_State *L, int what, int data) { | |||
1046 | case LUA_GCSTEP: { | 1046 | case LUA_GCSTEP: { |
1047 | if (g->gckind == KGC_GEN) { /* generational mode? */ | 1047 | if (g->gckind == KGC_GEN) { /* generational mode? */ |
1048 | res = (g->lastmajormem == 0); /* 1 if will do major collection */ | 1048 | res = (g->lastmajormem == 0); /* 1 if will do major collection */ |
1049 | luaC_forcestep(L); /* do a single step */ | 1049 | luaC_step(L); /* do a single step */ |
1050 | } | 1050 | } |
1051 | else { | 1051 | else { |
1052 | while (data-- >= 0) { | 1052 | while (data-- >= 0) { |
1053 | luaC_forcestep(L); | 1053 | luaC_step(L); |
1054 | if (g->gcstate == GCSpause) { /* end of cycle? */ | 1054 | if (g->gcstate == GCSpause) { /* end of cycle? */ |
1055 | res = 1; /* signal it */ | 1055 | res = 1; /* signal it */ |
1056 | break; | 1056 | break; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 2.119 2012/01/25 21:05:40 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.120 2012/05/08 13:53:33 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 | */ |
@@ -1069,9 +1069,9 @@ static void step (lua_State *L) { | |||
1069 | 1069 | ||
1070 | 1070 | ||
1071 | /* | 1071 | /* |
1072 | ** performs a basic GC step even if the collector is stopped | 1072 | ** performs a basic GC step |
1073 | */ | 1073 | */ |
1074 | void luaC_forcestep (lua_State *L) { | 1074 | void luaC_step (lua_State *L) { |
1075 | global_State *g = G(L); | 1075 | global_State *g = G(L); |
1076 | int i; | 1076 | int i; |
1077 | if (isgenerational(g)) generationalcollection(L); | 1077 | if (isgenerational(g)) generationalcollection(L); |
@@ -1082,14 +1082,6 @@ void luaC_forcestep (lua_State *L) { | |||
1082 | 1082 | ||
1083 | 1083 | ||
1084 | /* | 1084 | /* |
1085 | ** performs a basic GC step only if collector is running | ||
1086 | */ | ||
1087 | void luaC_step (lua_State *L) { | ||
1088 | if (G(L)->gcrunning) luaC_forcestep(L); | ||
1089 | } | ||
1090 | |||
1091 | |||
1092 | /* | ||
1093 | ** performs a full GC cycle; if "isemergency", does not call | 1085 | ** performs a full GC cycle; if "isemergency", does not call |
1094 | ** finalizers (which could change stack positions) | 1086 | ** finalizers (which could change stack positions) |
1095 | */ | 1087 | */ |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.h,v 2.52 2011/10/03 17:54:25 roberto Exp roberto $ | 2 | ** $Id: lgc.h,v 2.53 2012/01/23 20:29:12 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 | */ |
@@ -104,7 +104,7 @@ | |||
104 | 104 | ||
105 | 105 | ||
106 | #define luaC_condGC(L,c) \ | 106 | #define luaC_condGC(L,c) \ |
107 | {if (G(L)->GCdebt > 0) {c;}; condchangemem(L);} | 107 | {if (G(L)->GCdebt > 0 && G(L)->gcrunning) {c;}; condchangemem(L);} |
108 | #define luaC_checkGC(L) luaC_condGC(L, luaC_step(L);) | 108 | #define luaC_checkGC(L) luaC_condGC(L, luaC_step(L);) |
109 | 109 | ||
110 | 110 | ||