Adding stack alignment check. We aren't 16b aligned right now. Fuck.
This commit is contained in:
parent
007f7e371d
commit
5df538cd44
|
@ -109,10 +109,16 @@ void X64Emitter::Unlock() {
|
||||||
xe_mutex_unlock(lock_);
|
xe_mutex_unlock(lock_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define STACK_ALIGNMENT_CHECK 0
|
||||||
|
|
||||||
int X64Emitter::PrepareFunction(FunctionSymbol* symbol) {
|
int X64Emitter::PrepareFunction(FunctionSymbol* symbol) {
|
||||||
int result_code = 1;
|
int result_code = 1;
|
||||||
Lock();
|
Lock();
|
||||||
|
|
||||||
|
#if STACK_ALIGNMENT_CHECK
|
||||||
|
Label l(assembler_.newLabel());
|
||||||
|
#endif // STACK_ALIGNMENT_CHECK
|
||||||
|
|
||||||
if (symbol->impl_value) {
|
if (symbol->impl_value) {
|
||||||
result_code = 0;
|
result_code = 0;
|
||||||
XESUCCEED();
|
XESUCCEED();
|
||||||
|
@ -137,6 +143,15 @@ int X64Emitter::PrepareFunction(FunctionSymbol* symbol) {
|
||||||
// call [OnDemandCompileTrampoline]
|
// call [OnDemandCompileTrampoline]
|
||||||
// jmp [rax]
|
// jmp [rax]
|
||||||
|
|
||||||
|
#if STACK_ALIGNMENT_CHECK
|
||||||
|
assembler_.mov(rax, rsp);
|
||||||
|
assembler_.and_(rax, imm(0xF));
|
||||||
|
assembler_.test(rax, rax);
|
||||||
|
assembler_.jz(l);
|
||||||
|
assembler_.int3();
|
||||||
|
assembler_.bind(l);
|
||||||
|
#endif // STACK_ALIGNMENT_CHECK
|
||||||
|
|
||||||
#if defined(ASMJIT_WINDOWS)
|
#if defined(ASMJIT_WINDOWS)
|
||||||
// Calling convetion: kX86FuncConvX64W
|
// Calling convetion: kX86FuncConvX64W
|
||||||
// Arguments passed as RCX, RDX, R8, R9
|
// Arguments passed as RCX, RDX, R8, R9
|
||||||
|
|
Loading…
Reference in New Issue