summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorTellowKrinkle <tellowkrinkle@gmail.com>2025-09-06 03:31:47 -0500
committerTellowKrinkle <tellowkrinkle@gmail.com>2025-09-18 21:07:09 -0500
commit0cde7ae79b4358fadfdf4664ef2ab2d1ab46ab0d (patch)
tree538ae536b4c1e16d79651a24be58be9cf5426155 /Source/Core
parentfce5f7c74ed069459b3c298b6e2459dd76f987d7 (diff)
Cached Interpreter: Speculative devirtualization
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp b/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp
index b281ac0300..a8733b91b6 100644
--- a/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp
+++ b/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp
@@ -66,10 +66,25 @@ void CachedInterpreter::ExecuteOneBlock()
while (true)
{
const auto callback = *reinterpret_cast<const AnyCallback*>(normal_entry);
- if (const auto distance = callback(ppc_state, normal_entry + sizeof(callback)))
- normal_entry += distance;
+ const u8* payload = normal_entry + sizeof(callback);
+ // Direct dispatch to the most commonly used callbacks for better performance
+ if (callback == reinterpret_cast<AnyCallback>(CallbackCast(Interpret<false>))) [[likely]]
+ {
+ Interpret<false>(ppc_state, *reinterpret_cast<const InterpretOperands*>(payload));
+ normal_entry = payload + sizeof(InterpretOperands);
+ }
+ else if (callback == reinterpret_cast<AnyCallback>(CallbackCast(Interpret<true>)))
+ {
+ Interpret<true>(ppc_state, *reinterpret_cast<const InterpretOperands*>(payload));
+ normal_entry = payload + sizeof(InterpretOperands);
+ }
else
- break;
+ {
+ if (const auto distance = callback(ppc_state, payload))
+ normal_entry += distance;
+ else
+ break;
+ }
}
}