aboutsummaryrefslogtreecommitdiff
path: root/ltests.c
diff options
context:
space:
mode:
Diffstat (limited to 'ltests.c')
-rw-r--r--ltests.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/ltests.c b/ltests.c
index e0de86f3..9a55f6da 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 2.59 2009/03/03 18:52:36 roberto Exp roberto $ 2** $Id: ltests.c,v 2.60 2009/04/14 19:10:17 roberto Exp roberto $
3** Internal Module for Debugging of the Lua Implementation 3** Internal Module for Debugging of the Lua Implementation
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -296,13 +296,10 @@ static void checkstack (global_State *g, lua_State *L1) {
296 lua_assert(!isblack(uvo)); /* open upvalues cannot be black */ 296 lua_assert(!isblack(uvo)); /* open upvalues cannot be black */
297 } 297 }
298 checkliveness(g, gt(L1)); 298 checkliveness(g, gt(L1));
299 if (L1->base_ci) { 299 for (ci = L1->ci; ci != NULL; ci = ci->previous) {
300 for (ci = L1->base_ci; ci <= L1->ci; ci++) { 300 lua_assert(ci->top <= L1->stack_last);
301 lua_assert(ci->top <= L1->stack_last); 301 lua_assert(lua_checkpc(L1, ci));
302 lua_assert(lua_checkpc(L1, ci));
303 }
304 } 302 }
305 else lua_assert(L1->size_ci == 0);
306 if (L1->stack) { 303 if (L1->stack) {
307 for (o = L1->stack; o < L1->top; o++) 304 for (o = L1->stack; o < L1->top; o++)
308 checkliveness(g, o); 305 checkliveness(g, o);
@@ -356,10 +353,10 @@ printf(">>> %d %s %02x\n", g->gcstate, luaT_typenames[gch(o)->tt], gch(o)->mar
356 353
357 354
358int lua_checkpc (lua_State *L, pCallInfo ci) { 355int lua_checkpc (lua_State *L, pCallInfo ci) {
359 if (ci == L->base_ci || !isLua(ci)) return 1; 356 if (!isLua(ci)) return 1;
360 else { 357 else {
361 Proto *p = ci_func(ci)->l.p; 358 Proto *p = ci_func(ci)->l.p;
362 if (ci < L->ci) 359 if (ci != L->ci)
363 return p->code <= ci->savedpc && ci->savedpc <= p->code + p->sizecode; 360 return p->code <= ci->savedpc && ci->savedpc <= p->code + p->sizecode;
364 else 361 else
365 return p->code <= L->savedpc && L->savedpc <= p->code + p->sizecode; 362 return p->code <= L->savedpc && L->savedpc <= p->code + p->sizecode;
@@ -575,8 +572,7 @@ static int stacklevel (lua_State *L) {
575 unsigned long a = 0; 572 unsigned long a = 0;
576 lua_pushinteger(L, (L->top - L->stack)); 573 lua_pushinteger(L, (L->top - L->stack));
577 lua_pushinteger(L, (L->stack_last - L->stack)); 574 lua_pushinteger(L, (L->stack_last - L->stack));
578 lua_pushinteger(L, (L->ci - L->base_ci)); 575 lua_pushinteger(L, L->nci);
579 lua_pushinteger(L, (L->end_ci - L->base_ci));
580 lua_pushinteger(L, (unsigned long)&a); 576 lua_pushinteger(L, (unsigned long)&a);
581 return 5; 577 return 5;
582} 578}