Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Implement a new stack and error handling model for the SourcePawn VM. #285
Most of the goodies about this change are in the commit message, so I'll do a different overview here. This patch continues to whittle away at the concept of a "context", this time by presenting a unified stack and error handling model in the API. Stack traces now follow all functions on the stack, including natives, and other plugins. It is now possible to grab a full stack trace at pretty much any point in time.
This unification also changes how errors are propagated. SourcePawn now internally throws exceptions (an error code and a message), which can be handled in C++. For compatibility,
For the most part, very little needs to change for Core developers or extension authors. Callers that care about the return value of
The last piece of note is that as part of this unification, the RP stack has been removed. Rather than maintain complex data structures while code is running, the new stack frame iterator has been taught to decode the layout of the JIT stack. This should be a significant performance improvement for tight loops, especially ones that make function calls.
The first benchmark I tried performs an empty call:
The second benchmark performs an empty native call:
The results on my Core-i5 laptop:
I'll take it.