pcsx2
pcsx2 copied to clipboard
Misc: Remove all C++ exceptions from PCSX2
Description of Changes
Despite what jake's blog posts from years ago say, exceptions are not free.
- They further complicate the control flow of the function, potentially implicating optimizations.
- They bloat the heck out of the binary (disabling them shaved approx. 2MB on pcsx2-qt, and 30% in pcsx2-gsrunner).
- They're slow as heck if you actually throw.
- And most importantly, they're difficult to reason about. How are you supposed to know which functions throw what exceptions? You won't know until you get a random crash, or worse, inconsistent behaviour because it propagated up the call stack, some memory didn't get freed, your program's in an inconsistent state, etc. Java has this right in forcing you to declare what is thrown, and handle it, or pass it up.
First wx was gone, now exceptions are gone. Thank gosh.
Rationale behind Changes
Smaller binary. More maintainable code. Developers are less inclined to feel the need to grab their nearest bottle of glue when reading PCSX2 sources.
Suggested Testing Steps
Check save states. Check achievements. Check sound on Linux and Windows. If you know of any games which previously caused out-of-video-memory in GS, try those. I've changed the behaviour so it purges the pool and tries again, before cancelling the draw.