aboutsummaryrefslogtreecommitdiff
path: root/src/lj_err.c
diff options
context:
space:
mode:
authorMike Pall <mike>2010-02-13 04:51:56 +0100
committerMike Pall <mike>2010-02-13 04:51:56 +0100
commitc93138b59e8f28b3d412cd7ec0c6631fd27e3e1b (patch)
tree8c0ffe2086ab0b032ed8e9f92ae6fb9d4d040d66 /src/lj_err.c
parent4f8d7be8ea8a103f4d9046188d6005740b74f3d4 (diff)
downloadluajit-c93138b59e8f28b3d412cd7ec0c6631fd27e3e1b.tar.gz
luajit-c93138b59e8f28b3d412cd7ec0c6631fd27e3e1b.tar.bz2
luajit-c93138b59e8f28b3d412cd7ec0c6631fd27e3e1b.zip
Major redesign of function call handling.
Drop call gates. Use function headers, dispatched like bytecodes. Emit BC_FUNCF/BC_FUNCV bytecode at PC 0 for all Lua functions. C functions and ASM fast functions get extra bytecodes. Modify internal calling convention: new base in BASE (formerly in RA). Can now use better C function wrapper semantics (dynamic on/off). Prerequisite for call hooks with zero-overhead if disabled. Prerequisite for compiling recursive calls. Prerequisite for efficient 32/64 bit prototype guards.
Diffstat (limited to 'src/lj_err.c')
-rw-r--r--src/lj_err.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/lj_err.c b/src/lj_err.c
index 2b021d28..fdc06001 100644
--- a/src/lj_err.c
+++ b/src/lj_err.c
@@ -152,7 +152,7 @@ static const char *getobjname(GCproto *pt, const BCIns *ip, BCReg slot,
152restart: 152restart:
153 lname = getvarname(pt, proto_bcpos(pt, ip), slot); 153 lname = getvarname(pt, proto_bcpos(pt, ip), slot);
154 if (lname != NULL) { *name = lname; return "local"; } 154 if (lname != NULL) { *name = lname; return "local"; }
155 while (--ip >= proto_bc(pt)) { 155 while (--ip > proto_bc(pt)) {
156 BCIns ins = *ip; 156 BCIns ins = *ip;
157 BCOp op = bc_op(ins); 157 BCOp op = bc_op(ins);
158 BCReg ra = bc_a(ins); 158 BCReg ra = bc_a(ins);
@@ -222,11 +222,7 @@ void lj_err_pushloc(lua_State *L, GCproto *pt, BCPos pc)
222 if (name) { 222 if (name) {
223 const char *s = strdata(name); 223 const char *s = strdata(name);
224 MSize i, len = name->len; 224 MSize i, len = name->len;
225 BCLine line; 225 BCLine line = pc < pt->sizebc ? proto_line(pt, pc) : 0;
226 if (pc)
227 line = proto_line(pt, pc-1);
228 else
229 line = pt->linedefined;
230 if (*s == '@') { 226 if (*s == '@') {
231 s++; len--; 227 s++; len--;
232 for (i = len; i > 0; i--) 228 for (i = len; i > 0; i--)
@@ -345,9 +341,10 @@ LUA_API int lua_getinfo(lua_State *L, const char *what, lua_Debug *ar)
345 switch (*what) { 341 switch (*what) {
346 case 'S': 342 case 'S':
347 if (isluafunc(fn)) { 343 if (isluafunc(fn)) {
348 ar->source = strdata(proto_chunkname(funcproto(fn))); 344 GCproto *pt = funcproto(fn);
349 ar->linedefined = cast_int(funcproto(fn)->linedefined); 345 ar->source = strdata(proto_chunkname(pt));
350 ar->lastlinedefined = cast_int(funcproto(fn)->lastlinedefined); 346 ar->linedefined = (int)proto_line(pt, 0);
347 ar->lastlinedefined = (int)pt->lastlinedefined;
351 ar->what = (ar->linedefined == 0) ? "main" : "Lua"; 348 ar->what = (ar->linedefined == 0) ? "main" : "Lua";
352 } else { 349 } else {
353 ar->source = "=[C]"; 350 ar->source = "=[C]";
@@ -380,7 +377,7 @@ LUA_API int lua_getinfo(lua_State *L, const char *what, lua_Debug *ar)
380 GCproto *pt = funcproto(fn); 377 GCproto *pt = funcproto(fn);
381 BCLine *lineinfo = proto_lineinfo(pt); 378 BCLine *lineinfo = proto_lineinfo(pt);
382 MSize i, szl = pt->sizebc; 379 MSize i, szl = pt->sizebc;
383 for (i = 0; i < szl; i++) 380 for (i = 1; i < szl; i++)
384 setboolV(lj_tab_setint(L, t, lineinfo[i]), 1); 381 setboolV(lj_tab_setint(L, t, lineinfo[i]), 1);
385 settabV(L, L->top, t); 382 settabV(L, L->top, t);
386 } else { 383 } else {