diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-06-29 12:06:44 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-06-29 12:06:44 -0300 |
commit | f96497397addca22f22a6ba6eeabc906be43f16b (patch) | |
tree | af8d27b9af36dfe0b0b6e0f765ea90b95b110efc /lgc.c | |
parent | 5a1c8d8ef343bf0157851a4832c2c937b812b64f (diff) | |
download | lua-f96497397addca22f22a6ba6eeabc906be43f16b.tar.gz lua-f96497397addca22f22a6ba6eeabc906be43f16b.tar.bz2 lua-f96497397addca22f22a6ba6eeabc906be43f16b.zip |
new type 'StackValue' for stack elements
(we may want to put extra info there in the future)
Diffstat (limited to 'lgc.c')
-rw-r--r-- | lgc.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 2.231 2017/06/09 16:48:44 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.232 2017/06/12 14:21:44 roberto Exp roberto $ |
3 | ** Garbage Collector | 3 | ** Garbage Collector |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -575,11 +575,11 @@ static int traversethread (global_State *g, lua_State *th) { | |||
575 | lua_assert(g->gcstate == GCSatomic || | 575 | lua_assert(g->gcstate == GCSatomic || |
576 | th->openupval == NULL || isintwups(th)); | 576 | th->openupval == NULL || isintwups(th)); |
577 | for (; o < th->top; o++) /* mark live elements in the stack */ | 577 | for (; o < th->top; o++) /* mark live elements in the stack */ |
578 | markvalue(g, o); | 578 | markvalue(g, s2v(o)); |
579 | if (g->gcstate == GCSatomic) { /* final traversal? */ | 579 | if (g->gcstate == GCSatomic) { /* final traversal? */ |
580 | StkId lim = th->stack + th->stacksize; /* real end of stack */ | 580 | StkId lim = th->stack + th->stacksize; /* real end of stack */ |
581 | for (; o < lim; o++) /* clear not-marked stack slice */ | 581 | for (; o < lim; o++) /* clear not-marked stack slice */ |
582 | setnilvalue(o); | 582 | setnilvalue(s2v(o)); |
583 | /* 'remarkupvals' may have removed thread from 'twups' list */ | 583 | /* 'remarkupvals' may have removed thread from 'twups' list */ |
584 | if (!isintwups(th) && th->openupval != NULL) { | 584 | if (!isintwups(th) && th->openupval != NULL) { |
585 | th->twups = g->twups; /* link it back to the list */ | 585 | th->twups = g->twups; /* link it back to the list */ |
@@ -872,8 +872,8 @@ static void GCTM (lua_State *L, int propagateerrors) { | |||
872 | g->gcrunning = running; /* restore state */ | 872 | g->gcrunning = running; /* restore state */ |
873 | if (status != LUA_OK && propagateerrors) { /* error while running __gc? */ | 873 | if (status != LUA_OK && propagateerrors) { /* error while running __gc? */ |
874 | if (status == LUA_ERRRUN) { /* is there an error object? */ | 874 | if (status == LUA_ERRRUN) { /* is there an error object? */ |
875 | const char *msg = (ttisstring(L->top - 1)) | 875 | const char *msg = (ttisstring(s2v(L->top - 1))) |
876 | ? svalue(L->top - 1) | 876 | ? svalue(s2v(L->top - 1)) |
877 | : "no message"; | 877 | : "no message"; |
878 | luaO_pushfstring(L, "error in __gc metamethod (%s)", msg); | 878 | luaO_pushfstring(L, "error in __gc metamethod (%s)", msg); |
879 | status = LUA_ERRGCMM; /* error in __gc metamethod */ | 879 | status = LUA_ERRGCMM; /* error in __gc metamethod */ |