mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Fix GC steps threshold handling when called by JIT-compiled code.
Thanks to Cheng, Long.
This commit is contained in:
parent
8944e27762
commit
7b4d5306c7
@ -689,13 +689,15 @@ int LJ_FASTCALL lj_gc_step(lua_State *L)
|
|||||||
} while ((int32_t)lim > 0);
|
} while ((int32_t)lim > 0);
|
||||||
if (g->gc.debt < GCSTEPSIZE) {
|
if (g->gc.debt < GCSTEPSIZE) {
|
||||||
g->gc.threshold = g->gc.total + GCSTEPSIZE;
|
g->gc.threshold = g->gc.total + GCSTEPSIZE;
|
||||||
|
g->vmstate = ostate;
|
||||||
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
g->gc.debt -= GCSTEPSIZE;
|
g->gc.debt -= GCSTEPSIZE;
|
||||||
g->gc.threshold = g->gc.total;
|
g->gc.threshold = g->gc.total;
|
||||||
}
|
|
||||||
g->vmstate = ostate;
|
g->vmstate = ostate;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Ditto, but fix the stack top first. */
|
/* Ditto, but fix the stack top first. */
|
||||||
void LJ_FASTCALL lj_gc_step_fixtop(lua_State *L)
|
void LJ_FASTCALL lj_gc_step_fixtop(lua_State *L)
|
||||||
|
@ -778,7 +778,7 @@ int LJ_FASTCALL lj_trace_exit(jit_State *J, void *exptr)
|
|||||||
setcframe_pc(cf, pc);
|
setcframe_pc(cf, pc);
|
||||||
if (G(L)->gc.state == GCSatomic || G(L)->gc.state == GCSfinalize) {
|
if (G(L)->gc.state == GCSatomic || G(L)->gc.state == GCSfinalize) {
|
||||||
if (!(G(L)->hookmask & HOOK_GC))
|
if (!(G(L)->hookmask & HOOK_GC))
|
||||||
lj_gc_step(L); /* Exited because of GC: drive GC forward. */
|
lj_gc_check(L); /* Exited because of GC: drive GC forward. */
|
||||||
} else {
|
} else {
|
||||||
trace_hotside(J, pc);
|
trace_hotside(J, pc);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user