From 4f88418170d298b065a7f71d86b1127153919ae9 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 17 Apr 2009 11:28:06 -0300 Subject: 'CallInfo' stack implemented as double-linked list instead of an array --- ltests.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'ltests.c') diff --git a/ltests.c b/ltests.c index e0de86f3..9a55f6da 100644 --- a/ltests.c +++ b/ltests.c @@ -1,5 +1,5 @@ /* -** $Id: ltests.c,v 2.59 2009/03/03 18:52:36 roberto Exp roberto $ +** $Id: ltests.c,v 2.60 2009/04/14 19:10:17 roberto Exp roberto $ ** Internal Module for Debugging of the Lua Implementation ** See Copyright Notice in lua.h */ @@ -296,13 +296,10 @@ static void checkstack (global_State *g, lua_State *L1) { lua_assert(!isblack(uvo)); /* open upvalues cannot be black */ } checkliveness(g, gt(L1)); - if (L1->base_ci) { - for (ci = L1->base_ci; ci <= L1->ci; ci++) { - lua_assert(ci->top <= L1->stack_last); - lua_assert(lua_checkpc(L1, ci)); - } + for (ci = L1->ci; ci != NULL; ci = ci->previous) { + lua_assert(ci->top <= L1->stack_last); + lua_assert(lua_checkpc(L1, ci)); } - else lua_assert(L1->size_ci == 0); if (L1->stack) { for (o = L1->stack; o < L1->top; o++) checkliveness(g, o); @@ -356,10 +353,10 @@ printf(">>> %d %s %02x\n", g->gcstate, luaT_typenames[gch(o)->tt], gch(o)->mar int lua_checkpc (lua_State *L, pCallInfo ci) { - if (ci == L->base_ci || !isLua(ci)) return 1; + if (!isLua(ci)) return 1; else { Proto *p = ci_func(ci)->l.p; - if (ci < L->ci) + if (ci != L->ci) return p->code <= ci->savedpc && ci->savedpc <= p->code + p->sizecode; else return p->code <= L->savedpc && L->savedpc <= p->code + p->sizecode; @@ -575,8 +572,7 @@ static int stacklevel (lua_State *L) { unsigned long a = 0; lua_pushinteger(L, (L->top - L->stack)); lua_pushinteger(L, (L->stack_last - L->stack)); - lua_pushinteger(L, (L->ci - L->base_ci)); - lua_pushinteger(L, (L->end_ci - L->base_ci)); + lua_pushinteger(L, L->nci); lua_pushinteger(L, (unsigned long)&a); return 5; } -- cgit v1.2.3-55-g6feb