From 10e716c62369a444d590229f716b57d04968b883 Mon Sep 17 00:00:00 2001 From: degasus Date: Fri, 13 May 2016 23:28:35 +0200 Subject: [PATCH] JitCommon: Pass jit block instead of host pointer on linking. So the JIT may do more fancy stuff. --- Source/Core/Core/PowerPC/CachedInterpreter.cpp | 2 +- Source/Core/Core/PowerPC/CachedInterpreter.h | 2 +- Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.cpp | 3 ++- Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.h | 2 +- Source/Core/Core/PowerPC/JitCommon/JitCache.cpp | 5 +++-- Source/Core/Core/PowerPC/JitCommon/JitCache.h | 4 ++-- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Source/Core/Core/PowerPC/CachedInterpreter.cpp b/Source/Core/Core/PowerPC/CachedInterpreter.cpp index 3b52caaa62..7831239d4e 100644 --- a/Source/Core/Core/PowerPC/CachedInterpreter.cpp +++ b/Source/Core/Core/PowerPC/CachedInterpreter.cpp @@ -198,6 +198,6 @@ void CachedInterpreter::WriteDestroyBlock(const u8* location, u32 address) { } -void CachedInterpreter::WriteLinkBlock(u8* location, const u8* address) +void CachedInterpreter::WriteLinkBlock(u8* location, const JitBlock& block) { } diff --git a/Source/Core/Core/PowerPC/CachedInterpreter.h b/Source/Core/Core/PowerPC/CachedInterpreter.h index 4a6b76b4ed..cf7aa90615 100644 --- a/Source/Core/Core/PowerPC/CachedInterpreter.h +++ b/Source/Core/Core/PowerPC/CachedInterpreter.h @@ -35,7 +35,7 @@ public: return "Cached Interpreter"; } - void WriteLinkBlock(u8* location, const u8* address) override; + void WriteLinkBlock(u8* location, const JitBlock& block) override; void WriteDestroyBlock(const u8* location, u32 address) override; diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.cpp b/Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.cpp index ef9c6bcf46..fe9280bf58 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.cpp @@ -7,8 +7,9 @@ #include "Core/PowerPC/JitArm64/Jit.h" #include "Core/PowerPC/JitArm64/JitArm64Cache.h" -void JitArm64BlockCache::WriteLinkBlock(u8* location, const u8* address) +void JitArm64BlockCache::WriteLinkBlock(u8* location, const JitBlock& block) { + const u8* address = block.checkedEntry; ARM64XEmitter emit(location); s64 offset = address - location; diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.h b/Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.h index 7b7b2c755b..d9029822df 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.h +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.h @@ -12,6 +12,6 @@ typedef void (*CompiledCode)(); class JitArm64BlockCache : public JitBaseBlockCache { private: - void WriteLinkBlock(u8* location, const u8* address); + void WriteLinkBlock(u8* location, const JitBlock& block); void WriteDestroyBlock(const u8* location, u32 address); }; diff --git a/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp b/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp index 61034fbf82..91c2d1a1ac 100644 --- a/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp +++ b/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp @@ -198,7 +198,7 @@ using namespace Gen; int destinationBlock = GetBlockNumberFromStartAddress(e.exitAddress); if (destinationBlock != -1) { - WriteLinkBlock(e.exitPtrs, blocks[destinationBlock].checkedEntry); + WriteLinkBlock(e.exitPtrs, blocks[destinationBlock]); e.linkStatus = true; } } @@ -316,8 +316,9 @@ using namespace Gen; } } - void JitBlockCache::WriteLinkBlock(u8* location, const u8* address) + void JitBlockCache::WriteLinkBlock(u8* location, const JitBlock& block) { + const u8* address = block.checkedEntry; XEmitter emit(location); if (*location == 0xE8) { diff --git a/Source/Core/Core/PowerPC/JitCommon/JitCache.h b/Source/Core/Core/PowerPC/JitCommon/JitCache.h index 5c716f5800..1216a8753a 100644 --- a/Source/Core/Core/PowerPC/JitCommon/JitCache.h +++ b/Source/Core/Core/PowerPC/JitCommon/JitCache.h @@ -116,7 +116,7 @@ class JitBaseBlockCache void DestroyBlock(int block_num, bool invalidate); // Virtual for overloaded - virtual void WriteLinkBlock(u8* location, const u8* address) = 0; + virtual void WriteLinkBlock(u8* location, const JitBlock& block) = 0; virtual void WriteDestroyBlock(const u8* location, u32 address) = 0; public: @@ -164,6 +164,6 @@ public: class JitBlockCache : public JitBaseBlockCache { private: - void WriteLinkBlock(u8* location, const u8* address) override; + void WriteLinkBlock(u8* location, const JitBlock& block) override; void WriteDestroyBlock(const u8* location, u32 address) override; };