From ffe4c266eff69a912d398d10fd72963f178b6bec Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sun, 1 May 2016 11:13:51 +0200 Subject: [PATCH] Add CodeBlockCommon base class to remove further arch-specificity in JitBlockCache Remove unused ArmThunk. --- CMakeLists.txt | 3 +- Common/Arm64Emitter.cpp | 10 ++-- Common/Arm64Emitter.h | 5 +- Common/ArmEmitter.cpp | 4 +- Common/ArmEmitter.h | 5 +- Common/ArmThunk.cpp | 74 --------------------------- Common/CodeBlock.h | 64 ++++++++++++++--------- Common/Common.vcxproj | 8 +-- Common/Common.vcxproj.filters | 3 +- Common/Thunk.h | 10 +--- Common/x64Emitter.cpp | 6 +-- Common/x64Emitter.h | 5 +- Core/MIPS/ARM/ArmJit.cpp | 4 +- Core/MIPS/JitCommon/JitBlockCache.cpp | 2 +- Core/MIPS/JitCommon/JitBlockCache.h | 29 ++--------- Core/MIPS/x86/Jit.cpp | 2 +- Qt/Common.pro | 3 +- android/jni/Android.mk | 2 - unittest/TestArm64Emitter.cpp | 2 +- unittest/TestArmEmitter.cpp | 6 +-- unittest/TestX64Emitter.cpp | 8 +-- 21 files changed, 80 insertions(+), 175 deletions(-) delete mode 100644 Common/ArmThunk.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index f208b4e9e7..8e4bb97ccb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -306,8 +306,7 @@ endmacro() set(CommonExtra) if(ARM) set(CommonExtra ${CommonExtra} - Common/ArmCPUDetect.cpp - Common/ArmThunk.cpp) + Common/ArmCPUDetect.cpp) if(ARMV7) set(CommonExtra ${CommonExtra} Common/ColorConvNEON.cpp) diff --git a/Common/Arm64Emitter.cpp b/Common/Arm64Emitter.cpp index 805da7a85d..9029117e45 100644 --- a/Common/Arm64Emitter.cpp +++ b/Common/Arm64Emitter.cpp @@ -265,14 +265,14 @@ static int EncodeSize(int size) { } } -void ARM64XEmitter::SetCodePtr(u8* ptr) +void ARM64XEmitter::SetCodePointer(u8* ptr) { m_code = ptr; m_startcode = m_code; m_lastCacheFlushEnd = ptr; } -const u8* ARM64XEmitter::GetCodePtr() const +const u8* ARM64XEmitter::GetCodePointer() const { return m_code; } @@ -1914,7 +1914,7 @@ void ARM64XEmitter::MOVI2R(ARM64Reg Rd, u64 imm, bool optimize) } } - u64 aligned_pc = (u64)GetCodePtr() & ~0xFFF; + u64 aligned_pc = (u64)GetCodePointer() & ~0xFFF; s64 aligned_offset = (s64)imm - (s64)aligned_pc; if (upload_part.Count() > 1 && abs64(aligned_offset) < 0xFFFFFFFFLL) { @@ -1929,7 +1929,7 @@ void ARM64XEmitter::MOVI2R(ARM64Reg Rd, u64 imm, bool optimize) else { // If the address is within 1MB of PC we can load it in a single instruction still - s64 offset = (s64)imm - (s64)GetCodePtr(); + s64 offset = (s64)imm - (s64)GetCodePointer(); if (offset >= -0xFFFFF && offset <= 0xFFFFF) { ADR(Rd, (s32)offset); @@ -2100,7 +2100,7 @@ void ARM64FloatEmitter::EmitLoadStoreImmediate(u8 size, u32 opc, IndexType type, if (type == INDEX_UNSIGNED) { - _assert_msg_(DYNA_REC, !(imm & ((size - 1) >> 3)), "%s(INDEX_UNSIGNED) immediate offset must be aligned to size! (%d) (%p)", __FUNCTION__, imm, m_emit->GetCodePtr()); + _assert_msg_(DYNA_REC, !(imm & ((size - 1) >> 3)), "%s(INDEX_UNSIGNED) immediate offset must be aligned to size! (%d) (%p)", __FUNCTION__, imm, m_emit->GetCodePointer()); _assert_msg_(DYNA_REC, imm >= 0, "%s(INDEX_UNSIGNED) immediate offset must be positive!", __FUNCTION__); if (size == 16) imm >>= 1; diff --git a/Common/Arm64Emitter.h b/Common/Arm64Emitter.h index bf7e30987f..fc1814bae0 100644 --- a/Common/Arm64Emitter.h +++ b/Common/Arm64Emitter.h @@ -394,11 +394,12 @@ public: { } - void SetCodePtr(u8* ptr); + void SetCodePointer(u8* ptr); + const u8* GetCodePointer() const; + void ReserveCodeSpace(u32 bytes); const u8* AlignCode16(); const u8* AlignCodePage(); - const u8* GetCodePtr() const; void FlushIcache(); void FlushIcacheSection(u8* start, u8* end); u8* GetWritableCodePtr(); diff --git a/Common/ArmEmitter.cpp b/Common/ArmEmitter.cpp index c547fd4329..1ce785f10b 100644 --- a/Common/ArmEmitter.cpp +++ b/Common/ArmEmitter.cpp @@ -589,14 +589,14 @@ void ARMXEmitter::QuickCallFunction(ARMReg reg, const void *func) { } } -void ARMXEmitter::SetCodePtr(u8 *ptr) +void ARMXEmitter::SetCodePointer(u8 *ptr) { code = ptr; startcode = code; lastCacheFlushEnd = ptr; } -const u8 *ARMXEmitter::GetCodePtr() const +const u8 *ARMXEmitter::GetCodePointer() const { return code; } diff --git a/Common/ArmEmitter.h b/Common/ArmEmitter.h index 6000b94bde..d0cc1de2ed 100644 --- a/Common/ArmEmitter.h +++ b/Common/ArmEmitter.h @@ -445,11 +445,12 @@ public: } virtual ~ARMXEmitter() {} - void SetCodePtr(u8 *ptr); + void SetCodePointer(u8 *ptr); + const u8 *GetCodePointer() const; + void ReserveCodeSpace(u32 bytes); const u8 *AlignCode16(); const u8 *AlignCodePage(); - const u8 *GetCodePtr() const; void FlushIcache(); void FlushIcacheSection(u8 *start, u8 *end); u8 *GetWritableCodePtr(); diff --git a/Common/ArmThunk.cpp b/Common/ArmThunk.cpp deleted file mode 100644 index 8be655b4d9..0000000000 --- a/Common/ArmThunk.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2003 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#include "MemoryUtil.h" -#include "Thunk.h" - -#define THUNK_ARENA_SIZE 1024*1024*1 - -namespace -{ - -static u8 GC_ALIGNED32(saved_fp_state[16 * 4 * 4]); -static u8 GC_ALIGNED32(saved_gpr_state[16 * 8]); -static u16 saved_mxcsr; - -} // namespace - -using namespace ArmGen; - -void ThunkManager::Init() -{ -} - -void ThunkManager::Reset() -{ - thunks.clear(); - ResetCodePtr(); -} - -void ThunkManager::Shutdown() -{ - Reset(); - FreeCodeSpace(); -} - -int ThunkManager::ThunkStackOffset() -{ - return 0; -} - -int ThunkManager::ThunkBytesNeeded() -{ - return 0; -} - -const void *ThunkManager::ProtectFunction(const void *function, int num_params) -{ - _dbg_assert_msg_(JIT, false, "Arm ThunkManager not implemented? Will crash."); - return NULL; -} - -void Enter(ThunkEmitter *emit) -{ - _dbg_assert_msg_(JIT, false, "Arm ThunkManager not implemented? Will crash."); -} - -void Leave(ThunkEmitter *emit) -{ - _dbg_assert_msg_(JIT, false, "Arm ThunkManager not implemented? Will crash."); -} diff --git a/Common/CodeBlock.h b/Common/CodeBlock.h index 3a96d75177..337f08a9c9 100644 --- a/Common/CodeBlock.h +++ b/Common/CodeBlock.h @@ -12,19 +12,41 @@ // having to prefix them with gen-> or something similar. // Example implementation: // class JIT : public CodeBlock, public JitInterface {} -template class CodeBlock : public T, NonCopyable + +class CodeBlockCommon { +public: + CodeBlockCommon() : region(nullptr), region_size(0) {} + virtual ~CodeBlockCommon() {} + + bool IsInSpace(const u8 *ptr) { + return (ptr >= region) && (ptr < (region + region_size)); + } + + virtual void SetCodePtr(u8 *ptr) = 0; + virtual const u8 *GetCodePtr() const = 0; + + u8 *GetBasePtr() { + return region; + } + + size_t GetOffset(const u8 *ptr) const { + return ptr - region; + } + +protected: + u8 *region; + size_t region_size; +}; + +template class CodeBlock : public CodeBlockCommon, public T, NonCopyable { private: // A privately used function to set the executable RAM space to something invalid. // For debugging usefulness it should be used to set the RAM to a host specific breakpoint instruction virtual void PoisonMemory() = 0; -protected: - u8 *region; - size_t region_size; - public: - CodeBlock() : region(nullptr), region_size(0) {} + CodeBlock() {} virtual ~CodeBlock() { if (region) FreeCodeSpace(); } // Call this before you generate any code. @@ -32,7 +54,7 @@ public: { region_size = size; region = (u8*)AllocateExecutableMemory(region_size); - T::SetCodePtr(region); + T::SetCodePointer(region); } // Always clear code space with breakpoints, so that if someone accidentally executes @@ -55,11 +77,6 @@ public: region_size = 0; } - bool IsInSpace(const u8 *ptr) - { - return (ptr >= region) && (ptr < (region + region_size)); - } - // Cannot currently be undone. Will write protect the entire code region. // Start over if you need to change the code (call FreeCodeSpace(), AllocCodeSpace()). void WriteProtect() @@ -67,22 +84,21 @@ public: WriteProtectMemory(region, region_size, true); } + void SetCodePtr(u8 *ptr) override { + T::SetCodePointer(ptr); + } + + const u8 *GetCodePtr() const override { + return T::GetCodePointer(); + } + void ResetCodePtr() { - T::SetCodePtr(region); + T::SetCodePointer(region); } - size_t GetSpaceLeft() const - { - return region_size - (T::GetCodePtr() - region); - } - - u8 *GetBasePtr() { - return region; - } - - size_t GetOffset(const u8 *ptr) const { - return ptr - region; + size_t GetSpaceLeft() const { + return region_size - (T::GetCodePointer() - region); } }; diff --git a/Common/Common.vcxproj b/Common/Common.vcxproj index 2fb7c33a0b..cfd26a5698 100644 --- a/Common/Common.vcxproj +++ b/Common/Common.vcxproj @@ -258,12 +258,6 @@ true - - true - true - true - true - true true @@ -332,4 +326,4 @@ - \ No newline at end of file + diff --git a/Common/Common.vcxproj.filters b/Common/Common.vcxproj.filters index 1dcbacabe5..1a8a744b2f 100644 --- a/Common/Common.vcxproj.filters +++ b/Common/Common.vcxproj.filters @@ -104,7 +104,6 @@ Crypto - @@ -151,4 +150,4 @@ {c14d66ef-5f7c-4565-975a-72774e7ccfb9} - \ No newline at end of file + diff --git a/Common/Thunk.h b/Common/Thunk.h index 101ea84a8d..4e5feffd87 100644 --- a/Common/Thunk.h +++ b/Common/Thunk.h @@ -20,11 +20,7 @@ #include #include "Common.h" -#if defined(ARM) -#include "ArmEmitter.h" -#else #include "x64Emitter.h" -#endif // This simple class creates a wrapper around a C/C++ function that saves all fp state // before entering it, and restores it upon exit. This is required to be able to selectively @@ -32,18 +28,14 @@ // of complexity that it means to protect the generated code from this problem. // This process is called thunking. +// Only used for X86 right now. // There will only ever be one level of thunking on the stack, plus, // we don't want to pollute the stack, so we store away regs somewhere global. // NOT THREAD SAFE. This may only be used from the CPU thread. // Any other thread using this stuff will be FATAL. -#if defined(ARM) -typedef ArmGen::ARMXEmitter ThunkEmitter; -typedef ArmGen::ARMXCodeBlock ThunkCodeBlock; -#else typedef Gen::XEmitter ThunkEmitter; typedef Gen::XCodeBlock ThunkCodeBlock; -#endif class ThunkManager : public ThunkCodeBlock { diff --git a/Common/x64Emitter.cpp b/Common/x64Emitter.cpp index 3839df53b0..489223895f 100644 --- a/Common/x64Emitter.cpp +++ b/Common/x64Emitter.cpp @@ -96,12 +96,12 @@ enum NormalSSEOps }; -void XEmitter::SetCodePtr(u8 *ptr) +void XEmitter::SetCodePointer(u8 *ptr) { code = ptr; } -const u8 *XEmitter::GetCodePtr() const +const u8 *XEmitter::GetCodePointer() const { return code; } @@ -235,7 +235,7 @@ void OpArg::WriteRest(XEmitter *emit, int extraBytes, X64Reg _operandReg, emit->WriteModRM(0, _operandReg, _offsetOrBaseReg); //TODO : add some checks #ifdef _M_X64 - u64 ripAddr = (u64)emit->GetCodePtr() + 4 + extraBytes; + u64 ripAddr = (u64)emit->GetCodePointer() + 4 + extraBytes; s64 distance = (s64)offset - (s64)ripAddr; _assert_msg_(DYNA_REC, (distance < 0x80000000LL && diff --git a/Common/x64Emitter.h b/Common/x64Emitter.h index e78166f9b3..cd7647813d 100644 --- a/Common/x64Emitter.h +++ b/Common/x64Emitter.h @@ -374,12 +374,13 @@ public: void WriteModRM(int mod, int rm, int reg); void WriteSIB(int scale, int index, int base); - void SetCodePtr(u8 *ptr); + void SetCodePointer(u8 *ptr); + const u8 *GetCodePointer() const; + void ReserveCodeSpace(int bytes); const u8 *AlignCode4(); const u8 *AlignCode16(); const u8 *AlignCodePage(); - const u8 *GetCodePtr() const; u8 *GetWritableCodePtr(); void LockFlags() { flags_locked = true; } diff --git a/Core/MIPS/ARM/ArmJit.cpp b/Core/MIPS/ARM/ArmJit.cpp index 621678afe2..c7512181cd 100644 --- a/Core/MIPS/ARM/ArmJit.cpp +++ b/Core/MIPS/ARM/ArmJit.cpp @@ -399,14 +399,14 @@ void ArmJit::Comp_RunBlock(MIPSOpcode op) void ArmJit::LinkBlock(u8 *exitPoint, const u8 *checkedEntry) { ARMXEmitter emit(exitPoint); - u32 op = *((const u32 *)emit.GetCodePtr()); + u32 op = *((const u32 *)emit.GetCodePointer()); bool prelinked = (op & 0xFF000000) == 0xEA000000; // Jump directly to the block, yay. emit.B(checkedEntry); if (!prelinked) { do { - op = *((const u32 *)emit.GetCodePtr()); + op = *((const u32 *)emit.GetCodePointer()); // Overwrite whatever is here with a breakpoint. emit.BKPT(1); // Stop after overwriting the next unconditional branch or BKPT. diff --git a/Core/MIPS/JitCommon/JitBlockCache.cpp b/Core/MIPS/JitCommon/JitBlockCache.cpp index 29ca61296c..5b59e0bad7 100644 --- a/Core/MIPS/JitCommon/JitBlockCache.cpp +++ b/Core/MIPS/JitCommon/JitBlockCache.cpp @@ -59,7 +59,7 @@ op_agent_t agent; const u32 INVALID_EXIT = 0xFFFFFFFF; -JitBlockCache::JitBlockCache(MIPSState *mips, NativeCodeBlock *codeBlock) : +JitBlockCache::JitBlockCache(MIPSState *mips, CodeBlockCommon *codeBlock) : mips_(mips), codeBlock_(codeBlock), blocks_(0), num_blocks_(0) { } diff --git a/Core/MIPS/JitCommon/JitBlockCache.h b/Core/MIPS/JitCommon/JitBlockCache.h index 3dc23e6f63..03661b2855 100644 --- a/Core/MIPS/JitCommon/JitBlockCache.h +++ b/Core/MIPS/JitCommon/JitBlockCache.h @@ -23,31 +23,10 @@ #include #include "Common/CommonTypes.h" +#include "Common/CodeBlock.h" #include "Core/MIPS/MIPSAnalyst.h" #include "Core/MIPS/MIPS.h" -#if defined(ARM) -#include "Common/ArmEmitter.h" -namespace ArmGen { class ARMXEmitter; } -typedef ArmGen::ARMXCodeBlock NativeCodeBlock; -#elif defined(ARM64) -#include "Common/Arm64Emitter.h" -namespace Arm64Gen { class ARM64XEmitter; } -typedef Arm64Gen::ARM64CodeBlock NativeCodeBlock; -#elif defined(_M_IX86) || defined(_M_X64) -#include "Common/x64Emitter.h" -namespace Gen { class XEmitter; } -typedef Gen::XCodeBlock NativeCodeBlock; -#elif defined(MIPS) -#include "Common/MipsEmitter.h" -namespace MIPSGen { class MIPSEmitter; } -typedef MIPSGen::MIPSCodeBlock NativeCodeBlock; -#else -#include "Common/FakeEmitter.h" -namespace FakeGen { class FakeXEmitter; } -typedef FakeGen::FakeXCodeBlock NativeCodeBlock; -#endif - #if defined(ARM) || defined(ARM64) const int MAX_JIT_BLOCK_EXITS = 2; #else @@ -109,12 +88,12 @@ typedef void (*CompiledCode)(); class JitBlockCache { public: - JitBlockCache(MIPSState *mips_, NativeCodeBlock *codeBlock); + JitBlockCache(MIPSState *mips_, CodeBlockCommon *codeBlock); ~JitBlockCache(); int AllocateBlock(u32 em_address); // When a proxy block is invalidated, the block located at the rootAddress - void ProxyBlock(u32 rootAddress, u32 startAddress, u32 size, u8 *codePtr); + void ProxyBlock(u32 rootAddress, u32 startAddress, u32 size, const u8 *codePtr); void FinalizeBlock(int block_num, bool block_link); void Clear(); @@ -173,7 +152,7 @@ private: MIPSOpcode GetEmuHackOpForBlock(int block_num) const; MIPSState *mips_; - NativeCodeBlock *codeBlock_; + CodeBlockCommon *codeBlock_; JitBlock *blocks_; std::unordered_multimap proxyBlockMap_; diff --git a/Core/MIPS/x86/Jit.cpp b/Core/MIPS/x86/Jit.cpp index 527c6a2c7d..f3f83b58d3 100644 --- a/Core/MIPS/x86/Jit.cpp +++ b/Core/MIPS/x86/Jit.cpp @@ -505,7 +505,7 @@ void Jit::LinkBlock(u8 *exitPoint, const u8 *checkedEntry) { XEmitter emit(exitPoint); // Okay, this is a bit ugly, but we check here if it already has a JMP. // That means it doesn't have a full exit to pad with INT 3. - bool prelinked = *emit.GetCodePtr() == 0xE9; + bool prelinked = *emit.GetCodePointer() == 0xE9; emit.JMP(checkedEntry, true); if (!prelinked) { ptrdiff_t actualSize = emit.GetWritableCodePtr() - exitPoint; diff --git a/Qt/Common.pro b/Qt/Common.pro index 6aa505554d..7d2b705f06 100644 --- a/Qt/Common.pro +++ b/Qt/Common.pro @@ -7,8 +7,7 @@ include(Settings.pri) # CPU arm { - SOURCES += $$P/Common/ArmCPUDetect.cpp \ - $$P/Common/ArmThunk.cpp + SOURCES += $$P/Common/ArmCPUDetect.cpp } else:i86 { SOURCES += $$P/Common/ABI.cpp \ diff --git a/android/jni/Android.mk b/android/jni/Android.mk index 6eb9e787c8..8a3c46c084 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -57,7 +57,6 @@ ARCH_FILES := \ $(SRC)/Core/Util/AudioFormatNEON.cpp.neon \ $(SRC)/Common/ArmEmitter.cpp \ $(SRC)/Common/ArmCPUDetect.cpp \ - $(SRC)/Common/ArmThunk.cpp \ $(SRC)/Common/ColorConvNEON.cpp.neon \ $(SRC)/Core/MIPS/ARM/ArmCompALU.cpp \ $(SRC)/Core/MIPS/ARM/ArmCompBranch.cpp \ @@ -102,7 +101,6 @@ ifeq ($(TARGET_ARCH_ABI),armeabi) ARCH_FILES := \ $(SRC)/Common/ArmEmitter.cpp \ $(SRC)/Common/ArmCPUDetect.cpp \ - $(SRC)/Common/ArmThunk.cpp \ $(SRC)/Core/MIPS/ARM/ArmCompALU.cpp \ $(SRC)/Core/MIPS/ARM/ArmCompBranch.cpp \ $(SRC)/Core/MIPS/ARM/ArmCompFPU.cpp \ diff --git a/unittest/TestArm64Emitter.cpp b/unittest/TestArm64Emitter.cpp index e4781a9905..6aea74f0dc 100644 --- a/unittest/TestArm64Emitter.cpp +++ b/unittest/TestArm64Emitter.cpp @@ -10,7 +10,7 @@ static bool CheckLast(Arm64Gen::ARM64XEmitter &emit, const char *comp) { u32 instr; - memcpy(&instr, emit.GetCodePtr() - 4, 4); + memcpy(&instr, emit.GetCodePointer() - 4, 4); char disasm[512]; Arm64Dis(0, instr, disasm, sizeof(disasm), true); EXPECT_EQ_STR(std::string(disasm), std::string(comp)); diff --git a/unittest/TestArmEmitter.cpp b/unittest/TestArmEmitter.cpp index 84b6bee9e0..aa9db3f72a 100644 --- a/unittest/TestArmEmitter.cpp +++ b/unittest/TestArmEmitter.cpp @@ -11,7 +11,7 @@ static bool CheckLast(ArmGen::ARMXEmitter &emit, const char *comp) { u32 instr; - memcpy(&instr, emit.GetCodePtr() - 4, 4); + memcpy(&instr, emit.GetCodePointer() - 4, 4); char disasm[512]; ArmDis(0, instr, disasm, sizeof(disasm), true); EXPECT_EQ_STR(std::string(disasm), std::string(comp)); @@ -227,7 +227,7 @@ bool TestArmEmitter() { //RET(CheckLast(emitter, "eef70a00 VMOV.f32 s1, #112")); - const u8 *codeStart = emitter.GetCodePtr(); + const u8 *codeStart = emitter.GetCodePointer(); MIPSState mips; MIPSComp::JitState js; @@ -269,7 +269,7 @@ bool TestArmEmitter() { fpr.QMapReg(C000, V_Quad, MAP_DIRTY); fpr.FlushAll(); - const u8 *codeEnd = emitter.GetCodePtr(); + const u8 *codeEnd = emitter.GetCodePointer(); DisassembleARMBetween(codeStart, codeEnd); diff --git a/unittest/TestX64Emitter.cpp b/unittest/TestX64Emitter.cpp index 6ff8d0b2c4..6fe2882859 100644 --- a/unittest/TestX64Emitter.cpp +++ b/unittest/TestX64Emitter.cpp @@ -11,13 +11,13 @@ static const u8 *prevStart = NULL; bool CheckLast(Gen::XEmitter &emit, const char *comp) { - auto vec = DisassembleX86(prevStart, emit.GetCodePtr() - prevStart); + auto vec = DisassembleX86(prevStart, emit.GetCodePointer() - prevStart); EXPECT_EQ_STR(vec[0], std::string(comp)); return true; } void PrintLast(Gen::XEmitter &emit) { - for (const u8 *p = prevStart; p < emit.GetCodePtr(); p++) { + for (const u8 *p = prevStart; p < emit.GetCodePointer(); p++) { printf("%02x ", *p); } printf("\n"); @@ -29,11 +29,11 @@ bool TestX64Emitter() { u32 code[512]; XEmitter emitter((u8 *)code); - prevStart = emitter.GetCodePtr(); + prevStart = emitter.GetCodePointer(); emitter.VADDSD(XMM0, XMM1, R(XMM7)); RET(CheckLast(emitter, "vaddsd xmm0, xmm1, xmm7")); - prevStart = emitter.GetCodePtr(); + prevStart = emitter.GetCodePointer(); emitter.VMULSD(XMM0, XMM1, R(XMM7)); RET(CheckLast(emitter, "vmulsd xmm0, xmm1, xmm7"));