diff options
Diffstat (limited to 'src/lj_gc.c')
-rw-r--r-- | src/lj_gc.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lj_gc.c b/src/lj_gc.c index 8147cb55..3e3d1ec5 100644 --- a/src/lj_gc.c +++ b/src/lj_gc.c | |||
@@ -267,9 +267,9 @@ static void gc_traverse_proto(global_State *g, GCproto *pt) | |||
267 | /* Traverse the frame structure of a stack. */ | 267 | /* Traverse the frame structure of a stack. */ |
268 | static MSize gc_traverse_frames(global_State *g, lua_State *th) | 268 | static MSize gc_traverse_frames(global_State *g, lua_State *th) |
269 | { | 269 | { |
270 | TValue *frame, *top = th->top-1; | 270 | TValue *frame, *top = th->top-1, *bot = tvref(th->stack); |
271 | /* Note: extra vararg frame not skipped, marks function twice (harmless). */ | 271 | /* Note: extra vararg frame not skipped, marks function twice (harmless). */ |
272 | for (frame = th->base-1; frame > th->stack; frame = frame_prev(frame)) { | 272 | for (frame = th->base-1; frame > bot; frame = frame_prev(frame)) { |
273 | GCfunc *fn = frame_func(frame); | 273 | GCfunc *fn = frame_func(frame); |
274 | TValue *ftop = frame; | 274 | TValue *ftop = frame; |
275 | if (isluafunc(fn)) ftop += funcproto(fn)->framesize; | 275 | if (isluafunc(fn)) ftop += funcproto(fn)->framesize; |
@@ -277,18 +277,18 @@ static MSize gc_traverse_frames(global_State *g, lua_State *th) | |||
277 | gc_markobj(g, frame_gc(frame)); /* Need to mark hidden function (or L). */ | 277 | gc_markobj(g, frame_gc(frame)); /* Need to mark hidden function (or L). */ |
278 | } | 278 | } |
279 | top++; /* Correct bias of -1 (frame == base-1). */ | 279 | top++; /* Correct bias of -1 (frame == base-1). */ |
280 | if (top > th->maxstack) top = th->maxstack; | 280 | if (top > tvref(th->maxstack)) top = tvref(th->maxstack); |
281 | return (MSize)(top - th->stack); /* Return minimum needed stack size. */ | 281 | return (MSize)(top - bot); /* Return minimum needed stack size. */ |
282 | } | 282 | } |
283 | 283 | ||
284 | /* Traverse a thread object. */ | 284 | /* Traverse a thread object. */ |
285 | static void gc_traverse_thread(global_State *g, lua_State *th) | 285 | static void gc_traverse_thread(global_State *g, lua_State *th) |
286 | { | 286 | { |
287 | TValue *o, *top = th->top; | 287 | TValue *o, *top = th->top; |
288 | for (o = th->stack+1; o < top; o++) | 288 | for (o = tvref(th->stack)+1; o < top; o++) |
289 | gc_marktv(g, o); | 289 | gc_marktv(g, o); |
290 | if (g->gc.state == GCSatomic) { | 290 | if (g->gc.state == GCSatomic) { |
291 | top = th->stack + th->stacksize; | 291 | top = tvref(th->stack) + th->stacksize; |
292 | for (; o < top; o++) /* Clear unmarked slots. */ | 292 | for (; o < top; o++) /* Clear unmarked slots. */ |
293 | setnilV(o); | 293 | setnilV(o); |
294 | } | 294 | } |