mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-08-01 10:39:53 -06:00
Refactor the JIT to be object-oriented (#1879)
* Move TinyVector to a new file - So it's less sensitive to #include ordering * Forgot to include assert.h * Refactor ARMJIT_Memory into an object * Oops, forgot a declaration * Refactor ARMJIT to be contained in an object * Remove an unused function declaration * Add a missing #include * Remove a now-unused global * Use ARMJIT_Memory's own memory access functions * Fix some omissions in the ARM JIT * Move libandroid to be a member of ARMJIT_Memory instead of a global * Default-initialize most fields in ARMJIT_Compiler.h * Define NOOP_IF_NO_JIT * Finish refactoring the JIT to be object-oriented
This commit is contained in:

committed by
GitHub

parent
f2d7a29015
commit
544fefa27f
@ -21,7 +21,6 @@
|
||||
|
||||
#include "../dolphin/x64Emitter.h"
|
||||
|
||||
#include "../ARMJIT.h"
|
||||
#include "../ARMJIT_Internal.h"
|
||||
#include "../ARMJIT_RegisterCache.h"
|
||||
|
||||
@ -31,9 +30,11 @@
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
class ARMJIT_Memory;
|
||||
|
||||
namespace ARMJIT
|
||||
{
|
||||
|
||||
class ARMJIT;
|
||||
const Gen::X64Reg RCPU = Gen::RBP;
|
||||
const Gen::X64Reg RCPSR = Gen::R15;
|
||||
|
||||
@ -79,7 +80,11 @@ struct Op2
|
||||
class Compiler : public Gen::XEmitter
|
||||
{
|
||||
public:
|
||||
Compiler();
|
||||
#ifdef JIT_ENABLED
|
||||
explicit Compiler(ARMJIT& jit);
|
||||
#else
|
||||
explicit Compiler(ARMJIT& jit) : XEmitter(), JIT(jit) {}
|
||||
#endif
|
||||
|
||||
void Reset();
|
||||
|
||||
@ -238,42 +243,43 @@ public:
|
||||
void CreateMethod(const char* namefmt, void* start, ...);
|
||||
#endif
|
||||
|
||||
u8* FarCode;
|
||||
u8* NearCode;
|
||||
u32 FarSize;
|
||||
u32 NearSize;
|
||||
ARMJIT& JIT;
|
||||
u8* FarCode {};
|
||||
u8* NearCode {};
|
||||
u32 FarSize {};
|
||||
u32 NearSize {};
|
||||
|
||||
u8* NearStart;
|
||||
u8* FarStart;
|
||||
u8* NearStart {};
|
||||
u8* FarStart {};
|
||||
|
||||
void* PatchedStoreFuncs[2][2][3][16];
|
||||
void* PatchedLoadFuncs[2][2][3][2][16];
|
||||
void* PatchedStoreFuncs[2][2][3][16] {};
|
||||
void* PatchedLoadFuncs[2][2][3][2][16] {};
|
||||
|
||||
std::unordered_map<u8*, LoadStorePatch> LoadStorePatches;
|
||||
std::unordered_map<u8*, LoadStorePatch> LoadStorePatches {};
|
||||
|
||||
u8* ResetStart;
|
||||
u32 CodeMemSize;
|
||||
u8* ResetStart {};
|
||||
u32 CodeMemSize {};
|
||||
|
||||
bool Exit;
|
||||
bool IrregularCycles;
|
||||
bool Exit {};
|
||||
bool IrregularCycles {};
|
||||
|
||||
void* ReadBanked;
|
||||
void* WriteBanked;
|
||||
void* ReadBanked {};
|
||||
void* WriteBanked {};
|
||||
|
||||
bool CPSRDirty = false;
|
||||
|
||||
FetchedInstr CurInstr;
|
||||
FetchedInstr CurInstr {};
|
||||
|
||||
RegisterCache<Compiler, Gen::X64Reg> RegCache;
|
||||
RegisterCache<Compiler, Gen::X64Reg> RegCache {};
|
||||
|
||||
bool Thumb;
|
||||
u32 Num;
|
||||
u32 R15;
|
||||
u32 CodeRegion;
|
||||
bool Thumb {};
|
||||
u32 Num {};
|
||||
u32 R15 {};
|
||||
u32 CodeRegion {};
|
||||
|
||||
u32 ConstantCycles;
|
||||
u32 ConstantCycles {};
|
||||
|
||||
ARM* CurCPU;
|
||||
ARM* CurCPU {};
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user