Commit Graph

5 Commits

Author SHA1 Message Date
Peter Huene
920728d14d Implement registering JIT unwind information on Windows.
This commit implements registering unwind information for JIT functions on
Windows so that the operating system can both walk and unwind stacks containing
JIT frames.

Currently this only works with Cranelift as lightbeam does not emit unwind
information yet.

This commit also resets the stack guard page on Windows for stack overflow
exceptions, allowing reliable stack overflow traps.

With these changes, all previously disabled test suite tests (not including
the multi-value tests) on Windows are now passing.

Fixes #291.
2019-11-06 20:27:32 -08:00
Artur Jamro
fa9175f9e5 Trap registry 2019-09-25 17:56:08 -07:00
Alex Crichton
6def6de5e0 Remove the LLVM/bindgen/cmake dependencies from wasmtime-runtime (#253)
* Remove cmake/bindgen/llvm from wasmtime-runtime

This commit removes the cmake/bindgen dependency (which removes the need
for `llvm-config`) from the `wasmtime-runtime` crate. The C++ code is
instead compiled with the `cc` crate (it's just one file anyway) and the
interface is handwritten since it's quite small anyway.

Some other changes are:

* The `TrapContext` type in C++ was removed since it was unused, and it
  was moved to Rust with a `Cell` on each field.

* Functions between Rust/C++ now return `int` instead of `bool` to make
  them a bit more FFI compatible portably.

* The `jmp_buf` type has a workaround that will be fixed in the next commit.

* Move setjmp/longjmp to C++

This commit moves the definition of setjmp and longjmp into C++. This is
primarily done because it's [debatable whether it's possible to call
`setjmp` from Rust][rfc]. The semantics of `setjmp` are that it returns
twice but LLVM doesn't actually know about this because rustc isn't
telling LLVM this information, so it's unclear whether it can ever be
safe.

Additionally this removes the need for Rust code to know the definition
of `jmp_buf` which is a pretty hairy type to define in Rust across
platforms.

The solution in this commit is to move all setjmp/longjmp code to C++,
and that way we should be able to guarantee that jumps over wasm JIT
code should always go from C++ to C++, removing Rust from the equation
for now from needing to get any fiddly bits working across platforms.
This should overall help it be a bit more portable and also means Rust
doesn't have to know about `jmp_buf` as a type.

The previous `Vec` of `jmp_buf` is now replaced with one thread-local
pointer where previous values are stored on the stack and restored when
the function returns. This is intended to be functionally the same as
the previous implementation.

[rfc]: https://github.com/rust-lang/rfcs/issues/2625

* rustfmt

* Use volatile loads/stores

* Remove mention of cmake from README
2019-08-09 10:11:13 +02:00
Henrik Rydgård
f5ebdb8e6a Get wasmtime building on Windows. (#92)
* Get wasmtime building on Windows.

Requires LLVM binaries from http://releases.llvm.org/download.html at
build time (bindgen).
2019-04-03 06:50:38 -07:00
Dan Gohman
db0abe8431 Move the wasmtime crate directories form lib/* to wasmtime-*.
This follows a similar change to Cranelift made here:

https://github.com/CraneStation/cranelift/pull/660
2019-03-20 11:30:28 -07:00