mirror of
https://github.com/nmap/nmap.git
synced 2025-12-15 04:09:01 +00:00
Update Lua to 5.4.7
This commit is contained in:
20
liblua/lgc.c
20
liblua/lgc.c
@@ -542,10 +542,12 @@ static void traversestrongtable (global_State *g, Table *h) {
|
||||
static lu_mem traversetable (global_State *g, Table *h) {
|
||||
const char *weakkey, *weakvalue;
|
||||
const TValue *mode = gfasttm(g, h->metatable, TM_MODE);
|
||||
TString *smode;
|
||||
markobjectN(g, h->metatable);
|
||||
if (mode && ttisstring(mode) && /* is there a weak mode? */
|
||||
(cast_void(weakkey = strchr(svalue(mode), 'k')),
|
||||
cast_void(weakvalue = strchr(svalue(mode), 'v')),
|
||||
if (mode && ttisshrstring(mode) && /* is there a weak mode? */
|
||||
(cast_void(smode = tsvalue(mode)),
|
||||
cast_void(weakkey = strchr(getshrstr(smode), 'k')),
|
||||
cast_void(weakvalue = strchr(getshrstr(smode), 'v')),
|
||||
(weakkey || weakvalue))) { /* is really weak? */
|
||||
if (!weakkey) /* strong keys? */
|
||||
traverseweakvalue(g, h);
|
||||
@@ -638,7 +640,9 @@ static int traversethread (global_State *g, lua_State *th) {
|
||||
for (uv = th->openupval; uv != NULL; uv = uv->u.open.next)
|
||||
markobject(g, uv); /* open upvalues cannot be collected */
|
||||
if (g->gcstate == GCSatomic) { /* final traversal? */
|
||||
for (; o < th->stack_last.p + EXTRA_STACK; o++)
|
||||
if (!g->gcemergency)
|
||||
luaD_shrinkstack(th); /* do not change stack in emergency cycle */
|
||||
for (o = th->top.p; o < th->stack_last.p + EXTRA_STACK; o++)
|
||||
setnilvalue(s2v(o)); /* clear dead stack slice */
|
||||
/* 'remarkupvals' may have removed thread from 'twups' list */
|
||||
if (!isintwups(th) && th->openupval != NULL) {
|
||||
@@ -646,8 +650,6 @@ static int traversethread (global_State *g, lua_State *th) {
|
||||
g->twups = th;
|
||||
}
|
||||
}
|
||||
else if (!g->gcemergency)
|
||||
luaD_shrinkstack(th); /* do not change stack in emergency cycle */
|
||||
return 1 + stacksize(th);
|
||||
}
|
||||
|
||||
@@ -1409,7 +1411,7 @@ static void stepgenfull (lua_State *L, global_State *g) {
|
||||
setminordebt(g);
|
||||
}
|
||||
else { /* another bad collection; stay in incremental mode */
|
||||
g->GCestimate = gettotalbytes(g); /* first estimate */;
|
||||
g->GCestimate = gettotalbytes(g); /* first estimate */
|
||||
entersweep(L);
|
||||
luaC_runtilstate(L, bitmask(GCSpause)); /* finish collection */
|
||||
setpause(g);
|
||||
@@ -1604,7 +1606,7 @@ static lu_mem singlestep (lua_State *L) {
|
||||
case GCSenteratomic: {
|
||||
work = atomic(L); /* work is what was traversed by 'atomic' */
|
||||
entersweep(L);
|
||||
g->GCestimate = gettotalbytes(g); /* first estimate */;
|
||||
g->GCestimate = gettotalbytes(g); /* first estimate */
|
||||
break;
|
||||
}
|
||||
case GCSswpallgc: { /* sweep "regular" objects */
|
||||
@@ -1710,6 +1712,8 @@ static void fullinc (lua_State *L, global_State *g) {
|
||||
entersweep(L); /* sweep everything to turn them back to white */
|
||||
/* finish any pending sweep phase to start a new cycle */
|
||||
luaC_runtilstate(L, bitmask(GCSpause));
|
||||
luaC_runtilstate(L, bitmask(GCSpropagate)); /* start new cycle */
|
||||
g->gcstate = GCSenteratomic; /* go straight to atomic phase */
|
||||
luaC_runtilstate(L, bitmask(GCScallfin)); /* run up to finalizers */
|
||||
/* estimate must be correct after a full GC cycle */
|
||||
lua_assert(g->GCestimate == gettotalbytes(g));
|
||||
|
||||
Reference in New Issue
Block a user