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:
@@ -101,8 +101,8 @@ GCfunc *lj_func_newC(lua_State *L, MSize nelems, GCtab *env)
|
||||
fn->c.ffid = FF_C;
|
||||
fn->c.nupvalues = cast_byte(nelems);
|
||||
/* NOBARRIER: The GCfunc is new (marked white). */
|
||||
setmref(fn->c.pc, &G(L)->bc_cfunc_ext);
|
||||
setgcref(fn->c.env, obj2gco(env));
|
||||
fn->c.gate = G(L)->wrapmode ? lj_gate_cwrap : lj_gate_c;
|
||||
return fn;
|
||||
}
|
||||
|
||||
@@ -115,7 +115,6 @@ GCfunc *lj_func_newL(lua_State *L, GCproto *pt, GCtab *env)
|
||||
/* NOBARRIER: Really a setgcref. But the GCfunc is new (marked white). */
|
||||
setmref(fn->l.pc, proto_bc(pt));
|
||||
setgcref(fn->l.env, obj2gco(env));
|
||||
fn->l.gate = (pt->flags & PROTO_IS_VARARG) ? lj_gate_lv : lj_gate_lf;
|
||||
return fn;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user