From 0d1f21c8242a076e4b4e3c93a1b208e365c77b34 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 6 Aug 2019 10:43:22 -0700 Subject: [PATCH 1/5] 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. --- .azure-pipelines.yml | 12 ----- wasmtime-runtime/Cargo.toml | 4 +- wasmtime-runtime/build.rs | 45 +++++-------------- .../signalhandlers/CMakeLists.txt | 12 ----- .../signalhandlers/SignalHandlers.cpp | 4 +- .../signalhandlers/SignalHandlers.hpp | 10 +---- wasmtime-runtime/src/signalhandlers.rs | 33 +++++++++----- 7 files changed, 39 insertions(+), 81 deletions(-) delete mode 100644 wasmtime-runtime/signalhandlers/CMakeLists.txt diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 7e4145b1457f..28b69b151cf5 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -63,12 +63,6 @@ jobs: submodules: true - template: ci/azure-install-rust.yml - - script: | - powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf %TEMP%\LLVM-8.0.0-win64.exe https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/LLVM-8.0.0-win64.exe" - %TEMP%\LLVM-8.0.0-win64.exe /S /NCRC - condition: eq(variables['Agent.OS'], 'Windows_NT') - displayName: Install clang (Windows) - - script: cargo fetch displayName: Fetch cargo dependencies @@ -118,12 +112,6 @@ jobs: - bash: echo "##vso[task.setvariable variable=RUSTC_VERSION;]`rustc --version`" displayName: Set rustc version string for caching - - script: | - powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf %TEMP%\LLVM-8.0.0-win64.exe https://rust-lang-ci2.s3.amazonaws.com/rust-ci-mirror/LLVM-8.0.0-win64.exe" - %TEMP%\LLVM-8.0.0-win64.exe /S /NCRC - condition: eq(variables['Agent.OS'], 'Windows_NT') - displayName: Install clang (Windows) - # - bash: | # set -e # curl -Lfo sccache.tar.gz https://github.com/mozilla/sccache/releases/download/0.2.9/sccache-0.2.9-x86_64-apple-darwin.tar.gz diff --git a/wasmtime-runtime/Cargo.toml b/wasmtime-runtime/Cargo.toml index fc4b0e07571c..6dfd96dc0831 100644 --- a/wasmtime-runtime/Cargo.toml +++ b/wasmtime-runtime/Cargo.toml @@ -29,9 +29,7 @@ indexmap = "1.0.2" winapi = { version = "0.3.6", features = ["winbase", "memoryapi"] } [build-dependencies] -cmake = "0.1.35" -bindgen = "0.51.0" -regex = "1.0.6" +cc = "1.0" [features] default = ["std"] diff --git a/wasmtime-runtime/build.rs b/wasmtime-runtime/build.rs index 2e855b6c9106..9c9355f87f70 100644 --- a/wasmtime-runtime/build.rs +++ b/wasmtime-runtime/build.rs @@ -1,37 +1,16 @@ -extern crate bindgen; -extern crate cmake; -extern crate regex; - -use cmake::Config; -use regex::Regex; -use std::env; -use std::path::PathBuf; - fn main() { - let dst = Config::new("signalhandlers").build(); - - println!("cargo:rustc-link-search=native={}", dst.display()); - println!("cargo:rustc-link-lib=static=SignalHandlers"); - - let mut bindings_builder = bindgen::Builder::default() - .header("signalhandlers/SignalHandlers.hpp") - .whitelist_type("TrapContext") - .whitelist_type("jmp_buf") - .whitelist_function("EnsureEagerSignalHandlers"); - - // If we're compiling for Darwin, compile in extra Darwin support routines. - if Regex::new(r"-darwin[[:digit:].]*$") - .unwrap() - .is_match(&env::var("TARGET").unwrap()) - { - bindings_builder = bindings_builder.whitelist_function("EnsureDarwinMachPorts"); + println!("cargo:rerun-if-changed=signalhandlers/SignalHandlers.cpp"); + println!("cargo:rerun-if-changed=signalhandlers/SignalHandlers.hpp"); + let target = std::env::var("TARGET").unwrap(); + let mut build = cc::Build::new(); + build.cpp(true) + .warnings(false) + .file("signalhandlers/SignalHandlers.cpp"); + if !target.contains("windows") { + build.flag("-std=c++11") + .flag("-fno-exceptions") + .flag("-fno-rtti"); } - let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); - - bindings_builder - .generate() - .expect("Unable to generate bindings") - .write_to_file(out_path.join("signalhandlers.rs")) - .expect("Couldn't write bindings!"); + build.compile("signalhandlers"); } diff --git a/wasmtime-runtime/signalhandlers/CMakeLists.txt b/wasmtime-runtime/signalhandlers/CMakeLists.txt deleted file mode 100644 index b1568f267663..000000000000 --- a/wasmtime-runtime/signalhandlers/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -cmake_minimum_required(VERSION 3.0) -project(SignalHandlers CXX) - -if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - set(CMAKE_CXX_FLAGS "-std=c++11 -fno-exceptions -fno-rtti -fPIC") -else( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - set(CMAKE_CXX_FLAGS "-m32 -std=c++11 -fno-exceptions -fno-rtti -fPIC") -endif( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - -add_library(SignalHandlers STATIC SignalHandlers.cpp) - -install(TARGETS SignalHandlers DESTINATION .) diff --git a/wasmtime-runtime/signalhandlers/SignalHandlers.cpp b/wasmtime-runtime/signalhandlers/SignalHandlers.cpp index 588ac8e3412d..3f3635f11d29 100644 --- a/wasmtime-runtime/signalhandlers/SignalHandlers.cpp +++ b/wasmtime-runtime/signalhandlers/SignalHandlers.cpp @@ -668,7 +668,7 @@ WasmTrapHandler(int signum, siginfo_t* info, void* context) extern "C" MFBT_API bool IsSignalHandlingBroken(); #endif -bool +int EnsureEagerSignalHandlers() { #if defined(ANDROID) && defined(MOZ_LINKER) @@ -765,7 +765,7 @@ EnsureEagerSignalHandlers() return true; } -bool +int EnsureDarwinMachPorts() { #ifdef USE_APPLE_MACH_PORTS diff --git a/wasmtime-runtime/signalhandlers/SignalHandlers.hpp b/wasmtime-runtime/signalhandlers/SignalHandlers.hpp index a7214e92fa80..d5c55f0ccb62 100644 --- a/wasmtime-runtime/signalhandlers/SignalHandlers.hpp +++ b/wasmtime-runtime/signalhandlers/SignalHandlers.hpp @@ -17,12 +17,6 @@ void RecordTrap(const uint8_t* pc); // Initiate an unwind. void Unwind(void); -// Trap initialization state. -struct TrapContext { - bool triedToInstallSignalHandlers; - bool haveSignalHandlers; -}; - // This function performs the low-overhead signal handler initialization that we // want to do eagerly to ensure a more-deterministic global process state. This // is especially relevant for signal handlers since handler ordering depends on @@ -31,14 +25,14 @@ struct TrapContext { // called at the end of the startup process, after other handlers have been // installed. This function can thus be called multiple times, having no effect // after the first call. -bool +int EnsureEagerSignalHandlers(void); // Assuming EnsureEagerProcessSignalHandlers() has already been called, // this function performs the full installation of signal handlers which must // be performed per-thread. This operation may incur some overhead and // so should be done only when needed to use wasm. -bool +int EnsureDarwinMachPorts(void); #ifdef __cplusplus diff --git a/wasmtime-runtime/src/signalhandlers.rs b/wasmtime-runtime/src/signalhandlers.rs index b9cc41c0ae0d..419f69acc165 100644 --- a/wasmtime-runtime/src/signalhandlers.rs +++ b/wasmtime-runtime/src/signalhandlers.rs @@ -6,10 +6,22 @@ use crate::vmcontext::VMContext; use core::borrow::{Borrow, BorrowMut}; -use core::cell::RefCell; +use core::cell::Cell; use std::sync::RwLock; -include!(concat!(env!("OUT_DIR"), "/signalhandlers.rs")); +pub type jmp_buf = [u64; 16]; + +#[derive(Default)] +struct TrapContext { + tried_to_install_signal_handlers: Cell, + have_signal_handlers: Cell, +} + +extern "C" { + fn EnsureEagerSignalHandlers() -> libc::c_int; + #[cfg(any(target_os = "macos", target_os = "ios"))] + fn EnsureDarwinMachPorts() -> libc::c_int; +} struct InstallState { tried: bool, @@ -50,7 +62,7 @@ pub extern "C" fn wasmtime_init_eager() { state.tried = true; assert!(!state.success); - if !unsafe { EnsureEagerSignalHandlers() } { + if unsafe { EnsureEagerSignalHandlers() == 0 } { return; } @@ -58,8 +70,7 @@ pub extern "C" fn wasmtime_init_eager() { } thread_local! { - static TRAP_CONTEXT: RefCell = - RefCell::new(TrapContext { triedToInstallSignalHandlers: false, haveSignalHandlers: false }); + static TRAP_CONTEXT: TrapContext = TrapContext::default(); } /// Assuming `EnsureEagerProcessSignalHandlers` has already been called, @@ -68,10 +79,10 @@ thread_local! { /// so should be done only when needed to use wasm. #[no_mangle] pub extern "C" fn wasmtime_init_finish(vmctx: &mut VMContext) { - if !TRAP_CONTEXT.with(|cx| cx.borrow().triedToInstallSignalHandlers) { + if !TRAP_CONTEXT.with(|cx| cx.tried_to_install_signal_handlers.get()) { TRAP_CONTEXT.with(|cx| { - cx.borrow_mut().triedToInstallSignalHandlers = true; - assert!(!cx.borrow().haveSignalHandlers); + cx.tried_to_install_signal_handlers.set(true); + assert!(!cx.have_signal_handlers.get()); }); { @@ -90,12 +101,12 @@ pub extern "C" fn wasmtime_init_finish(vmctx: &mut VMContext) { ensure_darwin_mach_ports(); TRAP_CONTEXT.with(|cx| { - cx.borrow_mut().haveSignalHandlers = true; + cx.have_signal_handlers.set(true); }) } let instance = unsafe { vmctx.instance() }; - let have_signal_handlers = TRAP_CONTEXT.with(|cx| cx.borrow().haveSignalHandlers); + let have_signal_handlers = TRAP_CONTEXT.with(|cx| cx.have_signal_handlers.get()); if !have_signal_handlers && instance.needs_signal_handlers() { panic!("failed to install signal handlers"); } @@ -113,7 +124,7 @@ fn ensure_darwin_mach_ports() { state.tried = true; assert!(!state.success); - if !unsafe { EnsureDarwinMachPorts() } { + if unsafe { EnsureDarwinMachPorts() != 0 } { return; } From 9db595fea3faed93fab3826d7e4753a776b365a5 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 6 Aug 2019 11:02:38 -0700 Subject: [PATCH 2/5] 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 --- wasmtime-runtime/build.rs | 4 +- .../signalhandlers/SignalHandlers.hpp | 4 +- .../signalhandlers/Trampolines.cpp | 37 ++++++ wasmtime-runtime/src/signalhandlers.rs | 2 - wasmtime-runtime/src/traphandlers.rs | 106 +++++------------- 5 files changed, 74 insertions(+), 79 deletions(-) create mode 100644 wasmtime-runtime/signalhandlers/Trampolines.cpp diff --git a/wasmtime-runtime/build.rs b/wasmtime-runtime/build.rs index 9c9355f87f70..490b57a01031 100644 --- a/wasmtime-runtime/build.rs +++ b/wasmtime-runtime/build.rs @@ -1,11 +1,13 @@ fn main() { println!("cargo:rerun-if-changed=signalhandlers/SignalHandlers.cpp"); println!("cargo:rerun-if-changed=signalhandlers/SignalHandlers.hpp"); + println!("cargo:rerun-if-changed=signalhandlers/Trampolines.cpp"); let target = std::env::var("TARGET").unwrap(); let mut build = cc::Build::new(); build.cpp(true) .warnings(false) - .file("signalhandlers/SignalHandlers.cpp"); + .file("signalhandlers/SignalHandlers.cpp") + .file("signalhandlers/Trampolines.cpp"); if !target.contains("windows") { build.flag("-std=c++11") .flag("-fno-exceptions") diff --git a/wasmtime-runtime/signalhandlers/SignalHandlers.hpp b/wasmtime-runtime/signalhandlers/SignalHandlers.hpp index d5c55f0ccb62..3e9806528326 100644 --- a/wasmtime-runtime/signalhandlers/SignalHandlers.hpp +++ b/wasmtime-runtime/signalhandlers/SignalHandlers.hpp @@ -14,7 +14,9 @@ extern "C" { // Record the Trap code and wasm bytecode offset in TLS somewhere void RecordTrap(const uint8_t* pc); -// Initiate an unwind. +void* EnterScope(void*); +void LeaveScope(void*); +void* GetScope(void); void Unwind(void); // This function performs the low-overhead signal handler initialization that we diff --git a/wasmtime-runtime/signalhandlers/Trampolines.cpp b/wasmtime-runtime/signalhandlers/Trampolines.cpp new file mode 100644 index 000000000000..93cb41bd58de --- /dev/null +++ b/wasmtime-runtime/signalhandlers/Trampolines.cpp @@ -0,0 +1,37 @@ +#include + +#include "SignalHandlers.hpp" + +extern "C" +int WasmtimeCallTrampoline(void *vmctx, void (*body)(void*, void*), void *args) { + jmp_buf buf; + void *prev; + if (setjmp(buf) != 0) { + LeaveScope(prev); + return 0; + } + prev = EnterScope(&buf); + body(vmctx, args); + LeaveScope(prev); + return 1; +} + +extern "C" +int WasmtimeCall(void *vmctx, void (*body)(void*)) { + jmp_buf buf; + void *prev; + if (setjmp(buf) != 0) { + LeaveScope(prev); + return 0; + } + prev = EnterScope(&buf); + body(vmctx); + LeaveScope(prev); + return 1; +} + +extern "C" +void Unwind() { + jmp_buf *buf = (jmp_buf*) GetScope(); + longjmp(*buf, 1); +} diff --git a/wasmtime-runtime/src/signalhandlers.rs b/wasmtime-runtime/src/signalhandlers.rs index 419f69acc165..a383e5499571 100644 --- a/wasmtime-runtime/src/signalhandlers.rs +++ b/wasmtime-runtime/src/signalhandlers.rs @@ -9,8 +9,6 @@ use core::borrow::{Borrow, BorrowMut}; use core::cell::Cell; use std::sync::RwLock; -pub type jmp_buf = [u64; 16]; - #[derive(Default)] struct TrapContext { tried_to_install_signal_handlers: Cell, diff --git a/wasmtime-runtime/src/traphandlers.rs b/wasmtime-runtime/src/traphandlers.rs index 76a4cde7adf2..5c13f3b22add 100644 --- a/wasmtime-runtime/src/traphandlers.rs +++ b/wasmtime-runtime/src/traphandlers.rs @@ -1,28 +1,26 @@ //! WebAssembly trap handling, which is built on top of the lower-level //! signalhandling mechanisms. -use crate::signalhandlers::jmp_buf; use crate::vmcontext::{VMContext, VMFunctionBody}; -use core::cell::{Cell, RefCell}; -use core::mem; +use core::cell::Cell; use core::ptr; -use libc::c_int; use std::string::String; -use std::vec::Vec; -// Currently we uset setjmp/longjmp to unwind out of a signal handler -// and back to the point where WebAssembly was called (via `call_wasm`). -// This works because WebAssembly code currently does not use any EH -// or require any cleanups, and we never unwind through non-wasm frames. -// In the future, we'll likely replace this with fancier stack unwinding. extern "C" { - fn setjmp(env: *mut jmp_buf) -> c_int; - fn longjmp(env: *const jmp_buf, val: c_int) -> !; + fn WasmtimeCallTrampoline( + vmctx: *mut u8, + callee: *const VMFunctionBody, + values_vec: *mut u8, + ) -> i32; + fn WasmtimeCall( + vmctx: *mut u8, + callee: *const VMFunctionBody, + ) -> i32; } thread_local! { static TRAP_PC: Cell<*const u8> = Cell::new(ptr::null()); - static JMP_BUFS: RefCell> = RefCell::new(Vec::new()); + static JMP_BUF: Cell<*const u8> = Cell::new(ptr::null()); } /// Record the Trap code and wasm bytecode offset in TLS somewhere @@ -34,43 +32,25 @@ pub extern "C" fn RecordTrap(pc: *const u8) { TRAP_PC.with(|data| data.set(pc)); } -/// Initiate an unwind. #[doc(hidden)] #[allow(non_snake_case)] #[no_mangle] -pub extern "C" fn Unwind() { - JMP_BUFS.with(|bufs| { - let buf = bufs.borrow_mut().pop().unwrap(); - unsafe { longjmp(&buf, 1) }; - }) +pub extern "C" fn EnterScope(ptr: *const u8) -> *const u8 { + JMP_BUF.with(|buf| buf.replace(ptr)) } -/// A simple guard to ensure that `JMP_BUFS` is reset when we're done. -struct ScopeGuard { - orig_num_bufs: usize, -} - -impl ScopeGuard { - fn new() -> Self { - assert_eq!( - TRAP_PC.with(Cell::get), - ptr::null(), - "unfinished trap detected" - ); - Self { - orig_num_bufs: JMP_BUFS.with(|bufs| bufs.borrow().len()), - } - } +#[doc(hidden)] +#[allow(non_snake_case)] +#[no_mangle] +pub extern "C" fn GetScope() -> *const u8 { + JMP_BUF.with(|buf| buf.get()) } -impl Drop for ScopeGuard { - fn drop(&mut self) { - let orig_num_bufs = self.orig_num_bufs; - JMP_BUFS.with(|bufs| { - bufs.borrow_mut() - .resize(orig_num_bufs, unsafe { mem::zeroed() }) - }); - } +#[doc(hidden)] +#[allow(non_snake_case)] +#[no_mangle] +pub extern "C" fn LeaveScope(ptr: *const u8) { + JMP_BUF.with(|buf| buf.set(ptr)) } fn trap_message(_vmctx: *mut VMContext) -> String { @@ -82,10 +62,6 @@ fn trap_message(_vmctx: *mut VMContext) -> String { format!("wasm trap at {:?}", pc) } -fn push_jmp_buf(buf: jmp_buf) { - JMP_BUFS.with(|bufs| bufs.borrow_mut().push(buf)); -} - /// Call the wasm function pointed to by `callee`. `values_vec` points to /// a buffer which holds the incoming arguments, and to which the outgoing /// return values will be written. @@ -95,21 +71,11 @@ pub unsafe extern "C" fn wasmtime_call_trampoline( callee: *const VMFunctionBody, values_vec: *mut u8, ) -> Result<(), String> { - // Reset JMP_BUFS if the stack is unwound through this point. - let _guard = ScopeGuard::new(); - - // Set a setjmp catch point. - let mut buf = mem::uninitialized(); - if setjmp(&mut buf) != 0 { - return Err(trap_message(vmctx)); + if WasmtimeCallTrampoline(vmctx as *mut u8, callee, values_vec) == 0 { + Err(trap_message(vmctx)) + } else { + Ok(()) } - push_jmp_buf(buf); - - // Call the function! - let func: fn(*mut VMContext, *mut u8) = mem::transmute(callee); - func(vmctx, values_vec); - - Ok(()) } /// Call the wasm function pointed to by `callee`, which has no arguments or @@ -119,19 +85,9 @@ pub unsafe extern "C" fn wasmtime_call( vmctx: *mut VMContext, callee: *const VMFunctionBody, ) -> Result<(), String> { - // Reset JMP_BUFS if the stack is unwound through this point. - let _guard = ScopeGuard::new(); - - // Set a setjmp catch point. - let mut buf = mem::uninitialized(); - if setjmp(&mut buf) != 0 { - return Err(trap_message(vmctx)); + if WasmtimeCall(vmctx as *mut u8, callee) == 0 { + Err(trap_message(vmctx)) + } else { + Ok(()) } - push_jmp_buf(buf); - - // Call the function! - let func: fn(*mut VMContext) = mem::transmute(callee); - func(vmctx); - - Ok(()) } From 03a91a579fdcc50c2de466624025c6b555c801f6 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 7 Aug 2019 06:58:27 -0700 Subject: [PATCH 3/5] rustfmt --- wasmtime-runtime/build.rs | 6 ++++-- wasmtime-runtime/src/traphandlers.rs | 5 +---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/wasmtime-runtime/build.rs b/wasmtime-runtime/build.rs index 490b57a01031..a2db1468e8f9 100644 --- a/wasmtime-runtime/build.rs +++ b/wasmtime-runtime/build.rs @@ -4,12 +4,14 @@ fn main() { println!("cargo:rerun-if-changed=signalhandlers/Trampolines.cpp"); let target = std::env::var("TARGET").unwrap(); let mut build = cc::Build::new(); - build.cpp(true) + build + .cpp(true) .warnings(false) .file("signalhandlers/SignalHandlers.cpp") .file("signalhandlers/Trampolines.cpp"); if !target.contains("windows") { - build.flag("-std=c++11") + build + .flag("-std=c++11") .flag("-fno-exceptions") .flag("-fno-rtti"); } diff --git a/wasmtime-runtime/src/traphandlers.rs b/wasmtime-runtime/src/traphandlers.rs index 5c13f3b22add..360c392d2f94 100644 --- a/wasmtime-runtime/src/traphandlers.rs +++ b/wasmtime-runtime/src/traphandlers.rs @@ -12,10 +12,7 @@ extern "C" { callee: *const VMFunctionBody, values_vec: *mut u8, ) -> i32; - fn WasmtimeCall( - vmctx: *mut u8, - callee: *const VMFunctionBody, - ) -> i32; + fn WasmtimeCall(vmctx: *mut u8, callee: *const VMFunctionBody) -> i32; } thread_local! { From b6720334aadf7cf22c9d1e8ab13920e267a53ea8 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 7 Aug 2019 06:58:30 -0700 Subject: [PATCH 4/5] Use volatile loads/stores --- wasmtime-runtime/signalhandlers/Trampolines.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wasmtime-runtime/signalhandlers/Trampolines.cpp b/wasmtime-runtime/signalhandlers/Trampolines.cpp index 93cb41bd58de..4c6bbcc31056 100644 --- a/wasmtime-runtime/signalhandlers/Trampolines.cpp +++ b/wasmtime-runtime/signalhandlers/Trampolines.cpp @@ -5,7 +5,7 @@ extern "C" int WasmtimeCallTrampoline(void *vmctx, void (*body)(void*, void*), void *args) { jmp_buf buf; - void *prev; + void *volatile prev; if (setjmp(buf) != 0) { LeaveScope(prev); return 0; @@ -19,7 +19,7 @@ int WasmtimeCallTrampoline(void *vmctx, void (*body)(void*, void*), void *args) extern "C" int WasmtimeCall(void *vmctx, void (*body)(void*)) { jmp_buf buf; - void *prev; + void *volatile prev; if (setjmp(buf) != 0) { LeaveScope(prev); return 0; From 9cda8dc35175e8631d60355e57e4cb6e8b545ef1 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 7 Aug 2019 06:59:55 -0700 Subject: [PATCH 5/5] Remove mention of cmake from README --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 486142136377..2f822ca1590c 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,11 @@ obtain a full checkout, like this: git clone --recurse-submodules https://github.com/CraneStation/wasmtime.git ``` -To build Wasmtime, install cmake and clang, and then build with cargo, such -as with "cargo build --release". For information on installing clang, see -[rust-bindgen's documentation](https://github.com/rust-lang/rust-bindgen/blob/master/book/src/requirements.md). +To build an optimized version of Wasmtime, use Cargo: + +``` +cargo build --release +``` There are Rust, C, and C++ toolchains that can compile programs with WASI. See the [WASI intro][WASI intro] for more information, and the [WASI tutorial][WASI tutorial]