mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-12 09:24:07 +00:00
Merge branch 'master' into v2.1
This commit is contained in:
commit
fb19df9fd7
@ -248,9 +248,6 @@ ifneq (,$(findstring LJ_TARGET_PS3 1,$(TARGET_TESTARCH)))
|
|||||||
TARGET_XCFLAGS+= -DLUAJIT_USE_SYSMALLOC
|
TARGET_XCFLAGS+= -DLUAJIT_USE_SYSMALLOC
|
||||||
TARGET_XLIBS+= -lpthread
|
TARGET_XLIBS+= -lpthread
|
||||||
endif
|
endif
|
||||||
ifneq (,$(findstring LJ_NO_UNWIND 1,$(TARGET_TESTARCH)))
|
|
||||||
TARGET_ARCH+= -DLUAJIT_NO_UNWIND
|
|
||||||
endif
|
|
||||||
|
|
||||||
TARGET_XCFLAGS+= $(CCOPT_$(TARGET_LJARCH))
|
TARGET_XCFLAGS+= $(CCOPT_$(TARGET_LJARCH))
|
||||||
TARGET_ARCH+= $(patsubst %,-DLUAJIT_TARGET=LUAJIT_ARCH_%,$(TARGET_LJARCH))
|
TARGET_ARCH+= $(patsubst %,-DLUAJIT_TARGET=LUAJIT_ARCH_%,$(TARGET_LJARCH))
|
||||||
@ -405,6 +402,10 @@ ifeq (,$(findstring LJ_ABI_SOFTFP 1,$(TARGET_TESTARCH)))
|
|||||||
else
|
else
|
||||||
TARGET_ARCH+= -DLJ_ABI_SOFTFP=1
|
TARGET_ARCH+= -DLJ_ABI_SOFTFP=1
|
||||||
endif
|
endif
|
||||||
|
ifneq (,$(findstring LJ_NO_UNWIND 1,$(TARGET_TESTARCH)))
|
||||||
|
DASM_AFLAGS+= -D NO_UNWIND
|
||||||
|
TARGET_ARCH+= -DLUAJIT_NO_UNWIND
|
||||||
|
endif
|
||||||
DASM_AFLAGS+= -D VER=$(subst LJ_ARCH_VERSION_,,$(filter LJ_ARCH_VERSION_%,$(subst LJ_ARCH_VERSION ,LJ_ARCH_VERSION_,$(TARGET_TESTARCH))))
|
DASM_AFLAGS+= -D VER=$(subst LJ_ARCH_VERSION_,,$(filter LJ_ARCH_VERSION_%,$(subst LJ_ARCH_VERSION ,LJ_ARCH_VERSION_,$(TARGET_TESTARCH))))
|
||||||
ifeq (Windows,$(TARGET_SYS))
|
ifeq (Windows,$(TARGET_SYS))
|
||||||
DASM_AFLAGS+= -D WIN
|
DASM_AFLAGS+= -D WIN
|
||||||
|
@ -489,7 +489,7 @@
|
|||||||
#define LUAJIT_NO_EXP2
|
#define LUAJIT_NO_EXP2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(LUAJIT_NO_UNWIND) || defined(__symbian__) || LJ_TARGET_IOS || LJ_TARGET_PS3
|
#if defined(LUAJIT_NO_UNWIND) || defined(__symbian__) || LJ_TARGET_IOS || LJ_TARGET_PS3 || LJ_TARGET_PS4
|
||||||
#define LJ_NO_UNWIND 1
|
#define LJ_NO_UNWIND 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -58,10 +58,10 @@
|
|||||||
** EXT cannot be enabled on WIN32 since system exceptions use code-driven SEH.
|
** EXT cannot be enabled on WIN32 since system exceptions use code-driven SEH.
|
||||||
** EXT is mandatory on WIN64 since the calling convention has an abundance
|
** EXT is mandatory on WIN64 since the calling convention has an abundance
|
||||||
** of callee-saved registers (rbx, rbp, rsi, rdi, r12-r15, xmm6-xmm15).
|
** of callee-saved registers (rbx, rbp, rsi, rdi, r12-r15, xmm6-xmm15).
|
||||||
** EXT is mandatory on POSIX/x64 since the interpreter doesn't save r12/r13.
|
** The POSIX/x64 interpreter only saves r12/r13 for INT (e.g. PS4).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(__GNUC__) && (LJ_TARGET_X64 || defined(LUAJIT_UNWIND_EXTERNAL))
|
#if defined(__GNUC__) && (LJ_TARGET_X64 || defined(LUAJIT_UNWIND_EXTERNAL)) && !LJ_NO_UNWIND
|
||||||
#define LJ_UNWIND_EXT 1
|
#define LJ_UNWIND_EXT 1
|
||||||
#elif LJ_TARGET_X64 && LJ_TARGET_WINDOWS
|
#elif LJ_TARGET_X64 && LJ_TARGET_WINDOWS
|
||||||
#define LJ_UNWIND_EXT 1
|
#define LJ_UNWIND_EXT 1
|
||||||
|
@ -158,7 +158,11 @@ enum { LJ_CONT_TAILCALL, LJ_CONT_FFI_CALLBACK }; /* Special continuations. */
|
|||||||
#define CFRAME_OFS_NRES (4*4)
|
#define CFRAME_OFS_NRES (4*4)
|
||||||
#define CFRAME_OFS_MULTRES (1*4)
|
#define CFRAME_OFS_MULTRES (1*4)
|
||||||
#endif
|
#endif
|
||||||
|
#if LJ_NO_UNWIND
|
||||||
|
#define CFRAME_SIZE (12*8)
|
||||||
|
#else
|
||||||
#define CFRAME_SIZE (10*8)
|
#define CFRAME_SIZE (10*8)
|
||||||
|
#endif
|
||||||
#define CFRAME_SIZE_JIT (CFRAME_SIZE + 16)
|
#define CFRAME_SIZE_JIT (CFRAME_SIZE + 16)
|
||||||
#define CFRAME_SHIFT_MULTRES 0
|
#define CFRAME_SHIFT_MULTRES 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -27,11 +27,11 @@ if exist minilua.exe.manifest^
|
|||||||
@minilua
|
@minilua
|
||||||
@if not errorlevel 8 goto :FAIL
|
@if not errorlevel 8 goto :FAIL
|
||||||
|
|
||||||
@set DASMFLAGS=-D P64
|
@set DASMFLAGS=-D P64 -D NO_UNWIND
|
||||||
minilua %DASM% -LN %DASMFLAGS% -o host\buildvm_arch.h vm_x86.dasc
|
minilua %DASM% -LN %DASMFLAGS% -o host\buildvm_arch.h vm_x86.dasc
|
||||||
@if errorlevel 1 goto :BAD
|
@if errorlevel 1 goto :BAD
|
||||||
|
|
||||||
%LJCOMPILE% /I "." /I %DASMDIR% -DLUAJIT_TARGET=LUAJIT_ARCH_X64 -DLUAJIT_OS=LUAJIT_OS_OTHER -DLUAJIT_DISABLE_JIT -DLUAJIT_DISABLE_FFI host\buildvm*.c
|
%LJCOMPILE% /I "." /I %DASMDIR% -DLUAJIT_TARGET=LUAJIT_ARCH_X64 -DLUAJIT_OS=LUAJIT_OS_OTHER -DLUAJIT_DISABLE_JIT -DLUAJIT_DISABLE_FFI -DLUAJIT_NO_UNWIND host\buildvm*.c
|
||||||
@if errorlevel 1 goto :BAD
|
@if errorlevel 1 goto :BAD
|
||||||
%LJLINK% /out:buildvm.exe buildvm*.obj
|
%LJLINK% /out:buildvm.exe buildvm*.obj
|
||||||
@if errorlevel 1 goto :BAD
|
@if errorlevel 1 goto :BAD
|
||||||
|
@ -143,6 +143,9 @@
|
|||||||
|.define CFRAME_SPACE, aword*5 // Delta for rsp (see <--).
|
|.define CFRAME_SPACE, aword*5 // Delta for rsp (see <--).
|
||||||
|.macro saveregs_
|
|.macro saveregs_
|
||||||
| push rbx; push r15; push r14
|
| push rbx; push r15; push r14
|
||||||
|
|.if NO_UNWIND
|
||||||
|
| push r13; push r12
|
||||||
|
|.endif
|
||||||
| sub rsp, CFRAME_SPACE
|
| sub rsp, CFRAME_SPACE
|
||||||
|.endmacro
|
|.endmacro
|
||||||
|.macro saveregs
|
|.macro saveregs
|
||||||
@ -150,15 +153,28 @@
|
|||||||
|.endmacro
|
|.endmacro
|
||||||
|.macro restoreregs
|
|.macro restoreregs
|
||||||
| add rsp, CFRAME_SPACE
|
| add rsp, CFRAME_SPACE
|
||||||
|
|.if NO_UNWIND
|
||||||
|
| pop r12; pop r13
|
||||||
|
|.endif
|
||||||
| pop r14; pop r15; pop rbx; pop rbp
|
| pop r14; pop r15; pop rbx; pop rbp
|
||||||
|.endmacro
|
|.endmacro
|
||||||
|
|
|
|
||||||
|//----- 16 byte aligned,
|
|//----- 16 byte aligned,
|
||||||
|
|.if NO_UNWIND
|
||||||
|
|.define SAVE_RET, aword [rsp+aword*11] //<-- rsp entering interpreter.
|
||||||
|
|.define SAVE_R4, aword [rsp+aword*10]
|
||||||
|
|.define SAVE_R3, aword [rsp+aword*9]
|
||||||
|
|.define SAVE_R2, aword [rsp+aword*8]
|
||||||
|
|.define SAVE_R1, aword [rsp+aword*7]
|
||||||
|
|.define SAVE_RU2, aword [rsp+aword*6]
|
||||||
|
|.define SAVE_RU1, aword [rsp+aword*5] //<-- rsp after register saves.
|
||||||
|
|.else
|
||||||
|.define SAVE_RET, aword [rsp+aword*9] //<-- rsp entering interpreter.
|
|.define SAVE_RET, aword [rsp+aword*9] //<-- rsp entering interpreter.
|
||||||
|.define SAVE_R4, aword [rsp+aword*8]
|
|.define SAVE_R4, aword [rsp+aword*8]
|
||||||
|.define SAVE_R3, aword [rsp+aword*7]
|
|.define SAVE_R3, aword [rsp+aword*7]
|
||||||
|.define SAVE_R2, aword [rsp+aword*6]
|
|.define SAVE_R2, aword [rsp+aword*6]
|
||||||
|.define SAVE_R1, aword [rsp+aword*5] //<-- rsp after register saves.
|
|.define SAVE_R1, aword [rsp+aword*5] //<-- rsp after register saves.
|
||||||
|
|.endif
|
||||||
|.define SAVE_CFRAME, aword [rsp+aword*4]
|
|.define SAVE_CFRAME, aword [rsp+aword*4]
|
||||||
|.define SAVE_PC, aword [rsp+aword*3]
|
|.define SAVE_PC, aword [rsp+aword*3]
|
||||||
|.define SAVE_L, aword [rsp+aword*2]
|
|.define SAVE_L, aword [rsp+aword*2]
|
||||||
@ -4682,6 +4698,10 @@ static void emit_asm_debug(BuildCtx *ctx)
|
|||||||
"\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
|
"\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
|
||||||
"\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
|
"\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
|
||||||
"\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
|
"\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
|
||||||
|
#if LJ_NO_UNWIND
|
||||||
|
"\t.byte 0x8d\n\t.uleb128 0x6\n" /* offset r13 */
|
||||||
|
"\t.byte 0x8c\n\t.uleb128 0x7\n" /* offset r12 */
|
||||||
|
#endif
|
||||||
"\t.align 8\n"
|
"\t.align 8\n"
|
||||||
".LEFDE0:\n\n", fcofs, CFRAME_SIZE);
|
".LEFDE0:\n\n", fcofs, CFRAME_SIZE);
|
||||||
#if LJ_HASFFI
|
#if LJ_HASFFI
|
||||||
@ -4699,6 +4719,7 @@ static void emit_asm_debug(BuildCtx *ctx)
|
|||||||
"\t.align 8\n"
|
"\t.align 8\n"
|
||||||
".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
|
".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
|
||||||
#endif
|
#endif
|
||||||
|
#if !LJ_NO_UNWIND
|
||||||
#if (defined(__sun__) && defined(__svr4__))
|
#if (defined(__sun__) && defined(__svr4__))
|
||||||
fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@unwind\n");
|
fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@unwind\n");
|
||||||
#else
|
#else
|
||||||
@ -4768,8 +4789,10 @@ static void emit_asm_debug(BuildCtx *ctx)
|
|||||||
"\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
|
"\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
|
||||||
"\t.align 8\n"
|
"\t.align 8\n"
|
||||||
".LEFDE3:\n\n", (int)ctx->codesz - fcofs);
|
".LEFDE3:\n\n", (int)ctx->codesz - fcofs);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
#if !LJ_NO_UNWIND
|
||||||
/* Mental note: never let Apple design an assembler.
|
/* Mental note: never let Apple design an assembler.
|
||||||
** Or a linker. Or a plastic case. But I digress.
|
** Or a linker. Or a plastic case. But I digress.
|
||||||
*/
|
*/
|
||||||
@ -4864,6 +4887,7 @@ static void emit_asm_debug(BuildCtx *ctx)
|
|||||||
fprintf(ctx->fp, ".subsections_via_symbols\n");
|
fprintf(ctx->fp, ".subsections_via_symbols\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default: /* Difficult for other modes. */
|
default: /* Difficult for other modes. */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -222,6 +222,9 @@
|
|||||||
|.define CFRAME_SPACE, aword*5 // Delta for rsp (see <--).
|
|.define CFRAME_SPACE, aword*5 // Delta for rsp (see <--).
|
||||||
|.macro saveregs_
|
|.macro saveregs_
|
||||||
| push rbx; push r15; push r14
|
| push rbx; push r15; push r14
|
||||||
|
|.if NO_UNWIND
|
||||||
|
| push r13; push r12
|
||||||
|
|.endif
|
||||||
| sub rsp, CFRAME_SPACE
|
| sub rsp, CFRAME_SPACE
|
||||||
|.endmacro
|
|.endmacro
|
||||||
|.macro saveregs
|
|.macro saveregs
|
||||||
@ -229,15 +232,28 @@
|
|||||||
|.endmacro
|
|.endmacro
|
||||||
|.macro restoreregs
|
|.macro restoreregs
|
||||||
| add rsp, CFRAME_SPACE
|
| add rsp, CFRAME_SPACE
|
||||||
|
|.if NO_UNWIND
|
||||||
|
| pop r12; pop r13
|
||||||
|
|.endif
|
||||||
| pop r14; pop r15; pop rbx; pop rbp
|
| pop r14; pop r15; pop rbx; pop rbp
|
||||||
|.endmacro
|
|.endmacro
|
||||||
|
|
|
|
||||||
|//----- 16 byte aligned,
|
|//----- 16 byte aligned,
|
||||||
|
|.if NO_UNWIND
|
||||||
|
|.define SAVE_RET, aword [rsp+aword*11] //<-- rsp entering interpreter.
|
||||||
|
|.define SAVE_R4, aword [rsp+aword*10]
|
||||||
|
|.define SAVE_R3, aword [rsp+aword*9]
|
||||||
|
|.define SAVE_R2, aword [rsp+aword*8]
|
||||||
|
|.define SAVE_R1, aword [rsp+aword*7]
|
||||||
|
|.define SAVE_RU2, aword [rsp+aword*6]
|
||||||
|
|.define SAVE_RU1, aword [rsp+aword*5] //<-- rsp after register saves.
|
||||||
|
|.else
|
||||||
|.define SAVE_RET, aword [rsp+aword*9] //<-- rsp entering interpreter.
|
|.define SAVE_RET, aword [rsp+aword*9] //<-- rsp entering interpreter.
|
||||||
|.define SAVE_R4, aword [rsp+aword*8]
|
|.define SAVE_R4, aword [rsp+aword*8]
|
||||||
|.define SAVE_R3, aword [rsp+aword*7]
|
|.define SAVE_R3, aword [rsp+aword*7]
|
||||||
|.define SAVE_R2, aword [rsp+aword*6]
|
|.define SAVE_R2, aword [rsp+aword*6]
|
||||||
|.define SAVE_R1, aword [rsp+aword*5] //<-- rsp after register saves.
|
|.define SAVE_R1, aword [rsp+aword*5] //<-- rsp after register saves.
|
||||||
|
|.endif
|
||||||
|.define SAVE_CFRAME, aword [rsp+aword*4]
|
|.define SAVE_CFRAME, aword [rsp+aword*4]
|
||||||
|.define SAVE_PC, dword [rsp+dword*7]
|
|.define SAVE_PC, dword [rsp+dword*7]
|
||||||
|.define SAVE_L, dword [rsp+dword*6]
|
|.define SAVE_L, dword [rsp+dword*6]
|
||||||
@ -5422,6 +5438,10 @@ static void emit_asm_debug(BuildCtx *ctx)
|
|||||||
"\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
|
"\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
|
||||||
"\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
|
"\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
|
||||||
"\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
|
"\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
|
||||||
|
#if LJ_NO_UNWIND
|
||||||
|
"\t.byte 0x8d\n\t.uleb128 0x6\n" /* offset r13 */
|
||||||
|
"\t.byte 0x8c\n\t.uleb128 0x7\n" /* offset r12 */
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
"\t.long .Lbegin\n"
|
"\t.long .Lbegin\n"
|
||||||
"\t.long %d\n"
|
"\t.long %d\n"
|
||||||
@ -5457,6 +5477,7 @@ static void emit_asm_debug(BuildCtx *ctx)
|
|||||||
"\t.align " SZPTR "\n"
|
"\t.align " SZPTR "\n"
|
||||||
".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
|
".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
|
||||||
#endif
|
#endif
|
||||||
|
#if !LJ_NO_UNWIND
|
||||||
#if (defined(__sun__) && defined(__svr4__))
|
#if (defined(__sun__) && defined(__svr4__))
|
||||||
#if LJ_64
|
#if LJ_64
|
||||||
fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@unwind\n");
|
fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@unwind\n");
|
||||||
@ -5544,8 +5565,10 @@ static void emit_asm_debug(BuildCtx *ctx)
|
|||||||
#endif
|
#endif
|
||||||
"\t.align " SZPTR "\n"
|
"\t.align " SZPTR "\n"
|
||||||
".LEFDE3:\n\n", (int)ctx->codesz - fcofs);
|
".LEFDE3:\n\n", (int)ctx->codesz - fcofs);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
#if !LJ_NO_UNWIND
|
||||||
/* Mental note: never let Apple design an assembler.
|
/* Mental note: never let Apple design an assembler.
|
||||||
** Or a linker. Or a plastic case. But I digress.
|
** Or a linker. Or a plastic case. But I digress.
|
||||||
*/
|
*/
|
||||||
@ -5679,6 +5702,7 @@ static void emit_asm_debug(BuildCtx *ctx)
|
|||||||
fprintf(ctx->fp, ".subsections_via_symbols\n");
|
fprintf(ctx->fp, ".subsections_via_symbols\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default: /* Difficult for other modes. */
|
default: /* Difficult for other modes. */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user