mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 15:14:08 +00:00
Cleanup architecture, ABI and OS definitions.
This commit is contained in:
parent
1de05d1147
commit
24baf77955
@ -336,7 +336,7 @@ ifeq (Windows,$(TARGET_SYS))
|
||||
LUAJIT_SO= $(TARGET_DLLNAME)
|
||||
LUAJIT_T= luajit.exe
|
||||
ifneq ($(HOST_SYS),$(TARGET_SYS))
|
||||
HOST_XCFLAGS+= -malign-double
|
||||
HOST_XCFLAGS+= -malign-double -DLUAJIT_OS=LUAJIT_OS_WINDOWS
|
||||
endif
|
||||
# Mixed mode is not supported on Windows. And static mode doesn't work well.
|
||||
# C modules cannot be loaded, because they bind to lua51.dll.
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "lj_dispatch.h"
|
||||
#include "luajit.h"
|
||||
|
||||
#ifdef LUA_USE_WIN
|
||||
#if defined(_WIN32)
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#endif
|
||||
@ -64,11 +64,12 @@ static int collect_reloc(BuildCtx *ctx, uint8_t *addr, int idx, int type);
|
||||
#define DASM_ALIGNED_WRITES 1
|
||||
|
||||
/* Embed architecture-specific DynASM encoder and backend. */
|
||||
#if LJ_TARGET_X86ORX64
|
||||
#if LJ_TARGET_X86
|
||||
#include "../dynasm/dasm_x86.h"
|
||||
#if LJ_32
|
||||
#include "buildvm_x86.h"
|
||||
#elif defined(_WIN64)
|
||||
#elif LJ_TARGET_X64
|
||||
#include "../dynasm/dasm_x86.h"
|
||||
#if LJ_ABI_WIN
|
||||
#include "buildvm_x64win.h"
|
||||
#else
|
||||
#include "buildvm_x64.h"
|
||||
@ -449,7 +450,7 @@ int main(int argc, char **argv)
|
||||
|
||||
if (ctx->outname[0] == '-' && ctx->outname[1] == '\0') {
|
||||
ctx->fp = stdout;
|
||||
#ifdef LUA_USE_WIN
|
||||
#if defined(_WIN32)
|
||||
if (binmode)
|
||||
_setmode(_fileno(stdout), _O_BINARY); /* Yuck. */
|
||||
#endif
|
||||
|
12
src/lib_io.c
12
src/lib_io.c
@ -114,9 +114,9 @@ static int io_file_close(lua_State *L, IOFileUD *iof)
|
||||
if ((iof->type & IOFILE_TYPE_MASK) == IOFILE_TYPE_FILE) {
|
||||
ok = (fclose(iof->fp) == 0);
|
||||
} else if ((iof->type & IOFILE_TYPE_MASK) == IOFILE_TYPE_PIPE) {
|
||||
#if defined(LUA_USE_POSIX)
|
||||
#if LJ_TARGET_POSIX
|
||||
ok = (pclose(iof->fp) != -1);
|
||||
#elif defined(LUA_USE_WIN)
|
||||
#elif LJ_TARGET_WINDOWS
|
||||
ok = (_pclose(iof->fp) != -1);
|
||||
#else
|
||||
ok = 0;
|
||||
@ -289,7 +289,7 @@ LJLIB_CF(io_method_seek)
|
||||
,
|
||||
ofs = 0;
|
||||
)
|
||||
#if defined(LUA_USE_POSIX)
|
||||
#if LJ_TARGET_POSIX
|
||||
res = fseeko(fp, (int64_t)ofs, opt);
|
||||
#elif _MSC_VER >= 1400
|
||||
res = _fseeki64(fp, (int64_t)ofs, opt);
|
||||
@ -300,7 +300,7 @@ LJLIB_CF(io_method_seek)
|
||||
#endif
|
||||
if (res)
|
||||
return io_pushresult(L, 0, NULL);
|
||||
#if defined(LUA_USE_POSIX)
|
||||
#if LJ_TARGET_POSIX
|
||||
ofs = cast_num(ftello(fp));
|
||||
#elif _MSC_VER >= 1400
|
||||
ofs = cast_num(_ftelli64(fp));
|
||||
@ -374,13 +374,13 @@ LJLIB_CF(io_open)
|
||||
|
||||
LJLIB_CF(io_popen)
|
||||
{
|
||||
#if defined(LUA_USE_POSIX) || defined(LUA_USE_WIN)
|
||||
#if LJ_TARGET_POSIX || LJ_TARGET_WINDOWS
|
||||
const char *fname = strdata(lj_lib_checkstr(L, 1));
|
||||
GCstr *s = lj_lib_optstr(L, 2);
|
||||
const char *mode = s ? strdata(s) : "r";
|
||||
IOFileUD *iof = io_file_new(L);
|
||||
iof->type = IOFILE_TYPE_PIPE;
|
||||
#ifdef LUA_USE_POSIX
|
||||
#if LJ_TARGET_POSIX
|
||||
fflush(NULL);
|
||||
iof->fp = popen(fname, mode);
|
||||
#else
|
||||
|
12
src/lib_os.c
12
src/lib_os.c
@ -17,16 +17,16 @@
|
||||
#include "lauxlib.h"
|
||||
#include "lualib.h"
|
||||
|
||||
#ifdef LUA_USE_POSIX
|
||||
#include "lj_obj.h"
|
||||
#include "lj_err.h"
|
||||
#include "lj_lib.h"
|
||||
|
||||
#if LJ_TARGET_POSIX
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "lj_obj.h"
|
||||
#include "lj_err.h"
|
||||
#include "lj_lib.h"
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
#define LJLIB_MODULE_os
|
||||
@ -66,7 +66,7 @@ LJLIB_CF(os_rename)
|
||||
|
||||
LJLIB_CF(os_tmpname)
|
||||
{
|
||||
#ifdef LUA_USE_POSIX
|
||||
#if LJ_TARGET_POSIX
|
||||
char buf[15+1];
|
||||
int fp;
|
||||
strcpy(buf, "/tmp/lua_XXXXXX");
|
||||
|
@ -27,7 +27,7 @@
|
||||
#define PACKAGE_LIB_FAIL "open"
|
||||
#define setprogdir(L) ((void)0)
|
||||
|
||||
#if defined(LUA_DL_DLOPEN)
|
||||
#if LJ_TARGET_DLOPEN
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
@ -50,7 +50,7 @@ static lua_CFunction ll_sym(lua_State *L, void *lib, const char *sym)
|
||||
return f;
|
||||
}
|
||||
|
||||
#elif defined(LUA_DL_DLL)
|
||||
#elif LJ_TARGET_WINDOWS
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
@ -107,7 +107,7 @@ static lua_CFunction ll_sym(lua_State *L, void *lib, const char *sym)
|
||||
#undef PACKAGE_LIB_FAIL
|
||||
#define PACKAGE_LIB_FAIL "absent"
|
||||
|
||||
#define DLMSG "dynamic libraries not enabled; check your Lua installation"
|
||||
#define DLMSG "dynamic libraries not enabled; no support for target OS"
|
||||
|
||||
static void ll_unloadlib(void *lib)
|
||||
{
|
||||
|
@ -72,7 +72,7 @@
|
||||
|
||||
#define IS_DIRECT_BIT (SIZE_T_ONE)
|
||||
|
||||
#ifdef LUA_USE_WIN
|
||||
#if LJ_TARGET_WINDOWS
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
@ -166,13 +166,12 @@ static LJ_AINLINE int CALL_MUNMAP(void *ptr, size_t size)
|
||||
#if LJ_64
|
||||
/* 64 bit mode needs special support for allocating memory in the lower 2GB. */
|
||||
|
||||
#if defined(__linux__)
|
||||
#if LJ_TARGET_LINUX
|
||||
|
||||
/* Actually this only gives us max. 1GB in current Linux kernels. */
|
||||
#define CALL_MMAP(s) mmap(NULL, (s), MMAP_PROT, MAP_32BIT|MMAP_FLAGS, -1, 0)
|
||||
|
||||
#elif (defined(__MACH__) && defined(__APPLE__)) || \
|
||||
defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#elif LJ_TARGET_OSX || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
|
||||
/* OSX and FreeBSD mmap() use a naive first-fit linear search.
|
||||
** That's perfect for us. Except that -pagezero_size must be set for OSX,
|
||||
@ -233,7 +232,7 @@ static LJ_AINLINE void *CALL_MMAP(size_t size)
|
||||
#define DIRECT_MMAP(s) CALL_MMAP(s)
|
||||
#define CALL_MUNMAP(a, s) munmap((a), (s))
|
||||
|
||||
#ifdef __linux__
|
||||
#if LJ_TARGET_LINUX
|
||||
/* Need to define _GNU_SOURCE to get the mremap prototype. */
|
||||
#define CALL_MREMAP(addr, osz, nsz, mv) mremap((addr), (osz), (nsz), (mv))
|
||||
#define CALL_MREMAP_NOMOVE 0
|
||||
@ -420,7 +419,7 @@ typedef struct malloc_state *mstate;
|
||||
(((S) + (DEFAULT_GRANULARITY - SIZE_T_ONE))\
|
||||
& ~(DEFAULT_GRANULARITY - SIZE_T_ONE))
|
||||
|
||||
#ifdef LUA_USE_WIN
|
||||
#if LJ_TARGET_WINDOWS
|
||||
#define mmap_align(S) granularity_align(S)
|
||||
#else
|
||||
#define mmap_align(S) page_align(S)
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include "lua.h"
|
||||
|
||||
|
||||
/* Target endianess. */
|
||||
#define LUAJIT_LE 0
|
||||
#define LUAJIT_BE 1
|
||||
@ -23,6 +22,13 @@
|
||||
#define LUAJIT_ARCH_PPCSPE 4
|
||||
#define LUAJIT_ARCH_ppcspe 4
|
||||
|
||||
/* Target OS. */
|
||||
#define LUAJIT_OS_OTHER 0
|
||||
#define LUAJIT_OS_WINDOWS 1
|
||||
#define LUAJIT_OS_LINUX 2
|
||||
#define LUAJIT_OS_OSX 3
|
||||
#define LUAJIT_OS_BSD 4
|
||||
#define LUAJIT_OS_POSIX 5
|
||||
|
||||
/* Select native target if no target defined. */
|
||||
#ifndef LUAJIT_TARGET
|
||||
@ -43,15 +49,58 @@
|
||||
|
||||
#endif
|
||||
|
||||
/* Set target properties. */
|
||||
/* Select native OS if no target OS defined. */
|
||||
#ifndef LUAJIT_OS
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define LUAJIT_OS LUAJIT_OS_WINDOWS
|
||||
#elif defined(__linux__)
|
||||
#define LUAJIT_OS LUAJIT_OS_LINUX
|
||||
#elif defined(__MACH__) && defined(__APPLE__)
|
||||
#define LUAJIT_OS LUAJIT_OS_OSX
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
|
||||
defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#define LUAJIT_OS LUAJIT_OS_BSD
|
||||
#elif defined(__solaris__) || defined(__CYGWIN__)
|
||||
#define LUAJIT_OS LUAJIT_OS_POSIX
|
||||
#else
|
||||
#define LUAJIT_OS LUAJIT_OS_OTHER
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* Set target OS properties. */
|
||||
#if LUAJIT_OS == LUAJIT_OS_WINDOWS
|
||||
#define LJ_OS_NAME "Windows"
|
||||
#elif LUAJIT_OS == LUAJIT_OS_LINUX
|
||||
#define LJ_OS_NAME "Linux"
|
||||
#elif LUAJIT_OS == LUAJIT_OS_OSX
|
||||
#define LJ_OS_NAME "OSX"
|
||||
#elif LUAJIT_OS == LUAJIT_OS_BSD
|
||||
#define LJ_OS_NAME "BSD"
|
||||
#elif LUAJIT_OS == LUAJIT_OS_POSIX
|
||||
#define LJ_OS_NAME "Posix"
|
||||
#else
|
||||
#define LJ_OS_NAME "Other"
|
||||
#endif
|
||||
|
||||
#define LJ_TARGET_WINDOWS (LUAJIT_OS == LUAJIT_OS_WINDOWS)
|
||||
#define LJ_TARGET_LINUX (LUAJIT_OS == LUAJIT_OS_LINUX)
|
||||
#define LJ_TARGET_OSX (LUAJIT_OS == LUAJIT_OS_OSX)
|
||||
#define LJ_TARGET_POSIX (LUAJIT_OS > LUAJIT_OS_WINDOWS)
|
||||
#define LJ_TARGET_DLOPEN LJ_TARGET_POSIX
|
||||
|
||||
/* Set target architecture properties. */
|
||||
#if LUAJIT_TARGET == LUAJIT_ARCH_X86
|
||||
|
||||
#define LJ_ARCH_NAME "x86"
|
||||
#define LJ_ARCH_BITS 32
|
||||
#define LJ_ARCH_ENDIAN LUAJIT_LE
|
||||
#define LJ_ARCH_BITENDIAN LUAJIT_LE
|
||||
#define LJ_ARCH_HASFPU 1
|
||||
#define LJ_ABI_WIN LJ_TARGET_WINDOWS
|
||||
#define LJ_TARGET_X86 1
|
||||
#define LJ_TARGET_X86ORX64 1
|
||||
#define LJ_PAGESIZE 4096
|
||||
#define LJ_TARGET_EHRETREG 0
|
||||
#define LJ_TARGET_MASKSHIFT 1
|
||||
#define LJ_TARGET_MASKROT 1
|
||||
@ -61,9 +110,11 @@
|
||||
#define LJ_ARCH_NAME "x64"
|
||||
#define LJ_ARCH_BITS 64
|
||||
#define LJ_ARCH_ENDIAN LUAJIT_LE
|
||||
#define LJ_ARCH_BITENDIAN LUAJIT_LE
|
||||
#define LJ_ARCH_HASFPU 1
|
||||
#define LJ_ABI_WIN LJ_TARGET_WINDOWS
|
||||
#define LJ_TARGET_X64 1
|
||||
#define LJ_TARGET_X86ORX64 1
|
||||
#define LJ_PAGESIZE 4096
|
||||
#define LJ_TARGET_EHRETREG 0
|
||||
#define LJ_TARGET_MASKSHIFT 1
|
||||
#define LJ_TARGET_MASKROT 1
|
||||
@ -77,9 +128,12 @@
|
||||
#define LJ_ARCH_NAME "ppcspe"
|
||||
#define LJ_ARCH_BITS 32
|
||||
#define LJ_ARCH_ENDIAN LUAJIT_BE
|
||||
#define LJ_ARCH_BITENDIAN LUAJIT_BE
|
||||
#define LJ_ARCH_HASFPU 1
|
||||
#define LJ_ABI_SOFTFP 1
|
||||
#define LJ_ABI_EABI 1
|
||||
#define LJ_TARGET_PPC 1
|
||||
#define LJ_TARGET_PPCSPE 1
|
||||
#define LJ_PAGESIZE 4096
|
||||
#define LJ_TARGET_EHRETREG 3
|
||||
#define LJ_TARGET_MASKSHIFT 0
|
||||
#define LJ_TARGET_MASKROT 1
|
||||
@ -89,6 +143,10 @@
|
||||
#error "No target architecture defined"
|
||||
#endif
|
||||
|
||||
#ifndef LJ_PAGESIZE
|
||||
#define LJ_PAGESIZE 4096
|
||||
#endif
|
||||
|
||||
/* Check for minimum required compiler versions. */
|
||||
#if defined(__GNUC__)
|
||||
#if LJ_TARGET_X64
|
||||
|
@ -1345,7 +1345,7 @@ static void asm_gencall(ASMState *as, const CCallInfo *ci, IRRef *args)
|
||||
for (n = 0; n < nargs; n++) { /* Setup args. */
|
||||
IRIns *ir = IR(args[n]);
|
||||
Reg r;
|
||||
#if LJ_64 && defined(_WIN64)
|
||||
#if LJ_64 && LJ_ABI_WIN
|
||||
/* Windows/x64 argument registers are strictly positional. */
|
||||
r = irt_isnum(ir->t) ? (fpr <= REGARG_LASTFPR ? fpr : 0) : (gprs & 31);
|
||||
fpr++; gprs >>= 5;
|
||||
@ -3518,11 +3518,7 @@ static void asm_setup_regsp(ASMState *as, GCtrace *T)
|
||||
const CCallInfo *ci = &lj_ir_callinfo[ir->op2];
|
||||
#if LJ_64
|
||||
/* NYI: add stack slots for x64 calls with many args. */
|
||||
#ifdef _WIN64
|
||||
lua_assert(CCI_NARGS(ci) <= 4);
|
||||
#else
|
||||
lua_assert(CCI_NARGS(ci) <= 6); /* Safe lower bound. */
|
||||
#endif
|
||||
lua_assert(CCI_NARGS(ci) <= (LJ_ABI_WIN ? 4 : 6));
|
||||
ir->prev = REGSP_HINT(irt_isnum(ir->t) ? RID_FPRET : RID_RET);
|
||||
#else
|
||||
/* NYI: not fastcall-aware, but doesn't matter (yet). */
|
||||
|
10
src/lj_err.c
10
src/lj_err.c
@ -63,15 +63,11 @@
|
||||
** EXT is mandatory on POSIX/x64 since the interpreter doesn't save r12/r13.
|
||||
*/
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#if LJ_TARGET_X64 || defined(LUAJIT_UNWIND_EXTERNAL)
|
||||
#if defined(__GNUC__) && (LJ_TARGET_X64 || defined(LUAJIT_UNWIND_EXTERNAL))
|
||||
#define LJ_UNWIND_EXT 1
|
||||
#endif
|
||||
#elif defined(LUA_USE_WIN)
|
||||
#if LJ_TARGET_X64
|
||||
#elif LJ_TARGET_X64 && LJ_TARGET_WINDOWS
|
||||
#define LJ_UNWIND_EXT 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* -- Error messages ------------------------------------------------------ */
|
||||
|
||||
@ -604,7 +600,7 @@ static void err_raise_ext(int errcode)
|
||||
}
|
||||
#endif
|
||||
|
||||
#elif defined(_WIN64)
|
||||
#elif LJ_TARGET_X64 && LJ_TARGET_WINDOWS
|
||||
|
||||
/*
|
||||
** Someone in Redmond owes me several days of my life. A lot of this is
|
||||
|
@ -57,7 +57,7 @@ ERRDEF(NOENV, "no calling environment")
|
||||
ERRDEF(CYIELD, "attempt to yield across C-call boundary")
|
||||
ERRDEF(BADLU, "bad light userdata pointer")
|
||||
ERRDEF(NOGCMM, "bad action while in __gc metamethod")
|
||||
#ifdef LUA_USE_WIN
|
||||
#if LJ_TARGET_WINDOWS
|
||||
ERRDEF(BADFPU, "bad FPU precision (use D3DCREATE_FPU_PRESERVE with DirectX)")
|
||||
#endif
|
||||
|
||||
|
@ -69,7 +69,7 @@ enum {
|
||||
#define CFRAME_SIZE_JIT CFRAME_SIZE
|
||||
#define CFRAME_SHIFT_MULTRES 0
|
||||
#elif LJ_TARGET_X64
|
||||
#if _WIN64
|
||||
#if LJ_ABI_WIN
|
||||
#define CFRAME_OFS_PREV (13*8)
|
||||
#define CFRAME_OFS_PC (25*4)
|
||||
#define CFRAME_OFS_L (24*4)
|
||||
|
@ -335,7 +335,7 @@ static const ELFheader elfhdr_template = {
|
||||
.eclass = LJ_64 ? 2 : 1,
|
||||
.eendian = LJ_ENDIAN_SELECT(1, 2),
|
||||
.eversion = 1,
|
||||
#if defined(__linux__)
|
||||
#if LJ_TARGET_LINUX
|
||||
.eosabi = 0, /* Nope, it's not 3. */
|
||||
#elif defined(__FreeBSD__)
|
||||
.eosabi = 9,
|
||||
|
@ -55,7 +55,7 @@
|
||||
(JIT_F_OPT_2|JIT_F_OPT_FWD|JIT_F_OPT_DSE|JIT_F_OPT_ABC|JIT_F_OPT_FUSE)
|
||||
#define JIT_F_OPT_DEFAULT JIT_F_OPT_3
|
||||
|
||||
#if defined(LUA_USE_WIN) || LJ_64
|
||||
#if LJ_TARGET_WINDOWS || LJ_64
|
||||
/* See: http://blogs.msdn.com/oldnewthing/archive/2003/10/08/55239.aspx */
|
||||
#define JIT_P_sizemcode_DEFAULT 64
|
||||
#else
|
||||
|
@ -49,7 +49,7 @@ LJ_FUNC int lj_lib_checkopt(lua_State *L, int narg, int def, const char *lst);
|
||||
#define lj_lib_upvalue(L, n) \
|
||||
(&gcref((L->base-1)->fr.func)->fn.c.upvalue[(n)-1])
|
||||
|
||||
#ifdef LUA_USE_WIN
|
||||
#if LJ_TARGET_WINDOWS
|
||||
#define lj_lib_checkfpu(L) \
|
||||
do { setnumV(L->top++, (lua_Number)1437217655); \
|
||||
if (lua_tointeger(L, -1) != 1437217655) lj_err_caller(L, LJ_ERR_BADFPU); \
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
/* -- OS-specific functions ----------------------------------------------- */
|
||||
|
||||
#if defined(LUA_USE_WIN)
|
||||
#if LJ_TARGET_WINDOWS
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
@ -49,7 +49,7 @@ static void mcode_setprot(void *p, size_t sz, DWORD prot)
|
||||
VirtualProtect(p, sz, prot, &oprot);
|
||||
}
|
||||
|
||||
#elif defined(LUA_USE_POSIX)
|
||||
#elif LJ_TARGET_POSIX
|
||||
|
||||
#include <sys/mman.h>
|
||||
|
||||
@ -82,7 +82,7 @@ static void mcode_setprot(void *p, size_t sz, int prot)
|
||||
|
||||
#elif LJ_64
|
||||
|
||||
#error "Missing OS support for allocating executable memory"
|
||||
#error "Missing OS support for explicit placement of executable memory"
|
||||
|
||||
#else
|
||||
|
||||
|
@ -719,7 +719,7 @@ static LJ_AINLINE int32_t lj_num2bit(lua_Number n)
|
||||
return (int32_t)o.u32.lo;
|
||||
}
|
||||
|
||||
#if (defined(__i386__) || defined(_M_IX86)) && !defined(__SSE2__)
|
||||
#if LJ_TARGET_X86 && !defined(__SSE2__)
|
||||
#define lj_num2int(n) lj_num2bit((n))
|
||||
#else
|
||||
#define lj_num2int(n) ((int32_t)(n))
|
||||
|
@ -40,7 +40,7 @@ enum {
|
||||
|
||||
/* These definitions must match with the *.dasc file(s): */
|
||||
RID_BASE = RID_EDX, /* Interpreter BASE. */
|
||||
#if LJ_64 && !defined(_WIN64)
|
||||
#if LJ_64 && !LJ_ABI_WIN
|
||||
RID_PC = RID_EBX, /* Interpreter PC. */
|
||||
RID_DISPATCH = RID_R14D, /* Interpreter DISPATCH table. */
|
||||
#else
|
||||
@ -74,7 +74,7 @@ enum {
|
||||
/* ABI-specific register sets. */
|
||||
#define RSET_ACD (RID2RSET(RID_EAX)|RID2RSET(RID_ECX)|RID2RSET(RID_EDX))
|
||||
#if LJ_64
|
||||
#ifdef _WIN64
|
||||
#if LJ_ABI_WIN
|
||||
/* Windows x64 ABI. */
|
||||
#define RSET_SCRATCH \
|
||||
(RSET_ACD|RSET_RANGE(RID_R8D, RID_R11D+1)|RSET_RANGE(RID_XMM0, RID_XMM5+1))
|
||||
@ -117,7 +117,7 @@ enum {
|
||||
** SPS_FIRST: First spill slot for general use. Reserve min. two 32 bit slots.
|
||||
*/
|
||||
#if LJ_64
|
||||
#ifdef _WIN64
|
||||
#if LJ_ABI_WIN
|
||||
#define SPS_FIXED (4*2)
|
||||
#define SPS_FIRST (4*2) /* Don't use callee register save area. */
|
||||
#else
|
||||
|
@ -9,19 +9,8 @@
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
|
||||
/* Try to determine supported features for a couple of standard platforms. */
|
||||
#if defined(_WIN32)
|
||||
#define LUA_USE_WIN
|
||||
#define LUA_DL_DLL
|
||||
#elif defined(__linux__) || defined(__solaris__) || defined(__CYGWIN__) || \
|
||||
defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
|
||||
defined(__FreeBSD_kernel__) || (defined(__MACH__) && defined(__APPLE__))
|
||||
#define LUA_USE_POSIX
|
||||
#define LUA_DL_DLOPEN
|
||||
#endif
|
||||
|
||||
/* Default path for loading Lua and C modules with require(). */
|
||||
#ifdef LUA_USE_WIN
|
||||
#if defined(_WIN32)
|
||||
/*
|
||||
** In Windows, any exclamation mark ('!') in the path is replaced by the
|
||||
** path of the directory of the executable file of the current process.
|
||||
@ -58,7 +47,7 @@
|
||||
#define LUA_INIT "LUA_INIT"
|
||||
|
||||
/* Special file system characters. */
|
||||
#ifdef LUA_USE_WIN
|
||||
#if defined(_WIN32)
|
||||
#define LUA_DIRSEP "\\"
|
||||
#else
|
||||
#define LUA_DIRSEP "/"
|
||||
|
@ -18,10 +18,12 @@
|
||||
#include "lualib.h"
|
||||
#include "luajit.h"
|
||||
|
||||
#if defined(LUA_USE_POSIX)
|
||||
#include "lj_arch.h"
|
||||
|
||||
#if LJ_TARGET_POSIX
|
||||
#include <unistd.h>
|
||||
#define lua_stdin_is_tty() isatty(0)
|
||||
#elif defined(LUA_USE_WIN)
|
||||
#elif LJ_TARGET_WINDOWS
|
||||
#include <io.h>
|
||||
#ifdef __BORLANDC__
|
||||
#define lua_stdin_is_tty() isatty(_fileno(stdin))
|
||||
|
Loading…
Reference in New Issue
Block a user