From 98af5e4c10cceebf89822c45730f898a7fb840af Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 15 Jun 2018 07:54:21 -0400 Subject: [PATCH 1/2] DSPCore: Convert core type enum into an enum class Prevents pollution of the surrounding scope and makes the values strongly-typed. --- Source/Core/Core/DSP/DSPCore.cpp | 2 +- Source/Core/Core/DSP/DSPCore.h | 12 ++++++------ Source/Core/Core/HW/DSPLLE/DSPLLE.cpp | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Source/Core/Core/DSP/DSPCore.cpp b/Source/Core/Core/DSP/DSPCore.cpp index 83196a5c32..56864454e1 100644 --- a/Source/Core/Core/DSP/DSPCore.cpp +++ b/Source/Core/Core/DSP/DSPCore.cpp @@ -170,7 +170,7 @@ bool DSPCore_Init(const DSPInitOptions& opts) Common::WriteProtectMemory(g_dsp.iram, DSP_IRAM_BYTE_SIZE, false); // Initialize JIT, if necessary - if (opts.core_type == DSPInitOptions::CORE_JIT) + if (opts.core_type == DSPInitOptions::CoreType::JIT) g_dsp_jit = std::make_unique(); g_dsp_cap.reset(opts.capture_logger); diff --git a/Source/Core/Core/DSP/DSPCore.h b/Source/Core/Core/DSP/DSPCore.h index d1e9ce2f0d..17839b01ee 100644 --- a/Source/Core/Core/DSP/DSPCore.h +++ b/Source/Core/Core/DSP/DSPCore.h @@ -329,19 +329,19 @@ struct DSPInitOptions std::array coef_contents; // Core used to emulate the DSP. - // Default: CORE_JIT. - enum CoreType + // Default: JIT. + enum class CoreType { - CORE_INTERPRETER, - CORE_JIT, + Interpreter, + JIT, }; - CoreType core_type; + CoreType core_type = CoreType::JIT; // Optional capture logger used to log internal DSP data transfers. // Default: dummy implementation, does nothing. DSPCaptureLogger* capture_logger; - DSPInitOptions() : core_type(CORE_JIT), capture_logger(new DefaultDSPCaptureLogger()) {} + DSPInitOptions() : capture_logger(new DefaultDSPCaptureLogger()) {} }; // Initializes the DSP emulator using the provided options. Takes ownership of diff --git a/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp b/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp index cb48991315..d896211531 100644 --- a/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp +++ b/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp @@ -153,10 +153,10 @@ static bool FillDSPInitOptions(DSPInitOptions* opts) if (!LoadDSPRom(opts->coef_contents.data(), coef_file, DSP_COEF_BYTE_SIZE)) return false; - opts->core_type = DSPInitOptions::CORE_INTERPRETER; + opts->core_type = DSPInitOptions::CoreType::Interpreter; #ifdef _M_X86 if (SConfig::GetInstance().m_DSPEnableJIT) - opts->core_type = DSPInitOptions::CORE_JIT; + opts->core_type = DSPInitOptions::CoreType::JIT; #endif if (SConfig::GetInstance().m_DSPCaptureLog) From 161dffe2f912926872b1b408ad8051e2afa61b06 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 15 Jun 2018 07:56:56 -0400 Subject: [PATCH 2/2] DSPCore: Rename JIT core type to JIT64 This changes the identifier to represent the x86-64 DSP emitter. If any other JITs for the DSP are added in the future, they all can't use the same generic identifier. --- Source/Core/Core/DSP/DSPCore.cpp | 2 +- Source/Core/Core/DSP/DSPCore.h | 6 +++--- Source/Core/Core/HW/DSPLLE/DSPLLE.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/DSP/DSPCore.cpp b/Source/Core/Core/DSP/DSPCore.cpp index 56864454e1..4495cf9676 100644 --- a/Source/Core/Core/DSP/DSPCore.cpp +++ b/Source/Core/Core/DSP/DSPCore.cpp @@ -170,7 +170,7 @@ bool DSPCore_Init(const DSPInitOptions& opts) Common::WriteProtectMemory(g_dsp.iram, DSP_IRAM_BYTE_SIZE, false); // Initialize JIT, if necessary - if (opts.core_type == DSPInitOptions::CoreType::JIT) + if (opts.core_type == DSPInitOptions::CoreType::JIT64) g_dsp_jit = std::make_unique(); g_dsp_cap.reset(opts.capture_logger); diff --git a/Source/Core/Core/DSP/DSPCore.h b/Source/Core/Core/DSP/DSPCore.h index 17839b01ee..712bedfc2d 100644 --- a/Source/Core/Core/DSP/DSPCore.h +++ b/Source/Core/Core/DSP/DSPCore.h @@ -329,13 +329,13 @@ struct DSPInitOptions std::array coef_contents; // Core used to emulate the DSP. - // Default: JIT. + // Default: JIT64. enum class CoreType { Interpreter, - JIT, + JIT64, }; - CoreType core_type = CoreType::JIT; + CoreType core_type = CoreType::JIT64; // Optional capture logger used to log internal DSP data transfers. // Default: dummy implementation, does nothing. diff --git a/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp b/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp index d896211531..272815c2de 100644 --- a/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp +++ b/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp @@ -156,7 +156,7 @@ static bool FillDSPInitOptions(DSPInitOptions* opts) opts->core_type = DSPInitOptions::CoreType::Interpreter; #ifdef _M_X86 if (SConfig::GetInstance().m_DSPEnableJIT) - opts->core_type = DSPInitOptions::CoreType::JIT; + opts->core_type = DSPInitOptions::CoreType::JIT64; #endif if (SConfig::GetInstance().m_DSPCaptureLog)