From 5c5ecfff7d3a7184ed69be7a8296d1abf02abb72 Mon Sep 17 00:00:00 2001 From: losfair Date: Thu, 4 Jul 2019 01:27:19 +0800 Subject: [PATCH] Rename `alternative_stack` to `fault`. --- lib/runtime-core/image-loading-linux-x86-64.s | 2 +- lib/runtime-core/image-loading-macos-x86-64.s | 2 +- lib/runtime-core/src/{alternative_stack.rs => fault.rs} | 0 lib/runtime-core/src/lib.rs | 2 +- lib/runtime-core/src/state.rs | 2 +- lib/runtime-core/src/vm.rs | 2 +- lib/singlepass-backend/src/codegen_x64.rs | 3 +++ lib/singlepass-backend/src/protect_unix.rs | 2 +- src/bin/wasmer.rs | 2 +- 9 files changed, 10 insertions(+), 7 deletions(-) rename lib/runtime-core/src/{alternative_stack.rs => fault.rs} (100%) diff --git a/lib/runtime-core/image-loading-linux-x86-64.s b/lib/runtime-core/image-loading-linux-x86-64.s index a1d8aef03..37ed0f986 100644 --- a/lib/runtime-core/image-loading-linux-x86-64.s +++ b/lib/runtime-core/image-loading-linux-x86-64.s @@ -1,4 +1,4 @@ -# NOTE: Keep this consistent with `alternative_stack.rs`. +# NOTE: Keep this consistent with `fault.rs`. .globl run_on_alternative_stack run_on_alternative_stack: diff --git a/lib/runtime-core/image-loading-macos-x86-64.s b/lib/runtime-core/image-loading-macos-x86-64.s index 416896f1d..a6a307f1f 100644 --- a/lib/runtime-core/image-loading-macos-x86-64.s +++ b/lib/runtime-core/image-loading-macos-x86-64.s @@ -1,4 +1,4 @@ -# NOTE: Keep this consistent with `alternative_stack.rs`. +# NOTE: Keep this consistent with `fault.rs`. .globl _run_on_alternative_stack _run_on_alternative_stack: diff --git a/lib/runtime-core/src/alternative_stack.rs b/lib/runtime-core/src/fault.rs similarity index 100% rename from lib/runtime-core/src/alternative_stack.rs rename to lib/runtime-core/src/fault.rs diff --git a/lib/runtime-core/src/lib.rs b/lib/runtime-core/src/lib.rs index c8da29509..52b7cf82a 100644 --- a/lib/runtime-core/src/lib.rs +++ b/lib/runtime-core/src/lib.rs @@ -44,7 +44,7 @@ pub mod vmcalls; #[cfg(all(unix, target_arch = "x86_64"))] pub use trampoline_x64 as trampoline; #[cfg(all(unix, target_arch = "x86_64"))] -pub mod alternative_stack; +pub mod fault; pub mod state; use self::error::CompileResult; diff --git a/lib/runtime-core/src/state.rs b/lib/runtime-core/src/state.rs index 45d6b54a2..4bb7e6d65 100644 --- a/lib/runtime-core/src/state.rs +++ b/lib/runtime-core/src/state.rs @@ -362,7 +362,7 @@ impl InstanceImage { #[cfg(all(unix, target_arch = "x86_64"))] pub mod x64 { use super::*; - use crate::alternative_stack::{catch_unsafe_unwind, run_on_alternative_stack}; + use crate::fault::{catch_unsafe_unwind, run_on_alternative_stack}; use crate::codegen::BkptMap; use crate::structures::TypedIndex; use crate::types::LocalGlobalIndex; diff --git a/lib/runtime-core/src/vm.rs b/lib/runtime-core/src/vm.rs index 6518e4577..ffc517910 100644 --- a/lib/runtime-core/src/vm.rs +++ b/lib/runtime-core/src/vm.rs @@ -211,7 +211,7 @@ fn get_intrinsics_for_module(m: &ModuleInfo) -> *const Intrinsics { #[cfg(all(unix, target_arch = "x86_64"))] fn get_interrupt_signal_mem() -> *mut u8 { - unsafe { crate::alternative_stack::get_wasm_interrupt_signal_mem() } + unsafe { crate::fault::get_wasm_interrupt_signal_mem() } } #[cfg(not(all(unix, target_arch = "x86_64")))] diff --git a/lib/singlepass-backend/src/codegen_x64.rs b/lib/singlepass-backend/src/codegen_x64.rs index b99b2acb9..1163575fb 100644 --- a/lib/singlepass-backend/src/codegen_x64.rs +++ b/lib/singlepass-backend/src/codegen_x64.rs @@ -1236,6 +1236,9 @@ impl X64FunctionCode { match *param { Location::GPR(x) => { let content = m.state.register_values[X64Register::GPR(x).to_index().0]; + // FIXME: There might be some corner cases (release -> emit_call_sysv -> acquire?) that cause this assertion to fail. + // Hopefully nothing would be incorrect at runtime. + //assert!(content != MachineValue::Undefined); m.state.stack_values.push(content); } diff --git a/lib/singlepass-backend/src/protect_unix.rs b/lib/singlepass-backend/src/protect_unix.rs index 8160e7891..bf8274beb 100644 --- a/lib/singlepass-backend/src/protect_unix.rs +++ b/lib/singlepass-backend/src/protect_unix.rs @@ -11,7 +11,7 @@ //! use std::any::Any; use std::cell::Cell; -use wasmer_runtime_core::alternative_stack::{ +use wasmer_runtime_core::fault::{ begin_unsafe_unwind, catch_unsafe_unwind, ensure_sighandler, }; use wasmer_runtime_core::codegen::BkptMap; diff --git a/src/bin/wasmer.rs b/src/bin/wasmer.rs index 9b812194a..405fdcb27 100644 --- a/src/bin/wasmer.rs +++ b/src/bin/wasmer.rs @@ -514,7 +514,7 @@ fn execute_wasm(options: &Run) -> Result<(), String> { #[cfg(feature = "backend:singlepass")] unsafe { if options.backend == Backend::Singlepass { - use wasmer_runtime_core::alternative_stack::{ + use wasmer_runtime_core::fault::{ catch_unsafe_unwind, ensure_sighandler, }; use wasmer_runtime_core::state::{