From bb3d0021d6fcba75b83384ccfcd498e97b436728 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Tue, 18 Sep 2018 18:13:53 +0200 Subject: [PATCH] - switch ToMemAddress to imm_ptr where allowed --- src/scripting/vm/jit.cpp | 8 ++--- src/scripting/vm/jit_call.cpp | 10 +++--- src/scripting/vm/jit_flow.cpp | 8 ++--- src/scripting/vm/jit_load.cpp | 12 +++---- src/scripting/vm/jit_math.cpp | 68 +++++++++++++++++------------------ src/scripting/vm/jit_move.cpp | 4 +-- src/scripting/vm/jitintern.h | 14 ++++---- 7 files changed, 62 insertions(+), 62 deletions(-) diff --git a/src/scripting/vm/jit.cpp b/src/scripting/vm/jit.cpp index a818960ba..b802ecd8e 100644 --- a/src/scripting/vm/jit.cpp +++ b/src/scripting/vm/jit.cpp @@ -271,9 +271,9 @@ 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), ToMemAddress(pc)); + cc.mov(x86::qword_ptr(exceptInfo, 4 * 4), imm_ptr(pc)); #else - cc.mov(x86::dword_ptr(exceptInfo, 4 * 4), ToMemAddress(pc)); + cc.mov(x86::dword_ptr(exceptInfo, 4 * 4), imm_ptr(pc)); #endif // Return from function @@ -290,9 +290,9 @@ void JitCompiler::EmitThrowException(EVMAbortException reason, asmjit::X86Gp arg 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), ToMemAddress(pc)); + cc.mov(x86::qword_ptr(exceptInfo, 4 * 4), imm_ptr(pc)); #else - cc.mov(x86::dword_ptr(exceptInfo, 4 * 4), ToMemAddress(pc)); + cc.mov(x86::dword_ptr(exceptInfo, 4 * 4), imm_ptr(pc)); #endif // Return from function diff --git a/src/scripting/vm/jit_call.cpp b/src/scripting/vm/jit_call.cpp index 98cdf7d06..119bbf8d8 100644 --- a/src/scripting/vm/jit_call.cpp +++ b/src/scripting/vm/jit_call.cpp @@ -42,7 +42,7 @@ void JitCompiler::EmitPARAM() break; case REGT_STRING | REGT_KONST: tmp = cc.newIntPtr(); - cc.mov(tmp, ToMemAddress(&konsts[C])); + cc.mov(tmp, asmjit::imm_ptr(&konsts[C])); cc.mov(x86::ptr(params, index * sizeof(VMValue) + offsetof(VMValue, sp)), tmp); cc.mov(x86::byte_ptr(params, index * sizeof(VMValue) + offsetof(VMValue, Type)), (int)REGT_STRING); break; @@ -59,7 +59,7 @@ void JitCompiler::EmitPARAM() break; case REGT_POINTER | REGT_KONST: tmp = cc.newIntPtr(); - cc.mov(tmp, ToMemAddress(konsta[C].v)); + cc.mov(tmp, asmjit::imm_ptr(konsta[C].v)); cc.mov(x86::ptr(params, index * sizeof(VMValue) + offsetof(VMValue, a)), tmp); cc.mov(x86::byte_ptr(params, index * sizeof(VMValue) + offsetof(VMValue, Type)), (int)REGT_POINTER); break; @@ -97,7 +97,7 @@ void JitCompiler::EmitPARAM() case REGT_FLOAT | REGT_KONST: tmp = cc.newIntPtr(); tmp2 = cc.newXmmSd(); - cc.mov(tmp, ToMemAddress(konstf + C)); + cc.mov(tmp, asmjit::imm_ptr(konstf + C)); cc.movsd(tmp2, asmjit::x86::qword_ptr(tmp)); cc.movsd(x86::qword_ptr(params, index * sizeof(VMValue) + offsetof(VMValue, f)), tmp2); cc.mov(x86::byte_ptr(params, index * sizeof(VMValue) + offsetof(VMValue, Type)), (int)REGT_FLOAT); @@ -132,7 +132,7 @@ void JitCompiler::EmitCALL() void JitCompiler::EmitCALL_K() { auto ptr = cc.newIntPtr(); - cc.mov(ptr, ToMemAddress(konsta[A].o)); + cc.mov(ptr, asmjit::imm_ptr(konsta[A].o)); EmitDoCall(ptr); } @@ -144,7 +144,7 @@ void JitCompiler::EmitTAIL() void JitCompiler::EmitTAIL_K() { auto ptr = cc.newIntPtr(); - cc.mov(ptr, ToMemAddress(konsta[A].o)); + cc.mov(ptr, asmjit::imm_ptr(konsta[A].o)); EmitDoTail(ptr); } diff --git a/src/scripting/vm/jit_flow.cpp b/src/scripting/vm/jit_flow.cpp index 6a9898c7b..0884a9e00 100644 --- a/src/scripting/vm/jit_flow.cpp +++ b/src/scripting/vm/jit_flow.cpp @@ -75,7 +75,7 @@ void JitCompiler::EmitSCOPE() cc.bind(notnull); auto f = cc.newIntPtr(); - cc.mov(f, ToMemAddress(konsta[C].v)); + cc.mov(f, asmjit::imm_ptr(konsta[C].v)); auto result = cc.newInt32(); typedef int(*FuncPtr)(DObject*, VMFunction*, int); @@ -201,12 +201,12 @@ void JitCompiler::EmitRET() case REGT_POINTER: #ifdef ASMJIT_ARCH_64BIT if (regtype & REGT_KONST) - cc.mov(x86::qword_ptr(location), ToMemAddress(konsta[regnum].v)); + 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), ToMemAddress(konsta[regnum].v)); + cc.mov(x86::dword_ptr(location), asmjit::imm_ptr(konsta[regnum].v)); else cc.mov(x86::dword_ptr(location), regA[regnum]); #endif @@ -314,7 +314,7 @@ void JitCompiler::EmitNEW_K() { auto result = cc.newIntPtr(); auto regcls = cc.newIntPtr(); - cc.mov(regcls, ToMemAddress(konsta[B].v)); + cc.mov(regcls, asmjit::imm_ptr(konsta[B].v)); auto call = CreateCall([](PClass *cls, int c) -> DObject* { try { diff --git a/src/scripting/vm/jit_load.cpp b/src/scripting/vm/jit_load.cpp index 7d9d6cfab..352e639b2 100644 --- a/src/scripting/vm/jit_load.cpp +++ b/src/scripting/vm/jit_load.cpp @@ -17,7 +17,7 @@ void JitCompiler::EmitLK() void JitCompiler::EmitLKF() { auto base = cc.newIntPtr(); - cc.mov(base, ToMemAddress(konstf + BC)); + cc.mov(base, asmjit::imm_ptr(konstf + BC)); cc.movsd(regF[A], asmjit::x86::qword_ptr(base)); } @@ -25,7 +25,7 @@ void JitCompiler::EmitLKS() { auto call = CreateCall(&JitCompiler::CallAssignString); call->setArg(0, regS[A]); - call->setArg(1, asmjit::imm(ToMemAddress(konsts + BC))); + call->setArg(1, asmjit::imm_ptr(konsts + BC)); } void JitCompiler::EmitLKP() @@ -36,21 +36,21 @@ void JitCompiler::EmitLKP() void JitCompiler::EmitLK_R() { auto base = cc.newIntPtr(); - cc.mov(base, ToMemAddress(konstd + C)); + cc.mov(base, asmjit::imm_ptr(konstd + C)); cc.mov(regD[A], asmjit::x86::ptr(base, regD[B], 2)); } void JitCompiler::EmitLKF_R() { auto base = cc.newIntPtr(); - cc.mov(base, ToMemAddress(konstf + C)); + cc.mov(base, asmjit::imm_ptr(konstf + C)); cc.movsd(regF[A], asmjit::x86::qword_ptr(base, regD[B], 3)); } void JitCompiler::EmitLKS_R() { auto base = cc.newIntPtr(); - cc.mov(base, ToMemAddress(konsts + C)); + cc.mov(base, asmjit::imm_ptr(konsts + C)); auto ptr = cc.newIntPtr(); #ifdef ASMJIT_ARCH_64BIT static_assert(sizeof(FString) == 8, "sizeof(FString) needs to be 8"); @@ -67,7 +67,7 @@ void JitCompiler::EmitLKS_R() void JitCompiler::EmitLKP_R() { auto base = cc.newIntPtr(); - cc.mov(base, ToMemAddress(konsta + C)); + 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)); diff --git a/src/scripting/vm/jit_math.cpp b/src/scripting/vm/jit_math.cpp index b3f04ed7a..98278e505 100644 --- a/src/scripting/vm/jit_math.cpp +++ b/src/scripting/vm/jit_math.cpp @@ -221,7 +221,7 @@ void JitCompiler::EmitDIV_RK() auto konstTmp = cc.newIntPtr(); cc.mov(tmp0, regD[B]); cc.cdq(tmp1, tmp0); - cc.mov(konstTmp, ToMemAddress(&konstd[C])); + cc.mov(konstTmp, asmjit::imm_ptr(&konstd[C])); cc.idiv(tmp1, tmp0, asmjit::x86::ptr(konstTmp)); cc.mov(regD[A], tmp0); } @@ -273,7 +273,7 @@ void JitCompiler::EmitDIVU_RK() auto konstTmp = cc.newIntPtr(); cc.mov(tmp0, regD[B]); cc.mov(tmp1, 0); - cc.mov(konstTmp, ToMemAddress(&konstd[C])); + cc.mov(konstTmp, asmjit::imm_ptr(&konstd[C])); cc.div(tmp1, tmp0, asmjit::x86::ptr(konstTmp)); cc.mov(regD[A], tmp0); } @@ -325,7 +325,7 @@ void JitCompiler::EmitMOD_RK() auto konstTmp = cc.newIntPtr(); cc.mov(tmp0, regD[B]); cc.cdq(tmp1, tmp0); - cc.mov(konstTmp, ToMemAddress(&konstd[C])); + cc.mov(konstTmp, asmjit::imm_ptr(&konstd[C])); cc.idiv(tmp1, tmp0, asmjit::x86::ptr(konstTmp)); cc.mov(regD[A], tmp1); } @@ -377,7 +377,7 @@ void JitCompiler::EmitMODU_RK() auto konstTmp = cc.newIntPtr(); cc.mov(tmp0, regD[B]); cc.mov(tmp1, 0); - cc.mov(konstTmp, ToMemAddress(&konstd[C])); + cc.mov(konstTmp, asmjit::imm_ptr(&konstd[C])); cc.div(tmp1, tmp0, asmjit::x86::ptr(konstTmp)); cc.mov(regD[A], tmp1); } @@ -462,7 +462,7 @@ void JitCompiler::EmitMIN_RK() auto tmp0 = cc.newXmmSs(); auto tmp1 = cc.newXmmSs(); auto konstTmp = cc.newIntPtr(); - cc.mov(konstTmp, ToMemAddress(&konstd[C])); + cc.mov(konstTmp, asmjit::imm_ptr(&konstd[C])); cc.movd(tmp0, regD[B]); cc.movss(tmp1, asmjit::x86::dword_ptr(konstTmp)); cc.pminsd(tmp0, tmp1); @@ -484,7 +484,7 @@ void JitCompiler::EmitMAX_RK() auto tmp0 = cc.newXmmSs(); auto tmp1 = cc.newXmmSs(); auto konstTmp = cc.newIntPtr(); - cc.mov(konstTmp, ToMemAddress(&konstd[C])); + cc.mov(konstTmp, asmjit::imm_ptr(&konstd[C])); cc.movd(tmp0, regD[B]); cc.movss(tmp1, asmjit::x86::dword_ptr(konstTmp)); cc.pmaxsd(tmp0, tmp1); @@ -556,7 +556,7 @@ void JitCompiler::EmitLT_KR() { EmitComparisonOpcode([&](bool check, asmjit::Label& fail, asmjit::Label& success) { auto tmp = cc.newIntPtr(); - cc.mov(tmp, ToMemAddress(&konstd[B])); + cc.mov(tmp, asmjit::imm_ptr(&konstd[B])); cc.cmp(asmjit::x86::ptr(tmp), regD[C]); if (check) cc.jl(fail); else cc.jnl(fail); @@ -585,7 +585,7 @@ void JitCompiler::EmitLE_KR() { EmitComparisonOpcode([&](bool check, asmjit::Label& fail, asmjit::Label& success) { auto tmp = cc.newIntPtr(); - cc.mov(tmp, ToMemAddress(&konstd[B])); + cc.mov(tmp, asmjit::imm_ptr(&konstd[B])); cc.cmp(asmjit::x86::ptr(tmp), regD[C]); if (check) cc.jle(fail); else cc.jnle(fail); @@ -614,7 +614,7 @@ void JitCompiler::EmitLTU_KR() { EmitComparisonOpcode([&](bool check, asmjit::Label& fail, asmjit::Label& success) { auto tmp = cc.newIntPtr(); - cc.mov(tmp, ToMemAddress(&konstd[B])); + cc.mov(tmp, asmjit::imm_ptr(&konstd[B])); cc.cmp(asmjit::x86::ptr(tmp), regD[C]); if (check) cc.jb(fail); else cc.jnb(fail); @@ -643,7 +643,7 @@ void JitCompiler::EmitLEU_KR() { EmitComparisonOpcode([&](bool check, asmjit::Label& fail, asmjit::Label& success) { auto tmp = cc.newIntPtr(); - cc.mov(tmp, ToMemAddress(&konstd[B])); + cc.mov(tmp, asmjit::imm_ptr(&konstd[B])); cc.cmp(asmjit::x86::ptr(tmp), regD[C]); if (check) cc.jbe(fail); else cc.jnbe(fail); @@ -666,7 +666,7 @@ void JitCompiler::EmitADDF_RK() auto tmp = cc.newIntPtr(); if (A != B) cc.movsd(regF[A], regF[B]); - cc.mov(tmp, ToMemAddress(&konstf[C])); + cc.mov(tmp, asmjit::imm_ptr(&konstf[C])); cc.addsd(regF[A], asmjit::x86::qword_ptr(tmp)); } @@ -683,7 +683,7 @@ void JitCompiler::EmitSUBF_RK() auto tmp = cc.newIntPtr(); if (A != B) cc.movsd(regF[A], regF[B]); - cc.mov(tmp, ToMemAddress(&konstf[C])); + cc.mov(tmp, asmjit::imm_ptr(&konstf[C])); cc.subsd(regF[A], asmjit::x86::qword_ptr(tmp)); } @@ -691,7 +691,7 @@ void JitCompiler::EmitSUBF_KR() { auto rc = CheckRegF(C, A); auto tmp = cc.newIntPtr(); - cc.mov(tmp, ToMemAddress(&konstf[B])); + cc.mov(tmp, asmjit::imm_ptr(&konstf[B])); cc.movsd(regF[A], asmjit::x86::qword_ptr(tmp)); cc.subsd(regF[A], rc); } @@ -709,7 +709,7 @@ void JitCompiler::EmitMULF_RK() auto tmp = cc.newIntPtr(); if (A != B) cc.movsd(regF[A], regF[B]); - cc.mov(tmp, ToMemAddress(&konstf[C])); + cc.mov(tmp, asmjit::imm_ptr(&konstf[C])); cc.mulsd(regF[A], asmjit::x86::qword_ptr(tmp)); } @@ -735,7 +735,7 @@ void JitCompiler::EmitDIVF_RK() { auto tmp = cc.newIntPtr(); cc.movsd(regF[A], regF[B]); - cc.mov(tmp, ToMemAddress(&konstf[C])); + cc.mov(tmp, asmjit::imm_ptr(&konstf[C])); cc.divsd(regF[A], asmjit::x86::qword_ptr(tmp)); } } @@ -744,7 +744,7 @@ void JitCompiler::EmitDIVF_KR() { auto rc = CheckRegF(C, A); auto tmp = cc.newIntPtr(); - cc.mov(tmp, ToMemAddress(&konstf[B])); + cc.mov(tmp, asmjit::imm_ptr(&konstf[B])); cc.movsd(regF[A], asmjit::x86::qword_ptr(tmp)); cc.divsd(regF[A], rc); } @@ -818,7 +818,7 @@ void JitCompiler::EmitPOWF_RK() { auto tmp = cc.newIntPtr(); auto tmp2 = cc.newXmm(); - cc.mov(tmp, ToMemAddress(&konstf[C])); + cc.mov(tmp, asmjit::imm_ptr(&konstf[C])); cc.movsd(tmp2, asmjit::x86::qword_ptr(tmp)); auto call = CreateCall(g_pow); @@ -831,7 +831,7 @@ void JitCompiler::EmitPOWF_KR() { auto tmp = cc.newIntPtr(); auto tmp2 = cc.newXmm(); - cc.mov(tmp, ToMemAddress(&konstf[B])); + cc.mov(tmp, asmjit::imm_ptr(&konstf[B])); cc.movsd(tmp2, asmjit::x86::qword_ptr(tmp)); auto call = CreateCall(g_pow); @@ -852,7 +852,7 @@ void JitCompiler::EmitMINF_RK() { auto rb = CheckRegF(B, A); auto tmp = cc.newIntPtr(); - cc.mov(tmp, ToMemAddress(&konstf[C])); + cc.mov(tmp, asmjit::imm_ptr(&konstf[C])); cc.movsd(regF[A], asmjit::x86::qword_ptr(tmp)); cc.minsd(regF[A], rb); } @@ -869,7 +869,7 @@ void JitCompiler::EmitMAXF_RK() { auto rb = CheckRegF(B, A); auto tmp = cc.newIntPtr(); - cc.mov(tmp, ToMemAddress(&konstf[C])); + cc.mov(tmp, asmjit::imm_ptr(&konstf[C])); cc.movsd(regF[A], asmjit::x86::qword_ptr(tmp)); cc.maxsd(regF[A], rb); } @@ -883,7 +883,7 @@ void JitCompiler::EmitATAN2() static const double constant = 180 / M_PI; auto tmp = cc.newIntPtr(); - cc.mov(tmp, ToMemAddress(&constant)); + cc.mov(tmp, asmjit::imm_ptr(&constant)); cc.mulsd(regF[A], asmjit::x86::qword_ptr(tmp)); } @@ -907,7 +907,7 @@ void JitCompiler::EmitFLOP() { static const double constant = M_PI / 180; auto tmp = cc.newIntPtr(); - cc.mov(tmp, ToMemAddress(&constant)); + cc.mov(tmp, asmjit::imm_ptr(&constant)); cc.mulsd(v, asmjit::x86::qword_ptr(tmp)); } @@ -948,7 +948,7 @@ void JitCompiler::EmitFLOP() { static const double constant = 180 / M_PI; auto tmp = cc.newIntPtr(); - cc.mov(tmp, ToMemAddress(&constant)); + cc.mov(tmp, asmjit::imm_ptr(&constant)); cc.mulsd(regF[A], asmjit::x86::qword_ptr(tmp)); } } @@ -1001,7 +1001,7 @@ void JitCompiler::EmitEQF_K() bool approx = static_cast(A & CMP_APPROX); if (!approx) { auto konstTmp = cc.newIntPtr(); - cc.mov(konstTmp, ToMemAddress(&konstf[C])); + cc.mov(konstTmp, asmjit::imm_ptr(&konstf[C])); cc.ucomisd(regF[B], x86::qword_ptr(konstTmp)); if (check) { cc.jp(success); @@ -1023,7 +1023,7 @@ void JitCompiler::EmitEQF_K() auto epsilon = cc.newDoubleConst(kConstScopeLocal, VM_EPSILON); auto epsilonXmm = cc.newXmmSd(); - cc.mov(konstTmp, ToMemAddress(&konstf[C])); + cc.mov(konstTmp, asmjit::imm_ptr(&konstf[C])); cc.movsd(subTmp, regF[B]); cc.subsd(subTmp, x86::qword_ptr(konstTmp)); @@ -1056,7 +1056,7 @@ void JitCompiler::EmitLTF_RK() auto constTmp = cc.newIntPtr(); auto xmmTmp = cc.newXmmSd(); - cc.mov(constTmp, ToMemAddress(&konstf[C])); + cc.mov(constTmp, asmjit::imm_ptr(&konstf[C])); cc.movsd(xmmTmp, asmjit::x86::qword_ptr(constTmp)); cc.ucomisd(xmmTmp, regF[B]); @@ -1071,7 +1071,7 @@ void JitCompiler::EmitLTF_KR() if (static_cast(A & CMP_APPROX)) I_FatalError("CMP_APPROX not implemented for LTF_KR.\n"); auto tmp = cc.newIntPtr(); - cc.mov(tmp, ToMemAddress(&konstf[B])); + cc.mov(tmp, asmjit::imm_ptr(&konstf[B])); cc.ucomisd(regF[C], asmjit::x86::qword_ptr(tmp)); if (check) cc.ja(fail); @@ -1097,7 +1097,7 @@ void JitCompiler::EmitLEF_RK() auto constTmp = cc.newIntPtr(); auto xmmTmp = cc.newXmmSd(); - cc.mov(constTmp, ToMemAddress(&konstf[C])); + cc.mov(constTmp, asmjit::imm_ptr(&konstf[C])); cc.movsd(xmmTmp, asmjit::x86::qword_ptr(constTmp)); cc.ucomisd(xmmTmp, regF[B]); @@ -1112,7 +1112,7 @@ void JitCompiler::EmitLEF_KR() if (static_cast(A & CMP_APPROX)) I_FatalError("CMP_APPROX not implemented for LEF_KR.\n"); auto tmp = cc.newIntPtr(); - cc.mov(tmp, ToMemAddress(&konstf[B])); + cc.mov(tmp, asmjit::imm_ptr(&konstf[B])); cc.ucomisd(regF[C], asmjit::x86::qword_ptr(tmp)); if (check) cc.jae(fail); @@ -1180,7 +1180,7 @@ void JitCompiler::EmitMULVF2_RK() auto tmp = cc.newIntPtr(); cc.movsd(regF[A], regF[B]); cc.movsd(regF[A + 1], regF[B + 1]); - cc.mov(tmp, ToMemAddress(&konstf[C])); + cc.mov(tmp, asmjit::imm_ptr(&konstf[C])); cc.mulsd(regF[A], asmjit::x86::qword_ptr(tmp)); cc.mulsd(regF[A + 1], asmjit::x86::qword_ptr(tmp)); } @@ -1199,7 +1199,7 @@ void JitCompiler::EmitDIVVF2_RK() auto tmp = cc.newIntPtr(); cc.movsd(regF[A], regF[B]); cc.movsd(regF[A + 1], regF[B + 1]); - cc.mov(tmp, ToMemAddress(&konstf[C])); + cc.mov(tmp, asmjit::imm_ptr(&konstf[C])); cc.divsd(regF[A], asmjit::x86::qword_ptr(tmp)); cc.divsd(regF[A + 1], asmjit::x86::qword_ptr(tmp)); } @@ -1359,7 +1359,7 @@ void JitCompiler::EmitMULVF3_RK() cc.movsd(regF[A], regF[B]); cc.movsd(regF[A + 1], regF[B + 1]); cc.movsd(regF[A + 2], regF[B + 2]); - cc.mov(tmp, ToMemAddress(&konstf[C])); + cc.mov(tmp, asmjit::imm_ptr(&konstf[C])); cc.mulsd(regF[A], asmjit::x86::qword_ptr(tmp)); cc.mulsd(regF[A + 1], asmjit::x86::qword_ptr(tmp)); cc.mulsd(regF[A + 2], asmjit::x86::qword_ptr(tmp)); @@ -1382,7 +1382,7 @@ void JitCompiler::EmitDIVVF3_RK() cc.movsd(regF[A], regF[B]); cc.movsd(regF[A + 1], regF[B + 1]); cc.movsd(regF[A + 2], regF[B + 2]); - cc.mov(tmp, ToMemAddress(&konstf[C])); + cc.mov(tmp, asmjit::imm_ptr(&konstf[C])); cc.divsd(regF[A], asmjit::x86::qword_ptr(tmp)); cc.divsd(regF[A + 1], asmjit::x86::qword_ptr(tmp)); cc.divsd(regF[A + 2], asmjit::x86::qword_ptr(tmp)); @@ -1506,7 +1506,7 @@ void JitCompiler::EmitEQA_K() { EmitComparisonOpcode([&](bool check, asmjit::Label& fail, asmjit::Label& success) { auto tmp = cc.newIntPtr(); - cc.mov(tmp, ToMemAddress(konsta[C].v)); + cc.mov(tmp, asmjit::imm_ptr(konsta[C].v)); cc.cmp(regA[B], tmp); if (check) cc.je(fail); else cc.jne(fail); diff --git a/src/scripting/vm/jit_move.cpp b/src/scripting/vm/jit_move.cpp index ece9930f8..c3bc215d6 100644 --- a/src/scripting/vm/jit_move.cpp +++ b/src/scripting/vm/jit_move.cpp @@ -193,7 +193,7 @@ void JitCompiler::EmitDYNCAST_R() void JitCompiler::EmitDYNCAST_K() { auto c = cc.newIntPtr(); - cc.mov(c, ToMemAddress(konsta[C].o)); + cc.mov(c, asmjit::imm_ptr(konsta[C].o)); auto call = CreateCall([](DObject *obj, PClass *cls) -> DObject* { return (obj && obj->IsKindOf(cls)) ? obj : nullptr; }); @@ -216,7 +216,7 @@ void JitCompiler::EmitDYNCASTC_K() { using namespace asmjit; auto c = cc.newIntPtr(); - cc.mov(c, ToMemAddress(konsta[C].o)); + cc.mov(c, asmjit::imm_ptr(konsta[C].o)); typedef PClass*(*FuncPtr)(PClass*, PClass*); auto call = CreateCall([](PClass *cls1, PClass *cls2) -> PClass* { return (cls1 && cls1->IsDescendantOf(cls2)) ? cls1 : nullptr; diff --git a/src/scripting/vm/jitintern.h b/src/scripting/vm/jitintern.h index af1f6bd35..be4c9c668 100644 --- a/src/scripting/vm/jitintern.h +++ b/src/scripting/vm/jitintern.h @@ -80,25 +80,25 @@ private: } template - asmjit::CCFuncCall *CreateCall(RetType(*func)(P1 p1)) { return cc.call(ToMemAddress(reinterpret_cast(static_cast(func))), asmjit::FuncSignature1()); } + asmjit::CCFuncCall *CreateCall(RetType(*func)(P1 p1)) { return cc.call(asmjit::imm_ptr(reinterpret_cast(static_cast(func))), asmjit::FuncSignature1()); } template - asmjit::CCFuncCall *CreateCall(RetType(*func)(P1 p1, P2 p2)) { return cc.call(ToMemAddress(reinterpret_cast(static_cast(func))), asmjit::FuncSignature2()); } + asmjit::CCFuncCall *CreateCall(RetType(*func)(P1 p1, P2 p2)) { return cc.call(asmjit::imm_ptr(reinterpret_cast(static_cast(func))), asmjit::FuncSignature2()); } template - asmjit::CCFuncCall *CreateCall(RetType(*func)(P1 p1, P2 p2, P3 p3)) { return cc.call(ToMemAddress(reinterpret_cast(static_cast(func))), asmjit::FuncSignature3()); } + asmjit::CCFuncCall *CreateCall(RetType(*func)(P1 p1, P2 p2, P3 p3)) { return cc.call(asmjit::imm_ptr(reinterpret_cast(static_cast(func))), asmjit::FuncSignature3()); } template - asmjit::CCFuncCall *CreateCall(RetType(*func)(P1 p1, P2 p2, P3 p3, P4 p4)) { return cc.call(ToMemAddress(reinterpret_cast(static_cast(func))), asmjit::FuncSignature4()); } + asmjit::CCFuncCall *CreateCall(RetType(*func)(P1 p1, P2 p2, P3 p3, P4 p4)) { return cc.call(asmjit::imm_ptr(reinterpret_cast(static_cast(func))), asmjit::FuncSignature4()); } template - asmjit::CCFuncCall *CreateCall(RetType(*func)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)) { return cc.call(ToMemAddress(reinterpret_cast(static_cast(func))), asmjit::FuncSignature5()); } + asmjit::CCFuncCall *CreateCall(RetType(*func)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)) { return cc.call(asmjit::imm_ptr(reinterpret_cast(static_cast(func))), asmjit::FuncSignature5()); } template - asmjit::CCFuncCall *CreateCall(RetType(*func)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)) { return cc.call(ToMemAddress(reinterpret_cast(static_cast(func))), asmjit::FuncSignature6()); } + asmjit::CCFuncCall *CreateCall(RetType(*func)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)) { return cc.call(asmjit::imm_ptr(reinterpret_cast(static_cast(func))), asmjit::FuncSignature6()); } template - asmjit::CCFuncCall *CreateCall(RetType(*func)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7)) { return cc.call(ToMemAddress(reinterpret_cast(static_cast(func))), asmjit::FuncSignature7()); } + asmjit::CCFuncCall *CreateCall(RetType(*func)(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7)) { return cc.call(asmjit::imm_ptr(reinterpret_cast(static_cast(func))), asmjit::FuncSignature7()); } void EmitNullPointerThrow(int index, EVMAbortException reason); void EmitThrowException(EVMAbortException reason);