macOS: enable guest signal dispatch on the target thread #136
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!136
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/136/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@m1abdullahh on GitHub · 2026-07-31 01:28 UTC · original
m1abdullahh:macos-signal-dispatch→main· +69 −3 · 2 files · 1 commits · merged 2026-07-31 01:47 UTCWhat this fixes
Unity (IL2CPP) titles freeze on macOS at their first garbage collection. The GC does a stop-the-world: it raises a signal at every managed thread and each thread's handler parks its own thread until the collector resumes it. On macOS,
KernelRaiseExceptionran the guest handler on the calling thread instead of the target, so the collector parked itself and the game froze. Metal Slug Tactics (PPSA20643) showed this as a black screen frozen at about frame 167.The Linux port (#117) already added correct pthread_kill based delivery, but it is compiled out on macOS. This PR enables the same path there:
uc_mcontext->__ss) and the guest ucontext inCreateSignalUcontextFromHost/ApplySignalUcontextToHostTested
On an M3 Pro MacBook Pro:
Windows and Linux code paths are unchanged.
@Nmzik on GitHub · 2026-07-31 01:31 UTC · original
@m1abdullahh WOW. Thanks for the quick response! Are you sure you tested it with the latest code? :) I’m amazed it still works on macOS! :D
github.com/KytyPS5/KytyPS5@2f5396c6a5@Nmzik on GitHub · 2026-07-31 01:46 UTC · original
@m1abdullahh This is APPLE guarded code. Thanks!
@m1abdullahh on GitHub · 2026-07-31 01:59 UTC · original
@Nmzik oh, you merged it already! nice! This PR was actually for another issue I encountered while running Metal Slug Tactics and this is a fix for that and this has been WIP for some days.
But, yeah, just before creating this PR and after we spoke on email, I did test this on top of latest code with both Raiden III and Metal Slug Tactics and I see MASSIVE fps improvements! great work there!
@m1abdullahh on GitHub · 2026-07-31 02:07 UTC · original
Actually, correction to what I just wrote: that testing was from just before #135 landed, so not quite the latest code. Prompted by your question I re-ran everything on current main including #135, and here is the accurate picture:
ecb48f9is fine (4/4 runs),2f5396ccrashes (6/6 runs). Metal Slug Tactics is not affected.Happy to dig further on real hardware, just tell me what you would like logged.
@Nmzik on GitHub · 2026-07-31 02:41 UTC · original
@m1abdullahh Thanks for testing the latest major change in #135. At least some games are running on the latest code.
@m1abdullahh on GitHub · 2026-07-31 02:51 UTC · original
I'll dig into the Raiden regression on my hardware and report back with a root cause. Since it hides from any instrumented build I'll have to get creative, so it may take a bit.