summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2020-01-30 23:33:02 -0500
committerGravatar GitHub2020-01-30 23:33:02 -0500
commit6b5b01b29f51cf74c0735867f800afb9672729d9 (patch)
tree21f251c154835bc82f24a9b82a048f45e0495a7b
parentMerge pull request #3365 from yuzu-emu/revert-3151-fix-korean (diff)
parentkernel/physical_core: Make use of std::unique_ptr (diff)
downloadyuzu-6b5b01b29f51cf74c0735867f800afb9672729d9.tar.gz
yuzu-6b5b01b29f51cf74c0735867f800afb9672729d9.tar.xz
yuzu-6b5b01b29f51cf74c0735867f800afb9672729d9.zip
Merge pull request #3363 from lioncash/unique_ptr
kernel/physical_core: Make use of std::unique_ptr instead of std::shared_ptr
-rw-r--r--src/core/cpu_manager.cpp2
-rw-r--r--src/core/hle/kernel/kernel.cpp8
-rw-r--r--src/core/hle/kernel/physical_core.cpp9
-rw-r--r--src/core/hle/kernel/physical_core.h15
4 files changed, 17 insertions, 17 deletions
diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp
index 752534868..70ddbdcca 100644
--- a/src/core/cpu_manager.cpp
+++ b/src/core/cpu_manager.cpp
@@ -2,14 +2,12 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include "common/assert.h"
6#include "core/arm/exclusive_monitor.h" 5#include "core/arm/exclusive_monitor.h"
7#include "core/core.h" 6#include "core/core.h"
8#include "core/core_manager.h" 7#include "core/core_manager.h"
9#include "core/core_timing.h" 8#include "core/core_timing.h"
10#include "core/cpu_manager.h" 9#include "core/cpu_manager.h"
11#include "core/gdbstub/gdbstub.h" 10#include "core/gdbstub/gdbstub.h"
12#include "core/settings.h"
13 11
14namespace Core { 12namespace Core {
15 13
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 0cf3c8f70..edd4c4259 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -101,7 +101,7 @@ struct KernelCore::Impl {
101 void Initialize(KernelCore& kernel) { 101 void Initialize(KernelCore& kernel) {
102 Shutdown(); 102 Shutdown();
103 103
104 InitializePhysicalCores(kernel); 104 InitializePhysicalCores();
105 InitializeSystemResourceLimit(kernel); 105 InitializeSystemResourceLimit(kernel);
106 InitializeThreads(); 106 InitializeThreads();
107 InitializePreemption(); 107 InitializePreemption();
@@ -131,14 +131,14 @@ struct KernelCore::Impl {
131 } 131 }
132 cores.clear(); 132 cores.clear();
133 133
134 exclusive_monitor.reset(nullptr); 134 exclusive_monitor.reset();
135 } 135 }
136 136
137 void InitializePhysicalCores(KernelCore& kernel) { 137 void InitializePhysicalCores() {
138 exclusive_monitor = 138 exclusive_monitor =
139 Core::MakeExclusiveMonitor(system.Memory(), global_scheduler.CpuCoresCount()); 139 Core::MakeExclusiveMonitor(system.Memory(), global_scheduler.CpuCoresCount());
140 for (std::size_t i = 0; i < global_scheduler.CpuCoresCount(); i++) { 140 for (std::size_t i = 0; i < global_scheduler.CpuCoresCount(); i++) {
141 cores.emplace_back(system, kernel, i, *exclusive_monitor); 141 cores.emplace_back(system, i, *exclusive_monitor);
142 } 142 }
143 } 143 }
144 144
diff --git a/src/core/hle/kernel/physical_core.cpp b/src/core/hle/kernel/physical_core.cpp
index 896a1a87a..9303dd273 100644
--- a/src/core/hle/kernel/physical_core.cpp
+++ b/src/core/hle/kernel/physical_core.cpp
@@ -10,24 +10,23 @@
10#include "core/arm/exclusive_monitor.h" 10#include "core/arm/exclusive_monitor.h"
11#include "core/arm/unicorn/arm_unicorn.h" 11#include "core/arm/unicorn/arm_unicorn.h"
12#include "core/core.h" 12#include "core/core.h"
13#include "core/hle/kernel/kernel.h"
14#include "core/hle/kernel/physical_core.h" 13#include "core/hle/kernel/physical_core.h"
15#include "core/hle/kernel/scheduler.h" 14#include "core/hle/kernel/scheduler.h"
16#include "core/hle/kernel/thread.h" 15#include "core/hle/kernel/thread.h"
17 16
18namespace Kernel { 17namespace Kernel {
19 18
20PhysicalCore::PhysicalCore(Core::System& system, KernelCore& kernel, std::size_t id, 19PhysicalCore::PhysicalCore(Core::System& system, std::size_t id,
21 Core::ExclusiveMonitor& exclusive_monitor) 20 Core::ExclusiveMonitor& exclusive_monitor)
22 : core_index{id}, kernel{kernel} { 21 : core_index{id} {
23#ifdef ARCHITECTURE_x86_64 22#ifdef ARCHITECTURE_x86_64
24 arm_interface = std::make_shared<Core::ARM_Dynarmic>(system, exclusive_monitor, core_index); 23 arm_interface = std::make_unique<Core::ARM_Dynarmic>(system, exclusive_monitor, core_index);
25#else 24#else
26 arm_interface = std::make_shared<Core::ARM_Unicorn>(system); 25 arm_interface = std::make_shared<Core::ARM_Unicorn>(system);
27 LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available"); 26 LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available");
28#endif 27#endif
29 28
30 scheduler = std::make_shared<Kernel::Scheduler>(system, *arm_interface, core_index); 29 scheduler = std::make_unique<Kernel::Scheduler>(system, *arm_interface, core_index);
31} 30}
32 31
33PhysicalCore::~PhysicalCore() = default; 32PhysicalCore::~PhysicalCore() = default;
diff --git a/src/core/hle/kernel/physical_core.h b/src/core/hle/kernel/physical_core.h
index fbef0801f..4c32c0f1b 100644
--- a/src/core/hle/kernel/physical_core.h
+++ b/src/core/hle/kernel/physical_core.h
@@ -21,11 +21,15 @@ namespace Kernel {
21 21
22class PhysicalCore { 22class PhysicalCore {
23public: 23public:
24 PhysicalCore(Core::System& system, KernelCore& kernel, std::size_t id, 24 PhysicalCore(Core::System& system, std::size_t id, Core::ExclusiveMonitor& exclusive_monitor);
25 Core::ExclusiveMonitor& exclusive_monitor);
26
27 ~PhysicalCore(); 25 ~PhysicalCore();
28 26
27 PhysicalCore(const PhysicalCore&) = delete;
28 PhysicalCore& operator=(const PhysicalCore&) = delete;
29
30 PhysicalCore(PhysicalCore&&) = default;
31 PhysicalCore& operator=(PhysicalCore&&) = default;
32
29 /// Execute current jit state 33 /// Execute current jit state
30 void Run(); 34 void Run();
31 /// Execute a single instruction in current jit. 35 /// Execute a single instruction in current jit.
@@ -66,9 +70,8 @@ public:
66 70
67private: 71private:
68 std::size_t core_index; 72 std::size_t core_index;
69 KernelCore& kernel; 73 std::unique_ptr<Core::ARM_Interface> arm_interface;
70 std::shared_ptr<Core::ARM_Interface> arm_interface; 74 std::unique_ptr<Kernel::Scheduler> scheduler;
71 std::shared_ptr<Kernel::Scheduler> scheduler;
72}; 75};
73 76
74} // namespace Kernel 77} // namespace Kernel