summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/thread.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2018-07-18 18:10:06 -0400
committerGravatar Lioncash2018-07-18 18:18:27 -0400
commit3a4841e40302d50b21064be7bc248b249ac88467 (patch)
treea63c0f3686216645ffd3fc40f069b68c42f4423f /src/core/hle/kernel/thread.cpp
parentMerge pull request #681 from lioncash/const (diff)
downloadyuzu-3a4841e40302d50b21064be7bc248b249ac88467.tar.gz
yuzu-3a4841e40302d50b21064be7bc248b249ac88467.tar.xz
yuzu-3a4841e40302d50b21064be7bc248b249ac88467.zip
core: Don't construct instance of Core::System, just to access its live instance
This would result in a lot of allocations and related object construction, just to toss it all away immediately after the call. These are definitely not intentional, and it was intended that all of these should have been accessing the static function GetInstance() through the name itself, not constructed instances.
Diffstat (limited to 'src/core/hle/kernel/thread.cpp')
-rw-r--r--src/core/hle/kernel/thread.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 9a9746585..0b3c66428 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -165,7 +165,7 @@ void Thread::CancelWakeupTimer() {
165static boost::optional<s32> GetNextProcessorId(u64 mask) { 165static boost::optional<s32> GetNextProcessorId(u64 mask) {
166 for (s32 index = 0; index < Core::NUM_CPU_CORES; ++index) { 166 for (s32 index = 0; index < Core::NUM_CPU_CORES; ++index) {
167 if (mask & (1ULL << index)) { 167 if (mask & (1ULL << index)) {
168 if (!Core::System().GetInstance().Scheduler(index)->GetCurrentThread()) { 168 if (!Core::System::GetInstance().Scheduler(index)->GetCurrentThread()) {
169 // Core is enabled and not running any threads, use this one 169 // Core is enabled and not running any threads, use this one
170 return index; 170 return index;
171 } 171 }
@@ -215,14 +215,14 @@ void Thread::ResumeFromWait() {
215 new_processor_id = processor_id; 215 new_processor_id = processor_id;
216 } 216 }
217 if (ideal_core != -1 && 217 if (ideal_core != -1 &&
218 Core::System().GetInstance().Scheduler(ideal_core)->GetCurrentThread() == nullptr) { 218 Core::System::GetInstance().Scheduler(ideal_core)->GetCurrentThread() == nullptr) {
219 new_processor_id = ideal_core; 219 new_processor_id = ideal_core;
220 } 220 }
221 221
222 ASSERT(*new_processor_id < 4); 222 ASSERT(*new_processor_id < 4);
223 223
224 // Add thread to new core's scheduler 224 // Add thread to new core's scheduler
225 auto& next_scheduler = Core::System().GetInstance().Scheduler(*new_processor_id); 225 auto& next_scheduler = Core::System::GetInstance().Scheduler(*new_processor_id);
226 226
227 if (*new_processor_id != processor_id) { 227 if (*new_processor_id != processor_id) {
228 // Remove thread from previous core's scheduler 228 // Remove thread from previous core's scheduler
@@ -325,7 +325,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
325 thread->name = std::move(name); 325 thread->name = std::move(name);
326 thread->callback_handle = wakeup_callback_handle_table.Create(thread).Unwrap(); 326 thread->callback_handle = wakeup_callback_handle_table.Create(thread).Unwrap();
327 thread->owner_process = owner_process; 327 thread->owner_process = owner_process;
328 thread->scheduler = Core::System().GetInstance().Scheduler(processor_id); 328 thread->scheduler = Core::System::GetInstance().Scheduler(processor_id);
329 thread->scheduler->AddThread(thread, priority); 329 thread->scheduler->AddThread(thread, priority);
330 330
331 // Find the next available TLS index, and mark it as used 331 // Find the next available TLS index, and mark it as used
@@ -481,14 +481,14 @@ void Thread::ChangeCore(u32 core, u64 mask) {
481 new_processor_id = processor_id; 481 new_processor_id = processor_id;
482 } 482 }
483 if (ideal_core != -1 && 483 if (ideal_core != -1 &&
484 Core::System().GetInstance().Scheduler(ideal_core)->GetCurrentThread() == nullptr) { 484 Core::System::GetInstance().Scheduler(ideal_core)->GetCurrentThread() == nullptr) {
485 new_processor_id = ideal_core; 485 new_processor_id = ideal_core;
486 } 486 }
487 487
488 ASSERT(*new_processor_id < 4); 488 ASSERT(*new_processor_id < 4);
489 489
490 // Add thread to new core's scheduler 490 // Add thread to new core's scheduler
491 auto& next_scheduler = Core::System().GetInstance().Scheduler(*new_processor_id); 491 auto& next_scheduler = Core::System::GetInstance().Scheduler(*new_processor_id);
492 492
493 if (*new_processor_id != processor_id) { 493 if (*new_processor_id != processor_id) {
494 // Remove thread from previous core's scheduler 494 // Remove thread from previous core's scheduler