diff options
| author | bunnei <bunneidev@gmail.com> | 2018-10-16 11:21:42 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-10-16 11:21:42 -0400 |
| commit | 10792dbff6f5567edbb5ca4664728007efba94a7 (patch) | |
| tree | f9224c0af9d0ddcc1e2496b638a6108077fcd198 /src/core/core_cpu.cpp | |
| parent | 81bd8ee328f9a5cb24555b93f3df5e78cd885661 (diff) | |
| parent | f94bf1a29f572e138fcaaa637233ce3c8ccbf099 (diff) | |
Merge pull request #1502 from lioncash/unique
core: Convert shared_ptr instances into unique_ptr instances where applicable for System and Cpu
Diffstat (limited to 'src/core/core_cpu.cpp')
| -rw-r--r-- | src/core/core_cpu.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/core/core_cpu.cpp b/src/core/core_cpu.cpp index 265f8ed9cc..fffda8a996 100644 --- a/src/core/core_cpu.cpp +++ b/src/core/core_cpu.cpp @@ -49,10 +49,8 @@ bool CpuBarrier::Rendezvous() { return false; } -Cpu::Cpu(std::shared_ptr<ExclusiveMonitor> exclusive_monitor, - std::shared_ptr<CpuBarrier> cpu_barrier, std::size_t core_index) - : cpu_barrier{std::move(cpu_barrier)}, core_index{core_index} { - +Cpu::Cpu(ExclusiveMonitor& exclusive_monitor, CpuBarrier& cpu_barrier, std::size_t core_index) + : cpu_barrier{cpu_barrier}, core_index{core_index} { if (Settings::values.use_cpu_jit) { #ifdef ARCHITECTURE_x86_64 arm_interface = std::make_unique<ARM_Dynarmic>(exclusive_monitor, core_index); @@ -64,15 +62,15 @@ Cpu::Cpu(std::shared_ptr<ExclusiveMonitor> exclusive_monitor, arm_interface = std::make_unique<ARM_Unicorn>(); } - scheduler = std::make_shared<Kernel::Scheduler>(*arm_interface); + scheduler = std::make_unique<Kernel::Scheduler>(*arm_interface); } Cpu::~Cpu() = default; -std::shared_ptr<ExclusiveMonitor> Cpu::MakeExclusiveMonitor(std::size_t num_cores) { +std::unique_ptr<ExclusiveMonitor> Cpu::MakeExclusiveMonitor(std::size_t num_cores) { if (Settings::values.use_cpu_jit) { #ifdef ARCHITECTURE_x86_64 - return std::make_shared<DynarmicExclusiveMonitor>(num_cores); + return std::make_unique<DynarmicExclusiveMonitor>(num_cores); #else return nullptr; // TODO(merry): Passthrough exclusive monitor #endif @@ -83,7 +81,7 @@ std::shared_ptr<ExclusiveMonitor> Cpu::MakeExclusiveMonitor(std::size_t num_core void Cpu::RunLoop(bool tight_loop) { // Wait for all other CPU cores to complete the previous slice, such that they run in lock-step - if (!cpu_barrier->Rendezvous()) { + if (!cpu_barrier.Rendezvous()) { // If rendezvous failed, session has been killed return; } |
