diff options
author | Mike Pall <mike> | 2010-02-13 04:51:56 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2010-02-13 04:51:56 +0100 |
commit | c93138b59e8f28b3d412cd7ec0c6631fd27e3e1b (patch) | |
tree | 8c0ffe2086ab0b032ed8e9f92ae6fb9d4d040d66 /src/lj_lib.h | |
parent | 4f8d7be8ea8a103f4d9046188d6005740b74f3d4 (diff) | |
download | luajit-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_lib.h')
-rw-r--r-- | src/lj_lib.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lj_lib.h b/src/lj_lib.h index 44be96b9..fd2b025c 100644 --- a/src/lj_lib.h +++ b/src/lj_lib.h | |||
@@ -57,6 +57,19 @@ LJ_FUNC int lj_lib_checkopt(lua_State *L, int narg, int def, const char *lst); | |||
57 | #define lj_lib_checkfpu(L) UNUSED(L) | 57 | #define lj_lib_checkfpu(L) UNUSED(L) |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | /* Push internal function on the stack. */ | ||
61 | static LJ_AINLINE void lj_lib_pushcc(lua_State *L, lua_CFunction f, | ||
62 | int id, int n) | ||
63 | { | ||
64 | GCfunc *fn; | ||
65 | lua_pushcclosure(L, f, n); | ||
66 | fn = funcV(L->top-1); | ||
67 | fn->c.ffid = (uint8_t)id; | ||
68 | setmref(fn->c.pc, &G(L)->bc_cfunc_int); | ||
69 | } | ||
70 | |||
71 | #define lj_lib_pushcf(L, fn, id) (lj_lib_pushcc(L, (fn), (id), 0)) | ||
72 | |||
60 | /* Library function declarations. Scanned by buildvm. */ | 73 | /* Library function declarations. Scanned by buildvm. */ |
61 | #define LJLIB_CF(name) static int lj_cf_##name(lua_State *L) | 74 | #define LJLIB_CF(name) static int lj_cf_##name(lua_State *L) |
62 | #define LJLIB_ASM(name) static int lj_ffh_##name(lua_State *L) | 75 | #define LJLIB_ASM(name) static int lj_ffh_##name(lua_State *L) |