Skip to content

Commit

Permalink
Merge #2807
Browse files Browse the repository at this point in the history
2807: Run Wasm code on a separate stack r=Amanieu a=Amanieu

This uses the [corosensei](https://crates.io/crates/corosensei) crate to
run Wasm code on a separate stack from the main thread stack.

In trap handlers for stack overflows and memory out of bounds accesses,
we can now check whether we are executing on the Wasm stack and reset
execution back to the main thread stack when returning from the trap
handler.

When Wasm code needs to perform an operation which may modify internal
data structures (e.g. growing a memory) then execution must switch back
to the main thread stack using on_host_stack. This is necessary to avoid
leaving internal data structure in an inconsistent state when a stack
overflow happens.

In the future, this can also be used to suspend execution of a Wasm
module (#1127) by modeling it as an async function call.

Fixes #2757
Fixes #2562


Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
  • Loading branch information
bors[bot] and Amanieu authored Mar 16, 2022
2 parents c5c72b9 + c4e1c5f commit fc794ab
Show file tree
Hide file tree
Showing 24 changed files with 820 additions and 952 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-sys.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ jobs:
- name: Install Nightly Rust for Headless
uses: actions-rs/toolchain@v1
with:
toolchain: 'nightly-2021-11-01'
toolchain: 'nightly-2022-02-08'
target: ${{ matrix.target }}
override: true
components: "rust-src"
Expand Down
Loading

0 comments on commit fc794ab

Please sign in to comment.