From d9c5eba1bb0ad59a40f4d79fd331cdf1f9f4b81e Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Mon, 24 Sep 2012 16:56:07 +0200 Subject: [PATCH] Remove some library functions for no-JIT/no-FFI builds. --- src/lib_jit.c | 27 ++++++--------------------- src/lj_crecord.h | 13 ------------- src/lj_errmsg.h | 4 ++++ src/lj_record.c | 2 ++ 4 files changed, 12 insertions(+), 34 deletions(-) diff --git a/src/lib_jit.c b/src/lib_jit.c index 68328b67..a455a130 100644 --- a/src/lib_jit.c +++ b/src/lib_jit.c @@ -412,30 +412,16 @@ LJLIB_CF(jit_util_ircalladdr) return 0; } -#else - -static int trace_nojit(lua_State *L) -{ - UNUSED(L); - return 0; -} -#define lj_cf_jit_util_traceinfo trace_nojit -#define lj_cf_jit_util_traceir trace_nojit -#define lj_cf_jit_util_tracek trace_nojit -#define lj_cf_jit_util_tracesnap trace_nojit -#define lj_cf_jit_util_tracemc trace_nojit -#define lj_cf_jit_util_traceexitstub trace_nojit -#define lj_cf_jit_util_ircalladdr trace_nojit - #endif #include "lj_libdef.h" /* -- jit.opt module ------------------------------------------------------ */ +#if LJ_HASJIT + #define LJLIB_MODULE_jit_opt -#if LJ_HASJIT /* Parse optimization level. */ static int jitopt_level(jit_State *J, const char *str) { @@ -502,12 +488,10 @@ static int jitopt_param(jit_State *J, const char *str) } return 0; /* No match. */ } -#endif /* jit.opt.start(flags...) */ LJLIB_CF(jit_opt_start) { -#if LJ_HASJIT jit_State *J = L2J(L); int nargs = (int)(L->top - L->base); if (nargs == 0) { @@ -522,14 +506,13 @@ LJLIB_CF(jit_opt_start) lj_err_callerv(L, LJ_ERR_JITOPT, str); } } -#else - lj_err_caller(L, LJ_ERR_NOJIT); -#endif return 0; } #include "lj_libdef.h" +#endif + /* -- JIT compiler initialization ----------------------------------------- */ #if LJ_HASJIT @@ -670,7 +653,9 @@ LUALIB_API int luaopen_jit(lua_State *L) #ifndef LUAJIT_DISABLE_JITUTIL LJ_LIB_REG(L, "jit.util", jit_util); #endif +#if LJ_HASJIT LJ_LIB_REG(L, "jit.opt", jit_opt); +#endif L->top -= 2; jit_init(L); return 1; diff --git a/src/lj_crecord.h b/src/lj_crecord.h index c2a3758d..ab0e27e7 100644 --- a/src/lj_crecord.h +++ b/src/lj_crecord.h @@ -24,19 +24,6 @@ LJ_FUNC void LJ_FASTCALL recff_ffi_typeof(jit_State *J, RecordFFData *rd); LJ_FUNC void LJ_FASTCALL recff_ffi_istype(jit_State *J, RecordFFData *rd); LJ_FUNC void LJ_FASTCALL recff_ffi_abi(jit_State *J, RecordFFData *rd); LJ_FUNC void LJ_FASTCALL lj_crecord_tonumber(jit_State *J, RecordFFData *rd); -#else -#define recff_cdata_index recff_nyi -#define recff_cdata_call recff_nyi -#define recff_cdata_arith recff_nyi -#define recff_clib_index recff_nyi -#define recff_ffi_new recff_nyi -#define recff_ffi_errno recff_nyi -#define recff_ffi_string recff_nyi -#define recff_ffi_copy recff_nyi -#define recff_ffi_fill recff_nyi -#define recff_ffi_typeof recff_nyi -#define recff_ffi_istype recff_nyi -#define recff_ffi_abi recff_nyi #endif #endif diff --git a/src/lj_errmsg.h b/src/lj_errmsg.h index da40e848..f368da5a 100644 --- a/src/lj_errmsg.h +++ b/src/lj_errmsg.h @@ -102,7 +102,11 @@ ERRDEF(STRFMTW, "invalid format (width or precision too long)") ERRDEF(STRGSRV, "invalid replacement value (a %s)") ERRDEF(BADMODN, "name conflict for module " LUA_QS) #if LJ_HASJIT +#if LJ_TARGET_X86ORX64 ERRDEF(NOJIT, "JIT compiler disabled, CPU does not support SSE2") +#else +ERRDEF(NOJIT, "JIT compiler disabled") +#endif #elif defined(LJ_ARCH_NOJIT) ERRDEF(NOJIT, "no JIT compiler for this architecture (yet)") #else diff --git a/src/lj_record.c b/src/lj_record.c index 7620ae4c..5910dab4 100644 --- a/src/lj_record.c +++ b/src/lj_record.c @@ -1292,6 +1292,8 @@ static int rec_upvalue_constify(jit_State *J, GCupval *uvp) } return 0; } +#else + UNUSED(J); #endif if (!(tvistab(o) || tvisudata(o) || tvisthread(o))) return 1; -- 2.11.4.GIT