mipsjit: Fix basic compilation.

This commit is contained in:
Unknown W. Brackets 2021-02-08 23:30:14 -08:00
parent c7635a5d2f
commit 4e24b27053
3 changed files with 33 additions and 3 deletions

View file

@ -47,7 +47,11 @@ namespace MIPSComp {
// We can get block linking to work with W^X by doing even more unprotect/re-protect, but let's try without first.
// enableBlocklink = !PlatformIsWXExclusive(); // Revert to this line if block linking is slow in W^X mode
#if PPSSPP_ARCH(MIPS)
enableBlocklink = false;
#else
enableBlocklink = !Disabled(JitDisable::BLOCKLINK);
#endif
immBranches = false;
continueBranches = false;
continueJumps = false;

View file

@ -79,6 +79,16 @@ void MipsJit::FlushPrefixV()
{
}
MIPSOpcode MipsJit::GetOriginalOp(MIPSOpcode op) {
JitBlockCache *bc = GetBlockCache();
int block_num = bc->GetBlockNumberFromEmuHackOp(op, true);
if (block_num >= 0) {
return bc->GetOriginalFirstOp(block_num);
} else {
return op;
}
}
void MipsJit::ClearCache()
{
blocks.Clear();
@ -226,6 +236,14 @@ void MipsJit::Comp_RunBlock(MIPSOpcode op)
ERROR_LOG(JIT, "Comp_RunBlock should never be reached!");
}
void MipsJit::LinkBlock(u8 *exitPoint, const u8 *checkedEntry) {
// TODO
}
void MipsJit::UnlinkBlock(u8 *checkedEntry, u32 originalAddress) {
// TODO
}
bool MipsJit::ReplaceJalTo(u32 dest) {
const ReplacementTableEntry *entry = nullptr;
u32 funcSize = 0;

View file

@ -49,6 +49,8 @@ public:
void Compile(u32 em_address) override; // Compiles a block at current MIPS PC
const u8 *DoJit(u32 em_address, JitBlock *b);
const u8 *GetCrashHandler() const override { return nullptr; }
bool CodeInRange(const u8 *ptr) const override { return IsInSpace(ptr); }
bool DescribeCodePtr(const u8 *ptr, std::string &name);
void CompileDelaySlot(int flags);
@ -131,6 +133,8 @@ public:
JitBlockCache *GetBlockCache() override { return &blocks; }
JitBlockCacheDebugInterface *GetBlockCacheDebugInterface() override { return &blocks; }
MIPSOpcode GetOriginalOp(MIPSOpcode op) override;
std::vector<u32> SaveAndClearEmuHackOps() override { return blocks.SaveAndClearEmuHackOps(); }
void RestoreSavedEmuHackOps(std::vector<u32> saved) override { blocks.RestoreSavedEmuHackOps(saved); }
@ -138,6 +142,13 @@ public:
void InvalidateCacheAt(u32 em_address, int length = 4) override;
void UpdateFCR31() override;
const u8 *GetDispatcher() const override {
return dispatcher;
}
void LinkBlock(u8 *exitPoint, const u8 *checkedEntry) override;
void UnlinkBlock(u8 *checkedEntry, u32 originalAddress) override;
void EatPrefix() override { js.EatPrefix(); }
private:
@ -183,8 +194,5 @@ public:
const u8 *dispatcherNoCheck;
};
typedef void (MipsJit::*MIPSCompileFunc)(MIPSOpcode opcode);
typedef int (MipsJit::*MIPSReplaceFunc)();
} // namespace MIPSComp