Skip to content

Commit

Permalink
- fix 32 bit compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dpjudas committed Oct 7, 2018
1 parent f321f64 commit 47bcf31
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 34 deletions.
18 changes: 8 additions & 10 deletions src/scripting/vm/jit.cpp
Expand Up @@ -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();
Expand All @@ -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();
Expand Down
23 changes: 13 additions & 10 deletions src/scripting/vm/jit_flow.cpp
Expand Up @@ -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));
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));
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::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;
}

Expand Down
22 changes: 8 additions & 14 deletions src/scripting/vm/jit_load.cpp
Expand Up @@ -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<void, FString*, FString*>(&JitCompiler::CallAssignString);
call->setArg(0, regS[A]);
call->setArg(1, ptr);
Expand All @@ -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()
Expand Down

0 comments on commit 47bcf31

Please sign in to comment.