aboutsummaryrefslogtreecommitdiff
path: root/ltests.c
diff options
context:
space:
mode:
Diffstat (limited to 'ltests.c')
-rw-r--r--ltests.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/ltests.c b/ltests.c
index ebf73840..bee734f3 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 2.228 2017/11/03 12:12:30 roberto Exp roberto $ 2** $Id: ltests.c,v 2.227 2017/11/02 11:28:56 roberto Exp $
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*/
@@ -46,7 +46,7 @@ void *l_Trick = 0;
46int islocked = 0; 46int islocked = 0;
47 47
48 48
49#define obj_at(L,k) s2v(L->func + (k)) 49#define obj_at(L,k) s2v(L->ci->func + (k))
50 50
51 51
52static int runC (lua_State *L, lua_State *L1, const char *pc); 52static int runC (lua_State *L, lua_State *L1, const char *pc);
@@ -309,27 +309,28 @@ static void checkLclosure (global_State *g, LClosure *cl) {
309} 309}
310 310
311 311
312static int lua_checkpc (StkId func) { 312static int lua_checkpc (CallInfo *ci) {
313 if (!isLua(func)) return 1; 313 if (!isLua(ci)) return 1;
314 else { 314 else {
315 Proto *p = clLvalue(s2v(func))->p; 315 StkId f = ci->func;
316 return p->code <= func->stkci.u.l.savedpc && 316 Proto *p = clLvalue(s2v(f))->p;
317 func->stkci.u.l.savedpc <= p->code + p->sizecode; 317 return p->code <= ci->u.l.savedpc &&
318 ci->u.l.savedpc <= p->code + p->sizecode;
318 } 319 }
319} 320}
320 321
321 322
322static void checkstack (global_State *g, lua_State *L1) { 323static void checkstack (global_State *g, lua_State *L1) {
323 StkId o; 324 StkId o;
325 CallInfo *ci;
324 UpVal *uv; 326 UpVal *uv;
325 lua_assert(!isdead(g, L1)); 327 lua_assert(!isdead(g, L1));
326 for (uv = L1->openupval; uv != NULL; uv = uv->u.open.next) 328 for (uv = L1->openupval; uv != NULL; uv = uv->u.open.next)
327 lua_assert(upisopen(uv)); /* must be open */ 329 lua_assert(upisopen(uv)); /* must be open */
328 for (o = L1->func; o->stkci.previous != 0; o -= o->stkci.previous) { 330 for (ci = L1->ci; ci != NULL; ci = ci->previous) {
329 lua_assert(functop(o) <= L1->stack_last); 331 lua_assert(ci->top <= L1->stack_last);
330 lua_assert(lua_checkpc(o)); 332 lua_assert(lua_checkpc(ci));
331 } 333 }
332 lua_assert(o == L1->stack);
333 if (L1->stack) { /* complete thread? */ 334 if (L1->stack) { /* complete thread? */
334 for (o = L1->stack; o < L1->stack_last + EXTRA_STACK; o++) 335 for (o = L1->stack; o < L1->stack_last + EXTRA_STACK; o++)
335 checkliveness(L1, s2v(o)); /* entire stack must have valid values */ 336 checkliveness(L1, s2v(o)); /* entire stack must have valid values */