From 5aa36e894f5a0348dfd19bd9cdcdd27ce8aa5f05 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 6 Oct 2020 15:50:24 -0300 Subject: No more field 'lua_State.stacksize' The stack size is derived from 'stack_last', when needed. Moreover, the handling of stack sizes is more consistent, always excluding the extra space except when allocating/deallocating the array. --- lgc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lgc.c') diff --git a/lgc.c b/lgc.c index 4a7bcaed..3b8d0ed6 100644 --- a/lgc.c +++ b/lgc.c @@ -633,8 +633,7 @@ 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? */ - StkId lim = th->stack + th->stacksize; /* real end of stack */ - for (; o < lim; o++) /* clear not-marked stack slice */ + for (; o < th->stack_last; o++) /* clear not-marked stack slice */ setnilvalue(s2v(o)); /* 'remarkupvals' may have removed thread from 'twups' list */ if (!isintwups(th) && th->openupval != NULL) { @@ -644,7 +643,7 @@ static int traversethread (global_State *g, lua_State *th) { } else if (!g->gcemergency) luaD_shrinkstack(th); /* do not change stack in emergency cycle */ - return 1 + th->stacksize; + return 1 + stacksize(th); } -- cgit v1.2.3-55-g6feb