summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2017-02-23 12:48:52 -0500
committerLioncash <mathew1800@gmail.com>2017-02-23 18:08:20 -0500
commit07834764643ba9beefdf20c474194f0e32f55da3 (patch)
tree5dc195b88e019c29e6be25e650d578a489c08674 /Source
parent95b2b033b025729491d3c22f94f01d4aca38d4f0 (diff)
CachedInterpreter: Forward declare instruction struct
Allows changes to be made to the instruction struct without recompiling other source files.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp41
-rw-r--r--Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.h32
2 files changed, 46 insertions, 27 deletions
diff --git a/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp b/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp
index e97d29ff9c..80b3fa9c13 100644
--- a/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp
+++ b/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp
@@ -14,6 +14,42 @@
#include "Core/PowerPC/PPCAnalyst.h"
#include "Core/PowerPC/PowerPC.h"
+struct CachedInterpreter::Instruction
+{
+ typedef void (*CommonCallback)(UGeckoInstruction);
+ typedef bool (*ConditionalCallback)(u32 data);
+
+ Instruction() : type(INSTRUCTION_ABORT) {}
+ Instruction(const CommonCallback c, UGeckoInstruction i)
+ : common_callback(c), data(i.hex), type(INSTRUCTION_TYPE_COMMON)
+ {
+ }
+
+ Instruction(const ConditionalCallback c, u32 d)
+ : conditional_callback(c), data(d), type(INSTRUCTION_TYPE_CONDITIONAL)
+ {
+ }
+
+ union
+ {
+ const CommonCallback common_callback;
+ const ConditionalCallback conditional_callback;
+ };
+ u32 data;
+ enum
+ {
+ INSTRUCTION_ABORT,
+ INSTRUCTION_TYPE_COMMON,
+ INSTRUCTION_TYPE_CONDITIONAL,
+ } type;
+};
+
+CachedInterpreter::CachedInterpreter() : code_buffer(32000)
+{
+}
+
+CachedInterpreter::~CachedInterpreter() = default;
+
void CachedInterpreter::Init()
{
m_code.reserve(CODE_SIZE / sizeof(Instruction));
@@ -33,6 +69,11 @@ void CachedInterpreter::Shutdown()
m_block_cache.Shutdown();
}
+const u8* CachedInterpreter::GetCodePtr() const
+{
+ return reinterpret_cast<const u8*>(m_code.data() + m_code.size());
+}
+
void CachedInterpreter::ExecuteOneBlock()
{
const u8* normal_entry = m_block_cache.Dispatch();
diff --git a/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.h b/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.h
index 4aade83ba2..59576cde96 100644
--- a/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.h
+++ b/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.h
@@ -14,8 +14,9 @@
class CachedInterpreter : public JitBase
{
public:
- CachedInterpreter() : code_buffer(32000) {}
- ~CachedInterpreter() {}
+ CachedInterpreter();
+ ~CachedInterpreter();
+
void Init() override;
void Shutdown() override;
@@ -31,32 +32,9 @@ public:
const char* GetName() override { return "Cached Interpreter"; }
const CommonAsmRoutinesBase* GetAsmRoutines() override { return nullptr; }
private:
- struct Instruction
- {
- typedef void (*CommonCallback)(UGeckoInstruction);
- typedef bool (*ConditionalCallback)(u32 data);
-
- Instruction() : type(INSTRUCTION_ABORT){};
- Instruction(const CommonCallback c, UGeckoInstruction i)
- : common_callback(c), data(i.hex), type(INSTRUCTION_TYPE_COMMON){};
- Instruction(const ConditionalCallback c, u32 d)
- : conditional_callback(c), data(d), type(INSTRUCTION_TYPE_CONDITIONAL){};
-
- union
- {
- const CommonCallback common_callback;
- const ConditionalCallback conditional_callback;
- };
- u32 data;
- enum
- {
- INSTRUCTION_ABORT,
- INSTRUCTION_TYPE_COMMON,
- INSTRUCTION_TYPE_CONDITIONAL,
- } type;
- };
+ struct Instruction;
- const u8* GetCodePtr() { return (u8*)(m_code.data() + m_code.size()); }
+ const u8* GetCodePtr() const;
void ExecuteOneBlock();
BlockCache m_block_cache{*this};