diff options
Diffstat (limited to 'lgc.c')
-rw-r--r-- | lgc.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -301,7 +301,7 @@ static void reallymarkobject (global_State *g, GCObject *o) { | |||
301 | set2gray(uv); /* open upvalues are kept gray */ | 301 | set2gray(uv); /* open upvalues are kept gray */ |
302 | else | 302 | else |
303 | set2black(uv); /* closed upvalues are visited here */ | 303 | set2black(uv); /* closed upvalues are visited here */ |
304 | markvalue(g, uv->v); /* mark its content */ | 304 | markvalue(g, uv->v.p); /* mark its content */ |
305 | break; | 305 | break; |
306 | } | 306 | } |
307 | case LUA_VUSERDATA: { | 307 | case LUA_VUSERDATA: { |
@@ -376,7 +376,7 @@ static int remarkupvals (global_State *g) { | |||
376 | work++; | 376 | work++; |
377 | if (!iswhite(uv)) { /* upvalue already visited? */ | 377 | if (!iswhite(uv)) { /* upvalue already visited? */ |
378 | lua_assert(upisopen(uv) && isgray(uv)); | 378 | lua_assert(upisopen(uv) && isgray(uv)); |
379 | markvalue(g, uv->v); /* mark its value */ | 379 | markvalue(g, uv->v.p); /* mark its value */ |
380 | } | 380 | } |
381 | } | 381 | } |
382 | } | 382 | } |
@@ -620,19 +620,19 @@ static int traverseLclosure (global_State *g, LClosure *cl) { | |||
620 | */ | 620 | */ |
621 | static int traversethread (global_State *g, lua_State *th) { | 621 | static int traversethread (global_State *g, lua_State *th) { |
622 | UpVal *uv; | 622 | UpVal *uv; |
623 | StkId o = th->stack; | 623 | StkId o = th->stack.p; |
624 | if (isold(th) || g->gcstate == GCSpropagate) | 624 | if (isold(th) || g->gcstate == GCSpropagate) |
625 | linkgclist(th, g->grayagain); /* insert into 'grayagain' list */ | 625 | linkgclist(th, g->grayagain); /* insert into 'grayagain' list */ |
626 | if (o == NULL) | 626 | if (o == NULL) |
627 | return 1; /* stack not completely built yet */ | 627 | return 1; /* stack not completely built yet */ |
628 | lua_assert(g->gcstate == GCSatomic || | 628 | lua_assert(g->gcstate == GCSatomic || |
629 | th->openupval == NULL || isintwups(th)); | 629 | th->openupval == NULL || isintwups(th)); |
630 | for (; o < th->top; o++) /* mark live elements in the stack */ | 630 | for (; o < th->top.p; o++) /* mark live elements in the stack */ |
631 | markvalue(g, s2v(o)); | 631 | markvalue(g, s2v(o)); |
632 | for (uv = th->openupval; uv != NULL; uv = uv->u.open.next) | 632 | for (uv = th->openupval; uv != NULL; uv = uv->u.open.next) |
633 | markobject(g, uv); /* open upvalues cannot be collected */ | 633 | markobject(g, uv); /* open upvalues cannot be collected */ |
634 | if (g->gcstate == GCSatomic) { /* final traversal? */ | 634 | if (g->gcstate == GCSatomic) { /* final traversal? */ |
635 | for (; o < th->stack_last + EXTRA_STACK; o++) | 635 | for (; o < th->stack_last.p + EXTRA_STACK; o++) |
636 | setnilvalue(s2v(o)); /* clear dead stack slice */ | 636 | setnilvalue(s2v(o)); /* clear dead stack slice */ |
637 | /* 'remarkupvals' may have removed thread from 'twups' list */ | 637 | /* 'remarkupvals' may have removed thread from 'twups' list */ |
638 | if (!isintwups(th) && th->openupval != NULL) { | 638 | if (!isintwups(th) && th->openupval != NULL) { |
@@ -892,7 +892,7 @@ static GCObject *udata2finalize (global_State *g) { | |||
892 | 892 | ||
893 | static void dothecall (lua_State *L, void *ud) { | 893 | static void dothecall (lua_State *L, void *ud) { |
894 | UNUSED(ud); | 894 | UNUSED(ud); |
895 | luaD_callnoyield(L, L->top - 2, 0); | 895 | luaD_callnoyield(L, L->top.p - 2, 0); |
896 | } | 896 | } |
897 | 897 | ||
898 | 898 | ||
@@ -909,16 +909,16 @@ static void GCTM (lua_State *L) { | |||
909 | int oldgcstp = g->gcstp; | 909 | int oldgcstp = g->gcstp; |
910 | g->gcstp |= GCSTPGC; /* avoid GC steps */ | 910 | g->gcstp |= GCSTPGC; /* avoid GC steps */ |
911 | L->allowhook = 0; /* stop debug hooks during GC metamethod */ | 911 | L->allowhook = 0; /* stop debug hooks during GC metamethod */ |
912 | setobj2s(L, L->top++, tm); /* push finalizer... */ | 912 | setobj2s(L, L->top.p++, tm); /* push finalizer... */ |
913 | setobj2s(L, L->top++, &v); /* ... and its argument */ | 913 | setobj2s(L, L->top.p++, &v); /* ... and its argument */ |
914 | L->ci->callstatus |= CIST_FIN; /* will run a finalizer */ | 914 | L->ci->callstatus |= CIST_FIN; /* will run a finalizer */ |
915 | status = luaD_pcall(L, dothecall, NULL, savestack(L, L->top - 2), 0); | 915 | status = luaD_pcall(L, dothecall, NULL, savestack(L, L->top.p - 2), 0); |
916 | L->ci->callstatus &= ~CIST_FIN; /* not running a finalizer anymore */ | 916 | L->ci->callstatus &= ~CIST_FIN; /* not running a finalizer anymore */ |
917 | L->allowhook = oldah; /* restore hooks */ | 917 | L->allowhook = oldah; /* restore hooks */ |
918 | g->gcstp = oldgcstp; /* restore state */ | 918 | g->gcstp = oldgcstp; /* restore state */ |
919 | if (l_unlikely(status != LUA_OK)) { /* error while running __gc? */ | 919 | if (l_unlikely(status != LUA_OK)) { /* error while running __gc? */ |
920 | luaE_warnerror(L, "__gc"); | 920 | luaE_warnerror(L, "__gc"); |
921 | L->top--; /* pops error object */ | 921 | L->top.p--; /* pops error object */ |
922 | } | 922 | } |
923 | } | 923 | } |
924 | } | 924 | } |