mirror of
https://github.com/dolphin-emu/dolphin
synced 2025-10-06 00:13:03 +02:00
Merge pull request #13951 from TellowKrinkle/InterpreterOpt
Cached Interpreter: Speculative devirtualization
This commit is contained in:
@@ -66,10 +66,25 @@ void CachedInterpreter::ExecuteOneBlock()
|
|||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
const auto callback = *reinterpret_cast<const AnyCallback*>(normal_entry);
|
const auto callback = *reinterpret_cast<const AnyCallback*>(normal_entry);
|
||||||
if (const auto distance = callback(ppc_state, normal_entry + sizeof(callback)))
|
const u8* payload = normal_entry + sizeof(callback);
|
||||||
normal_entry += distance;
|
// 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
|
else
|
||||||
break;
|
{
|
||||||
|
if (const auto distance = callback(ppc_state, payload))
|
||||||
|
normal_entry += distance;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user