Fastmem: increase the size of trampoline cache in MMU mode, check space

Fastmem in MMU mode generates way more trampolines than normal, so we need
a bunch more space too, lest we run out of room.
This commit is contained in:
Fiora 2015-01-02 23:33:07 -08:00
parent 1ee83e332e
commit 3d2492627f
5 changed files with 13 additions and 8 deletions

View File

@ -183,7 +183,7 @@ void Jit64::Init()
gpr.SetEmitter(this);
fpr.SetEmitter(this);
trampolines.Init();
trampolines.Init(js.memcheck ? TRAMPOLINE_CODE_SIZE_MMU : TRAMPOLINE_CODE_SIZE);
AllocCodeSpace(CODE_SIZE);
// BLR optimization has the same consequences as block linking, as well as
@ -494,6 +494,7 @@ void Jit64::Jit(u32 em_address)
{
if (GetSpaceLeft() < 0x10000 ||
farcode.GetSpaceLeft() < 0x10000 ||
trampolines.GetSpaceLeft() < 0x10000 ||
blocks.IsFull() ||
SConfig::GetInstance().m_LocalCoreStartupParameter.bJITNoBlockCache ||
m_clear_cache_asap)

View File

@ -249,7 +249,7 @@ void JitIL::Init()
jo.accurateSinglePrecision = false;
js.memcheck = SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU;
trampolines.Init();
trampolines.Init(js.memcheck ? TRAMPOLINE_CODE_SIZE_MMU : TRAMPOLINE_CODE_SIZE);
AllocCodeSpace(CODE_SIZE);
blocks.Init();
asm_routines.Init(nullptr);

View File

@ -42,6 +42,10 @@ static const int CODE_SIZE = 1024 * 1024 * 32;
static const int FARCODE_SIZE = 1024 * 1024 * 8;
static const int FARCODE_SIZE_MMU = 1024 * 1024 * 48;
// same for the trampoline code cache, because fastmem results in far more backpatches in MMU mode
static const int TRAMPOLINE_CODE_SIZE = 1024 * 1024 * 8;
static const int TRAMPOLINE_CODE_SIZE_MMU = 1024 * 1024 * 32;
// Like XCodeBlock but has some utilities for memory access.
class EmuCodeBlock : public Gen::X64CodeBlock
{

View File

@ -19,9 +19,9 @@
using namespace Gen;
void TrampolineCache::Init()
void TrampolineCache::Init(int size)
{
AllocCodeSpace(8 * 1024 * 1024);
AllocCodeSpace(size);
}
void TrampolineCache::ClearCodeSpace()

View File

@ -17,7 +17,7 @@ const int BACKPATCH_SIZE = 5;
class TrampolineCache : public Gen::X64CodeBlock
{
public:
void Init();
void Init(int size);
void Shutdown();
const u8* GenerateReadTrampoline(const InstructionInfo &info, BitSet32 registersInUse, u8* exceptionHandler, u8* returnPtr);