aboutsummaryrefslogtreecommitdiff
path: root/src/lj_api.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_api.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_api.c')
-rw-r--r--src/lj_api.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lj_api.c b/src/lj_api.c
index ad28bbf2..a19f0b33 100644
--- a/src/lj_api.c
+++ b/src/lj_api.c
@@ -18,6 +18,7 @@
18#include "lj_udata.h" 18#include "lj_udata.h"
19#include "lj_meta.h" 19#include "lj_meta.h"
20#include "lj_state.h" 20#include "lj_state.h"
21#include "lj_bc.h"
21#include "lj_frame.h" 22#include "lj_frame.h"
22#include "lj_trace.h" 23#include "lj_trace.h"
23#include "lj_vm.h" 24#include "lj_vm.h"
@@ -487,8 +488,8 @@ LUA_API lua_CFunction lua_tocfunction(lua_State *L, int idx)
487{ 488{
488 cTValue *o = index2adr(L, idx); 489 cTValue *o = index2adr(L, idx);
489 if (tvisfunc(o)) { 490 if (tvisfunc(o)) {
490 ASMFunction gate = funcV(o)->c.gate; 491 BCOp op = bc_op(*mref(funcV(o)->c.pc, BCIns));
491 if (gate == lj_gate_c || gate == lj_gate_cwrap) 492 if (op == BC_FUNCC || op == BC_FUNCCW)
492 return funcV(o)->c.f; 493 return funcV(o)->c.f;
493 } 494 }
494 return NULL; 495 return NULL;