diff --git a/src/scripting/vm/jit.cpp b/src/scripting/vm/jit.cpp index 3ed45d302c..c922d81596 100644 --- a/src/scripting/vm/jit.cpp +++ b/src/scripting/vm/jit.cpp @@ -272,11 +272,10 @@ void JitCompiler::EmitThrowException(EVMAbortException reason) // Update JitExceptionInfo struct cc.mov(x86::dword_ptr(exceptInfo, 0 * 4), (int32_t)reason); -#ifdef ASMJIT_ARCH_64BIT - cc.mov(x86::qword_ptr(exceptInfo, 4 * 4), imm_ptr(pc)); -#else - cc.mov(x86::dword_ptr(exceptInfo, 4 * 4), imm_ptr(pc)); -#endif + if (cc.is64Bit()) + cc.mov(x86::qword_ptr(exceptInfo, 4 * 4), imm_ptr(pc)); + else + cc.mov(x86::dword_ptr(exceptInfo, 4 * 4), imm_ptr(pc)); // Return from function X86Gp vReg = newTempInt32(); @@ -291,11 +290,10 @@ void JitCompiler::EmitThrowException(EVMAbortException reason, asmjit::X86Gp arg // Update JitExceptionInfo struct cc.mov(x86::dword_ptr(exceptInfo, 0 * 4), (int32_t)reason); cc.mov(x86::dword_ptr(exceptInfo, 1 * 4), arg1); -#ifdef ASMJIT_ARCH_64BIT - cc.mov(x86::qword_ptr(exceptInfo, 4 * 4), imm_ptr(pc)); -#else - cc.mov(x86::dword_ptr(exceptInfo, 4 * 4), imm_ptr(pc)); -#endif + if (cc.is64Bit()) + cc.mov(x86::qword_ptr(exceptInfo, 4 * 4), imm_ptr(pc)); + else + cc.mov(x86::dword_ptr(exceptInfo, 4 * 4), imm_ptr(pc)); // Return from function X86Gp vReg = newTempInt32(); diff --git a/src/scripting/vm/jit_flow.cpp b/src/scripting/vm/jit_flow.cpp index 1efab419bd..3fec98ec51 100644 --- a/src/scripting/vm/jit_flow.cpp +++ b/src/scripting/vm/jit_flow.cpp @@ -195,17 +195,20 @@ void JitCompiler::EmitRET() break; } case REGT_POINTER: - #ifdef ASMJIT_ARCH_64BIT - if (regtype & REGT_KONST) - cc.mov(x86::qword_ptr(location), asmjit::imm_ptr(konsta[regnum].v)); + if (cc.is64Bit()) + { + if (regtype & REGT_KONST) + cc.mov(x86::qword_ptr(location), asmjit::imm_ptr(konsta[regnum].v)); + else + cc.mov(x86::qword_ptr(location), regA[regnum]); + } else - cc.mov(x86::qword_ptr(location), regA[regnum]); - #else - if (regtype & REGT_KONST) - cc.mov(x86::dword_ptr(location), asmjit::imm_ptr(konsta[regnum].v)); - else - cc.mov(x86::dword_ptr(location), regA[regnum]); - #endif + { + if (regtype & REGT_KONST) + cc.mov(x86::dword_ptr(location), asmjit::imm_ptr(konsta[regnum].v)); + else + cc.mov(x86::dword_ptr(location), regA[regnum]); + } break; } diff --git a/src/scripting/vm/jit_load.cpp b/src/scripting/vm/jit_load.cpp index 72faace9be..e8864af5c7 100644 --- a/src/scripting/vm/jit_load.cpp +++ b/src/scripting/vm/jit_load.cpp @@ -52,13 +52,10 @@ void JitCompiler::EmitLKS_R() auto base = newTempIntPtr(); cc.mov(base, asmjit::imm_ptr(konsts + C)); auto ptr = newTempIntPtr(); -#ifdef ASMJIT_ARCH_64BIT - static_assert(sizeof(FString) == 8, "sizeof(FString) needs to be 8"); - cc.lea(ptr, asmjit::x86::ptr(base, regD[B], 3)); -#else - static_assert(sizeof(FString) == 4, "sizeof(FString) needs to be 4"); - cc.lea(ptr, asmjit::x86::ptr(base, regD[B], 2)); -#endif + if (cc.is64Bit()) + cc.lea(ptr, asmjit::x86::ptr(base, regD[B], 3)); + else + cc.lea(ptr, asmjit::x86::ptr(base, regD[B], 2)); auto call = CreateCall(&JitCompiler::CallAssignString); call->setArg(0, regS[A]); call->setArg(1, ptr); @@ -68,13 +65,10 @@ void JitCompiler::EmitLKP_R() { auto base = newTempIntPtr(); cc.mov(base, asmjit::imm_ptr(konsta + C)); -#ifdef ASMJIT_ARCH_64BIT - static_assert(sizeof(FVoidObj) == 8, "sizeof(FVoidObj) needs to be 8"); - cc.mov(regA[A], asmjit::x86::ptr(base, regD[B], 3)); -#else - static_assert(sizeof(FVoidObj) == 4, "sizeof(FVoidObj) needs to be 4"); - cc.mov(regA[A], asmjit::x86::ptr(base, regD[B], 2)); -#endif + if (cc.is64Bit()) + cc.mov(regA[A], asmjit::x86::ptr(base, regD[B], 3)); + else + cc.mov(regA[A], asmjit::x86::ptr(base, regD[B], 2)); } void JitCompiler::EmitLFP()