Emulator Issues #11717
Frequent JIT cache flushing in some games
All Metroid Prime games
Donkey Kong Country Returns
True Crime: New York
Various other titles I don't remember
What's the problem? Describe what went wrong.
I'm making this issue as a way to encompass all the issue reports of game stuttering that are due to this, as well as have it properly documented for prospective devs.
Some games invalidate icache a lot which causes the JIT cache to fill up very quickly, resulting in frequent flushes which manifest as a very noticeable hitch in gameplay. This is due to our naive block allocator that simply places new blocks at the end of the buffer, and never reuses space from invalidated blocks until the cache is completely cleared. True Crime: New York is a particularly egregious offender, invalidating icache so much that the JIT cache is cleared every 2 seconds, making the game nearly unplayable. Even throwing that out as an outlier, many other titles experience stutters every few minutes that, while not making the game unplayable, are rather annoying and detract from the enjoyment.
What steps will reproduce the problem?
Play any of the listed games for some amount of time.
Is the issue present in the latest development version? For future reference, please also write down the version number of the latest development version.
Is the issue present in the latest stable version?
Presumably yes. The JIT cache has not changed in years, though it's slightly worse in dev builds due to some JIT changes generating more code.
If the issue isn't present in the latest stable version, which is the first broken version? (You can find the first broken version by bisecting. Windows users can use the tool https://forums.dolphin-emu.org/Thread-green-notice-development-thread-unofficial-dolphin-bisection-tool-for-finding-broken-builds and anyone who is building Dolphin on their own can use git bisect.)
N/A, been an issue since the dawn of time.
What are your PC specifications? (CPU, GPU, Operating System, more)
4.5GHz CPU Processor
24-bit Accelerated Video Graphics
Modern Operating System
Is there anything else that can help developers narrow down the issue? (e.g. logs, screenshots,
configuration files, savefiles, savestates)
Nope, but I will say that fixing this issue won't be easy. It's most likely going to require some pretty big changes to the whole JIT.