CPU/CodeCache: Dynamically compute BIOS memory access timing

The timings can change if the game does so. Instead of forcing the
blocks to recompile, we can just manually multiply size * word_time.

Improves stability of Nightmare Creatures booting, and fixes corrupted
text in Formula Circus when using the cached interpreter.
This commit is contained in:
Stenzek
2024-07-19 19:31:33 +10:00
parent 5f36c2948f
commit 2e96931c32
18 changed files with 294 additions and 65 deletions
+9 -2
View File
@@ -77,8 +77,7 @@ void CPU::NewRec::Compiler::BeginBlock()
GenerateBlockProtectCheck(ram_ptr, shadow_ptr, m_block->size * sizeof(Instruction));
}
if (m_block->uncached_fetch_ticks > 0 || m_block->icache_line_count > 0)
GenerateICacheCheckAndUpdate();
GenerateICacheCheckAndUpdate();
if (g_settings.bios_tty_logging)
{
@@ -1719,6 +1718,14 @@ void CPU::NewRec::Compiler::TruncateBlock()
iinfo->is_last_instruction = true;
}
const TickCount* CPU::NewRec::Compiler::GetFetchMemoryAccessTimePtr() const
{
const TickCount* ptr =
Bus::GetMemoryAccessTimePtr(m_block->pc & PHYSICAL_MEMORY_ADDRESS_MASK, MemoryAccessSize::Word);
AssertMsg(ptr, "Address has dynamic fetch ticks");
return ptr;
}
void CPU::NewRec::Compiler::FlushForLoadStore(const std::optional<VirtualMemoryAddress>& address, bool store,
bool use_fastmem)
{