diff options
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 1.128 2001/02/23 17:17:25 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 1.129 2001/02/23 17:28:12 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 | */ |
@@ -94,9 +94,9 @@ static void dohook (lua_State *L, lua_Debug *ar, lua_Hook hook) { | |||
94 | StkId old_top = L->Cbase = L->top; | 94 | StkId old_top = L->Cbase = L->top; |
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 | LUA_UNLOCK(L); | 97 | lua_unlock(L); |
98 | (*hook)(L, ar); | 98 | (*hook)(L, ar); |
99 | LUA_LOCK(L); | 99 | lua_lock(L); |
100 | lua_assert(L->allowhooks == 0); | 100 | lua_assert(L->allowhooks == 0); |
101 | L->allowhooks = 1; | 101 | L->allowhooks = 1; |
102 | L->top = old_top; | 102 | L->top = old_top; |
@@ -135,9 +135,9 @@ static StkId callCclosure (lua_State *L, const struct Closure *cl, StkId base) { | |||
135 | luaD_checkstack(L, nup+LUA_MINSTACK); /* ensure minimum stack size */ | 135 | luaD_checkstack(L, nup+LUA_MINSTACK); /* ensure minimum stack size */ |
136 | for (n=0; n<nup; n++) /* copy upvalues as extra arguments */ | 136 | for (n=0; n<nup; n++) /* copy upvalues as extra arguments */ |
137 | setobj(L->top++, &cl->upvalue[n]); | 137 | setobj(L->top++, &cl->upvalue[n]); |
138 | LUA_UNLOCK(L); | 138 | lua_unlock(L); |
139 | n = (*cl->f.c)(L); /* do the actual call */ | 139 | n = (*cl->f.c)(L); /* do the actual call */ |
140 | LUA_LOCK(L); | 140 | lua_lock(L); |
141 | L->Cbase = old_Cbase; /* restore old C base */ | 141 | L->Cbase = old_Cbase; /* restore old C base */ |
142 | return L->top - n; /* return index of first result */ | 142 | return L->top - n; /* return index of first result */ |
143 | } | 143 | } |
@@ -212,13 +212,13 @@ LUA_API int lua_call (lua_State *L, int nargs, int nresults) { | |||
212 | StkId func; | 212 | StkId func; |
213 | struct CallS c; | 213 | struct CallS c; |
214 | int status; | 214 | int status; |
215 | LUA_LOCK(L); | 215 | lua_lock(L); |
216 | func = L->top - (nargs+1); /* function to be called */ | 216 | func = L->top - (nargs+1); /* function to be called */ |
217 | c.func = func; c.nresults = nresults; | 217 | c.func = func; c.nresults = nresults; |
218 | status = luaD_runprotected(L, f_call, &c); | 218 | status = luaD_runprotected(L, f_call, &c); |
219 | if (status != 0) /* an error occurred? */ | 219 | if (status != 0) /* an error occurred? */ |
220 | L->top = func; /* remove parameters from the stack */ | 220 | L->top = func; /* remove parameters from the stack */ |
221 | LUA_UNLOCK(L); | 221 | lua_unlock(L); |
222 | return status; | 222 | return status; |
223 | } | 223 | } |
224 | 224 | ||
@@ -242,7 +242,7 @@ static int protectedparser (lua_State *L, ZIO *z, int bin) { | |||
242 | struct SParser p; | 242 | struct SParser p; |
243 | lu_mem old_blocks; | 243 | lu_mem old_blocks; |
244 | int status; | 244 | int status; |
245 | LUA_LOCK(L); | 245 | lua_lock(L); |
246 | p.z = z; p.bin = bin; | 246 | p.z = z; p.bin = bin; |
247 | /* before parsing, give a (good) chance to GC */ | 247 | /* before parsing, give a (good) chance to GC */ |
248 | if (G(L)->nblocks/8 >= G(L)->GCthreshold/10) | 248 | if (G(L)->nblocks/8 >= G(L)->GCthreshold/10) |
@@ -256,7 +256,7 @@ static int protectedparser (lua_State *L, ZIO *z, int bin) { | |||
256 | } | 256 | } |
257 | else if (status == LUA_ERRRUN) /* an error occurred: correct error code */ | 257 | else if (status == LUA_ERRRUN) /* an error occurred: correct error code */ |
258 | status = LUA_ERRSYNTAX; | 258 | status = LUA_ERRSYNTAX; |
259 | LUA_UNLOCK(L); | 259 | lua_unlock(L); |
260 | return status; | 260 | return status; |
261 | } | 261 | } |
262 | 262 | ||