summaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-11-18 16:45:38 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-11-18 16:45:38 -0200
commit636c629e563262e7f0d02606abbe3605b7e0747a (patch)
treed747c7e58900e433fe9f4a66630e531709cd4d4e /ldo.c
parent96ba5d0bc217e9b74f0f7656c2f1bb5f6b968778 (diff)
downloadlua-636c629e563262e7f0d02606abbe3605b7e0747a.tar.gz
lua-636c629e563262e7f0d02606abbe3605b7e0747a.tar.bz2
lua-636c629e563262e7f0d02606abbe3605b7e0747a.zip
new assertions
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/ldo.c b/ldo.c
index 02f0d20b..cbdb1205 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 1.202 2002/11/18 11:01:55 roberto Exp roberto $ 2** $Id: ldo.c,v 1.203 2002/11/18 15:24:11 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -107,10 +107,13 @@ static void correctstack (lua_State *L, TObject *oldstack) {
107 for (up = L->openupval; up != NULL; up = up->gch.next) 107 for (up = L->openupval; up != NULL; up = up->gch.next)
108 gcotouv(up)->v = (gcotouv(up)->v - oldstack) + L->stack; 108 gcotouv(up)->v = (gcotouv(up)->v - oldstack) + L->stack;
109 for (ci = L->base_ci; ci <= L->ci; ci++) { 109 for (ci = L->base_ci; ci <= L->ci; ci++) {
110 ci->base = (ci->base - oldstack) + L->stack; 110 StkId newbase = (ci->base - oldstack) + L->stack;
111 ci->top = (ci->top - oldstack) + L->stack; 111 ci->top = (ci->top - oldstack) + L->stack;
112 if (ci->state & CI_HASFRAME) /* Lua function with active frame? */ 112 if (ci->state & CI_HASFRAME) { /* Lua function with active frame? */
113 *ci->u.l.pb = (*ci->u.l.pb - oldstack) + L->stack; /* correct frame */ 113 lua_assert(*ci->u.l.pb == ci->base);
114 *ci->u.l.pb = newbase; /* correct frame */
115 }
116 ci->base = newbase;
114 } 117 }
115} 118}
116 119