-
Notifications
You must be signed in to change notification settings - Fork 699
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add interpreter support for exception handling
Details about the implementation approach: * Try blocks generate metadata tracking the instruction ranges for the handlers and which exception tags are handled (or if a `catch_all` is present). The metadata is stored in a function's `FuncDesc`, and is transferred into the `Frame` when a function call is executed. * The stack is unwound when a `throw` is executed. This unwinding also handles tag dispatch to the appropriate catch. The metadata to find the matching handler is looked up in the call `Frame` stack. * If a `try-delegate` is present, it is used in the stack unwinding process to skip over to the relevant handler. * A separate `exceptions_` stack in call frames tracks caught exceptions that can be accessed via a `rethrow`. The stack is popped on exit from a try block or when exiting via control instructions like `br`. * Because stack unwinding relies on finding metadata in the call frame, `return_call` needs to be modified slightly to adjust the current frame when executing the call, rather than re-using the frame completely as-is.
- Loading branch information
Showing
15 changed files
with
802 additions
and
29 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Oops, something went wrong.