summaryrefslogtreecommitdiff
path: root/src/lj_dispatch.c
diff options
context:
space:
mode:
authorMike Pall <mike>2012-09-12 11:02:19 +0200
committerMike Pall <mike>2012-09-12 11:02:19 +0200
commit039bf85e2610927119254b9c922eab484820e6a7 (patch)
tree8b7bb6d8df89652e2991b08db3f711f53ab7e849 /src/lj_dispatch.c
parent76ab3709da40dd3cc3ab9223dde33050430cd789 (diff)
downloadluajit2-039bf85e2610927119254b9c922eab484820e6a7.tar.gz
Add more assertions for stack consistency during recording.
Diffstat (limited to 'src/lj_dispatch.c')
-rw-r--r--src/lj_dispatch.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lj_dispatch.c b/src/lj_dispatch.c
index f795954b..7dc600e8 100644
--- a/src/lj_dispatch.c
+++ b/src/lj_dispatch.c
@@ -392,8 +392,12 @@ void LJ_FASTCALL lj_dispatch_ins(lua_State *L, const BCIns *pc)
{
jit_State *J = G2J(g);
if (J->state != LJ_TRACE_IDLE) {
+#ifdef LUA_USE_ASSERT
+ ptrdiff_t delta = L->top - L->base;
+#endif
J->L = L;
lj_trace_ins(J, pc-1); /* The interpreter bytecode PC is offset by 1. */
+ lua_assert(L->top - L->base == delta);
}
}
#endif
@@ -448,8 +452,12 @@ ASMFunction LJ_FASTCALL lj_dispatch_call(lua_State *L, const BCIns *pc)
#if LJ_HASJIT
J->L = L;
if ((uintptr_t)pc & 1) { /* Marker for hot call. */
+#ifdef LUA_USE_ASSERT
+ ptrdiff_t delta = L->top - L->base;
+#endif
pc = (const BCIns *)((uintptr_t)pc & ~(uintptr_t)1);
lj_trace_hot(J, pc);
+ lua_assert(L->top - L->base == delta);
goto out;
} else if (J->state != LJ_TRACE_IDLE &&
!(g->hookmask & (HOOK_GC|HOOK_VMEVENT))) {