summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Lioncash2020-01-30 18:38:28 -0500
committerGravatar Lioncash2020-01-30 18:42:40 -0500
commit2de2bb980e8b032aeb6413adaaed6701e76e73f7 (patch)
tree8156623d13b7708b2808ea69d6f80a835136797b
parentcore/cpu_manager: Remove unused includes (diff)
downloadyuzu-2de2bb980e8b032aeb6413adaaed6701e76e73f7.tar.gz
yuzu-2de2bb980e8b032aeb6413adaaed6701e76e73f7.tar.xz
yuzu-2de2bb980e8b032aeb6413adaaed6701e76e73f7.zip
kernel/physical_core: Make use of std::unique_ptr
shared_ptr was used in 2d1984c20c75e03ec79eeb3806b12efa1679b977 due to a misunderstanding of how the language generates move constructors and move assignment operators. If a destructor is user-provided, then the compiler won't generate the move constructor and move assignment operators by default--they must be explicitly opted into. The reason for the compilation errors is due to the fact that the language will fall back to attempting to use the copy constructor/copy assignment operators if the respective move constructor or move assignment operator is unavailable. Given that we explicitly opt into them now, the the move constructor and move assignment operators will be generated as expected.
-rw-r--r--src/core/hle/kernel/physical_core.cpp4
-rw-r--r--src/core/hle/kernel/physical_core.h10
2 files changed, 10 insertions, 4 deletions
diff --git a/src/core/hle/kernel/physical_core.cpp b/src/core/hle/kernel/physical_core.cpp
index e96d063fd..9303dd273 100644
--- a/src/core/hle/kernel/physical_core.cpp
+++ b/src/core/hle/kernel/physical_core.cpp
@@ -20,13 +20,13 @@ PhysicalCore::PhysicalCore(Core::System& system, std::size_t id,
20 Core::ExclusiveMonitor& exclusive_monitor) 20 Core::ExclusiveMonitor& exclusive_monitor)
21 : core_index{id} { 21 : core_index{id} {
22#ifdef ARCHITECTURE_x86_64 22#ifdef ARCHITECTURE_x86_64
23 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);
24#else 24#else
25 arm_interface = std::make_shared<Core::ARM_Unicorn>(system); 25 arm_interface = std::make_shared<Core::ARM_Unicorn>(system);
26 LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available"); 26 LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available");
27#endif 27#endif
28 28
29 scheduler = std::make_shared<Kernel::Scheduler>(system, *arm_interface, core_index); 29 scheduler = std::make_unique<Kernel::Scheduler>(system, *arm_interface, core_index);
30} 30}
31 31
32PhysicalCore::~PhysicalCore() = default; 32PhysicalCore::~PhysicalCore() = default;
diff --git a/src/core/hle/kernel/physical_core.h b/src/core/hle/kernel/physical_core.h
index 7dca97d1b..4c32c0f1b 100644
--- a/src/core/hle/kernel/physical_core.h
+++ b/src/core/hle/kernel/physical_core.h
@@ -24,6 +24,12 @@ public:
24 PhysicalCore(Core::System& system, std::size_t id, Core::ExclusiveMonitor& exclusive_monitor); 24 PhysicalCore(Core::System& system, std::size_t id, Core::ExclusiveMonitor& exclusive_monitor);
25 ~PhysicalCore(); 25 ~PhysicalCore();
26 26
27 PhysicalCore(const PhysicalCore&) = delete;
28 PhysicalCore& operator=(const PhysicalCore&) = delete;
29
30 PhysicalCore(PhysicalCore&&) = default;
31 PhysicalCore& operator=(PhysicalCore&&) = default;
32
27 /// Execute current jit state 33 /// Execute current jit state
28 void Run(); 34 void Run();
29 /// Execute a single instruction in current jit. 35 /// Execute a single instruction in current jit.
@@ -64,8 +70,8 @@ public:
64 70
65private: 71private:
66 std::size_t core_index; 72 std::size_t core_index;
67 std::shared_ptr<Core::ARM_Interface> arm_interface; 73 std::unique_ptr<Core::ARM_Interface> arm_interface;
68 std::shared_ptr<Kernel::Scheduler> scheduler; 74 std::unique_ptr<Kernel::Scheduler> scheduler;
69}; 75};
70 76
71} // namespace Kernel 77} // namespace Kernel