-
Notifications
You must be signed in to change notification settings - Fork 645
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a single setjmp for exceptions in native backend
Summary: Avoid having multiple setjmp invocations (in loops, etc) and set up the native backend's exception handling in the same way the JIT will have to. There's a single `setjmp` call at the start of the function if there's a try anywhere in the function. There's a dynamic lookup for the catch handler in case it's caught. Because we have access to TryStart and TryEnd instructions, use that information to update a `tryState` number, then switch on `tryState` to determine which catch handler to use, if any. If the `tryState` is `0`, there's no handler at the current point, so we propagate the exception by using `_sh_throw_current`. Call `_sh_end_try` whenever we return from the function or rethrow an exception out of the function. Note that this doesn't affect functions without `try` at all, because they never call `setjmp`. Reviewed By: neildhar Differential Revision: D64148520 fbshipit-source-id: 8b4e449e4decd7330a34a5cfcc75be4b873bbdb1
- Loading branch information
1 parent
e2f851b
commit 54b2b10
Showing
3 changed files
with
115 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters