From 8ad1ea4c846f60bf575d1b2793b9b0fcc6e5ba79 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sat, 13 Dec 2014 00:09:37 +0100 Subject: [PATCH] Split JitCommon.h so that you can include it without getting the "NativeJit" definition --- Core/Core.vcxproj | 3 +- Core/Core.vcxproj.filters | 3 ++ Core/Debugger/Breakpoints.cpp | 2 +- Core/HLE/ReplaceTables.h | 2 +- Core/MIPS/ARM/ArmAsm.cpp | 10 ++---- Core/MIPS/JitCommon/JitBlockCache.cpp | 1 + Core/MIPS/JitCommon/JitCommon.cpp | 6 +++- Core/MIPS/JitCommon/JitCommon.h | 30 +++--------------- Core/MIPS/JitCommon/NativeJit.h | 45 +++++++++++++++++++++++++++ Core/MIPS/MIPS.cpp | 1 + Core/MIPS/MIPSAsm.cpp | 2 +- Core/MIPS/MIPSTables.cpp | 2 +- Core/MIPS/x86/Asm.cpp | 7 +---- Core/MIPS/x86/CompReplace.cpp | 2 +- UI/CwCheatScreen.cpp | 2 +- UI/DevScreens.cpp | 1 + UI/MiscScreens.cpp | 1 + Windows/WndMainWindow.cpp | 2 +- unittest/JitHarness.cpp | 1 + 19 files changed, 74 insertions(+), 49 deletions(-) create mode 100644 Core/MIPS/JitCommon/NativeJit.h diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 9a21fede5a..4fa5e0a314 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -603,6 +603,7 @@ + @@ -672,4 +673,4 @@ - \ No newline at end of file + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index f699198e8b..3116a6ce23 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -609,6 +609,9 @@ MIPS\JitCommon + + MIPS\JitCommon + FileSystems diff --git a/Core/Debugger/Breakpoints.cpp b/Core/Debugger/Breakpoints.cpp index 5f2683df83..366e1fbd2f 100644 --- a/Core/Debugger/Breakpoints.cpp +++ b/Core/Debugger/Breakpoints.cpp @@ -20,7 +20,7 @@ #include "Core/Debugger/SymbolMap.h" #include "Core/Host.h" #include "Core/MIPS/MIPSAnalyst.h" -#include "Core/MIPS/JitCommon/JitCommon.h" +#include "Core/MIPS/JitCommon/NativeJit.h" #include "Core/CoreTiming.h" #include diff --git a/Core/HLE/ReplaceTables.h b/Core/HLE/ReplaceTables.h index e994bd0458..403cffea96 100644 --- a/Core/HLE/ReplaceTables.h +++ b/Core/HLE/ReplaceTables.h @@ -34,7 +34,7 @@ #pragma once #include "Common/CommonTypes.h" -#include "Core/MIPS/JitCommon/JitCommon.h" +#include "Core/MIPS/JitCommon/NativeJit.h" typedef int (* ReplaceFunc)(); diff --git a/Core/MIPS/ARM/ArmAsm.cpp b/Core/MIPS/ARM/ArmAsm.cpp index 5dac3730af..33c2b79560 100644 --- a/Core/MIPS/ARM/ArmAsm.cpp +++ b/Core/MIPS/ARM/ArmAsm.cpp @@ -23,9 +23,9 @@ #include "Common/MemoryUtil.h" #include "Common/CPUDetect.h" #include "Common/ArmEmitter.h" -#include "Core/MIPS/JitCommon/JitCommon.h" #include "Core/MIPS/ARM/ArmJit.h" #include "Core/MIPS/ARM/ArmAsm.h" +#include "Core/MIPS/JitCommon/JitCommon.h" using namespace ArmGen; @@ -53,12 +53,6 @@ static const bool enableDebug = false; // R7 : Down counter extern volatile CoreState coreState; -void JitAt() -{ - MIPSComp::jit->Compile(currentMIPS->pc); -} - - void ShowPC(u32 sp) { if (currentMIPS) { ERROR_LOG(JIT, "ShowPC : %08x ArmSP : %08x", currentMIPS->pc, sp); @@ -176,7 +170,7 @@ void ArmJit::GenerateFixedCode() // No block found, let's jit SaveDowncount(); RestoreRoundingMode(true); - QuickCallFunction(R2, (void *)&JitAt); + QuickCallFunction(R2, (void *)&MIPSComp::JitAt); ApplyRoundingMode(true); RestoreDowncount(); diff --git a/Core/MIPS/JitCommon/JitBlockCache.cpp b/Core/MIPS/JitCommon/JitBlockCache.cpp index e801a67edc..5ba5656ccf 100644 --- a/Core/MIPS/JitCommon/JitBlockCache.cpp +++ b/Core/MIPS/JitCommon/JitBlockCache.cpp @@ -42,6 +42,7 @@ #include "Core/MIPS/JitCommon/JitBlockCache.h" #include "Core/MIPS/JitCommon/JitCommon.h" +#include "Core/MIPS/JitCommon/NativeJit.h" #if defined(ARM) #include "Core/MIPS/ARM/ArmAsm.h" diff --git a/Core/MIPS/JitCommon/JitCommon.cpp b/Core/MIPS/JitCommon/JitCommon.cpp index c605128472..eb9643b2b4 100644 --- a/Core/MIPS/JitCommon/JitCommon.cpp +++ b/Core/MIPS/JitCommon/JitCommon.cpp @@ -17,7 +17,8 @@ #include -#include "JitCommon.h" +#include "Core/MIPS/JitCommon/JitCommon.h" +#include "Core/MIPS/JitCommon/NativeJit.h" #include "Common/StringUtils.h" #include "ext/disarm.h" @@ -29,6 +30,9 @@ namespace MIPSComp { #else Jit *jit; #endif + void JitAt() { + jit->Compile(currentMIPS->pc); + } } // We compile this for x86 as well because it may be useful when developing the ARM JIT on a PC. diff --git a/Core/MIPS/JitCommon/JitCommon.h b/Core/MIPS/JitCommon/JitCommon.h index a55040c1a6..59b687c85a 100644 --- a/Core/MIPS/JitCommon/JitCommon.h +++ b/Core/MIPS/JitCommon/JitCommon.h @@ -22,32 +22,10 @@ #include "Common/Common.h" -struct JitBlock; - -#ifdef USING_QT_UI -#undef emit -#endif - -#if defined(PPC) -#include "../PPC/PpcJit.h" -typedef MIPSComp::Jit NativeJit; -#elif defined(ARM) -#include "../ARM/ArmJit.h" -typedef MIPSComp::ArmJit NativeJit; -#elif defined(_M_IX86) || defined(_M_X64) -#include "../x86/Jit.h" -typedef MIPSComp::Jit NativeJit; -#elif defined(MIPS) -#include "../MIPS/MipsJit.h" -typedef MIPSComp::Jit NativeJit; -#else -#include "../fake/FakeJit.h" -#endif - -namespace MIPSComp { - extern NativeJit *jit; -} - // TODO: Find a better place for these. std::vector DisassembleArm2(const u8 *data, int size); std::vector DisassembleX86(const u8 *data, int size); + +namespace MIPSComp { + void JitAt(); +} \ No newline at end of file diff --git a/Core/MIPS/JitCommon/NativeJit.h b/Core/MIPS/JitCommon/NativeJit.h new file mode 100644 index 0000000000..2a7a09e441 --- /dev/null +++ b/Core/MIPS/JitCommon/NativeJit.h @@ -0,0 +1,45 @@ +// Copyright (c) 2012- PPSSPP Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0 or later versions. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official git repository and contact information can be found at +// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. + +#pragma once + +struct JitBlock; + +#ifdef USING_QT_UI +#undef emit +#endif + +#if defined(PPC) +#include "../PPC/PpcJit.h" +typedef MIPSComp::Jit NativeJit; +#elif defined(ARM) +#include "../ARM/ArmJit.h" +typedef MIPSComp::ArmJit NativeJit; +#elif defined(_M_IX86) || defined(_M_X64) +#include "../x86/Jit.h" +typedef MIPSComp::Jit NativeJit; +#elif defined(MIPS) +#include "../MIPS/MipsJit.h" +typedef MIPSComp::Jit NativeJit; +#else +#include "../fake/FakeJit.h" +typedef MIPSComp::Jit FakeJit; +#endif + +namespace MIPSComp { + extern NativeJit *jit; +} \ No newline at end of file diff --git a/Core/MIPS/MIPS.cpp b/Core/MIPS/MIPS.cpp index 3e5e7401cf..d07fe15c80 100644 --- a/Core/MIPS/MIPS.cpp +++ b/Core/MIPS/MIPS.cpp @@ -32,6 +32,7 @@ #include "Core/System.h" #include "Core/HLE/sceDisplay.h" #include "Core/MIPS/JitCommon/JitCommon.h" +#include "Core/MIPS/JitCommon/NativeJit.h" #include "Core/CoreTiming.h" MIPSState mipsr4k; diff --git a/Core/MIPS/MIPSAsm.cpp b/Core/MIPS/MIPSAsm.cpp index 7401d4560e..2504a9e115 100644 --- a/Core/MIPS/MIPSAsm.cpp +++ b/Core/MIPS/MIPSAsm.cpp @@ -6,7 +6,7 @@ #include #include "util/text/utf8.h" #include "Core/MemMap.h" -#include "Core/MIPS/JitCommon/JitCommon.h" +#include "Core/MIPS/JitCommon/NativeJit.h" #include "Core/Debugger/SymbolMap.h" #if defined(_WIN32) || defined(ANDROID) diff --git a/Core/MIPS/MIPSTables.cpp b/Core/MIPS/MIPSTables.cpp index e6f640f997..c6a61fbb3a 100644 --- a/Core/MIPS/MIPSTables.cpp +++ b/Core/MIPS/MIPSTables.cpp @@ -29,7 +29,7 @@ #include "Core/Reporting.h" #include "Core/Debugger/Breakpoints.h" -#include "JitCommon/JitCommon.h" +#include "JitCommon/NativeJit.h" enum MipsEncoding { Imme, diff --git a/Core/MIPS/x86/Asm.cpp b/Core/MIPS/x86/Asm.cpp index 12fd1da530..68fc9c9f6b 100644 --- a/Core/MIPS/x86/Asm.cpp +++ b/Core/MIPS/x86/Asm.cpp @@ -52,11 +52,6 @@ static bool enableDebug = false; extern volatile CoreState coreState; -void Jit() -{ - MIPSComp::jit->Compile(currentMIPS->pc); -} - // IDEA, NOT IMPLEMENTED: no more block numbers - hack opcodes just contain offset within // dynarec buffer, gets rid of lookup into block buffer // At this offset - 4, there is an int specifying the block number if needed. @@ -135,7 +130,7 @@ void AsmRoutineManager::Generate(MIPSState *mips, MIPSComp::Jit *jit) //Ok, no block, let's jit jit->RestoreRoundingMode(true, this); - ABI_CallFunction(&Jit); + ABI_CallFunction(&MIPSComp::JitAt); jit->ApplyRoundingMode(true, this); JMP(dispatcherNoCheck, true); // Let's just dispatch again, we'll enter the block since we know it's there. diff --git a/Core/MIPS/x86/CompReplace.cpp b/Core/MIPS/x86/CompReplace.cpp index fd60ac2978..f0e907d03f 100644 --- a/Core/MIPS/x86/CompReplace.cpp +++ b/Core/MIPS/x86/CompReplace.cpp @@ -16,7 +16,7 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "Core/MemMap.h" -#include "Core/MIPS/JitCommon/JitCommon.h" +#include "Core/MIPS/JitCommon/NativeJit.h" #include "Core/MIPS/x86/RegCache.h" static const u64 MEMORY_ALIGNED16(ssNoSignMask[2]) = {0x7FFFFFFF7FFFFFFFULL, 0x7FFFFFFF7FFFFFFFULL}; diff --git a/UI/CwCheatScreen.cpp b/UI/CwCheatScreen.cpp index 6bd69b1e23..dea9d5306a 100644 --- a/UI/CwCheatScreen.cpp +++ b/UI/CwCheatScreen.cpp @@ -23,7 +23,7 @@ #include "Core/Core.h" #include "Core/Config.h" -#include "Core/MIPS/JitCommon/JitCommon.h" +#include "Core/MIPS/JitCommon/NativeJit.h" #include "UI/OnScreenDisplay.h" #include "UI/ui_atlas.h" diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index a24fd2833d..92ca86f96a 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -33,6 +33,7 @@ #include "Core/System.h" #include "Core/CoreParameter.h" #include "Core/MIPS/MIPSTables.h" +#include "Core/MIPS/JitCommon/NativeJit.h" #include "Core/MIPS/JitCommon/JitCommon.h" #include "GPU/GPUInterface.h" #include "GPU/GPUState.h" diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp index f7e78f2ae5..39c8d94db4 100644 --- a/UI/MiscScreens.cpp +++ b/UI/MiscScreens.cpp @@ -36,6 +36,7 @@ #include "Core/Host.h" #include "Core/System.h" #include "Core/MIPS/JitCommon/JitCommon.h" +#include "Core/MIPS/JitCommon/NativeJit.h" #include "Core/HLE/sceUtility.h" #include "Common/CPUDetect.h" #include "Common/FileUtil.h" diff --git a/Windows/WndMainWindow.cpp b/Windows/WndMainWindow.cpp index ae03a21c29..3961615e14 100644 --- a/Windows/WndMainWindow.cpp +++ b/Windows/WndMainWindow.cpp @@ -49,7 +49,7 @@ #include "Core/SaveState.h" #include "Core/System.h" #include "Core/Config.h" -#include "Core/MIPS/JitCommon/JitCommon.h" +#include "Core/MIPS/JitCommon/NativeJit.h" #include "Core/MIPS/JitCommon/JitBlockCache.h" #include "Core/FileSystems/MetaFileSystem.h" #include "Windows/EmuThread.h" diff --git a/unittest/JitHarness.cpp b/unittest/JitHarness.cpp index 638b1d8b33..27b842887d 100644 --- a/unittest/JitHarness.cpp +++ b/unittest/JitHarness.cpp @@ -20,6 +20,7 @@ #include "base/timeutil.h" #include "input/input_state.h" #include "Core/MIPS/JitCommon/JitCommon.h" +#include "Core/MIPS/JitCommon/NativeJit.h" #include "Core/MIPS/MIPSCodeUtils.h" #include "Core/MIPS/MIPSDebugInterface.h" #include "Core/MIPS/MIPSAsm.h"