diff options
Diffstat (limited to 'lgc.c')
-rw-r--r-- | lgc.c | 50 |
1 files changed, 25 insertions, 25 deletions
@@ -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) |