CodeBlock: Add a shared IsAlmostFull function

This function shall keep care about the low watermark of code space.
If we ran out of space, the JITs shall clear their block cache.
This commit is contained in:
degasus 2015-07-15 08:53:05 +02:00
parent a5c10ded55
commit 6f38d1baa1
4 changed files with 9 additions and 6 deletions

View File

@ -72,5 +72,11 @@ public:
{
return region_size - (T::GetCodePtr() - region);
}
bool IsAlmostFull() const
{
// This should be bigger than the biggest block ever.
return GetSpaceLeft() < 0x10000;
}
};

View File

@ -490,9 +490,7 @@ void Jit64::Trace()
void Jit64::Jit(u32 em_address)
{
if (GetSpaceLeft() < 0x10000 ||
farcode.GetSpaceLeft() < 0x10000 ||
trampolines.GetSpaceLeft() < 0x10000 ||
if (IsAlmostFull() || farcode.IsAlmostFull() || trampolines.IsAlmostFull() ||
blocks.IsFull() ||
SConfig::GetInstance().bJITNoBlockCache ||
m_clear_cache_asap)

View File

@ -473,7 +473,7 @@ void JitIL::Trace()
void JitIL::Jit(u32 em_address)
{
if (GetSpaceLeft() < 0x10000 || farcode.GetSpaceLeft() < 0x10000 || blocks.IsFull() ||
if (IsAlmostFull() || farcode.IsAlmostFull() || blocks.IsFull() ||
SConfig::GetInstance().bJITNoBlockCache)
{
ClearCache();

View File

@ -279,8 +279,7 @@ void JitArm64::SingleStep()
void JitArm64::Jit(u32)
{
if (GetSpaceLeft() < 0x10000 || farcode.GetSpaceLeft() < 0x10000 || blocks.IsFull() ||
SConfig::GetInstance().bJITNoBlockCache)
if (IsAlmostFull() || farcode.IsAlmostFull() || blocks.IsFull() || SConfig::GetInstance().bJITNoBlockCache)
{
ClearCache();
}