aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2015-06-09 22:09:11 +0200
committerMike Pall <mike>2015-06-09 22:09:11 +0200
commitfb19df9fd765ce7384e2e28cec78b3c30a10d5ee (patch)
treea3e6b0811cf37b6eb7fc720fc56e7e1c8222b06c
parent4da1bb66cdd20e868dae42d2c544280ec1b9fa76 (diff)
parent72347895edbdc8730c1e758bfee4264fd60164ac (diff)
downloadluajit-fb19df9fd765ce7384e2e28cec78b3c30a10d5ee.tar.gz
luajit-fb19df9fd765ce7384e2e28cec78b3c30a10d5ee.tar.bz2
luajit-fb19df9fd765ce7384e2e28cec78b3c30a10d5ee.zip
Merge branch 'master' into v2.1
-rw-r--r--src/Makefile7
-rw-r--r--src/lj_arch.h2
-rw-r--r--src/lj_err.c4
-rw-r--r--src/lj_frame.h4
-rw-r--r--src/ps4build.bat4
-rw-r--r--src/vm_x64.dasc24
-rw-r--r--src/vm_x86.dasc24
7 files changed, 61 insertions, 8 deletions
diff --git a/src/Makefile b/src/Makefile
index 903beedd..532da6e9 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -248,9 +248,6 @@ ifneq (,$(findstring LJ_TARGET_PS3 1,$(TARGET_TESTARCH)))
248 TARGET_XCFLAGS+= -DLUAJIT_USE_SYSMALLOC 248 TARGET_XCFLAGS+= -DLUAJIT_USE_SYSMALLOC
249 TARGET_XLIBS+= -lpthread 249 TARGET_XLIBS+= -lpthread
250endif 250endif
251ifneq (,$(findstring LJ_NO_UNWIND 1,$(TARGET_TESTARCH)))
252 TARGET_ARCH+= -DLUAJIT_NO_UNWIND
253endif
254 251
255TARGET_XCFLAGS+= $(CCOPT_$(TARGET_LJARCH)) 252TARGET_XCFLAGS+= $(CCOPT_$(TARGET_LJARCH))
256TARGET_ARCH+= $(patsubst %,-DLUAJIT_TARGET=LUAJIT_ARCH_%,$(TARGET_LJARCH)) 253TARGET_ARCH+= $(patsubst %,-DLUAJIT_TARGET=LUAJIT_ARCH_%,$(TARGET_LJARCH))
@@ -405,6 +402,10 @@ ifeq (,$(findstring LJ_ABI_SOFTFP 1,$(TARGET_TESTARCH)))
405else 402else
406 TARGET_ARCH+= -DLJ_ABI_SOFTFP=1 403 TARGET_ARCH+= -DLJ_ABI_SOFTFP=1
407endif 404endif
405ifneq (,$(findstring LJ_NO_UNWIND 1,$(TARGET_TESTARCH)))
406 DASM_AFLAGS+= -D NO_UNWIND
407 TARGET_ARCH+= -DLUAJIT_NO_UNWIND
408endif
408DASM_AFLAGS+= -D VER=$(subst LJ_ARCH_VERSION_,,$(filter LJ_ARCH_VERSION_%,$(subst LJ_ARCH_VERSION ,LJ_ARCH_VERSION_,$(TARGET_TESTARCH)))) 409DASM_AFLAGS+= -D VER=$(subst LJ_ARCH_VERSION_,,$(filter LJ_ARCH_VERSION_%,$(subst LJ_ARCH_VERSION ,LJ_ARCH_VERSION_,$(TARGET_TESTARCH))))
409ifeq (Windows,$(TARGET_SYS)) 410ifeq (Windows,$(TARGET_SYS))
410 DASM_AFLAGS+= -D WIN 411 DASM_AFLAGS+= -D WIN
diff --git a/src/lj_arch.h b/src/lj_arch.h
index 442ba4fc..96e9a99e 100644
--- a/src/lj_arch.h
+++ b/src/lj_arch.h
@@ -489,7 +489,7 @@
489#define LUAJIT_NO_EXP2 489#define LUAJIT_NO_EXP2
490#endif 490#endif
491 491
492#if defined(LUAJIT_NO_UNWIND) || defined(__symbian__) || LJ_TARGET_IOS || LJ_TARGET_PS3 492#if defined(LUAJIT_NO_UNWIND) || defined(__symbian__) || LJ_TARGET_IOS || LJ_TARGET_PS3 || LJ_TARGET_PS4
493#define LJ_NO_UNWIND 1 493#define LJ_NO_UNWIND 1
494#endif 494#endif
495 495
diff --git a/src/lj_err.c b/src/lj_err.c
index 26210f54..2e20c2c0 100644
--- a/src/lj_err.c
+++ b/src/lj_err.c
@@ -58,10 +58,10 @@
58** EXT cannot be enabled on WIN32 since system exceptions use code-driven SEH. 58** EXT cannot be enabled on WIN32 since system exceptions use code-driven SEH.
59** EXT is mandatory on WIN64 since the calling convention has an abundance 59** EXT is mandatory on WIN64 since the calling convention has an abundance
60** of callee-saved registers (rbx, rbp, rsi, rdi, r12-r15, xmm6-xmm15). 60** of callee-saved registers (rbx, rbp, rsi, rdi, r12-r15, xmm6-xmm15).
61** EXT is mandatory on POSIX/x64 since the interpreter doesn't save r12/r13. 61** The POSIX/x64 interpreter only saves r12/r13 for INT (e.g. PS4).
62*/ 62*/
63 63
64#if defined(__GNUC__) && (LJ_TARGET_X64 || defined(LUAJIT_UNWIND_EXTERNAL)) 64#if defined(__GNUC__) && (LJ_TARGET_X64 || defined(LUAJIT_UNWIND_EXTERNAL)) && !LJ_NO_UNWIND
65#define LJ_UNWIND_EXT 1 65#define LJ_UNWIND_EXT 1
66#elif LJ_TARGET_X64 && LJ_TARGET_WINDOWS 66#elif LJ_TARGET_X64 && LJ_TARGET_WINDOWS
67#define LJ_UNWIND_EXT 1 67#define LJ_UNWIND_EXT 1
diff --git a/src/lj_frame.h b/src/lj_frame.h
index 517f4684..a86c36be 100644
--- a/src/lj_frame.h
+++ b/src/lj_frame.h
@@ -158,7 +158,11 @@ enum { LJ_CONT_TAILCALL, LJ_CONT_FFI_CALLBACK }; /* Special continuations. */
158#define CFRAME_OFS_NRES (4*4) 158#define CFRAME_OFS_NRES (4*4)
159#define CFRAME_OFS_MULTRES (1*4) 159#define CFRAME_OFS_MULTRES (1*4)
160#endif 160#endif
161#if LJ_NO_UNWIND
162#define CFRAME_SIZE (12*8)
163#else
161#define CFRAME_SIZE (10*8) 164#define CFRAME_SIZE (10*8)
165#endif
162#define CFRAME_SIZE_JIT (CFRAME_SIZE + 16) 166#define CFRAME_SIZE_JIT (CFRAME_SIZE + 16)
163#define CFRAME_SHIFT_MULTRES 0 167#define CFRAME_SHIFT_MULTRES 0
164#endif 168#endif
diff --git a/src/ps4build.bat b/src/ps4build.bat
index 42fc9a64..337a44fa 100644
--- a/src/ps4build.bat
+++ b/src/ps4build.bat
@@ -27,11 +27,11 @@ if exist minilua.exe.manifest^
27@minilua 27@minilua
28@if not errorlevel 8 goto :FAIL 28@if not errorlevel 8 goto :FAIL
29 29
30@set DASMFLAGS=-D P64 30@set DASMFLAGS=-D P64 -D NO_UNWIND
31minilua %DASM% -LN %DASMFLAGS% -o host\buildvm_arch.h vm_x86.dasc 31minilua %DASM% -LN %DASMFLAGS% -o host\buildvm_arch.h vm_x86.dasc
32@if errorlevel 1 goto :BAD 32@if errorlevel 1 goto :BAD
33 33
34%LJCOMPILE% /I "." /I %DASMDIR% -DLUAJIT_TARGET=LUAJIT_ARCH_X64 -DLUAJIT_OS=LUAJIT_OS_OTHER -DLUAJIT_DISABLE_JIT -DLUAJIT_DISABLE_FFI host\buildvm*.c 34%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
35@if errorlevel 1 goto :BAD 35@if errorlevel 1 goto :BAD
36%LJLINK% /out:buildvm.exe buildvm*.obj 36%LJLINK% /out:buildvm.exe buildvm*.obj
37@if errorlevel 1 goto :BAD 37@if errorlevel 1 goto :BAD
diff --git a/src/vm_x64.dasc b/src/vm_x64.dasc
index f99525b5..2b1c8d2d 100644
--- a/src/vm_x64.dasc
+++ b/src/vm_x64.dasc
@@ -143,6 +143,9 @@
143|.define CFRAME_SPACE, aword*5 // Delta for rsp (see <--). 143|.define CFRAME_SPACE, aword*5 // Delta for rsp (see <--).
144|.macro saveregs_ 144|.macro saveregs_
145| push rbx; push r15; push r14 145| push rbx; push r15; push r14
146|.if NO_UNWIND
147| push r13; push r12
148|.endif
146| sub rsp, CFRAME_SPACE 149| sub rsp, CFRAME_SPACE
147|.endmacro 150|.endmacro
148|.macro saveregs 151|.macro saveregs
@@ -150,15 +153,28 @@
150|.endmacro 153|.endmacro
151|.macro restoreregs 154|.macro restoreregs
152| add rsp, CFRAME_SPACE 155| add rsp, CFRAME_SPACE
156|.if NO_UNWIND
157| pop r12; pop r13
158|.endif
153| pop r14; pop r15; pop rbx; pop rbp 159| pop r14; pop r15; pop rbx; pop rbp
154|.endmacro 160|.endmacro
155| 161|
156|//----- 16 byte aligned, 162|//----- 16 byte aligned,
163|.if NO_UNWIND
164|.define SAVE_RET, aword [rsp+aword*11] //<-- rsp entering interpreter.
165|.define SAVE_R4, aword [rsp+aword*10]
166|.define SAVE_R3, aword [rsp+aword*9]
167|.define SAVE_R2, aword [rsp+aword*8]
168|.define SAVE_R1, aword [rsp+aword*7]
169|.define SAVE_RU2, aword [rsp+aword*6]
170|.define SAVE_RU1, aword [rsp+aword*5] //<-- rsp after register saves.
171|.else
157|.define SAVE_RET, aword [rsp+aword*9] //<-- rsp entering interpreter. 172|.define SAVE_RET, aword [rsp+aword*9] //<-- rsp entering interpreter.
158|.define SAVE_R4, aword [rsp+aword*8] 173|.define SAVE_R4, aword [rsp+aword*8]
159|.define SAVE_R3, aword [rsp+aword*7] 174|.define SAVE_R3, aword [rsp+aword*7]
160|.define SAVE_R2, aword [rsp+aword*6] 175|.define SAVE_R2, aword [rsp+aword*6]
161|.define SAVE_R1, aword [rsp+aword*5] //<-- rsp after register saves. 176|.define SAVE_R1, aword [rsp+aword*5] //<-- rsp after register saves.
177|.endif
162|.define SAVE_CFRAME, aword [rsp+aword*4] 178|.define SAVE_CFRAME, aword [rsp+aword*4]
163|.define SAVE_PC, aword [rsp+aword*3] 179|.define SAVE_PC, aword [rsp+aword*3]
164|.define SAVE_L, aword [rsp+aword*2] 180|.define SAVE_L, aword [rsp+aword*2]
@@ -4682,6 +4698,10 @@ static void emit_asm_debug(BuildCtx *ctx)
4682 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */ 4698 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
4683 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */ 4699 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
4684 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */ 4700 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
4701#if LJ_NO_UNWIND
4702 "\t.byte 0x8d\n\t.uleb128 0x6\n" /* offset r13 */
4703 "\t.byte 0x8c\n\t.uleb128 0x7\n" /* offset r12 */
4704#endif
4685 "\t.align 8\n" 4705 "\t.align 8\n"
4686 ".LEFDE0:\n\n", fcofs, CFRAME_SIZE); 4706 ".LEFDE0:\n\n", fcofs, CFRAME_SIZE);
4687#if LJ_HASFFI 4707#if LJ_HASFFI
@@ -4699,6 +4719,7 @@ static void emit_asm_debug(BuildCtx *ctx)
4699 "\t.align 8\n" 4719 "\t.align 8\n"
4700 ".LEFDE1:\n\n", (int)ctx->codesz - fcofs); 4720 ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
4701#endif 4721#endif
4722#if !LJ_NO_UNWIND
4702#if (defined(__sun__) && defined(__svr4__)) 4723#if (defined(__sun__) && defined(__svr4__))
4703 fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@unwind\n"); 4724 fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@unwind\n");
4704#else 4725#else
@@ -4769,7 +4790,9 @@ static void emit_asm_debug(BuildCtx *ctx)
4769 "\t.align 8\n" 4790 "\t.align 8\n"
4770 ".LEFDE3:\n\n", (int)ctx->codesz - fcofs); 4791 ".LEFDE3:\n\n", (int)ctx->codesz - fcofs);
4771#endif 4792#endif
4793#endif
4772 break; 4794 break;
4795#if !LJ_NO_UNWIND
4773 /* Mental note: never let Apple design an assembler. 4796 /* Mental note: never let Apple design an assembler.
4774 ** Or a linker. Or a plastic case. But I digress. 4797 ** Or a linker. Or a plastic case. But I digress.
4775 */ 4798 */
@@ -4864,6 +4887,7 @@ static void emit_asm_debug(BuildCtx *ctx)
4864 fprintf(ctx->fp, ".subsections_via_symbols\n"); 4887 fprintf(ctx->fp, ".subsections_via_symbols\n");
4865 } 4888 }
4866 break; 4889 break;
4890#endif
4867 default: /* Difficult for other modes. */ 4891 default: /* Difficult for other modes. */
4868 break; 4892 break;
4869 } 4893 }
diff --git a/src/vm_x86.dasc b/src/vm_x86.dasc
index 58266196..f31e595b 100644
--- a/src/vm_x86.dasc
+++ b/src/vm_x86.dasc
@@ -222,6 +222,9 @@
222|.define CFRAME_SPACE, aword*5 // Delta for rsp (see <--). 222|.define CFRAME_SPACE, aword*5 // Delta for rsp (see <--).
223|.macro saveregs_ 223|.macro saveregs_
224| push rbx; push r15; push r14 224| push rbx; push r15; push r14
225|.if NO_UNWIND
226| push r13; push r12
227|.endif
225| sub rsp, CFRAME_SPACE 228| sub rsp, CFRAME_SPACE
226|.endmacro 229|.endmacro
227|.macro saveregs 230|.macro saveregs
@@ -229,15 +232,28 @@
229|.endmacro 232|.endmacro
230|.macro restoreregs 233|.macro restoreregs
231| add rsp, CFRAME_SPACE 234| add rsp, CFRAME_SPACE
235|.if NO_UNWIND
236| pop r12; pop r13
237|.endif
232| pop r14; pop r15; pop rbx; pop rbp 238| pop r14; pop r15; pop rbx; pop rbp
233|.endmacro 239|.endmacro
234| 240|
235|//----- 16 byte aligned, 241|//----- 16 byte aligned,
242|.if NO_UNWIND
243|.define SAVE_RET, aword [rsp+aword*11] //<-- rsp entering interpreter.
244|.define SAVE_R4, aword [rsp+aword*10]
245|.define SAVE_R3, aword [rsp+aword*9]
246|.define SAVE_R2, aword [rsp+aword*8]
247|.define SAVE_R1, aword [rsp+aword*7]
248|.define SAVE_RU2, aword [rsp+aword*6]
249|.define SAVE_RU1, aword [rsp+aword*5] //<-- rsp after register saves.
250|.else
236|.define SAVE_RET, aword [rsp+aword*9] //<-- rsp entering interpreter. 251|.define SAVE_RET, aword [rsp+aword*9] //<-- rsp entering interpreter.
237|.define SAVE_R4, aword [rsp+aword*8] 252|.define SAVE_R4, aword [rsp+aword*8]
238|.define SAVE_R3, aword [rsp+aword*7] 253|.define SAVE_R3, aword [rsp+aword*7]
239|.define SAVE_R2, aword [rsp+aword*6] 254|.define SAVE_R2, aword [rsp+aword*6]
240|.define SAVE_R1, aword [rsp+aword*5] //<-- rsp after register saves. 255|.define SAVE_R1, aword [rsp+aword*5] //<-- rsp after register saves.
256|.endif
241|.define SAVE_CFRAME, aword [rsp+aword*4] 257|.define SAVE_CFRAME, aword [rsp+aword*4]
242|.define SAVE_PC, dword [rsp+dword*7] 258|.define SAVE_PC, dword [rsp+dword*7]
243|.define SAVE_L, dword [rsp+dword*6] 259|.define SAVE_L, dword [rsp+dword*6]
@@ -5422,6 +5438,10 @@ static void emit_asm_debug(BuildCtx *ctx)
5422 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */ 5438 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
5423 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */ 5439 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
5424 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */ 5440 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
5441#if LJ_NO_UNWIND
5442 "\t.byte 0x8d\n\t.uleb128 0x6\n" /* offset r13 */
5443 "\t.byte 0x8c\n\t.uleb128 0x7\n" /* offset r12 */
5444#endif
5425#else 5445#else
5426 "\t.long .Lbegin\n" 5446 "\t.long .Lbegin\n"
5427 "\t.long %d\n" 5447 "\t.long %d\n"
@@ -5457,6 +5477,7 @@ static void emit_asm_debug(BuildCtx *ctx)
5457 "\t.align " SZPTR "\n" 5477 "\t.align " SZPTR "\n"
5458 ".LEFDE1:\n\n", (int)ctx->codesz - fcofs); 5478 ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
5459#endif 5479#endif
5480#if !LJ_NO_UNWIND
5460#if (defined(__sun__) && defined(__svr4__)) 5481#if (defined(__sun__) && defined(__svr4__))
5461#if LJ_64 5482#if LJ_64
5462 fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@unwind\n"); 5483 fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@unwind\n");
@@ -5545,7 +5566,9 @@ static void emit_asm_debug(BuildCtx *ctx)
5545 "\t.align " SZPTR "\n" 5566 "\t.align " SZPTR "\n"
5546 ".LEFDE3:\n\n", (int)ctx->codesz - fcofs); 5567 ".LEFDE3:\n\n", (int)ctx->codesz - fcofs);
5547#endif 5568#endif
5569#endif
5548 break; 5570 break;
5571#if !LJ_NO_UNWIND
5549 /* Mental note: never let Apple design an assembler. 5572 /* Mental note: never let Apple design an assembler.
5550 ** Or a linker. Or a plastic case. But I digress. 5573 ** Or a linker. Or a plastic case. But I digress.
5551 */ 5574 */
@@ -5679,6 +5702,7 @@ static void emit_asm_debug(BuildCtx *ctx)
5679 fprintf(ctx->fp, ".subsections_via_symbols\n"); 5702 fprintf(ctx->fp, ".subsections_via_symbols\n");
5680 } 5703 }
5681 break; 5704 break;
5705#endif
5682 default: /* Difficult for other modes. */ 5706 default: /* Difficult for other modes. */
5683 break; 5707 break;
5684 } 5708 }