forked from bytecodealliance/wasmtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In resume instruction, update StackLimits from generated code (#223)
This PR is part of a series that implements native stack switching. This particular PR moves one particular aspect out of the `tc_resume` libcall: Updating the `StackLimits` object of the parent of the continuation being resumed. Doing this *inside* the libcall had practical reasons: We needed access to the updated `last_wasm_exit_pc`/`last_wasm_exit_fp` value in the `VMRuntimeLimits` in order to copy them into the `StackLimits`. However, these values are only updated by the libcall mechanism itself, so they are only available inside the libcall implementation itself. This PR obtains the corresponding values using code generated for `resume`, before the actual `tc_resume` libcall happening, and writes them into the `StackLimits`. 1. We use the `get_frame_pointer` instruction to obtain a value for `last_wasm_exit_fp`. 2. The value for `last_wasm_exit_pc` is obtained using a new CLIF instruction, `get_instruction_pointer`. All this does is giving us some instruction pointer that is guaranteed to be associated with the current Wasm instruction being translated (i.e., `resume` in our case). While this means that we will write slightly different values for `last_wasm_exit_pc` into the `StackLimits` than before, this difference does not matter at all for backtrace creation. `last_wasm_exit_pc` is never used for control flow (i.e., it is never branched to), all that matters is what Wasm instruction it is associated with. I consider this to be a workaround, once native stack switching is fully rolled out it would be nice to overhaul the whole backtrace generation mechanism in the longer term. But this PR's goal is to make it possible to move to native stack switching with as little changes to backtrace creation as possible.
- Loading branch information
1 parent
8a25022
commit 46da60f
Showing
11 changed files
with
146 additions
and
41 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
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
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