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.
This commit is contained in:
Mike Pall
2010-02-13 04:51:56 +01:00
parent 4f8d7be8ea
commit c93138b59e
34 changed files with 4410 additions and 4264 deletions

View File

@@ -1671,14 +1671,8 @@ static int rec_call(jit_State *J, BCReg func, ptrdiff_t cres, ptrdiff_t nargs)
GCproto *pt = funcproto(rd.fn);
if ((pt->flags & PROTO_NO_JIT))
lj_trace_err(J, LJ_TRERR_CJITOFF);
if ((pt->flags & PROTO_IS_VARARG)) {
if (rd.fn->l.gate != lj_gate_lv)
lj_trace_err(J, LJ_TRERR_NYILNKF);
if ((pt->flags & PROTO_IS_VARARG))
lj_trace_err(J, LJ_TRERR_NYIVF);
} else {
if (rd.fn->l.gate != lj_gate_lf)
lj_trace_err(J, LJ_TRERR_NYILNKF);
}
if (cres == CALLRES_TAILCALL) {
ptrdiff_t i;
/* Tailcalls can form a loop, so count towards the loop unroll limit. */