diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-11-23 17:29:03 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-11-23 17:29:03 -0300 |
| commit | ec61be9a7e828bfa366a35658b90f53b1ce39478 (patch) | |
| tree | 58ca7e26ac48fcbf26136efc2c72e30980f87e40 | |
| parent | f356d5acdd9d8e8f7e9d1d7632c4657f945ff4f4 (diff) | |
| download | lua-ec61be9a7e828bfa366a35658b90f53b1ce39478.tar.gz lua-ec61be9a7e828bfa366a35658b90f53b1ce39478.tar.bz2 lua-ec61be9a7e828bfa366a35658b90f53b1ce39478.zip | |
'l_mem' renamed to 'l_obj' to count objects
| -rw-r--r-- | lapi.c | 6 | ||||
| -rw-r--r-- | lgc.c | 50 | ||||
| -rw-r--r-- | llimits.h | 14 | ||||
| -rw-r--r-- | lstate.c | 4 | ||||
| -rw-r--r-- | lstate.h | 10 | ||||
| -rw-r--r-- | ltests.c | 16 |
6 files changed, 51 insertions, 49 deletions
| @@ -1163,7 +1163,7 @@ LUA_API int lua_gc (lua_State *L, int what, ...) { | |||
| 1163 | } | 1163 | } |
| 1164 | case LUA_GCSTEP: { | 1164 | case LUA_GCSTEP: { |
| 1165 | int data = va_arg(argp, int); | 1165 | int data = va_arg(argp, int); |
| 1166 | l_mem debt = 1; /* =1 to signal that it did an actual step */ | 1166 | l_obj debt = 1; /* =1 to signal that it did an actual step */ |
| 1167 | lu_byte oldstp = g->gcstp; | 1167 | lu_byte oldstp = g->gcstp; |
| 1168 | g->gcstp = 0; /* allow GC to run (GCSTPGC must be zero here) */ | 1168 | g->gcstp = 0; /* allow GC to run (GCSTPGC must be zero here) */ |
| 1169 | if (data == 0) { | 1169 | if (data == 0) { |
| @@ -1217,8 +1217,8 @@ LUA_API int lua_gc (lua_State *L, int what, ...) { | |||
| 1217 | if (stepmul != 0) | 1217 | if (stepmul != 0) |
| 1218 | setgcparam(g->gcstepmul, stepmul); | 1218 | setgcparam(g->gcstepmul, stepmul); |
| 1219 | if (stepsize != 0) | 1219 | if (stepsize != 0) |
| 1220 | g->gcstepsize = (stepsize <= log2maxs(l_mem)) ? stepsize | 1220 | g->gcstepsize = (stepsize <= log2maxs(l_obj)) ? stepsize |
| 1221 | : log2maxs(l_mem); | 1221 | : log2maxs(l_obj); |
| 1222 | luaC_changemode(L, KGC_INC); | 1222 | luaC_changemode(L, KGC_INC); |
| 1223 | break; | 1223 | break; |
| 1224 | } | 1224 | } |
| @@ -93,7 +93,7 @@ | |||
| 93 | #define markobjectN(g,t) { if (t) markobject(g,t); } | 93 | #define markobjectN(g,t) { if (t) markobject(g,t); } |
| 94 | 94 | ||
| 95 | static void reallymarkobject (global_State *g, GCObject *o); | 95 | static void reallymarkobject (global_State *g, GCObject *o); |
| 96 | static l_mem atomic (lua_State *L); | 96 | static l_obj atomic (lua_State *L); |
| 97 | static void entersweep (lua_State *L); | 97 | static void entersweep (lua_State *L); |
| 98 | 98 | ||
| 99 | 99 | ||
| @@ -335,9 +335,9 @@ static void markmt (global_State *g) { | |||
| 335 | /* | 335 | /* |
| 336 | ** mark all objects in list of being-finalized | 336 | ** mark all objects in list of being-finalized |
| 337 | */ | 337 | */ |
| 338 | static l_mem markbeingfnz (global_State *g) { | 338 | static l_obj markbeingfnz (global_State *g) { |
| 339 | GCObject *o; | 339 | GCObject *o; |
| 340 | l_mem count = 0; | 340 | l_obj count = 0; |
| 341 | for (o = g->tobefnz; o != NULL; o = o->next) { | 341 | for (o = g->tobefnz; o != NULL; o = o->next) { |
| 342 | count++; | 342 | count++; |
| 343 | markobject(g, o); | 343 | markobject(g, o); |
| @@ -357,8 +357,8 @@ static l_mem markbeingfnz (global_State *g) { | |||
| 357 | ** upvalues, as they have nothing to be checked. (If the thread gets an | 357 | ** upvalues, as they have nothing to be checked. (If the thread gets an |
| 358 | ** upvalue later, it will be linked in the list again.) | 358 | ** upvalue later, it will be linked in the list again.) |
| 359 | */ | 359 | */ |
| 360 | static l_mem remarkupvals (global_State *g) { | 360 | static l_obj remarkupvals (global_State *g) { |
| 361 | l_mem work = 0; | 361 | l_obj work = 0; |
| 362 | lua_State *thread; | 362 | lua_State *thread; |
| 363 | lua_State **p = &g->twups; | 363 | lua_State **p = &g->twups; |
| 364 | while ((thread = *p) != NULL) { | 364 | while ((thread = *p) != NULL) { |
| @@ -662,8 +662,8 @@ static void propagatemark (global_State *g) { | |||
| 662 | } | 662 | } |
| 663 | 663 | ||
| 664 | 664 | ||
| 665 | static l_mem propagateall (global_State *g) { | 665 | static l_obj propagateall (global_State *g) { |
| 666 | l_mem work = 0; | 666 | l_obj work = 0; |
| 667 | while (g->gray) { | 667 | while (g->gray) { |
| 668 | propagatemark(g); | 668 | propagatemark(g); |
| 669 | work++; | 669 | work++; |
| @@ -678,9 +678,9 @@ static l_mem propagateall (global_State *g) { | |||
| 678 | ** inverts the direction of the traversals, trying to speed up | 678 | ** inverts the direction of the traversals, trying to speed up |
| 679 | ** convergence on chains in the same table. | 679 | ** convergence on chains in the same table. |
| 680 | */ | 680 | */ |
| 681 | static l_mem convergeephemerons (global_State *g) { | 681 | static l_obj convergeephemerons (global_State *g) { |
| 682 | int changed; | 682 | int changed; |
| 683 | l_mem work = 0; | 683 | l_obj work = 0; |
| 684 | int dir = 0; | 684 | int dir = 0; |
| 685 | do { | 685 | do { |
| 686 | GCObject *w; | 686 | GCObject *w; |
| @@ -715,8 +715,8 @@ static l_mem convergeephemerons (global_State *g) { | |||
| 715 | /* | 715 | /* |
| 716 | ** clear entries with unmarked keys from all weaktables in list 'l' | 716 | ** clear entries with unmarked keys from all weaktables in list 'l' |
| 717 | */ | 717 | */ |
| 718 | static l_mem clearbykeys (global_State *g, GCObject *l) { | 718 | static l_obj clearbykeys (global_State *g, GCObject *l) { |
| 719 | l_mem work = 0; | 719 | l_obj work = 0; |
| 720 | for (; l; l = gco2t(l)->gclist) { | 720 | for (; l; l = gco2t(l)->gclist) { |
| 721 | Table *h = gco2t(l); | 721 | Table *h = gco2t(l); |
| 722 | Node *limit = gnodelast(h); | 722 | Node *limit = gnodelast(h); |
| @@ -737,8 +737,8 @@ static l_mem clearbykeys (global_State *g, GCObject *l) { | |||
| 737 | ** clear entries with unmarked values from all weaktables in list 'l' up | 737 | ** clear entries with unmarked values from all weaktables in list 'l' up |
| 738 | ** to element 'f' | 738 | ** to element 'f' |
| 739 | */ | 739 | */ |
| 740 | static l_mem clearbyvalues (global_State *g, GCObject *l, GCObject *f) { | 740 | static l_obj clearbyvalues (global_State *g, GCObject *l, GCObject *f) { |
| 741 | l_mem work = 0; | 741 | l_obj work = 0; |
| 742 | for (; l != f; l = gco2t(l)->gclist) { | 742 | for (; l != f; l = gco2t(l)->gclist) { |
| 743 | Table *h = gco2t(l); | 743 | Table *h = gco2t(l); |
| 744 | Node *n, *limit = gnodelast(h); | 744 | Node *n, *limit = gnodelast(h); |
| @@ -1054,7 +1054,7 @@ void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) { | |||
| 1054 | static void setpause (global_State *g) { | 1054 | static void setpause (global_State *g) { |
| 1055 | unsigned int pause = getgcparam(g->gcpause); | 1055 | unsigned int pause = getgcparam(g->gcpause); |
| 1056 | lu_mem threshold = g->marked / 8 * pause / 12; | 1056 | lu_mem threshold = g->marked / 8 * pause / 12; |
| 1057 | l_mem debt = gettotalobjs(g) - threshold; | 1057 | l_obj debt = gettotalobjs(g) - threshold; |
| 1058 | if (debt > 0) debt = 0; | 1058 | if (debt > 0) debt = 0; |
| 1059 | luaE_setdebt(g, debt); | 1059 | luaE_setdebt(g, debt); |
| 1060 | } | 1060 | } |
| @@ -1306,7 +1306,7 @@ static void atomic2gen (lua_State *L, global_State *g) { | |||
| 1306 | ** total number of objects grows 'genminormul'%. | 1306 | ** total number of objects grows 'genminormul'%. |
| 1307 | */ | 1307 | */ |
| 1308 | static void setminordebt (global_State *g) { | 1308 | static void setminordebt (global_State *g) { |
| 1309 | luaE_setdebt(g, -(cast(l_mem, (gettotalobjs(g) / 100)) * g->genminormul)); | 1309 | luaE_setdebt(g, -(cast(l_obj, (gettotalobjs(g) / 100)) * g->genminormul)); |
| 1310 | } | 1310 | } |
| 1311 | 1311 | ||
| 1312 | 1312 | ||
| @@ -1431,8 +1431,8 @@ static void genstep (lua_State *L, global_State *g) { | |||
| 1431 | if (g->lastatomic != 0) /* last collection was a bad one? */ | 1431 | if (g->lastatomic != 0) /* last collection was a bad one? */ |
| 1432 | stepgenfull(L, g); /* do a full step */ | 1432 | stepgenfull(L, g); /* do a full step */ |
| 1433 | else { | 1433 | else { |
| 1434 | l_mem majorbase = g->GCestimate; /* objects after last major collection */ | 1434 | l_obj majorbase = g->GCestimate; /* objects after last major collection */ |
| 1435 | l_mem majorinc = (majorbase / 100) * getgcparam(g->genmajormul); | 1435 | l_obj majorinc = (majorbase / 100) * getgcparam(g->genmajormul); |
| 1436 | if (g->GCdebt > 0 && gettotalobjs(g) > majorbase + majorinc) { | 1436 | if (g->GCdebt > 0 && gettotalobjs(g) > majorbase + majorinc) { |
| 1437 | g->marked = 0; | 1437 | g->marked = 0; |
| 1438 | fullgen(L, g); /* do a major collection */ | 1438 | fullgen(L, g); /* do a major collection */ |
| @@ -1512,8 +1512,8 @@ void luaC_freeallobjects (lua_State *L) { | |||
| 1512 | } | 1512 | } |
| 1513 | 1513 | ||
| 1514 | 1514 | ||
| 1515 | static l_mem atomic (lua_State *L) { | 1515 | static l_obj atomic (lua_State *L) { |
| 1516 | l_mem work = 0; | 1516 | l_obj work = 0; |
| 1517 | global_State *g = G(L); | 1517 | global_State *g = G(L); |
| 1518 | GCObject *origweak, *origall; | 1518 | GCObject *origweak, *origall; |
| 1519 | GCObject *grayagain = g->grayagain; /* save original list */ | 1519 | GCObject *grayagain = g->grayagain; /* save original list */ |
| @@ -1558,7 +1558,7 @@ static l_mem atomic (lua_State *L) { | |||
| 1558 | static void sweepstep (lua_State *L, global_State *g, | 1558 | static void sweepstep (lua_State *L, global_State *g, |
| 1559 | int nextstate, GCObject **nextlist) { | 1559 | int nextstate, GCObject **nextlist) { |
| 1560 | if (g->sweepgc) { | 1560 | if (g->sweepgc) { |
| 1561 | l_mem olddebt = g->GCdebt; | 1561 | l_obj olddebt = g->GCdebt; |
| 1562 | g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX); | 1562 | g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX); |
| 1563 | g->GCestimate += g->GCdebt - olddebt; /* update estimate */ | 1563 | g->GCestimate += g->GCdebt - olddebt; /* update estimate */ |
| 1564 | } | 1564 | } |
| @@ -1569,9 +1569,9 @@ static void sweepstep (lua_State *L, global_State *g, | |||
| 1569 | } | 1569 | } |
| 1570 | 1570 | ||
| 1571 | 1571 | ||
| 1572 | static l_mem singlestep (lua_State *L) { | 1572 | static l_obj singlestep (lua_State *L) { |
| 1573 | global_State *g = G(L); | 1573 | global_State *g = G(L); |
| 1574 | l_mem work; | 1574 | l_obj work; |
| 1575 | lua_assert(!g->gcstopem); /* collector is not reentrant */ | 1575 | lua_assert(!g->gcstopem); /* collector is not reentrant */ |
| 1576 | g->gcstopem = 1; /* no emergency collections while collecting */ | 1576 | g->gcstopem = 1; /* no emergency collections while collecting */ |
| 1577 | switch (g->gcstate) { | 1577 | switch (g->gcstate) { |
| @@ -1658,10 +1658,10 @@ void luaC_runtilstate (lua_State *L, int statesmask) { | |||
| 1658 | */ | 1658 | */ |
| 1659 | static void incstep (lua_State *L, global_State *g) { | 1659 | static void incstep (lua_State *L, global_State *g) { |
| 1660 | int stepmul = (getgcparam(g->gcstepmul) | 1); /* avoid division by 0 */ | 1660 | int stepmul = (getgcparam(g->gcstepmul) | 1); /* avoid division by 0 */ |
| 1661 | l_mem debt = (g->GCdebt / 100) * stepmul; | 1661 | l_obj debt = (g->GCdebt / 100) * stepmul; |
| 1662 | l_mem stepsize = cast(l_mem, 1) << g->gcstepsize; | 1662 | l_obj stepsize = cast(l_obj, 1) << g->gcstepsize; |
| 1663 | do { /* repeat until pause or enough "credit" (negative debt) */ | 1663 | do { /* repeat until pause or enough "credit" (negative debt) */ |
| 1664 | l_mem work = singlestep(L); /* perform one single step */ | 1664 | l_obj work = singlestep(L); /* perform one single step */ |
| 1665 | debt -= work; | 1665 | debt -= work; |
| 1666 | } while (debt > -stepsize && g->gcstate != GCSpause); | 1666 | } while (debt > -stepsize && g->gcstate != GCSpause); |
| 1667 | if (g->gcstate == GCSpause) | 1667 | if (g->gcstate == GCSpause) |
| @@ -16,19 +16,21 @@ | |||
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | /* | 18 | /* |
| 19 | ** 'lu_mem' and 'l_mem' are unsigned/signed integers big enough to count | 19 | ** 'lu_mem' is an unsigned integer big enough to count the total memory |
| 20 | ** the total memory used by Lua (in bytes). Usually, 'size_t' and | 20 | ** used by Lua (in bytes). 'l_obj' is a signed integer big enough to |
| 21 | ** count the total number of objects used by Lua. (It is negative due | ||
| 22 | ** to the use of debt in several computations.) Usually, 'size_t' and | ||
| 21 | ** 'ptrdiff_t' should work, but we use 'long' for 16-bit machines. | 23 | ** 'ptrdiff_t' should work, but we use 'long' for 16-bit machines. |
| 22 | */ | 24 | */ |
| 23 | #if defined(LUAI_MEM) /* { external definitions? */ | 25 | #if defined(LUAI_MEM) /* { external definitions? */ |
| 24 | typedef LUAI_UMEM lu_mem; | 26 | typedef LUAI_UMEM lu_mem; |
| 25 | typedef LUAI_MEM l_mem; | 27 | typedef LUAI_MEM l_obj; |
| 26 | #elif LUAI_IS32INT /* }{ */ | 28 | #elif LUAI_IS32INT /* }{ */ |
| 27 | typedef size_t lu_mem; | 29 | typedef size_t lu_mem; |
| 28 | typedef ptrdiff_t l_mem; | 30 | typedef ptrdiff_t l_obj; |
| 29 | #else /* 16-bit ints */ /* }{ */ | 31 | #else /* 16-bit ints */ /* }{ */ |
| 30 | typedef unsigned long lu_mem; | 32 | typedef unsigned long lu_mem; |
| 31 | typedef long l_mem; | 33 | typedef long l_obj; |
| 32 | #endif /* } */ | 34 | #endif /* } */ |
| 33 | 35 | ||
| 34 | 36 | ||
| @@ -47,7 +49,7 @@ typedef signed char ls_byte; | |||
| 47 | 49 | ||
| 48 | #define MAX_LUMEM ((lu_mem)(~(lu_mem)0)) | 50 | #define MAX_LUMEM ((lu_mem)(~(lu_mem)0)) |
| 49 | 51 | ||
| 50 | #define MAX_LMEM ((l_mem)(MAX_LUMEM >> 1)) | 52 | #define MAX_LMEM ((l_obj)(MAX_LUMEM >> 1)) |
| 51 | 53 | ||
| 52 | 54 | ||
| 53 | #define MAX_INT INT_MAX /* maximum value of an int */ | 55 | #define MAX_INT INT_MAX /* maximum value of an int */ |
| @@ -86,8 +86,8 @@ static unsigned int luai_makeseed (lua_State *L) { | |||
| 86 | ** set GCdebt to a new value keeping the value (totalobjs + GCdebt) | 86 | ** set GCdebt to a new value keeping the value (totalobjs + GCdebt) |
| 87 | ** invariant (and avoiding underflows in 'totalobjs') | 87 | ** invariant (and avoiding underflows in 'totalobjs') |
| 88 | */ | 88 | */ |
| 89 | void luaE_setdebt (global_State *g, l_mem debt) { | 89 | void luaE_setdebt (global_State *g, l_obj debt) { |
| 90 | l_mem tb = gettotalobjs(g); | 90 | l_obj tb = gettotalobjs(g); |
| 91 | lua_assert(tb > 0); | 91 | lua_assert(tb > 0); |
| 92 | if (debt < tb - MAX_LMEM) | 92 | if (debt < tb - MAX_LMEM) |
| 93 | debt = tb - MAX_LMEM; /* will make 'totalobjs == MAX_LMEM' */ | 93 | debt = tb - MAX_LMEM; /* will make 'totalobjs == MAX_LMEM' */ |
| @@ -249,10 +249,10 @@ typedef struct CallInfo { | |||
| 249 | typedef struct global_State { | 249 | typedef struct global_State { |
| 250 | lua_Alloc frealloc; /* function to reallocate memory */ | 250 | lua_Alloc frealloc; /* function to reallocate memory */ |
| 251 | void *ud; /* auxiliary data to 'frealloc' */ | 251 | void *ud; /* auxiliary data to 'frealloc' */ |
| 252 | l_mem totalbytes; /* number of bytes currently allocated */ | 252 | lu_mem totalbytes; /* number of bytes currently allocated */ |
| 253 | l_mem totalobjs; /* total number of objects allocated - GCdebt */ | 253 | l_obj totalobjs; /* total number of objects allocated - GCdebt */ |
| 254 | l_mem GCdebt; /* bytes allocated not yet compensated by the collector */ | 254 | l_obj GCdebt; /* bytes allocated not yet compensated by the collector */ |
| 255 | lu_mem marked; /* number of objects marked in a GC cycle */ | 255 | l_obj marked; /* number of objects marked in a GC cycle */ |
| 256 | lu_mem GCestimate; /* an estimate of the non-garbage memory in use */ | 256 | lu_mem GCestimate; /* an estimate of the non-garbage memory in use */ |
| 257 | lu_mem lastatomic; /* see function 'genstep' in file 'lgc.c' */ | 257 | lu_mem lastatomic; /* see function 'genstep' in file 'lgc.c' */ |
| 258 | stringtable strt; /* hash table for strings */ | 258 | stringtable strt; /* hash table for strings */ |
| @@ -391,7 +391,7 @@ union GCUnion { | |||
| 391 | #define gettotalobjs(g) ((g)->totalobjs + (g)->GCdebt) | 391 | #define gettotalobjs(g) ((g)->totalobjs + (g)->GCdebt) |
| 392 | 392 | ||
| 393 | 393 | ||
| 394 | LUAI_FUNC void luaE_setdebt (global_State *g, l_mem debt); | 394 | LUAI_FUNC void luaE_setdebt (global_State *g, l_obj debt); |
| 395 | LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); | 395 | LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); |
| 396 | LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L); | 396 | LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L); |
| 397 | LUAI_FUNC void luaE_freeCI (lua_State *L); | 397 | LUAI_FUNC void luaE_freeCI (lua_State *L); |
| @@ -531,7 +531,7 @@ static void checkobject (global_State *g, GCObject *o, int maybedead, | |||
| 531 | } | 531 | } |
| 532 | 532 | ||
| 533 | 533 | ||
| 534 | static lu_mem checkgraylist (global_State *g, GCObject *o) { | 534 | static l_obj checkgraylist (global_State *g, GCObject *o) { |
| 535 | int total = 0; /* count number of elements in the list */ | 535 | int total = 0; /* count number of elements in the list */ |
| 536 | cast_void(g); /* better to keep it if we need to print an object */ | 536 | cast_void(g); /* better to keep it if we need to print an object */ |
| 537 | while (o) { | 537 | while (o) { |
| @@ -560,7 +560,7 @@ static lu_mem checkgraylist (global_State *g, GCObject *o) { | |||
| 560 | /* | 560 | /* |
| 561 | ** Check objects in gray lists. | 561 | ** Check objects in gray lists. |
| 562 | */ | 562 | */ |
| 563 | static lu_mem checkgrays (global_State *g) { | 563 | static l_obj checkgrays (global_State *g) { |
| 564 | int total = 0; /* count number of elements in all lists */ | 564 | int total = 0; /* count number of elements in all lists */ |
| 565 | if (!keepinvariant(g)) return total; | 565 | if (!keepinvariant(g)) return total; |
| 566 | total += checkgraylist(g, g->gray); | 566 | total += checkgraylist(g, g->gray); |
| @@ -577,7 +577,7 @@ static lu_mem checkgrays (global_State *g) { | |||
| 577 | ** 'count' and check its TESTBIT. (It must have been previously set by | 577 | ** 'count' and check its TESTBIT. (It must have been previously set by |
| 578 | ** 'checkgraylist'.) | 578 | ** 'checkgraylist'.) |
| 579 | */ | 579 | */ |
| 580 | static void incifingray (global_State *g, GCObject *o, lu_mem *count) { | 580 | static void incifingray (global_State *g, GCObject *o, l_obj *count) { |
| 581 | if (!keepinvariant(g)) | 581 | if (!keepinvariant(g)) |
| 582 | return; /* gray lists not being kept in these phases */ | 582 | return; /* gray lists not being kept in these phases */ |
| 583 | if (o->tt == LUA_VUPVAL) { | 583 | if (o->tt == LUA_VUPVAL) { |
| @@ -594,10 +594,10 @@ static void incifingray (global_State *g, GCObject *o, lu_mem *count) { | |||
| 594 | } | 594 | } |
| 595 | 595 | ||
| 596 | 596 | ||
| 597 | static lu_mem checklist (global_State *g, int maybedead, int tof, | 597 | static l_obj checklist (global_State *g, int maybedead, int tof, |
| 598 | GCObject *newl, GCObject *survival, GCObject *old, GCObject *reallyold) { | 598 | GCObject *newl, GCObject *survival, GCObject *old, GCObject *reallyold) { |
| 599 | GCObject *o; | 599 | GCObject *o; |
| 600 | lu_mem total = 0; /* number of object that should be in gray lists */ | 600 | l_obj total = 0; /* number of object that should be in gray lists */ |
| 601 | for (o = newl; o != survival; o = o->next) { | 601 | for (o = newl; o != survival; o = o->next) { |
| 602 | checkobject(g, o, maybedead, G_NEW); | 602 | checkobject(g, o, maybedead, G_NEW); |
| 603 | incifingray(g, o, &total); | 603 | incifingray(g, o, &total); |
| @@ -626,8 +626,8 @@ int lua_checkmemory (lua_State *L) { | |||
| 626 | global_State *g = G(L); | 626 | global_State *g = G(L); |
| 627 | GCObject *o; | 627 | GCObject *o; |
| 628 | int maybedead; | 628 | int maybedead; |
| 629 | lu_mem totalin; /* total of objects that are in gray lists */ | 629 | l_obj totalin; /* total of objects that are in gray lists */ |
| 630 | lu_mem totalshould; /* total of objects that should be in gray lists */ | 630 | l_obj totalshould; /* total of objects that should be in gray lists */ |
| 631 | if (keepinvariant(g)) { | 631 | if (keepinvariant(g)) { |
| 632 | assert(!iswhite(g->mainthread)); | 632 | assert(!iswhite(g->mainthread)); |
| 633 | assert(!iswhite(gcvalue(&g->l_registry))); | 633 | assert(!iswhite(gcvalue(&g->l_registry))); |
| @@ -1033,7 +1033,7 @@ static int query_inc (lua_State *L) { | |||
| 1033 | lua_pushinteger(L, g->GCdebt); | 1033 | lua_pushinteger(L, g->GCdebt); |
| 1034 | lua_pushinteger(L, getgcparam(g->gcpause)); | 1034 | lua_pushinteger(L, getgcparam(g->gcpause)); |
| 1035 | lua_pushinteger(L, getgcparam(g->gcstepmul)); | 1035 | lua_pushinteger(L, getgcparam(g->gcstepmul)); |
| 1036 | lua_pushinteger(L, cast(l_mem, 1) << g->gcstepsize); | 1036 | lua_pushinteger(L, cast(l_obj, 1) << g->gcstepsize); |
| 1037 | return 5; | 1037 | return 5; |
| 1038 | } | 1038 | } |
| 1039 | 1039 | ||
