Improve perf of __KernelExecutePendingMipsCalls().
This was using ~3% in many games with fast forward. It was all the RTL type lookup, so avoiding it is an easy win.
This commit is contained in:
parent
f9fc1af5c8
commit
6b7ff47617
2 changed files with 8 additions and 7 deletions
|
@ -2383,7 +2383,7 @@ void __KernelSwitchContext(Thread *target, const char *reason)
|
|||
target->nt.waitType = WAITTYPE_NONE;
|
||||
target->nt.waitID = 0;
|
||||
|
||||
__KernelExecutePendingMipsCalls(true);
|
||||
__KernelExecutePendingMipsCalls(target, true);
|
||||
}
|
||||
|
||||
void __KernelChangeThreadState(Thread *thread, ThreadStatus newStatus) {
|
||||
|
@ -2552,7 +2552,7 @@ void __KernelReturnFromMipsCall()
|
|||
currentCallbackThreadID = 0;
|
||||
|
||||
// yeah! back in the real world, let's keep going. Should we process more callbacks?
|
||||
if (!__KernelExecutePendingMipsCalls(call->reschedAfter))
|
||||
if (!__KernelExecutePendingMipsCalls(cur, call->reschedAfter))
|
||||
{
|
||||
// Sometimes, we want to stay on the thread.
|
||||
int threadReady = cur->nt.status & (THREADSTATUS_READY | THREADSTATUS_RUNNING);
|
||||
|
@ -2563,9 +2563,10 @@ void __KernelReturnFromMipsCall()
|
|||
delete call;
|
||||
}
|
||||
|
||||
bool __KernelExecutePendingMipsCalls(bool reschedAfter)
|
||||
// First arg must be current thread, passed to avoid perf cost of a lookup.
|
||||
bool __KernelExecutePendingMipsCalls(Thread *thread, bool reschedAfter)
|
||||
{
|
||||
Thread *thread = __GetCurrentThread();
|
||||
_dbg_assert_msg_(HLE, thread->GetUID() == __KernelGetCurThread(), "__KernelExecutePendingMipsCalls() should be called only with the current thread.");
|
||||
|
||||
if (thread->pendingMipsCalls.empty()) {
|
||||
// Nothing to do
|
||||
|
@ -2690,7 +2691,7 @@ bool __KernelCheckCallbacks() {
|
|||
// } while (processed && currentThread == __KernelGetCurThread());
|
||||
|
||||
if (processed)
|
||||
return __KernelExecutePendingMipsCalls(true);
|
||||
return __KernelExecutePendingMipsCalls(__GetCurrentThread(), true);
|
||||
return processed;
|
||||
}
|
||||
|
||||
|
@ -2708,7 +2709,7 @@ bool __KernelForceCallbacks()
|
|||
|
||||
bool callbacksProcessed = __KernelCheckThreadCallbacks(curThread, true);
|
||||
if (callbacksProcessed)
|
||||
__KernelExecutePendingMipsCalls(false);
|
||||
__KernelExecutePendingMipsCalls(curThread, false);
|
||||
|
||||
return callbacksProcessed;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue