aboutsummaryrefslogtreecommitdiff
path: root/src/buildvm_x86.dasc
diff options
context:
space:
mode:
authorMike Pall <mike>2009-12-15 21:36:42 +0100
committerMike Pall <mike>2009-12-15 21:36:42 +0100
commit8df960388870e9d5e53cf4e1504bf2a8325e17a1 (patch)
tree542f19f190761a3623dc956078f014eb5f0d4609 /src/buildvm_x86.dasc
parent1eedc6d2f153f7d68f49282732b17f9a4d35698a (diff)
downloadluajit-8df960388870e9d5e53cf4e1504bf2a8325e17a1.tar.gz
luajit-8df960388870e9d5e53cf4e1504bf2a8325e17a1.tar.bz2
luajit-8df960388870e9d5e53cf4e1504bf2a8325e17a1.zip
Unify interpreter reg saves/restores for WIN64 prolog/epilog req.
Diffstat (limited to 'src/buildvm_x86.dasc')
-rw-r--r--src/buildvm_x86.dasc11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/buildvm_x86.dasc b/src/buildvm_x86.dasc
index 4b406754..615a83d3 100644
--- a/src/buildvm_x86.dasc
+++ b/src/buildvm_x86.dasc
@@ -82,23 +82,27 @@
82|.macro pop_eax; .if X64; pop rax; .else; pop eax; .endif; .endmacro 82|.macro pop_eax; .if X64; pop rax; .else; pop eax; .endif; .endmacro
83| 83|
84|// Stack layout while in interpreter. Must match with lj_frame.h. 84|// Stack layout while in interpreter. Must match with lj_frame.h.
85|.define CFRAME_SPACE, aword*7 // Delta for esp (see <--).
85|.macro saveregs 86|.macro saveregs
86| .if X64 87| .if X64
87| .if X64WIN; push rdi; push rsi; .endif 88| .if X64WIN; push rdi; push rsi; .endif
88| push rbp; push rbx; push r12; push r13; push r14; push r15 89| push rbp; push rbx; push r12; push r13; push r14; push r15
90| sub rsp, CFRAME_SPACE
89| .else 91| .else
90| push ebp; push edi; push esi; push ebx 92| push ebp; push edi; push esi; push ebx
93| sub esp, CFRAME_SPACE
91| .endif 94| .endif
92|.endmacro 95|.endmacro
93|.macro restoreregs 96|.macro restoreregs
94| .if X64 97| .if X64
98| add rsp, CFRAME_SPACE
95| pop r15; pop r14; pop r13; pop r12; pop rbx; pop rbp 99| pop r15; pop r14; pop r13; pop r12; pop rbx; pop rbp
96| .if X64WIN; pop rsi; pop rdi; .endif 100| .if X64WIN; pop rsi; pop rdi; .endif
97| .else 101| .else
102| add esp, CFRAME_SPACE
98| pop ebx; pop esi; pop edi; pop ebp 103| pop ebx; pop esi; pop edi; pop ebp
99| .endif 104| .endif
100|.endmacro 105|.endmacro
101|.define CFRAME_SPACE, aword*7 // Delta for esp (see <--).
102| 106|
103|.define INARG_4, aword [esp+aword*15] 107|.define INARG_4, aword [esp+aword*15]
104|.define INARG_3, aword [esp+aword*14] 108|.define INARG_3, aword [esp+aword*14]
@@ -430,7 +434,6 @@ static void build_subroutines(BuildCtx *ctx, int cmov)
430 | xor eax, eax // Ok return status for vm_pcall. 434 | xor eax, eax // Ok return status for vm_pcall.
431 | 435 |
432 |->vm_leave_unw: 436 |->vm_leave_unw:
433 | add esp, CFRAME_SPACE
434 | restoreregs 437 | restoreregs
435 | ret 438 | ret
436 | 439 |
@@ -550,7 +553,6 @@ static void build_subroutines(BuildCtx *ctx, int cmov)
550 | // (lua_State *L, StkId base, int nres1 = 0, ptrdiff_t ef = 0) 553 | // (lua_State *L, StkId base, int nres1 = 0, ptrdiff_t ef = 0)
551 | saveregs 554 | saveregs
552 | mov PC, FRAME_C 555 | mov PC, FRAME_C
553 | sub esp, CFRAME_SPACE
554 | xor RD, RD 556 | xor RD, RD
555 | mov L:RB, SAVE_L 557 | mov L:RB, SAVE_L
556 | lea KBASE, [esp+CFRAME_RESUME] 558 | lea KBASE, [esp+CFRAME_RESUME]
@@ -590,7 +592,6 @@ static void build_subroutines(BuildCtx *ctx, int cmov)
590 | mov PC, FRAME_C 592 | mov PC, FRAME_C
591 | 593 |
592 |1: // Entry point for vm_pcall above (PC = ftype). 594 |1: // Entry point for vm_pcall above (PC = ftype).
593 | sub esp, CFRAME_SPACE
594 | mov L:RB, SAVE_L 595 | mov L:RB, SAVE_L
595 | mov RA, INARG_BASE 596 | mov RA, INARG_BASE
596 | 597 |
@@ -623,8 +624,6 @@ static void build_subroutines(BuildCtx *ctx, int cmov)
623 |->vm_cpcall: // Setup protected C frame, call C. 624 |->vm_cpcall: // Setup protected C frame, call C.
624 | // (lua_State *L, lua_CPFunction cp, lua_CFunction func, void *ud) 625 | // (lua_State *L, lua_CPFunction cp, lua_CFunction func, void *ud)
625 | saveregs 626 | saveregs
626 | sub esp, CFRAME_SPACE
627 |
628 | mov L:RB, SAVE_L 627 | mov L:RB, SAVE_L
629 | mov RC, INARG_CP_UD 628 | mov RC, INARG_CP_UD
630 | mov RA, INARG_CP_FUNC 629 | mov RA, INARG_CP_FUNC