1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:08:11 +00:00

UserspaceEmulator: Add a very simple instruction fetch cache

To avoid MMU region lookup on every single instruction fetch, we now
cache a raw pointer to the current instruction. This gets automatically
invalidated when we jump somewhere, but as long as we're executing
sequentially, instruction fetches will hit the cache and bypass all
the region lookup stuff.

This is about a ~2x speedup. :^)
This commit is contained in:
Andreas Kling 2020-07-13 20:14:14 +02:00
parent c8d3f8cdeb
commit 8656835935
5 changed files with 44 additions and 4 deletions

View file

@ -75,4 +75,9 @@ void SimpleRegion::write32(u32 offset, u32 value)
*reinterpret_cast<u32*>(m_data + offset) = value;
}
u8* SimpleRegion::cacheable_ptr(u32 offset)
{
return m_data + offset;
}
}