summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2013-11-05 19:36:59 +0100
committerMike Pall <mike>2013-11-05 19:36:59 +0100
commit7b4d5306c7441a373516ee54bd942218f35348c2 (patch)
treeb2963d0af64c5282189f74244fa2d550338c4380
parent8944e27762712679e50962598ed1be8dc1fbe7be (diff)
downloadluajit2-7b4d5306c7441a373516ee54bd942218f35348c2.tar.gz
Fix GC steps threshold handling when called by JIT-compiled code.
Thanks to Cheng, Long.
-rw-r--r--src/lj_gc.c6
-rw-r--r--src/lj_trace.c2
2 files changed, 5 insertions, 3 deletions
diff --git a/src/lj_gc.c b/src/lj_gc.c
index 5c665786..7012dbec 100644
--- a/src/lj_gc.c
+++ b/src/lj_gc.c
@@ -689,12 +689,14 @@ int LJ_FASTCALL lj_gc_step(lua_State *L)
} while ((int32_t)lim > 0);
if (g->gc.debt < GCSTEPSIZE) {
g->gc.threshold = g->gc.total + GCSTEPSIZE;
+ g->vmstate = ostate;
+ return 1;
} else {
g->gc.debt -= GCSTEPSIZE;
g->gc.threshold = g->gc.total;
+ g->vmstate = ostate;
+ return 0;
}
- g->vmstate = ostate;
- return 0;
}
/* Ditto, but fix the stack top first. */
diff --git a/src/lj_trace.c b/src/lj_trace.c
index c70fc247..add9da6d 100644
--- a/src/lj_trace.c
+++ b/src/lj_trace.c
@@ -778,7 +778,7 @@ int LJ_FASTCALL lj_trace_exit(jit_State *J, void *exptr)
setcframe_pc(cf, pc);
if (G(L)->gc.state == GCSatomic || G(L)->gc.state == GCSfinalize) {
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 {
trace_hotside(J, pc);
}