forked from bytecodealliance/wasmtime
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Codegen for switch instructions (#264)
This PR provides the missing piece to support `switch` instructions, by adding the necessary codegen (but only for the optimized implementation, support in the baseline implementation is not included). Thus, the main change is the addition of `wasmtime_cranelift::wasmfx::optimized::translate_switch`. In general, the implementation piggybacks on #256: On `resume`, we now fill the `HandlerList` with _m_ entries for all tags with suspend handlers, followed by _n_ entries for all tags with switch handlers. The `search_handler` code is changed so that on `suspend` and `switch`, we look in the correct part of the `HandlerList`. We could use two separate `HandlerLists` instead, but then we would have yet another allocation to manage, so putting both kinds of tags into the same list, and then only searching part of it seems preferable. A few more notes: - `translate_resume` and `translate_switch` now return a `WasmResult`. This is used so that the baseline implementation can bail out without needing to `panic`. - The test runner in `stack_switchting.rs` now takes an extra parameter that allows us to enable the gc proposal, which is required for the tests using recursive types. --------- Co-authored-by: Daniel Hillerström <[email protected]>
- Loading branch information
1 parent
55a486a
commit 8b79a23
Showing
19 changed files
with
1,131 additions
and
72 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
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.