mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Add a thread safe variant of clearing the jit cache
This commit is contained in:
parent
f1964f90d6
commit
0480ca48fb
@ -17,6 +17,7 @@
|
||||
#include "Common/JitRegister.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/PowerPC/JitCommon/JitBase.h"
|
||||
#include "Core/PowerPC/JitInterface.h"
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
@ -27,6 +28,13 @@
|
||||
|
||||
using namespace Gen;
|
||||
|
||||
static int s_clear_jit_cache_thread_safe;
|
||||
|
||||
static void ClearCacheThreadSafe(u64 userdata, s64 cyclesdata)
|
||||
{
|
||||
JitInterface::ClearCache();
|
||||
}
|
||||
|
||||
bool JitBaseBlockCache::IsFull() const
|
||||
{
|
||||
return GetNumBlocks() >= MAX_NUM_BLOCKS - 1;
|
||||
@ -34,6 +42,7 @@ bool JitBaseBlockCache::IsFull() const
|
||||
|
||||
void JitBaseBlockCache::Init()
|
||||
{
|
||||
s_clear_jit_cache_thread_safe = CoreTiming::RegisterEvent("clearJitCache", ClearCacheThreadSafe);
|
||||
JitRegister::Init(SConfig::GetInstance().m_perfDir);
|
||||
|
||||
iCache.fill(0);
|
||||
@ -73,6 +82,11 @@ void JitBaseBlockCache::Clear()
|
||||
blocks[0].invalid = true;
|
||||
}
|
||||
|
||||
void JitBaseBlockCache::SchedulateClearCacheThreadSafe()
|
||||
{
|
||||
CoreTiming::ScheduleEvent(0, s_clear_jit_cache_thread_safe);
|
||||
}
|
||||
|
||||
void JitBaseBlockCache::Reset()
|
||||
{
|
||||
Shutdown();
|
||||
|
@ -159,6 +159,7 @@ public:
|
||||
void FinalizeBlock(int block_num, bool block_link, const u8* code_ptr);
|
||||
|
||||
void Clear();
|
||||
void SchedulateClearCacheThreadSafe();
|
||||
void Init();
|
||||
void Shutdown();
|
||||
void Reset();
|
||||
|
Loading…
Reference in New Issue
Block a user