aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRSDuck <RSDuck@users.noreply.github.com>2020-05-09 14:36:18 +0200
committerRSDuck <rsduck@users.noreply.github.com>2020-06-16 12:01:10 +0200
commitefb796640b6b4c140dd8e2924e740702d66e7823 (patch)
treec2ba5c53fc3cc171e8df7f29cfd19f850a65608e
parent80b88dbd05a66ad50108778d5f36e17f5b1cd661 (diff)
use instr hash as key for restore candidates
makes Golden Sun burn a little slower through the JIT memory
-rw-r--r--src/ARMJIT.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ARMJIT.cpp b/src/ARMJIT.cpp
index 9602aed..8d87c76 100644
--- a/src/ARMJIT.cpp
+++ b/src/ARMJIT.cpp
@@ -1042,13 +1042,13 @@ void CompileBlock(ARM* cpu)
u32 literalHash = (u32)XXH3_64bits(literalValues, numLiterals * 4);
u32 instrHash = (u32)XXH3_64bits(instrValues, i * 4);
- JitBlock* prevBlock = RestoreCandidates.LookUp(pseudoPhysicalAddr);
+ JitBlock* prevBlock = RestoreCandidates.LookUp(instrHash);
bool mayRestore = true;
if (prevBlock)
{
- RestoreCandidates.Remove(pseudoPhysicalAddr);
+ RestoreCandidates.Remove(instrHash);
- mayRestore = prevBlock->LiteralHash == literalHash && prevBlock->InstrHash == instrHash;
+ mayRestore = prevBlock->PseudoPhysicalAddr == pseudoPhysicalAddr && prevBlock->LiteralHash == literalHash;
if (mayRestore && prevBlock->NumAddresses == numAddressRanges)
{
@@ -1125,6 +1125,7 @@ void CompileBlock(ARM* cpu)
void InvalidateByAddr(u32 pseudoPhysical)
{
JIT_DEBUGPRINT("invalidating by addr %x\n", pseudoPhysical);
+
AddressRange* range = &CodeRanges[pseudoPhysical / 512];
u32 mask = 1 << ((pseudoPhysical & 0x1FF) / 16);
@@ -1203,7 +1204,7 @@ void InvalidateByAddr(u32 pseudoPhysical)
if (!literalInvalidation)
{
- JitBlock* prevBlock = RestoreCandidates.Insert(block->PseudoPhysicalAddr, block);
+ JitBlock* prevBlock = RestoreCandidates.Insert(block->InstrHash, block);
if (prevBlock)
delete prevBlock;
}