From c93138b59e8f28b3d412cd7ec0c6631fd27e3e1b Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Sat, 13 Feb 2010 04:51:56 +0100 Subject: 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. --- src/lib_jit.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/lib_jit.c') diff --git a/src/lib_jit.c b/src/lib_jit.c index 8fda41d0..a5829dc3 100644 --- a/src/lib_jit.c +++ b/src/lib_jit.c @@ -177,7 +177,7 @@ LJLIB_CF(jit_util_funcinfo) GCtab *t; lua_createtable(L, 0, 16); /* Increment hash size if fields are added. */ t = tabV(L->top-1); - setintfield(L, t, "linedefined", pt->linedefined); + setintfield(L, t, "linedefined", proto_line(pt, 0)); setintfield(L, t, "lastlinedefined", pt->lastlinedefined); setintfield(L, t, "stackslots", pt->framesize); setintfield(L, t, "params", pt->numparams); @@ -185,9 +185,9 @@ LJLIB_CF(jit_util_funcinfo) setintfield(L, t, "gcconsts", (int32_t)pt->sizekgc); setintfield(L, t, "nconsts", (int32_t)pt->sizekn); setintfield(L, t, "upvalues", (int32_t)pt->sizeuv); - if (pc-1 < pt->sizebc) + if (pc < pt->sizebc) setintfield(L, t, "currentline", - proto_lineinfo(pt) ? proto_line(pt, pc-1) : 0); + proto_lineinfo(pt) ? proto_line(pt, pc) : 0); lua_pushboolean(L, (pt->flags & PROTO_IS_VARARG)); lua_setfield(L, -2, "isvararg"); setstrV(L, L->top++, proto_chunkname(pt)); @@ -209,7 +209,7 @@ LJLIB_CF(jit_util_funcinfo) LJLIB_CF(jit_util_funcbc) { GCproto *pt = check_Lproto(L, 0); - BCPos pc = (BCPos)lj_lib_checkint(L, 2) - 1; + BCPos pc = (BCPos)lj_lib_checkint(L, 2); if (pc < pt->sizebc) { BCIns ins = proto_bc(pt)[pc]; BCOp op = bc_op(ins); -- cgit v1.2.3-55-g6feb