From 53e5aa62983dd2db68ac78c2a1272aba456362e6 Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Wed, 6 Dec 2023 09:19:24 -0500 Subject: Exclude JIT-related declarations more aggressively --- src/ARMJIT.h | 58 ++++++++++++++++++++++++++++------------ src/ARMJIT_A64/ARMJIT_Compiler.h | 8 +++--- src/ARMJIT_Compiler.h | 6 ++--- src/ARMJIT_x64/ARMJIT_Compiler.h | 7 +++-- src/NDS.h | 3 +++ 5 files changed, 53 insertions(+), 29 deletions(-) diff --git a/src/ARMJIT.h b/src/ARMJIT.h index 6390855..7ea5472 100644 --- a/src/ARMJIT.h +++ b/src/ARMJIT.h @@ -23,7 +23,10 @@ #include #include #include "types.h" +#include "MemConstants.h" +#include "Args.h" +#ifdef JIT_ENABLED #include "ARMJIT_Memory.h" #include "JitBlock.h" @@ -32,8 +35,6 @@ #endif #include "ARMJIT_Compiler.h" -#include "Args.h" -#include "MemConstants.h" namespace melonDS { @@ -52,17 +53,16 @@ public: BranchOptimizations(jit.has_value() ? jit->BranchOptimizations : false), FastMemory(jit.has_value() ? jit->FastMemory : false) {} - ~ARMJIT() noexcept NOOP_IF_NO_JIT; - void InvalidateByAddr(u32) noexcept NOOP_IF_NO_JIT; - void CheckAndInvalidateWVRAM(int) noexcept NOOP_IF_NO_JIT; - void CheckAndInvalidateITCM() noexcept NOOP_IF_NO_JIT; - void Reset() noexcept NOOP_IF_NO_JIT; - void JitEnableWrite() noexcept NOOP_IF_NO_JIT; - void JitEnableExecute() noexcept NOOP_IF_NO_JIT; - void CompileBlock(ARM* cpu) noexcept NOOP_IF_NO_JIT; - void ResetBlockCache() noexcept NOOP_IF_NO_JIT; + ~ARMJIT() noexcept; + void InvalidateByAddr(u32) noexcept; + void CheckAndInvalidateWVRAM(int) noexcept; + void CheckAndInvalidateITCM() noexcept; + void Reset() noexcept; + void JitEnableWrite() noexcept; + void JitEnableExecute() noexcept; + void CompileBlock(ARM* cpu) noexcept; + void ResetBlockCache() noexcept; -#ifdef JIT_ENABLED template void CheckAndInvalidate(u32 addr) noexcept { @@ -73,10 +73,6 @@ public: JitBlockEntry LookUpBlock(u32 num, u64* entries, u32 offset, u32 addr) noexcept; bool SetupExecutableRegion(u32 num, u32 blockAddr, u64*& entry, u32& start, u32& size) noexcept; u32 LocaliseCodeAddress(u32 num, u32 addr) const noexcept; -#else - template - void CheckAndInvalidate(u32) noexcept {} -#endif ARMJIT_Memory Memory; private: @@ -185,5 +181,33 @@ public: // Defined in assembly extern "C" void ARM_Dispatch(melonDS::ARM* cpu, melonDS::JitBlockEntry entry); +#else +namespace melonDS +{ +class ARM; + +// This version is a stub; the methods all do nothing, +// but there's still a Memory member. +class ARMJIT +{ +public: + ARMJIT(melonDS::NDS& nds, std::optional) noexcept : Memory(nds) {} + ~ARMJIT() noexcept {} + void InvalidateByAddr(u32) noexcept {} + void CheckAndInvalidateWVRAM(int) noexcept {} + void CheckAndInvalidateITCM() noexcept {} + void Reset() noexcept {} + void JitEnableWrite() noexcept {} + void JitEnableExecute() noexcept {} + void CompileBlock(ARM*) noexcept {} + void ResetBlockCache() noexcept {} + template + void CheckAndInvalidate(u32 addr) noexcept {} + + ARMJIT_Memory Memory; +}; +} +#endif // JIT_ENABLED + +#endif // ARMJIT_H -#endif diff --git a/src/ARMJIT_A64/ARMJIT_Compiler.h b/src/ARMJIT_A64/ARMJIT_Compiler.h index 7765690..54e6054 100644 --- a/src/ARMJIT_A64/ARMJIT_Compiler.h +++ b/src/ARMJIT_A64/ARMJIT_Compiler.h @@ -19,6 +19,8 @@ #ifndef ARMJIT_A64_COMPILER_H #define ARMJIT_A64_COMPILER_H +#if defined(JIT_ENABLED) && defined(__aarch64__) + #include "../ARM.h" #include "../dolphin/Arm64Emitter.h" @@ -96,11 +98,7 @@ class Compiler : public Arm64Gen::ARM64XEmitter public: typedef void (Compiler::*CompileFunc)(); -#ifdef JIT_ENABLED explicit Compiler(melonDS::NDS& nds); -#else - explicit Compiler(melonDS::NDS& nds) : XEmitter(), NDS(nds) {} -#endif ~Compiler() override; void PushRegs(bool saveHiRegs, bool saveRegsToBeChanged, bool allowUnload = true); @@ -291,3 +289,5 @@ public: } #endif + +#endif diff --git a/src/ARMJIT_Compiler.h b/src/ARMJIT_Compiler.h index 4ece834..ff4f8ff 100644 --- a/src/ARMJIT_Compiler.h +++ b/src/ARMJIT_Compiler.h @@ -20,10 +20,6 @@ #define ARMJIT_COMPILER_H #ifdef JIT_ENABLED -#define NOOP_IF_NO_JIT -#else -#define NOOP_IF_NO_JIT {} -#endif #if defined(__x86_64__) #include "ARMJIT_x64/ARMJIT_Compiler.h" @@ -34,3 +30,5 @@ #endif #endif + +#endif diff --git a/src/ARMJIT_x64/ARMJIT_Compiler.h b/src/ARMJIT_x64/ARMJIT_Compiler.h index fa6d78a..aa80570 100644 --- a/src/ARMJIT_x64/ARMJIT_Compiler.h +++ b/src/ARMJIT_x64/ARMJIT_Compiler.h @@ -19,6 +19,8 @@ #ifndef ARMJIT_X64_COMPILER_H #define ARMJIT_X64_COMPILER_H +#if defined(JIT_ENABLED) && defined(__x86_64__) + #include "../dolphin/x64Emitter.h" #include "../ARMJIT_Internal.h" @@ -81,11 +83,7 @@ struct Op2 class Compiler : public Gen::XEmitter { public: -#ifdef JIT_ENABLED explicit Compiler(melonDS::NDS& nds); -#else - explicit Compiler(melonDS::NDS& nds) : XEmitter(), NDS(nds) {} -#endif void Reset(); @@ -284,5 +282,6 @@ public: }; } +#endif #endif diff --git a/src/NDS.h b/src/NDS.h index 1a6d475..d3a753a 100644 --- a/src/NDS.h +++ b/src/NDS.h @@ -36,6 +36,9 @@ #include "AREngine.h" #include "GPU.h" #include "ARMJIT.h" +#include "MemRegion.h" +#include "ARMJIT_Memory.h" +#include "ARM.h" #include "DMA.h" #include "FreeBIOS.h" -- cgit v1.2.3