mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-25 17:19:42 +00:00
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
@ -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;
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ bool __KernelCheckCallbacks();
|
||||
bool __KernelForceCallbacks();
|
||||
class Thread;
|
||||
void __KernelSwitchContext(Thread *target, const char *reason);
|
||||
bool __KernelExecutePendingMipsCalls(bool reschedAfter);
|
||||
bool __KernelExecutePendingMipsCalls(Thread *currentThread, bool reschedAfter);
|
||||
void __KernelNotifyCallback(RegisteredCallbackType type, SceUID cbId, int notifyArg);
|
||||
|
||||
// Switch to an idle / non-user thread, if not already on one.
|
||||
|
Loading…
Reference in New Issue
Block a user