Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
recompiler: allow jitprotect() calls to be nested (#1306)
The following applies only to macOS when JIT page protection is enforced (namely on Apple silicon). A sequence of jitprotect(false) calls must now be followed by an equal number of jitprotect(true) calls to restore executable protection. A further assumption is that nesting always starts with (false), which is only logical because you have to write something before you have anything to execute. This is explicitly checked in debug builds. The N64 and PS1 recompilers have needed this since commit 8ed4af8 in order to handle the path taken on recompiler cache flushes. It's subtle, but emit() will evict all pools and so the second call to pool() from block() will reallocate the pool and unexpectedly toggle the protection out from under it. Technically the SH2 recompiler has needed this since commit 241f0e9 (from 8 months ago!) but that same commit made cache flushes practically nonexistent, so it's likely not impacting the retail title library.
- Loading branch information