'CallInfo' stack implemented as double-linked list instead of an array
This commit is contained in:
18
ltests.c
18
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user