mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Merge pull request #4953 from lioncash/fwd
CachedInterpreter: Forward declare instruction struct
This commit is contained in:
commit
51136681df
@ -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();
|
||||
|
@ -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);
|
||||
struct Instruction;
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
const u8* GetCodePtr() { return (u8*)(m_code.data() + m_code.size()); }
|
||||
const u8* GetCodePtr() const;
|
||||
void ExecuteOneBlock();
|
||||
|
||||
BlockCache m_block_cache{*this};
|
||||
|
Loading…
Reference in New Issue
Block a user