mirror of
https://github.com/corda/corda.git
synced 2025-02-02 01:08:09 +00:00
conditionally include continuation code in compile-x86.S
This commit is contained in:
parent
b4dea1f71c
commit
2478d4fc7f
@ -12,6 +12,12 @@
|
|||||||
|
|
||||||
#define LOCAL(x) .L##x
|
#define LOCAL(x) .L##x
|
||||||
|
|
||||||
|
#if defined __APPLE__ || defined __MINGW32__ || defined __CYGWIN32__
|
||||||
|
# define GLOBAL(x) _##x
|
||||||
|
#else
|
||||||
|
# define GLOBAL(x) x
|
||||||
|
#endif
|
||||||
|
|
||||||
.text
|
.text
|
||||||
|
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
@ -29,8 +35,8 @@
|
|||||||
#define CONTINUATION_LENGTH 56
|
#define CONTINUATION_LENGTH 56
|
||||||
#define CONTINUATION_BODY 64
|
#define CONTINUATION_BODY 64
|
||||||
|
|
||||||
.globl vmInvoke
|
.globl GLOBAL(vmInvoke)
|
||||||
vmInvoke:
|
GLOBAL(vmInvoke):
|
||||||
pushq %rbp
|
pushq %rbp
|
||||||
movq %rsp,%rbp
|
movq %rsp,%rbp
|
||||||
|
|
||||||
@ -74,11 +80,12 @@ LOCAL(vmInvoke_argumentTest):
|
|||||||
// call function
|
// call function
|
||||||
call *%rsi
|
call *%rsi
|
||||||
|
|
||||||
.globl vmInvoke_returnAddress
|
.globl GLOBAL(vmInvoke_returnAddress)
|
||||||
vmInvoke_returnAddress:
|
GLOBAL(vmInvoke_returnAddress):
|
||||||
// restore stack pointer
|
// restore stack pointer
|
||||||
movq %rbp,%rsp
|
movq %rbp,%rsp
|
||||||
|
|
||||||
|
#ifdef AVIAN_CONTINUATIONS
|
||||||
// call the next continuation, if any
|
// call the next continuation, if any
|
||||||
movq THREAD_CONTINUATION(%rbx),%rcx
|
movq THREAD_CONTINUATION(%rbx),%rcx
|
||||||
cmpq $0,%rcx
|
cmpq $0,%rcx
|
||||||
@ -132,6 +139,8 @@ LOCAL(vmInvoke_handleException):
|
|||||||
jmp *THREAD_EXCEPTION_HANDLER(%rbx)
|
jmp *THREAD_EXCEPTION_HANDLER(%rbx)
|
||||||
|
|
||||||
LOCAL(vmInvoke_exit):
|
LOCAL(vmInvoke_exit):
|
||||||
|
#endif // AVIAN_CONTINUATIONS
|
||||||
|
|
||||||
// restore callee-saved registers
|
// restore callee-saved registers
|
||||||
movq %rsp,%r9
|
movq %rsp,%r9
|
||||||
subq $48,%r9
|
subq $48,%r9
|
||||||
@ -146,8 +155,9 @@ LOCAL(vmInvoke_exit):
|
|||||||
popq %rbp
|
popq %rbp
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.globl vmJumpAndInvoke
|
.globl GLOBAL(vmJumpAndInvoke)
|
||||||
vmJumpAndInvoke:
|
GLOBAL(vmJumpAndInvoke):
|
||||||
|
#ifdef AVIAN_CONTINUATIONS
|
||||||
// %rdi: thread
|
// %rdi: thread
|
||||||
// %rsi: address
|
// %rsi: address
|
||||||
// %rdx: base
|
// %rdx: base
|
||||||
@ -182,6 +192,11 @@ LOCAL(vmJumpAndInvoke_argumentTest):
|
|||||||
movq %rcx,%rsp
|
movq %rcx,%rsp
|
||||||
|
|
||||||
jmp *%rsi
|
jmp *%rsi
|
||||||
|
#else // not AVIAN_CONTINUATIONS
|
||||||
|
// vmJumpAndInvoke should only be called when continuations are
|
||||||
|
// enabled
|
||||||
|
int3
|
||||||
|
#endif // not AVIAN_CONTINUATIONS
|
||||||
|
|
||||||
#elif defined __i386__
|
#elif defined __i386__
|
||||||
|
|
||||||
@ -198,13 +213,8 @@ LOCAL(vmJumpAndInvoke_argumentTest):
|
|||||||
#define CONTINUATION_LENGTH 28
|
#define CONTINUATION_LENGTH 28
|
||||||
#define CONTINUATION_BODY 32
|
#define CONTINUATION_BODY 32
|
||||||
|
|
||||||
#if defined __APPLE__ || defined __MINGW32__ || defined __CYGWIN32__
|
.globl GLOBAL(vmInvoke)
|
||||||
.globl _vmInvoke
|
GLOBAL(vmInvoke):
|
||||||
_vmInvoke:
|
|
||||||
#else
|
|
||||||
.globl vmInvoke
|
|
||||||
vmInvoke:
|
|
||||||
#endif
|
|
||||||
pushl %ebp
|
pushl %ebp
|
||||||
movl %esp,%ebp
|
movl %esp,%ebp
|
||||||
|
|
||||||
@ -254,6 +264,7 @@ vmInvoke_returnAddress:
|
|||||||
subl $16,%ecx
|
subl $16,%ecx
|
||||||
movl %ecx,%esp
|
movl %ecx,%esp
|
||||||
|
|
||||||
|
#ifdef AVIAN_CONTINUATIONS
|
||||||
// call the next continuation, if any
|
// call the next continuation, if any
|
||||||
movl THREAD_CONTINUATION(%ebx),%ecx
|
movl THREAD_CONTINUATION(%ebx),%ecx
|
||||||
cmpl $0,%ecx
|
cmpl $0,%ecx
|
||||||
@ -316,6 +327,8 @@ LOCAL(vmInvoke_handleException):
|
|||||||
jmp *THREAD_EXCEPTION_HANDLER(%ebx)
|
jmp *THREAD_EXCEPTION_HANDLER(%ebx)
|
||||||
|
|
||||||
LOCAL(vmInvoke_exit):
|
LOCAL(vmInvoke_exit):
|
||||||
|
#endif // AVIAN_CONTINUATIONS
|
||||||
|
|
||||||
// restore callee-saved registers
|
// restore callee-saved registers
|
||||||
movl 0(%esp),%ebx
|
movl 0(%esp),%ebx
|
||||||
movl 4(%esp),%esi
|
movl 4(%esp),%esi
|
||||||
@ -347,8 +360,9 @@ LOCAL(getPC):
|
|||||||
movl (%esp),%esi
|
movl (%esp),%esi
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.globl vmJumpAndInvoke
|
.globl GLOBAL(vmJumpAndInvoke)
|
||||||
vmJumpAndInvoke:
|
GLOBAL(vmJumpAndInvoke):
|
||||||
|
#ifdef AVIAN_CONTINUATIONS
|
||||||
// 4(%esp): thread
|
// 4(%esp): thread
|
||||||
// 8(%esp): address
|
// 8(%esp): address
|
||||||
// 12(%esp): base
|
// 12(%esp): base
|
||||||
@ -388,6 +402,11 @@ LOCAL(vmJumpAndInvoke_argumentTest):
|
|||||||
movl %ecx,%esp
|
movl %ecx,%esp
|
||||||
|
|
||||||
jmp *%esi
|
jmp *%esi
|
||||||
|
#else // not AVIAN_CONTINUATIONS
|
||||||
|
// vmJumpAndInvoke should only be called when continuations are
|
||||||
|
// enabled
|
||||||
|
int3
|
||||||
|
#endif // AVIAN_CONTINUATIONS
|
||||||
|
|
||||||
#else
|
#else
|
||||||
# error unsupported platform
|
# error unsupported platform
|
||||||
|
Loading…
x
Reference in New Issue
Block a user