This commit extracts changes to core libraries made in the WASIX branch.
It is not reasonable to extract the partial commit history, so this is
just a batch commit.
The history will make a bit more sense again if we decide to merge the
WASIX branch with full commit history.
The Universal type was essentially a builder of engines that's given a
compiler backend and creates an Engine with .engine() method. The name
was not clear.
Since there's one engine now, it doesn't make sense to initialize a
`Store` with the engine specifically. It's an extra redundant step for
the API user.
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#2757Fixes#2562
Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>