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=syrusakbary 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 <[email protected]>
  • Loading branch information
bors[bot] and Amanieu authored Mar 7, 2022
2 parents b04a41d + bee530b commit cf6b96e
Show file tree
Hide file tree
Showing 24 changed files with 782 additions and 956 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 cf6b96e

Please sign in to comment.