diff options
Diffstat (limited to 'src/lj_gc.c')
-rw-r--r-- | src/lj_gc.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/lj_gc.c b/src/lj_gc.c index 5a7127c2..d6dfde93 100644 --- a/src/lj_gc.c +++ b/src/lj_gc.c | |||
@@ -268,12 +268,12 @@ static MSize gc_traverse_frames(global_State *g, lua_State *th) | |||
268 | { | 268 | { |
269 | TValue *frame, *top = th->top-1, *bot = tvref(th->stack); | 269 | TValue *frame, *top = th->top-1, *bot = tvref(th->stack); |
270 | /* Note: extra vararg frame not skipped, marks function twice (harmless). */ | 270 | /* Note: extra vararg frame not skipped, marks function twice (harmless). */ |
271 | for (frame = th->base-1; frame > bot; frame = frame_prev(frame)) { | 271 | for (frame = th->base-1; frame > bot+LJ_FR2; frame = frame_prev(frame)) { |
272 | GCfunc *fn = frame_func(frame); | 272 | GCfunc *fn = frame_func(frame); |
273 | TValue *ftop = frame; | 273 | TValue *ftop = frame; |
274 | if (isluafunc(fn)) ftop += funcproto(fn)->framesize; | 274 | if (isluafunc(fn)) ftop += funcproto(fn)->framesize; |
275 | if (ftop > top) top = ftop; | 275 | if (ftop > top) top = ftop; |
276 | gc_markobj(g, fn); /* Need to mark hidden function (or L). */ | 276 | if (!LJ_FR2) gc_markobj(g, fn); /* Need to mark hidden function (or L). */ |
277 | } | 277 | } |
278 | top++; /* Correct bias of -1 (frame == base-1). */ | 278 | top++; /* Correct bias of -1 (frame == base-1). */ |
279 | if (top > tvref(th->maxstack)) top = tvref(th->maxstack); | 279 | if (top > tvref(th->maxstack)) top = tvref(th->maxstack); |
@@ -284,7 +284,7 @@ static MSize gc_traverse_frames(global_State *g, lua_State *th) | |||
284 | static void gc_traverse_thread(global_State *g, lua_State *th) | 284 | static void gc_traverse_thread(global_State *g, lua_State *th) |
285 | { | 285 | { |
286 | TValue *o, *top = th->top; | 286 | TValue *o, *top = th->top; |
287 | for (o = tvref(th->stack)+1; o < top; o++) | 287 | for (o = tvref(th->stack)+1+LJ_FR2; o < top; o++) |
288 | gc_marktv(g, o); | 288 | gc_marktv(g, o); |
289 | if (g->gc.state == GCSatomic) { | 289 | if (g->gc.state == GCSatomic) { |
290 | top = tvref(th->stack) + th->stacksize; | 290 | top = tvref(th->stack) + th->stacksize; |
@@ -456,13 +456,14 @@ static void gc_call_finalizer(global_State *g, lua_State *L, | |||
456 | int errcode; | 456 | int errcode; |
457 | TValue *top; | 457 | TValue *top; |
458 | lj_trace_abort(g); | 458 | lj_trace_abort(g); |
459 | top = L->top; | ||
460 | L->top = top+2; | ||
461 | hook_entergc(g); /* Disable hooks and new traces during __gc. */ | 459 | hook_entergc(g); /* Disable hooks and new traces during __gc. */ |
462 | g->gc.threshold = LJ_MAX_MEM; /* Prevent GC steps. */ | 460 | g->gc.threshold = LJ_MAX_MEM; /* Prevent GC steps. */ |
463 | copyTV(L, top, mo); | 461 | top = L->top; |
464 | setgcV(L, top+1, o, ~o->gch.gct); | 462 | copyTV(L, top++, mo); |
465 | errcode = lj_vm_pcall(L, top+1, 1+0, -1); /* Stack: |mo|o| -> | */ | 463 | if (LJ_FR2) setnilV(top++); |
464 | setgcV(L, top, o, ~o->gch.gct); | ||
465 | L->top = top+1; | ||
466 | errcode = lj_vm_pcall(L, top, 1+0, -1); /* Stack: |mo|o| -> | */ | ||
466 | hook_restore(g, oldh); | 467 | hook_restore(g, oldh); |
467 | g->gc.threshold = oldt; /* Restore GC threshold. */ | 468 | g->gc.threshold = oldt; /* Restore GC threshold. */ |
468 | if (errcode) | 469 | if (errcode) |