diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-01-19 11:20:30 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-01-19 11:20:30 -0200 |
commit | 4ac58853dc820127a11a14ed8bde1fae9458369e (patch) | |
tree | e8179692c97e935ba921c8ebd17abf9c8510d89e /ldo.c | |
parent | f2c451d7455aad3496f32dfa2bfca7f7e8b5376d (diff) | |
download | lua-4ac58853dc820127a11a14ed8bde1fae9458369e.tar.gz lua-4ac58853dc820127a11a14ed8bde1fae9458369e.tar.bz2 lua-4ac58853dc820127a11a14ed8bde1fae9458369e.zip |
thead-specific state separated from "global" state
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 1.113 2001/01/10 18:56:11 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 1.114 2001/01/18 15:59:09 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 | */ |
@@ -55,7 +55,7 @@ void luaD_checkstack (lua_State *L, int n) { | |||
55 | } | 55 | } |
56 | else { | 56 | else { |
57 | L->stack_last += EXTRA_STACK; /* to be used by error message */ | 57 | L->stack_last += EXTRA_STACK; /* to be used by error message */ |
58 | LUA_ASSERT(L->stack_last == L->stack+L->stacksize-1, "wrong stack limit"); | 58 | lua_assert(L->stack_last == L->stack+L->stacksize-1); |
59 | lua_error(L, "stack overflow"); | 59 | lua_error(L, "stack overflow"); |
60 | } | 60 | } |
61 | } | 61 | } |
@@ -95,7 +95,7 @@ static void dohook (lua_State *L, lua_Debug *ar, lua_Hook hook) { | |||
95 | luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ | 95 | luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ |
96 | L->allowhooks = 0; /* cannot call hooks inside a hook */ | 96 | L->allowhooks = 0; /* cannot call hooks inside a hook */ |
97 | (*hook)(L, ar); | 97 | (*hook)(L, ar); |
98 | LUA_ASSERT(L->allowhooks == 0, "invalid allow"); | 98 | lua_assert(L->allowhooks == 0); |
99 | L->allowhooks = 1; | 99 | L->allowhooks = 1; |
100 | L->top = old_top; | 100 | L->top = old_top; |
101 | L->Cbase = old_Cbase; | 101 | L->Cbase = old_Cbase; |
@@ -161,7 +161,7 @@ void luaD_call (lua_State *L, StkId func, int nResults) { | |||
161 | Closure *cl; | 161 | Closure *cl; |
162 | if (ttype(func) != LUA_TFUNCTION) { | 162 | if (ttype(func) != LUA_TFUNCTION) { |
163 | /* `func' is not a function; check the `function' tag method */ | 163 | /* `func' is not a function; check the `function' tag method */ |
164 | Closure *tm = luaT_gettmbyObj(L, func, TM_FUNCTION); | 164 | Closure *tm = luaT_gettmbyObj(G(L), func, TM_FUNCTION); |
165 | if (tm == NULL) | 165 | if (tm == NULL) |
166 | luaG_typeerror(L, func, "call"); | 166 | luaG_typeerror(L, func, "call"); |
167 | luaD_openstack(L, func); | 167 | luaD_openstack(L, func); |
@@ -177,7 +177,7 @@ void luaD_call (lua_State *L, StkId func, int nResults) { | |||
177 | luaV_execute(L, cl, func+1)); | 177 | luaV_execute(L, cl, func+1)); |
178 | if (callhook) /* same hook that was active at entry */ | 178 | if (callhook) /* same hook that was active at entry */ |
179 | luaD_callHook(L, func, callhook, "return"); | 179 | luaD_callHook(L, func, callhook, "return"); |
180 | LUA_ASSERT(ttype(func) == LUA_TMARK, "invalid tag"); | 180 | lua_assert(ttype(func) == LUA_TMARK); |
181 | /* move results to `func' (to erase parameters and function) */ | 181 | /* move results to `func' (to erase parameters and function) */ |
182 | if (nResults == LUA_MULTRET) { | 182 | if (nResults == LUA_MULTRET) { |
183 | while (firstResult < L->top) /* copy all results */ | 183 | while (firstResult < L->top) /* copy all results */ |
@@ -244,12 +244,12 @@ static int protectedparser (lua_State *L, ZIO *z, int bin) { | |||
244 | int status; | 244 | int status; |
245 | p.z = z; p.bin = bin; | 245 | p.z = z; p.bin = bin; |
246 | luaC_checkGC(L); | 246 | luaC_checkGC(L); |
247 | old_blocks = L->nblocks; | 247 | old_blocks = G(L)->nblocks; |
248 | status = luaD_runprotected(L, f_parser, &p); | 248 | status = luaD_runprotected(L, f_parser, &p); |
249 | if (status == 0) { | 249 | if (status == 0) { |
250 | /* add new memory to threshold (as it probably will stay) */ | 250 | /* add new memory to threshold (as it probably will stay) */ |
251 | LUA_ASSERT(L->nblocks >= old_blocks, "cannot reduce memory usage here"); | 251 | lua_assert(G(L)->nblocks >= old_blocks); |
252 | L->GCthreshold += (L->nblocks - old_blocks); | 252 | G(L)->GCthreshold += (G(L)->nblocks - old_blocks); |
253 | } | 253 | } |
254 | else if (status == LUA_ERRRUN) /* an error occurred: correct error code */ | 254 | else if (status == LUA_ERRRUN) /* an error occurred: correct error code */ |
255 | status = LUA_ERRSYNTAX; | 255 | status = LUA_ERRSYNTAX; |