diff options
| author | 2020-01-30 23:33:02 -0500 | |
|---|---|---|
| committer | 2020-01-30 23:33:02 -0500 | |
| commit | 6b5b01b29f51cf74c0735867f800afb9672729d9 (patch) | |
| tree | 21f251c154835bc82f24a9b82a048f45e0495a7b | |
| parent | Merge pull request #3365 from yuzu-emu/revert-3151-fix-korean (diff) | |
| parent | kernel/physical_core: Make use of std::unique_ptr (diff) | |
| download | yuzu-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.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/kernel.cpp | 8 | ||||
| -rw-r--r-- | src/core/hle/kernel/physical_core.cpp | 9 | ||||
| -rw-r--r-- | src/core/hle/kernel/physical_core.h | 15 |
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 | ||
| 14 | namespace Core { | 12 | namespace 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 | ||
| 18 | namespace Kernel { | 17 | namespace Kernel { |
| 19 | 18 | ||
| 20 | PhysicalCore::PhysicalCore(Core::System& system, KernelCore& kernel, std::size_t id, | 19 | PhysicalCore::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 | ||
| 33 | PhysicalCore::~PhysicalCore() = default; | 32 | PhysicalCore::~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 | ||
| 22 | class PhysicalCore { | 22 | class PhysicalCore { |
| 23 | public: | 23 | public: |
| 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 | ||
| 67 | private: | 71 | private: |
| 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 |