diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-10-06 15:50:24 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-10-12 12:29:09 -0300 |
| commit | 5aa36e894f5a0348dfd19bd9cdcdd27ce8aa5f05 (patch) | |
| tree | da97440202c35ef78d3ad9e440cba959835d88d9 /lgc.c | |
| parent | 9ecd446141f572252a57cb33d2bba6aa00d96a55 (diff) | |
| download | lua-5aa36e894f5a0348dfd19bd9cdcdd27ce8aa5f05.tar.gz lua-5aa36e894f5a0348dfd19bd9cdcdd27ce8aa5f05.tar.bz2 lua-5aa36e894f5a0348dfd19bd9cdcdd27ce8aa5f05.zip | |
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.
Diffstat (limited to 'lgc.c')
| -rw-r--r-- | lgc.c | 5 |
1 files changed, 2 insertions, 3 deletions
| @@ -633,8 +633,7 @@ static int traversethread (global_State *g, lua_State *th) { | |||
| 633 | for (uv = th->openupval; uv != NULL; uv = uv->u.open.next) | 633 | for (uv = th->openupval; uv != NULL; uv = uv->u.open.next) |
| 634 | markobject(g, uv); /* open upvalues cannot be collected */ | 634 | markobject(g, uv); /* open upvalues cannot be collected */ |
| 635 | if (g->gcstate == GCSatomic) { /* final traversal? */ | 635 | if (g->gcstate == GCSatomic) { /* final traversal? */ |
| 636 | StkId lim = th->stack + th->stacksize; /* real end of stack */ | 636 | for (; o < th->stack_last; o++) /* clear not-marked stack slice */ |
| 637 | for (; o < lim; o++) /* clear not-marked stack slice */ | ||
| 638 | setnilvalue(s2v(o)); | 637 | setnilvalue(s2v(o)); |
| 639 | /* 'remarkupvals' may have removed thread from 'twups' list */ | 638 | /* 'remarkupvals' may have removed thread from 'twups' list */ |
| 640 | if (!isintwups(th) && th->openupval != NULL) { | 639 | if (!isintwups(th) && th->openupval != NULL) { |
| @@ -644,7 +643,7 @@ static int traversethread (global_State *g, lua_State *th) { | |||
| 644 | } | 643 | } |
| 645 | else if (!g->gcemergency) | 644 | else if (!g->gcemergency) |
| 646 | luaD_shrinkstack(th); /* do not change stack in emergency cycle */ | 645 | luaD_shrinkstack(th); /* do not change stack in emergency cycle */ |
| 647 | return 1 + th->stacksize; | 646 | return 1 + stacksize(th); |
| 648 | } | 647 | } |
| 649 | 648 | ||
| 650 | 649 | ||
