summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-10-06 14:06:49 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-10-06 14:06:49 -0300
commite14a02c24f22ff03bba4a0582f56d7af518339df (patch)
tree04a5611b78ff6ffb868c092564227ea070ae3ff0
parent15f415051810726eb7e22425a823d33a354e026a (diff)
downloadlua-e14a02c24f22ff03bba4a0582f56d7af518339df.tar.gz
lua-e14a02c24f22ff03bba4a0582f56d7af518339df.tar.bz2
lua-e14a02c24f22ff03bba4a0582f56d7af518339df.zip
when thread yields, real "func" is in field 'extra', not in 'func'
-rw-r--r--ltests.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/ltests.c b/ltests.c
index 9057cde3..4fa105dd 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 2.185 2014/09/04 18:15:29 roberto Exp roberto $ 2** $Id: ltests.c,v 2.186 2014/10/01 11:54:56 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*/
@@ -280,10 +280,14 @@ static void checkLclosure (global_State *g, LClosure *cl) {
280} 280}
281 281
282 282
283static int lua_checkpc (CallInfo *ci) { 283static int lua_checkpc (lua_State *L, CallInfo *ci) {
284 if (!isLua(ci)) return 1; 284 if (!isLua(ci)) return 1;
285 else { 285 else {
286 Proto *p = ci_func(ci)->p; 286 Proto *p;
287 if (L->status != LUA_YIELD || ci != L->ci)
288 p = ci_func(ci)->p;
289 else /* real 'func' was saved in 'extra' field */
290 p = clLvalue(restorestack(L, ci->extra))->p;
287 return p->code <= ci->u.l.savedpc && 291 return p->code <= ci->u.l.savedpc &&
288 ci->u.l.savedpc <= p->code + p->sizecode; 292 ci->u.l.savedpc <= p->code + p->sizecode;
289 } 293 }
@@ -299,7 +303,7 @@ static void checkstack (global_State *g, lua_State *L1) {
299 lua_assert(upisopen(uv)); /* must be open */ 303 lua_assert(upisopen(uv)); /* must be open */
300 for (ci = L1->ci; ci != NULL; ci = ci->previous) { 304 for (ci = L1->ci; ci != NULL; ci = ci->previous) {
301 lua_assert(ci->top <= L1->stack_last); 305 lua_assert(ci->top <= L1->stack_last);
302 lua_assert(lua_checkpc(ci)); 306 lua_assert(lua_checkpc(L1, ci));
303 } 307 }
304 if (L1->stack) { 308 if (L1->stack) {
305 for (o = L1->stack; o < L1->top; o++) 309 for (o = L1->stack; o < L1->top; o++)