Emulator Issues #11717

Frequent JIT cache flushing in some games

Added by Techjar over 1 year ago. Updated 6 months ago.

% Done:


Operating system:
Issue type:
Relates to usability:
Relates to performance:
Relates to maintainability:
Regression start:
Fixed in:


Game Name?

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.

Yes, 5.0-10151

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 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.


#1 Updated by markwest76 over 1 year ago

Do you think this issue could be a duplicate of issue #11693 ?

#2 Updated by Techjar over 1 year ago

Yeah that's another game that experiences JIT flushing. Though, it would be an duplicate of this one, as this is meant to be the single place to document all the JIT flushing cases.

#3 Updated by markwest76 over 1 year ago

So you can confirm that 5-0-8007 is stutter-free with all the mentioned games?

#4 Updated by Techjar over 1 year ago

No, as stated older builds just stutter a bit less frequently. Why you experience "no" stuttering on that build we cannot explain, nor reproduce.

#5 Updated by markwest76 9 months ago

Another game massively affected by this stuttering plague is Prince of Persia Forgotten Sands...

#6 Updated by markwest76 6 months ago

I suggest to check if 5.0-11318 has fixed this issue...

#7 Updated by Techjar 6 months ago

It has not, only made the interval between flushes a bit longer depending on the game.

#8 Updated by flacs 6 months ago

Try 5.0-11590 (the PDEP issue fix, just in case someone has a Zen CPU) and compare it with 5.0-11537 (last build before double-to-float conversions were de-inlined).

#9 Updated by Techjar 6 months ago

That one probably also helps increase the interval further, but we still don't have a proper solution to more or less eliminate the flushing.

Also available in: Atom PDF