diff options
Diffstat (limited to '')
-rw-r--r-- | src/lib_base.c | 4 | ||||
-rw-r--r-- | src/lj_api.c | 3 | ||||
-rw-r--r-- | src/lua.h | 1 |
3 files changed, 6 insertions, 2 deletions
diff --git a/src/lib_base.c b/src/lib_base.c index 887fea7a..ca268b1d 100644 --- a/src/lib_base.c +++ b/src/lib_base.c | |||
@@ -435,13 +435,13 @@ LJLIB_CF(gcinfo) | |||
435 | LJLIB_CF(collectgarbage) | 435 | LJLIB_CF(collectgarbage) |
436 | { | 436 | { |
437 | int opt = lj_lib_checkopt(L, 1, LUA_GCCOLLECT, /* ORDER LUA_GC* */ | 437 | int opt = lj_lib_checkopt(L, 1, LUA_GCCOLLECT, /* ORDER LUA_GC* */ |
438 | "\4stop\7restart\7collect\5count\1\377\4step\10setpause\12setstepmul"); | 438 | "\4stop\7restart\7collect\5count\1\377\4step\10setpause\12setstepmul\1\377\11isrunning"); |
439 | int32_t data = lj_lib_optint(L, 2, 0); | 439 | int32_t data = lj_lib_optint(L, 2, 0); |
440 | if (opt == LUA_GCCOUNT) { | 440 | if (opt == LUA_GCCOUNT) { |
441 | setnumV(L->top, (lua_Number)G(L)->gc.total/1024.0); | 441 | setnumV(L->top, (lua_Number)G(L)->gc.total/1024.0); |
442 | } else { | 442 | } else { |
443 | int res = lua_gc(L, opt, data); | 443 | int res = lua_gc(L, opt, data); |
444 | if (opt == LUA_GCSTEP) | 444 | if (opt == LUA_GCSTEP || opt == LUA_GCISRUNNING) |
445 | setboolV(L->top, res); | 445 | setboolV(L->top, res); |
446 | else | 446 | else |
447 | setintV(L->top, res); | 447 | setintV(L->top, res); |
diff --git a/src/lj_api.c b/src/lj_api.c index 1f09284f..042b0d9c 100644 --- a/src/lj_api.c +++ b/src/lj_api.c | |||
@@ -1188,6 +1188,9 @@ LUA_API int lua_gc(lua_State *L, int what, int data) | |||
1188 | res = (int)(g->gc.stepmul); | 1188 | res = (int)(g->gc.stepmul); |
1189 | g->gc.stepmul = (MSize)data; | 1189 | g->gc.stepmul = (MSize)data; |
1190 | break; | 1190 | break; |
1191 | case LUA_GCISRUNNING: | ||
1192 | res = (g->gc.threshold != LJ_MAX_MEM); | ||
1193 | break; | ||
1191 | default: | 1194 | default: |
1192 | res = -1; /* Invalid option. */ | 1195 | res = -1; /* Invalid option. */ |
1193 | } | 1196 | } |
@@ -226,6 +226,7 @@ LUA_API int (lua_status) (lua_State *L); | |||
226 | #define LUA_GCSTEP 5 | 226 | #define LUA_GCSTEP 5 |
227 | #define LUA_GCSETPAUSE 6 | 227 | #define LUA_GCSETPAUSE 6 |
228 | #define LUA_GCSETSTEPMUL 7 | 228 | #define LUA_GCSETSTEPMUL 7 |
229 | #define LUA_GCISRUNNING 9 | ||
229 | 230 | ||
230 | LUA_API int (lua_gc) (lua_State *L, int what, int data); | 231 | LUA_API int (lua_gc) (lua_State *L, int what, int data); |
231 | 232 | ||