mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-26 08:55:58 +00:00
Add hack to make the JIT stable(r) on UWP ARM. Can't make it right without FlushInstructionCache which is not available. Sigh...
This commit is contained in:
parent
5f1e9dd822
commit
29ad3180a0
@ -2,6 +2,8 @@
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "ppsspp_config.h"
|
||||
|
||||
#include <limits>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
@ -12,13 +14,15 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "ppsspp_config.h"
|
||||
|
||||
#include "Arm64Emitter.h"
|
||||
#include "MathUtil.h"
|
||||
#include "CommonTypes.h"
|
||||
#include "CommonWindows.h"
|
||||
#include "CPUDetect.h"
|
||||
|
||||
#include "CommonWindows.h"
|
||||
|
||||
#ifdef IOS
|
||||
#include <libkern/OSCacheControl.h>
|
||||
#endif
|
||||
@ -322,7 +326,11 @@ void ARM64XEmitter::FlushIcacheSection(u8* start, u8* end)
|
||||
#if defined(IOS)
|
||||
// Header file says this is equivalent to: sys_icache_invalidate(start, end - start);
|
||||
sys_cache_control(kCacheFunctionPrepareForExecution, start, end - start);
|
||||
#elif PPSSPP_ARCH(ARM64)
|
||||
#elif PPSSPP_PLATFORM(WINDOWS)
|
||||
#if !PPSSPP_PLATFORM(UWP) // Not available on UWP, which is very bad!
|
||||
FlushInstructionCache(GetCurrentProcess(), start, end - start);
|
||||
#endif
|
||||
#elif PPSSPP_ARCH(ARM64)
|
||||
// Code from Dolphin, contributed by the Mono project.
|
||||
|
||||
// Don't rely on GCC's __clear_cache implementation, as it caches
|
||||
|
@ -15,6 +15,8 @@
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "ppsspp_config.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
|
||||
#include <assert.h>
|
||||
@ -33,6 +35,10 @@
|
||||
#include "ArmEmitter.h"
|
||||
#include "CPUDetect.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "CommonWindows.h"
|
||||
#endif
|
||||
|
||||
// Want it in release builds too
|
||||
#ifdef __ANDROID__
|
||||
#undef _dbg_assert_msg_
|
||||
@ -626,14 +632,18 @@ void ARMXEmitter::FlushIcacheSection(u8 *start, u8 *end)
|
||||
#if defined(IOS)
|
||||
// Header file says this is equivalent to: sys_icache_invalidate(start, end - start);
|
||||
sys_cache_control(kCacheFunctionPrepareForExecution, start, end - start);
|
||||
#elif !defined(_WIN32)
|
||||
#if defined(ARM)
|
||||
#elif PPSSPP_PLATFORM(WINDOWS)
|
||||
#if !PPSSPP_PLATFORM(UWP) // Not available on UWP, which is very bad!
|
||||
FlushInstructionCache(GetCurrentProcess(), start, end - start);
|
||||
#endif
|
||||
#elif PPSSPP_ARCH(ARM)
|
||||
|
||||
#if defined(__clang__) || defined(__ANDROID__)
|
||||
__clear_cache(start, end);
|
||||
#else
|
||||
__builtin___clear_cache(start, end);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -2171,6 +2171,10 @@ namespace MIPSComp
|
||||
DISABLE;
|
||||
}
|
||||
|
||||
#if PPSSPP_ARCH(ARM_HARDFP)
|
||||
DISABLE;
|
||||
#endif
|
||||
|
||||
int vd = _VD;
|
||||
int vs = _VS;
|
||||
|
||||
|
@ -83,7 +83,7 @@ ArmJit::ArmJit(MIPSState *mips) : blocks(mips, this), gpr(mips, &js, &jo), fpr(m
|
||||
AllocCodeSpace(1024 * 1024 * 16); // 32MB is the absolute max because that's what an ARM branch instruction can reach, backwards and forwards.
|
||||
GenerateFixedCode();
|
||||
|
||||
INFO_LOG(JIT, "ARM JIT initialized: %d MB of code space", GetSpaceLeft() / 1024 * 1024);
|
||||
INFO_LOG(JIT, "ARM JIT initialized: %d MB of code space", GetSpaceLeft() / (1024 * 1024));
|
||||
|
||||
js.startDefaultPrefix = mips_->HasDefaultPrefix();
|
||||
}
|
||||
@ -197,6 +197,15 @@ void ArmJit::CompileDelaySlot(int flags)
|
||||
|
||||
void ArmJit::Compile(u32 em_address) {
|
||||
PROFILE_THIS_SCOPE("jitc");
|
||||
|
||||
// If I keep any of these, it works on UWP for ARM!
|
||||
#if PPSSPP_PLATFORM(UWP)
|
||||
INFO_LOG(JIT, "Compiling at %08x", em_address);
|
||||
#endif
|
||||
// Sleep(1);
|
||||
// Unfortunately Microsoft forgot to expose FlushInstructionCache to UWP applications... even though they expose
|
||||
// the ability to generate code :( This will work great on x86 but on ARM we're out of luck.
|
||||
|
||||
if (GetSpaceLeft() < 0x10000 || blocks.IsFull()) {
|
||||
ClearCache();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user