mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-16 07:50:28 +02:00
Avoid dynamic_cast() for threads where possible.
It's reasonable to trust currentThread and threadReadyQueue, and these eat a few percentage points of time.
This commit is contained in:
1 parent
d8c0a9410c
commit
14e065cbb2
2 files changed
+18
-9
No files matched your search
@@ -595,12 +595,9 @@ void MipsCall::setReturnValue(u64 value)
|
||||
savedV1 = (value >> 32) & 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
// TODO: Should move to this wrapper so we can keep the current thread as a SceUID instead
|
||||
// of a dangerous raw pointer.
|
||||
Thread *__GetCurrentThread() {
|
||||
u32 error;
|
||||
if (currentThread != 0)
|
||||
return kernelObjects.Get<Thread>(currentThread, error);
|
||||
return kernelObjects.GetFast<Thread>(currentThread);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
@@ -784,9 +781,8 @@ bool __KernelSwitchOffThread(const char *reason)
|
||||
if (current && current->isRunning())
|
||||
__KernelChangeReadyState(current, threadID, true);
|
||||
|
||||
u32 error;
|
||||
// Idle 0 chosen entirely arbitrarily.
|
||||
Thread *t = kernelObjects.Get<Thread>(threadIdleID[0], error);
|
||||
Thread *t = kernelObjects.GetFast<Thread>(threadIdleID[0]);
|
||||
if (t)
|
||||
{
|
||||
__KernelSwitchContext(t, reason);
|
||||
@@ -1275,9 +1271,9 @@ Thread *__KernelNextThread() {
|
||||
}
|
||||
}
|
||||
|
||||
u32 error;
|
||||
// Assume threadReadyQueue has not become corrupt.
|
||||
if (bestThread != -1)
|
||||
return kernelObjects.Get<Thread>(bestThread, error);
|
||||
return kernelObjects.GetFast<Thread>(bestThread);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user