diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index 6df3461eaa..5629e21f86 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -168,6 +168,7 @@ set(SRCS ActionReplay.cpp PowerPC/SignatureDB/SignatureDB.cpp PowerPC/JitInterface.cpp PowerPC/CachedInterpreter/CachedInterpreter.cpp + PowerPC/CachedInterpreter/InterpreterBlockCache.cpp PowerPC/Interpreter/Interpreter_Branch.cpp PowerPC/Interpreter/Interpreter.cpp PowerPC/Interpreter/Interpreter_FloatingPoint.cpp diff --git a/Source/Core/Core/Core.vcxproj b/Source/Core/Core/Core.vcxproj index bf36fb253b..944085b82b 100644 --- a/Source/Core/Core/Core.vcxproj +++ b/Source/Core/Core/Core.vcxproj @@ -205,6 +205,7 @@ + @@ -425,6 +426,7 @@ + diff --git a/Source/Core/Core/Core.vcxproj.filters b/Source/Core/Core/Core.vcxproj.filters index 68ff807b8c..fb6c05b4cc 100644 --- a/Source/Core/Core/Core.vcxproj.filters +++ b/Source/Core/Core/Core.vcxproj.filters @@ -279,6 +279,9 @@ PowerPC\Cached Interpreter + + PowerPC\Cached Interpreter + PowerPC\Interpreter @@ -875,6 +878,9 @@ PowerPC\Cached Interpreter + + PowerPC\Cached Interpreter + PowerPC\Interpreter diff --git a/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp b/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp index 5ed3d21cda..44bf711e90 100644 --- a/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp +++ b/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp @@ -20,7 +20,7 @@ void CachedInterpreter::Init() jo.enableBlocklink = false; - JitBaseBlockCache::Init(); + m_block_cache.Init(); UpdateMemoryOptions(); code_block.m_stats = &js.st; @@ -30,12 +30,12 @@ void CachedInterpreter::Init() void CachedInterpreter::Shutdown() { - JitBaseBlockCache::Shutdown(); + m_block_cache.Shutdown(); } void CachedInterpreter::ExecuteOneBlock() { - const u8* normal_entry = JitBaseBlockCache::Dispatch(); + const u8* normal_entry = m_block_cache.Dispatch(); const Instruction* code = reinterpret_cast(normal_entry); for (; code->type != Instruction::INSTRUCTION_ABORT; ++code) @@ -123,7 +123,7 @@ static bool CheckDSI(u32 data) void CachedInterpreter::Jit(u32 address) { - if (m_code.size() >= CODE_SIZE / sizeof(Instruction) - 0x1000 || IsFull() || + if (m_code.size() >= CODE_SIZE / sizeof(Instruction) - 0x1000 || m_block_cache.IsFull() || SConfig::GetInstance().bJITNoBlockCache) { ClearCache(); @@ -140,8 +140,8 @@ void CachedInterpreter::Jit(u32 address) return; } - int block_num = AllocateBlock(PC); - JitBlock* b = GetBlock(block_num); + int block_num = m_block_cache.AllocateBlock(PC); + JitBlock* b = m_block_cache.GetBlock(block_num); js.blockStart = PC; js.firstFPInstructionFound = false; @@ -212,12 +212,12 @@ void CachedInterpreter::Jit(u32 address) b->codeSize = (u32)(GetCodePtr() - b->checkedEntry); b->originalSize = code_block.m_num_instructions; - FinalizeBlock(block_num, jo.enableBlocklink, b->checkedEntry); + m_block_cache.FinalizeBlock(block_num, jo.enableBlocklink, b->checkedEntry); } void CachedInterpreter::ClearCache() { m_code.clear(); - JitBaseBlockCache::Clear(); + m_block_cache.Clear(); UpdateMemoryOptions(); } diff --git a/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.h b/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.h index 42291fe509..e21df9c099 100644 --- a/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.h +++ b/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.h @@ -7,10 +7,11 @@ #include #include "Common/CommonTypes.h" +#include "Core/PowerPC/CachedInterpreter/InterpreterBlockCache.h" #include "Core/PowerPC/JitCommon/JitBase.h" #include "Core/PowerPC/PPCAnalyst.h" -class CachedInterpreter : public JitBase, JitBaseBlockCache +class CachedInterpreter : public JitBase { public: CachedInterpreter() : code_buffer(32000) {} @@ -26,9 +27,8 @@ public: void Jit(u32 address) override; - JitBaseBlockCache* GetBlockCache() override { return this; } + JitBaseBlockCache* GetBlockCache() override { return &m_block_cache; } const char* GetName() override { return "Cached Interpreter"; } - void WriteLinkBlock(const JitBlock::LinkData& source, const JitBlock* dest) override {} const CommonAsmRoutinesBase* GetAsmRoutines() override { return nullptr; } private: struct Instruction @@ -59,6 +59,7 @@ private: const u8* GetCodePtr() { return (u8*)(m_code.data() + m_code.size()); } void ExecuteOneBlock(); + BlockCache m_block_cache; std::vector m_code; PPCAnalyst::CodeBuffer code_buffer; }; diff --git a/Source/Core/Core/PowerPC/CachedInterpreter/InterpreterBlockCache.cpp b/Source/Core/Core/PowerPC/CachedInterpreter/InterpreterBlockCache.cpp new file mode 100644 index 0000000000..f402ab3440 --- /dev/null +++ b/Source/Core/Core/PowerPC/CachedInterpreter/InterpreterBlockCache.cpp @@ -0,0 +1,11 @@ +// Copyright 2016 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include "Core/PowerPC/CachedInterpreter/InterpreterBlockCache.h" + +BlockCache::BlockCache() = default; + +void BlockCache::WriteLinkBlock(const JitBlock::LinkData& source, const JitBlock* dest) +{ +} diff --git a/Source/Core/Core/PowerPC/CachedInterpreter/InterpreterBlockCache.h b/Source/Core/Core/PowerPC/CachedInterpreter/InterpreterBlockCache.h new file mode 100644 index 0000000000..d93c08e5ac --- /dev/null +++ b/Source/Core/Core/PowerPC/CachedInterpreter/InterpreterBlockCache.h @@ -0,0 +1,16 @@ +// Copyright 2016 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +#include "Core/PowerPC/JitCommon/JitCache.h" + +class BlockCache final : public JitBaseBlockCache +{ +public: + BlockCache(); + +private: + void WriteLinkBlock(const JitBlock::LinkData& source, const JitBlock* dest) override; +};