From f0ce453d47c7f747d6a2c129f66e96932cfccca1 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 9 Dec 2018 17:36:43 +0100 Subject: [PATCH] - workaround pointer truncation bug in asmjit --- src/scripting/vm/jit_flow.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/scripting/vm/jit_flow.cpp b/src/scripting/vm/jit_flow.cpp index 08e7b06600..0ca8bf4372 100644 --- a/src/scripting/vm/jit_flow.cpp +++ b/src/scripting/vm/jit_flow.cpp @@ -169,16 +169,28 @@ void JitCompiler::EmitRET() if (cc.is64Bit()) { if (regtype & REGT_KONST) - cc.mov(x86::qword_ptr(location), asmjit::imm_ptr(konsta[regnum].v)); + { + auto ptr = newTempIntPtr(); + cc.mov(ptr, asmjit::imm_ptr(konsta[regnum].v)); + cc.mov(x86::qword_ptr(location), ptr); + } 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)); + { + auto ptr = newTempIntPtr(); + cc.mov(ptr, asmjit::imm_ptr(konsta[regnum].v)); + cc.mov(x86::dword_ptr(location), ptr); + } else + { cc.mov(x86::dword_ptr(location), regA[regnum]); + } } break; }