A lightweight WebAssembly runtime that is fast, secure, and standards-compliant
[stack-switching] Interop with ASan (#14398)
Daniel Hillerström11eac9de8693
diff --git a/crates/cranelift/src/func_environ.rs b/crates/cranelift/src/func_environ.rsindex b8f0f6a943..739bd3c0f2 100644--- a/crates/cranelift/src/func_environ.rs+++ b/crates/cranelift/src/func_environ.rs@@ -60,6 +60,23 @@ pub(crate) struct VMPayloadStackSlots {pub(crate) gc_ref_markers: Option<ir::StackSlot>,}+/// Function-local support used while translating stack-switching+/// operations.+#[derive(Default)]+struct StackSwitchingSupport {+ /// A stack slot backing the current stack's `handler_list` field.+ handler_list_buffer: Option<ir::StackSlot>,++ /// Stack slots backing the current continuation's `values` field.+ values_storage: Option<VMPayloadStackSlots>,++ /// Reusable result storage for the `get_interned_contref` builtin.+ contref_result_storage: Option<ir::StackSlot>,++ /// Reusable result storage for ASan's fake-stack pointer.+ asan_fake_stack_storage: Option<ir::StackSlot>,+}+#[derive(Copy, Clone, Debug)]pub(crate) enum Extension {Sign,@@ -225,17 +242,8 @@ pub struct FuncEnvironment<'module_environment> {/// into the host to trap when signal handlers are disabled.pub(crate) stack_limit_at_function_entry: Option<VmctxLoadChain>,- /// Used by the stack switching feature. If set, we have a allocated a- /// slot on this function's stack to be used for the- /// current stack's `handler_list` field.- stack_switching_handler_list_buffer: Option<ir::StackSlot>,-- /// Used by the stack switching feature. If set, these are the stack slots- /// backing the current continuation's `values` field.- stack_switching_values_storage: Option<VMPayloadStackSlots>,-- /// Reusable storage for `get_interned_contref` builtin.- stack_switching_cont_ref_result_storage: Option<ir::StackSlot>,+ /// Function-local support for translating stack-switching operations.+ stack_switching: StackSwitchingSupport,/// The stack-slot used for exposing Wasm state via debug/// instrumentation, if any, and the builder containing its metadata.@@ -315,9 +323,7 @@ impl<'module_environment> FuncEnvironment<'module_environment> {stack_limit_at_function_entry: None,- stack_switching_handler_list_buffer: None,- stack_switching_values_storage: None,- stack_switching_cont_ref_result_storage: None,+ stack_switching: StackSwitchingSupport::default(),state_slot: None,next_srcloc: ir::SourceLoc::default(),@@ -338,10 +344,32 @@ impl<'module_environment> FuncEnvironment<'module_environment> {data: ir::StackSlotData,) -> ir::StackSlot {*self- .stack_switching_cont_ref_result_storage+ .stack_switching+ .contref_result_storage.get_or_insert_with(|| builder.create_sized_stack_slot(data))}+ /// Returns the cached ASan fake-stack out-parameter slot, creating it with+ /// `data` if necessary.+ pub(crate) fn get_or_create_asan_fake_stack_slot(+ &mut self,+ builder: &mut FunctionBuilder<'_>,+ ) -> ir::StackSlot {+ let pointer_type = self.pointer_type();+ *self+ .stack_switching+ .asan_fake_stack_storage+ .get_or_insert_with(|| {+ let pointer_bytes = pointer_type.bytes();+ let data = ir::StackSlotData::new(+ ir::StackSlotKind::ExplicitSlot,+ pointer_bytes,+ u8::try_from(pointer_bytes.trailing_zeros()).unwrap(),+ );+ return builder.create_sized_stack_slot(data);+ })+ }+/// Consume the branch hint for the instruction at module-relative `offset`/// (i.e. `builder.srcloc().bits()`), if any. The lazy decoder only moves/// forward, making this O(n) over a function body.diff --git a/crates/cranelift/src/func_environ/stack_switching/instructions.rs b/crates/cranelift/src/func_environ/stack_switching/instructions.rsindex 5a6dac28c5..405a65f265 100644--- a/crates/cranelift/src/func_environ/stack_switching/instructions.rs+++ b/crates/cranelift/src/func_environ/stack_switching/instructions.rs@@ -9,8 +9,8 @@ use cranelift_codegen::ir::{Block, BlockCall, InstBuilder, JumpTableData};use cranelift_frontend::FunctionBuilder;use itertools::{Either, Itertools};use wasmtime_environ::{- PtrSize, TagIndex, TypeIndex, WasmHeapType, WasmRefType, WasmResult, WasmValType,- wasm_unsupported,+ BuiltinFunctionIndex, PtrSize, TagIndex, TypeIndex, WasmHeapType, WasmRefType, WasmResult,+ WasmValType, wasm_unsupported,};fn control_context_size(triple: &target_lexicon::Triple) -> WasmResult<u8> {@@ -22,6 +22,63 @@ fn control_context_size(triple: &target_lexicon::Triple) -> WasmResult<u8> {}}+/// Emit a stack switch instruction. On ASan-enabled builds this+/// function also emits the fiber switch hooks.+fn emit_stack_switch<'a>(+ env: &mut crate::func_environ::FuncEnvironment<'a>,+ builder: &mut FunctionBuilder,+ store_context_ptr: ir::Value,+ load_context_ptr: ir::Value,+ payload: ir::Value,+ asan_target_csi: impl FnOnce(+ &mut crate::func_environ::FuncEnvironment<'a>,+ &mut FunctionBuilder,+ ) -> ir::Value,+) -> ir::Value {+ if !env.compiler.tunables().asan_stack_switching {+ return builder+ .ins()+ .stack_switch(store_context_ptr, load_context_ptr, payload);+ }++ // ASan-aware stack switching.+ // The `asan_target_csi` is provided as a function to lazily load+ // the necessary ASan bookkeeping.+ let target_csi = asan_target_csi(env, builder);+ let pointer_type = env.pointer_type();+ let slot = env.get_or_create_asan_fake_stack_slot(builder);+ let fake_stack_save = builder.ins().stack_addr(pointer_type, slot, 0);+ let region = env.alias_regions.stack_slot_region(builder.func, slot);+ let flags = MemFlagsData::trusted().with_alias_region(Some(region));+ let null = builder.ins().iconst(pointer_type, 0);+ builder.ins().store(flags, null, fake_stack_save, 0);+ let vmctx = env.vmctx_val(&mut builder.cursor());++ let asan_start_switch_fiber = env.builtin_functions.load_builtin(+ builder.func,+ BuiltinFunctionIndex::asan_start_switch_fiber(),+ );+ builder.ins().call(+ asan_start_switch_fiber,+ &[vmctx, fake_stack_save, target_csi],+ );++ let result = builder+ .ins()+ .stack_switch(store_context_ptr, load_context_ptr, payload);++ let fake_stack = builder.ins().load(pointer_type, flags, fake_stack_save, 0);+ let asan_finish_switch_fiber = env.builtin_functions.load_builtin(+ builder.func,+ BuiltinFunctionIndex::asan_finish_switch_fiber(),+ );+ builder+ .ins()+ .call(asan_finish_switch_fiber, &[vmctx, fake_stack]);++ result+}+use super::control_effect::ControlEffect;use super::fatpointer;@@ -1778,12 +1835,12 @@ fn translate_resume_impl<'a>(let handler_count = u32::try_from(resumetable.len()).unwrap();// Populate the Array's data ptr with a pointer to a sufficiently// large area on this stack.- env.stack_switching_handler_list_buffer =+ env.stack_switching.handler_list_buffer =Some(handler_list.allocate_or_reuse_stack_slot(env,builder,handler_count,- env.stack_switching_handler_list_buffer,+ env.stack_switching.handler_list_buffer,));let suspend_handler_count = suspend_handlers.len();@@ -1824,10 +1881,14 @@ fn translate_resume_impl<'a>(let fiber_stack = last_ancestor.get_fiber_stack(env, builder);let control_context_ptr = fiber_stack.load_control_context(env, builder);- let result =- builder- .ins()- .stack_switch(control_context_ptr, control_context_ptr, resume_payload);+ let result = emit_stack_switch(+ env,+ builder,+ control_context_ptr,+ control_context_ptr,+ resume_payload,+ |env, builder| last_ancestor.common_stack_information(env, builder).address,+ );// At this point we know nothing about the continuation that just// suspended or returned. In particular, it does not have to be what we@@ -2086,7 +2147,7 @@ pub(crate) fn translate_suspend<'a>(let vmctx = env.vmctx_val(&mut builder.cursor());let active_stack_chain = vmctx_load_stack_chain(env, builder, vmctx);- let (_, end_of_chain_contref, handler_index) =+ let (handler_stack_chain, end_of_chain_contref, handler_index) =search_handler(env, builder, &active_stack_chain, tag_addr, true);// If we get here, the search_handler logic succeeded (i.e., did not trap).@@ -2109,8 +2170,8 @@ pub(crate) fn translate_suspend<'a>(let needs_gc_ref_markers =types_need_gc_ref_markers(suspend_arg_types) || types_need_gc_ref_markers(tag_return_types);- let existing_storage = env.stack_switching_values_storage;- env.stack_switching_values_storage = Some(values.prepare_stack_storage(+ let existing_storage = env.stack_switching.values_storage;+ env.stack_switching.values_storage = Some(values.prepare_stack_storage(env,builder,required_capacity,@@ -2139,10 +2200,18 @@ pub(crate) fn translate_suspend<'a>(let fiber_stack = end_of_chain_contref.get_fiber_stack(env, builder);let control_context_ptr = fiber_stack.load_control_context(env, builder);- let result =- builder- .ins()- .stack_switch(control_context_ptr, control_context_ptr, suspend_payload);+ let result = emit_stack_switch(+ env,+ builder,+ control_context_ptr,+ control_context_ptr,+ suspend_payload,+ |env, builder| {+ handler_stack_chain+ .get_common_stack_information(env, builder)+ .address+ },+ );// A normal resume supplies the tag's return values. `resume_throw_ref`// supplies an exception reference and throws it at this suspension point.@@ -2226,8 +2295,8 @@ pub(crate) fn translate_switch<'a>(// reference.let values = switcher_contref.values(env, builder);let required_capacity = u32::try_from(std::cmp::max(1, return_types.len())).unwrap();- let existing_storage = env.stack_switching_values_storage;- env.stack_switching_values_storage = Some(values.prepare_stack_storage(+ let existing_storage = env.stack_switching.values_storage;+ env.stack_switching.values_storage = Some(values.prepare_stack_storage(env,builder,required_capacity,@@ -2408,10 +2477,17 @@ pub(crate) fn translate_switch<'a>(let switch_payload = ControlEffect::encode_switch(builder).to_u64();- builder.ins().stack_switch(+ emit_stack_switch(+ env,+ builder,switcher_last_ancestor_cc,tmp_control_context,switch_payload,+ |env, builder| {+ switchee_contref_last_ancestor+ .common_stack_information(env, builder)+ .address+ },)};diff --git a/crates/environ/src/builtin.rs b/crates/environ/src/builtin.rsindex fc390ef509..7d214e6988 100644--- a/crates/environ/src/builtin.rs+++ b/crates/environ/src/builtin.rs@@ -187,6 +187,13 @@ macro_rules! foreach_builtin_function {contref_id: u32,result: pointer) -> bool;++ // Helpers used around stack switch instructions in+ // ASan-instrumented builds.+ #[cfg(feature = "stack-switching")]+ asan_start_switch_fiber(vmctx: vmctx, fake_stack_save: pointer, target_csi: pointer);+ #[cfg(feature = "stack-switching")]+ asan_finish_switch_fiber(vmctx: vmctx, fake_stack: pointer);}};}diff --git a/crates/environ/src/tunables.rs b/crates/environ/src/tunables.rsindex 8e0c6f03ab..e3bda88426 100644--- a/crates/environ/src/tunables.rs+++ b/crates/environ/src/tunables.rs@@ -155,6 +155,15 @@ define_tunables! {/// to signal checksum computation for compiled artifacts.pub recording: bool,+ /// Whether compiled stack-switching instructions must emit the+ /// AddressSanitizer fiber-switch handshake expected by this runtime.+ ///+ /// This setting is derived from how Wasmtime was built. It+ /// ensures that the compiled artifact and runtime are ABI+ /// compatible, e.g. it prevents running a non-ASan artifact+ /// on an ASan-enabled runtime.+ pub asan_stack_switching: bool,+/// An allocation counter that triggers GC when it reaches zero.////// Decremented on every allocation and when it hits zero, a GC is@@ -277,6 +286,7 @@ impl Tunables {debug_guest: false,concurrency_support: true,recording: false,+ asan_stack_switching: false,gc_zeal_alloc_counter: None,gc_heap_reservation: 0,gc_heap_guard_size: 0,diff --git a/crates/environ/src/vmtypes.rs b/crates/environ/src/vmtypes.rsindex 3a8e22edb2..19ba87fb12 100644--- a/crates/environ/src/vmtypes.rs+++ b/crates/environ/src/vmtypes.rs@@ -637,6 +637,17 @@ macro_rules! for_each_vm_type {/// The index within `handlers` of the first `switch` handler.pub first_switch_handler_index: u32,++ /// Bottom of the usable stack range reported to ASan,+ /// or `None` until ASan discovers an initial stack's+ /// bounds. Technically only needed by the runtime,+ /// but we are using `VmPtr` here to avoid introducing+ /// macro rules for `*mut u8` just for the sake of ASan+ /// builds.+ pub asan_stack_bottom: Option<VmPtr<u8>>,++ /// Size of the usable stack range reported to ASan.+ pub asan_stack_size: usize,}/// A continuation.diff --git a/crates/wasmtime/src/config.rs b/crates/wasmtime/src/config.rsindex 65239deff7..edbc23a666 100644--- a/crates/wasmtime/src/config.rs+++ b/crates/wasmtime/src/config.rs@@ -2689,6 +2689,12 @@ impl Config {let mut tunables = Tunables::default_for_target(&self.compiler_target())?;+ // Stack switching is emitted inline in compiled Wasm. In+ // ASan-enabled builds the compiler must arrange the+ // corresponding fiber switch handshake around every such+ // instruction.+ tunables.asan_stack_switching = cfg!(asan);+// By default this is enabled with the Cargo feature, and if the feature// is missing this is disabled.tunables.concurrency_support = cfg!(feature = "component-model-async");diff --git a/crates/wasmtime/src/engine/serialization.rs b/crates/wasmtime/src/engine/serialization.rsindex b335db1cca..d83c3b8496 100644--- a/crates/wasmtime/src/engine/serialization.rs+++ b/crates/wasmtime/src/engine/serialization.rs@@ -315,6 +315,7 @@ impl Metadata<'_> {inlining_sum_size_threshold,concurrency_support,recording,+ asan_stack_switching,// This doesn't affect compilation, it's just a runtime setting.memory_reservation_for_growth: _,@@ -423,6 +424,11 @@ impl Metadata<'_> {"concurrency support",)?;Self::check_bool(recording, other.recording, "RR recording support")?;+ Self::check_bool(+ asan_stack_switching,+ other.asan_stack_switching,+ "AddressSanitizer stack-switching support",+ )?;Self::check_inlining(inlining, other.inlining)?;Self::check_int(gc_heap_reservation,diff --git a/crates/wasmtime/src/lib.rs b/crates/wasmtime/src/lib.rsindex f3f0a3fb90..bf9a83374b 100644--- a/crates/wasmtime/src/lib.rs+++ b/crates/wasmtime/src/lib.rs@@ -374,6 +374,8 @@#![doc(test(attr(deny(warnings))))]#![doc(test(attr(allow(dead_code, unused_variables, unused_mut))))]#![cfg_attr(docsrs, feature(doc_cfg))]+#![cfg_attr(all(asan, feature = "stack-switching"), allow(unstable_features))]+#![cfg_attr(all(asan, feature = "stack-switching"), feature(sanitize))]// NB: this list is currently being burned down to remove all features listed// here to get warnings in all configurations of Wasmtime.#![cfg_attr(diff --git a/crates/wasmtime/src/runtime/store.rs b/crates/wasmtime/src/runtime/store.rsindex 174d522913..c46d3eab56 100644--- a/crates/wasmtime/src/runtime/store.rs+++ b/crates/wasmtime/src/runtime/store.rs@@ -2141,6 +2141,17 @@ at https://bytecodealliance.org/security.let mut continuation = Box::new(VMContRef::empty());let stack_size = self.engine.config().async_stack_size;let stack = crate::vm::VMContinuationStack::new(stack_size)?;+ #[cfg(asan)]+ {+ let asan_range = stack+ .asan_range()+ .expect("supported continuation stacks have a usable range");+ continuation.common_stack_information.asan_stack_bottom = Some(vm::VmPtr::from(+ NonNull::new(asan_range.start as *mut u8)+ .expect("a continuation stack's ASan range must have a non-null bottom"),+ ));+ continuation.common_stack_information.asan_stack_size = asan_range.len();+ }continuation.stack = stack;let ptr = continuation.deref_mut() as *mut VMContRef;self.continuations.push(continuation);diff --git a/crates/wasmtime/src/runtime/vm/libcalls.rs b/crates/wasmtime/src/runtime/vm/libcalls.rsindex 157cf8095b..b5e43da3de 100644--- a/crates/wasmtime/src/runtime/vm/libcalls.rs+++ b/crates/wasmtime/src/runtime/vm/libcalls.rs@@ -1183,6 +1183,25 @@ fn cont_new(Ok(Some(AllocationSize(ans.cast::<u8>() as usize)))}+#[cfg(feature = "stack-switching")]+unsafe fn asan_start_switch_fiber(+ _store: &mut dyn VMStore,+ _instance: InstanceId,+ fake_stack_save: *mut u8,+ target_csi: *mut u8,+) {+ unsafe { crate::vm::stack_switching::asan::start_switch_fiber(fake_stack_save, target_csi) }+}++#[cfg(feature = "stack-switching")]+unsafe fn asan_finish_switch_fiber(+ _store: &mut dyn VMStore,+ _instance: InstanceId,+ fake_stack: *mut u8,+) {+ unsafe { crate::vm::stack_switching::asan::finish_switch_fiber(fake_stack) }+}+#[cfg(feature = "gc")]fn get_instance_id(_store: &mut dyn VMStore, instance: InstanceId) -> u32 {instance.as_u32()diff --git a/crates/wasmtime/src/runtime/vm/stack_switching.rs b/crates/wasmtime/src/runtime/vm/stack_switching.rsindex f1984a63a2..a029b977f0 100644--- a/crates/wasmtime/src/runtime/vm/stack_switching.rs+++ b/crates/wasmtime/src/runtime/vm/stack_switching.rs@@ -1,6 +1,8 @@//! This module contains the runtime components of the implementation of the//! stack switching proposal.+#[cfg(feature = "stack-switching")]+pub(crate) mod asan;mod stack;use crate::vm::{@@ -88,6 +90,8 @@ impl VMCommonStackInformation {state: VMStackState::Running,handlers: VMHostArray::empty(),first_switch_handler_index: 0,+ asan_stack_bottom: None,+ asan_stack_size: 0,}}}@@ -154,6 +158,8 @@ impl VMContRef {state,handlers,first_switch_handler_index: 0,+ asan_stack_bottom: None,+ asan_stack_size: 0,};let parent_chain = VMStackChain::Absent;let last_ancestor = None;diff --git a/crates/wasmtime/src/runtime/vm/stack_switching/asan.rs b/crates/wasmtime/src/runtime/vm/stack_switching/asan.rsnew file mode 100644index 0000000000..84318cce7a--- /dev/null+++ b/crates/wasmtime/src/runtime/vm/stack_switching/asan.rs@@ -0,0 +1,145 @@+//! AddressSanitizer integration for continuation stack switching.+//!+//! ASan maintains per-stack bookkeeping, including an opaque "fake+//! stack" used to detect stack-use-after-return. A stack switch must+//! bracket the actual switch with ASan's fiber switch handshake:+//!+//! ```text+//! stack A stack B+//! ------- -------+//! start_switch_fiber(&save_a, B's bounds)+//! stack_switch(A -> B) ----------------------> resumes+//! finish_switch_fiber(save_b)+//! ... runs on B ...+//! start_switch_fiber(&save_b, A's bounds)+//! resumes <----------------------------------- stack_switch(B -> A)+//! finish_switch_fiber(save_a)+//! ```+//!+//! Here `save_a` and `save_b` are stack slots in the generated Wasm+//! frames. The `start_switch_fiber` writes an opaque ASan fake-stack+//! token into the slot belonging to the stack being suspended. This+//! token is exclusively for ASan bookkeeping.+//!+//! A fresh continuation has no suspended generated frame at which to+//! execute the right-hand `finish_switch_fiber`. Its entry trampoline+//! therefore calls `fiber_start_complete` with a null fake-stack+//! token. ASan reports the old stack's bounds through that call, and+//! we record them in the parent's `VMCommonStackInformation` for+//! subsequent switches back to it.++#[cfg(asan)]+mod enabled {++ use crate::vm::{VMCommonStackInformation, VMContRef, VMStackChain, VmPtr};+ use core::ptr::NonNull;++ unsafe fn continuation_from_args(args: *mut crate::vm::VMHostArray) -> *mut VMContRef {+ unsafe {+ args.cast::<u8>()+ .byte_sub(core::mem::offset_of!(VMContRef, args))+ .cast()+ }+ }++ unsafe fn parent_csi(contref: *mut VMContRef) -> *mut VMCommonStackInformation {+ let parent = unsafe { &mut (*contref).parent_chain };+ match parent {+ VMStackChain::InitialStack(csi) => csi.as_ptr(),+ VMStackChain::Continuation(contref) => unsafe {+ core::ptr::addr_of_mut!((*contref.as_ptr()).common_stack_information)+ },+ VMStackChain::Absent => panic!("a running continuation must have a parent stack"),+ }+ }++ unsafe fn stack_range(csi: *const VMCommonStackInformation) -> (*const u8, usize) {+ let csi = unsafe { &*csi };+ let bottom = csi+ .asan_stack_bottom+ .expect("ASan requires the destination stack's bounds");+ (bottom.as_ptr(), csi.asan_stack_size)+ }++ /// Begins ASan's stack-switch handshake.+ ///+ /// `fake_stack_save` points to storage in the generated Wasm frame+ /// that survives until this same stack is resumed.+ pub unsafe extern "C" fn start_switch_fiber(fake_stack_save: *mut u8, target_csi: *mut u8) {+ unsafe {+ let (bottom, size) = stack_range(target_csi.cast());+ __sanitizer_start_switch_fiber(Some(&mut *fake_stack_save.cast()), bottom, size);+ }+ }++ /// Completes ASan's stack-switch handshake after this stack is+ /// resumed.+ pub unsafe extern "C" fn finish_switch_fiber(fake_stack: *mut u8) {+ unsafe {+ let mut bottom = core::ptr::null();+ let mut size = 0;+ __sanitizer_finish_switch_fiber(fake_stack, &mut bottom, &mut size);+ }+ }++ /// Completes the first switch onto a newly-created continuation stack+ /// and records the parent stack's bounds.+ #[cfg_attr(asan, sanitize(address = "off"))]+ #[cfg(all(feature = "stack-switching"))]+ pub unsafe fn fiber_start_complete(args: *mut crate::vm::VMHostArray) {+ unsafe {+ let mut bottom = core::ptr::null();+ let mut size = 0;+ __sanitizer_finish_switch_fiber(core::ptr::null_mut(), &mut bottom, &mut size);++ let parent = &mut *parent_csi(continuation_from_args(args));+ parent.asan_stack_bottom = Some(VmPtr::from(+ NonNull::new(bottom.cast_mut())+ .expect("ASan must report the previous stack's bounds"),+ ));+ parent.asan_stack_size = size;+ }+ }++ /// Begins a non-returning switch from a completed or trapped+ /// continuation to its parent stack.+ #[cfg_attr(asan, sanitize(address = "off"))]+ #[cfg(all(feature = "stack-switching"))]+ pub unsafe extern "C" fn fiber_exit(args: *mut crate::vm::VMHostArray) {+ unsafe {+ let parent = parent_csi(continuation_from_args(args));+ let (bottom, size) = stack_range(parent);+ __sanitizer_start_switch_fiber(None, bottom, size);+ }+ }++ unsafe extern "C" {+ fn __sanitizer_start_switch_fiber(+ fake_stack_save: Option<&mut *mut u8>,+ bottom: *const u8,+ size: usize,+ );+ fn __sanitizer_finish_switch_fiber(+ fake_stack: *mut u8,+ bottom_old: &mut *const u8,+ size_old: &mut usize,+ );+ }+}++#[cfg(not(asan))]+mod disabled {+ #[allow(dead_code, reason = "Used by ASan builds")]+ pub unsafe extern "C" fn start_switch_fiber(_fake_stack_save: *mut u8, _target_csi: *mut u8) {}++ /// Completes ASan's stack-switch handshake after this stack is+ /// resumed.+ #[allow(dead_code, reason = "Used by ASan builds")]+ pub unsafe extern "C" fn finish_switch_fiber(_fake_stack: *mut u8) {}+}++#[cfg(not(asan))]+#[allow(unused_imports, reason = "Used by ASan builds")]+pub use disabled::*;+#[cfg(asan)]+pub use enabled::*;diff --git a/crates/wasmtime/src/runtime/vm/stack_switching/stack.rs b/crates/wasmtime/src/runtime/vm/stack_switching/stack.rsindex e8438a91d4..e300ffd13c 100644--- a/crates/wasmtime/src/runtime/vm/stack_switching/stack.rs+++ b/crates/wasmtime/src/runtime/vm/stack_switching/stack.rs@@ -77,6 +77,13 @@ impl VMContinuationStack {self.0.range()}+ /// Returns the usable stack range to report to AddressSanitizer. Unlike+ /// [`Self::range`], this excludes any inaccessible guard region.+ #[cfg(all(feature = "stack-switching", asan))]+ pub(crate) fn asan_range(&self) -> Option<Range<usize>> {+ self.0.asan_range()+ }+/// Returns the instruction pointer stored in the Fiber's ControlContext.pub fn control_context_instruction_pointer(&self) -> usize {self.0.control_context_instruction_pointer()diff --git a/crates/wasmtime/src/runtime/vm/stack_switching/stack/dummy.rs b/crates/wasmtime/src/runtime/vm/stack_switching/stack/dummy.rsindex 3c08078902..8634ca69a0 100644--- a/crates/wasmtime/src/runtime/vm/stack_switching/stack/dummy.rs+++ b/crates/wasmtime/src/runtime/vm/stack_switching/stack/dummy.rs@@ -43,6 +43,11 @@ impl VMContinuationStack {panic!("Stack switching disabled or not implemented on this platform")}+ #[cfg(all(feature = "stack-switching", asan))]+ pub fn asan_range(&self) -> Option<Range<usize>> {+ panic!("Stack switching disabled or not implemented on this platform")+ }+pub fn control_context_instruction_pointer(&self) -> usize {panic!("Stack switching disabled or not implemented on this platform")}diff --git a/crates/wasmtime/src/runtime/vm/stack_switching/stack/unix.rs b/crates/wasmtime/src/runtime/vm/stack_switching/stack/unix.rsindex 0f35a6cf80..0f9d1fa7e7 100644--- a/crates/wasmtime/src/runtime/vm/stack_switching/stack/unix.rs+++ b/crates/wasmtime/src/runtime/vm/stack_switching/stack/unix.rs@@ -62,6 +62,8 @@ use core::ptr::NonNull;use std::io;use std::ops::Range;use std::ptr;+#[cfg(asan)]+use std::sync::Mutex;use crate::prelude::*;use crate::runtime::vm::{VMContext, VMFuncRef, VMHostArray, VMPayloads, ValRaw, VmPtr};@@ -72,6 +74,13 @@ pub enum Allocator {Custom,}+// ASan retains metadata for addresses that have been used as+// stacks. We keep continuation mappings alive and reuse them instead+// to avoid false-positives to arise from the memory subsystem+// choosing to repurpose previous stack space.+#[cfg(asan)]+static ASAN_STACKS: Mutex<Vec<(usize, usize)>> = Mutex::new(Vec::new());+#[derive(Debug)]#[repr(C)]pub struct VMContinuationStack {@@ -99,6 +108,25 @@ impl VMContinuationStack {unsafe {// Add in one page for a guard page and then ask for some memory.let mmap_len = size + page_size;++ #[cfg(asan)]+ if let Some((base, len)) = {+ let mut stacks = ASAN_STACKS.lock().unwrap();+ stacks+ .iter()+ .position(|(_, len)| *len == mmap_len)+ .map(|index| stacks.swap_remove(index))+ } {+ return Ok(Self {+ top: VmPtr::from(+ NonNull::new((base as *mut u8).add(len))+ .expect("a cached continuation stack must have a non-null top"),+ ),+ len,+ allocator: Allocator::Mmap,+ });+ }+let mmap = rustix::mm::mmap_anonymous(ptr::null_mut(),mmap_len,@@ -161,6 +189,23 @@ impl VMContinuationStack {Some(base..base + self.len)}+ #[cfg(asan)]+ pub fn asan_range(&self) -> Option<Range<usize>> {+ let top = self.top.addr().get();+ let bottom = top - self.len;+ let usable_bottom = match self.allocator {+ Allocator::Mmap =>+ // The ASan fiber switch API requires the bounds of+ // the readable and writable stack region, therefore+ // we disregard the guard page here.+ {+ bottom + rustix::param::page_size()+ }+ Allocator::Custom => bottom,+ };+ Some(usable_bottom..top)+ }+pub fn control_context_instruction_pointer(&self) -> usize {// See picture at top of this file:// RIP is stored 8 bytes below top of stack.@@ -364,13 +409,27 @@ impl VMContinuationStack {}impl Drop for VMContinuationStack {+ #[cfg(asan)]fn drop(&mut self) {unsafe {match self.allocator {Allocator::Mmap => {- let top = self.top.as_ptr();- let ret = rustix::mm::munmap(top.sub(self.len) as _, self.len);- debug_assert!(ret.is_ok());+ let bottom = self.top.as_ptr().sub(self.len);+ ASAN_STACKS.lock().unwrap().push((bottom.addr(), self.len))+ }+ Allocator::Custom => {} // It's the creator's responsibility to reclaim the memory.+ }+ }+ }++ #[cfg(not(asan))]+ fn drop(&mut self) {+ unsafe {+ match self.allocator {+ Allocator::Mmap => {+ let bottom = self.top.as_ptr().sub(self.len);+ let ret = rustix::mm::munmap(bottom as _, self.len);+ debug_assert!(ret.is_ok())}Allocator::Custom => {} // It's the creator's responsibility to reclaim the memory.}@@ -387,6 +446,9 @@ unsafe extern "C" fn fiber_start(return_value_count: u32,) -> bool {unsafe {+ #[cfg(asan)]+ crate::vm::stack_switching::asan::fiber_start_complete(args);+let func_ref = NonNull::new(func_ref).unwrap();let caller_vmxtx = NonNull::new_unchecked(caller_vmctx);let args = &mut *args;diff --git a/crates/wasmtime/src/runtime/vm/stack_switching/stack/unix/x86_64.rs b/crates/wasmtime/src/runtime/vm/stack_switching/stack/unix/x86_64.rsindex 69337194d2..ad79365149 100644--- a/crates/wasmtime/src/runtime/vm/stack_switching/stack/unix/x86_64.rs+++ b/crates/wasmtime/src/runtime/vm/stack_switching/stack/unix/x86_64.rs@@ -37,10 +37,22 @@ pub fn wasmtime_continuation_start_address() -> *const () {// - align_up(`args_capacity`, 16)// RBP: TOS - 0x10-#[unsafe(naked)]-pub(crate) unsafe extern "C" fn wasmtime_continuation_start() {- naked_asm!(- "+// ASan and non-ASan builds have nearly identical assembly+// stubs. However, ASan requires a special sequence after+// `fiber_start` returns. This sequence must call `fiber_exit` to+// abandon the stack appropriately.+//+// This macro provides maximal sharing for the two stubs, while+// allowing ASan build to preserve the arguments/result and invoke+// `fiber_exit`. Meanwhile, a non-ASan build supplies empty fragments+// such that no overhead is incurred.+macro_rules! define_wasmtime_continuation_start {+ ($before_start:literal, $after_start:literal $(, $fiber_exit:path)?) => {+ #[unsafe(naked)]+ pub(crate) unsafe extern "C" fn wasmtime_continuation_start() {+ naked_asm!(+ concat!(+ "// TODO(frank-emrich): Restore DWARF information for this function. In// the meantime, debugging is possible using frame pointer walking.@@ -58,12 +70,17 @@ pub(crate) unsafe extern "C" fn wasmtime_continuation_start() {pop rdx // argspop rsi // caller_vmctxpop rdi // func_ref+ ",+ $before_start,+ "// Note that RBP already contains the right frame pointer to build a// frame pointer chain including the parent continuation:// The current value of RBP is where we store the parent RBP in the// control context!call {fiber_start}-+ ",+ $after_start,+ "// A failed array call means that the continuation trapped. Preserve// this information as the control effect sent to the parent stack.test al, al@@ -84,14 +101,41 @@ pub(crate) unsafe extern "C" fn wasmtime_continuation_start() {mov rbp, [rbp]jmp rsi- ",- fiber_start = sym super::fiber_start,- trap_control_effect = const (- crate::vm::CONTROL_EFFECT_TRAP_ENCODING- ),- );+ "+ ),+ fiber_start = sym super::fiber_start,+ $(fiber_exit = sym $fiber_exit,)?+ trap_control_effect = const (+ crate::vm::CONTROL_EFFECT_TRAP_ENCODING+ ),+ );+ }+ };}+#[cfg(asan)]+define_wasmtime_continuation_start!(+ "+ // Keep the args pointer and fiber_start's result across the ASan exit+ // hook. Reserving 16 bytes preserves the call site stack alignment.+ sub rsp, 16+ mov [rsp], rdx+ ",+ "+ mov [rsp + 8], al++ // This begins ASan's terminal stack switch handshake.+ mov rdi, [rsp]+ call {fiber_exit}+ mov al, [rsp + 8]+ add rsp, 16+ ",+ crate::vm::stack_switching::asan::fiber_exit+);++#[cfg(not(asan))]+define_wasmtime_continuation_start!("", "");+#[test]fn test_control_effect_payloads() {// These assumptions are baked into `wasmtime_continuation_start`.diff --git a/tests/all/stack_switching.rs b/tests/all/stack_switching.rsindex 3a075d4719..9453f3942b 100644--- a/tests/all/stack_switching.rs+++ b/tests/all/stack_switching.rs@@ -218,14 +218,14 @@ mod wasi {))"#;- #[cfg_attr(any(asan, miri), ignore)]+ #[cfg_attr(miri, ignore)]#[test]fn write_something_test() -> Result<()> {assert_eq!(run_wasi_test(WRITE_SOMETHING_WAT)?, 0);Ok(())}- #[cfg_attr(any(asan, miri), ignore)]+ #[cfg_attr(miri, ignore)]#[tokio::test]async fn write_something_test_async() -> Result<()> {assert_eq!(run_wasi_test_async(WRITE_SOMETHING_WAT).await?, 0);@@ -251,14 +251,14 @@ mod wasi {))"#;- #[cfg_attr(any(asan, miri), ignore)]+ #[cfg_attr(miri, ignore)]#[test]fn sched_yield_test() -> Result<()> {assert_eq!(run_wasi_test(SCHED_YIELD_WAT)?, 0);Ok(())}- #[cfg_attr(any(asan, miri), ignore)]+ #[cfg_attr(miri, ignore)]#[tokio::test]async fn sched_yield_test_async() -> Result<()> {assert_eq!(run_wasi_test_async(SCHED_YIELD_WAT).await?, 0);@@ -268,7 +268,7 @@ mod wasi {/// Test that two distinct instantiations of the same module yield/// different control tag identities.-#[cfg_attr(any(asan, miri), ignore)]+#[cfg_attr(miri, ignore)]#[test]fn inter_instance_suspend() -> Result<()> {let mut config = Config::default();@@ -344,7 +344,7 @@ fn inter_instance_suspend() -> Result<()> {/// A GC reference returned through a continuation payload must retain/// its stack-map metadata while it is live on the operand stack/// across subsequent GC safepoints.-#[cfg_attr(any(asan, miri), ignore)]+#[cfg_attr(miri, ignore)]#[test]fn continuation_result_gc_ref_on_operand_stack() -> Result<()> {let mut config = Config::new();@@ -490,12 +490,8 @@ mod host {bail!("intentional host trap")}- // TODO(dhil): Enable ASAN. ASAN produces a false positive here,- // because ASAN thinks the thread is on the default stack. We need to- // instrument the stack switching runtime to inform ASAN about the- // switching of stacks.#[test]- #[cfg_attr(any(asan, miri), ignore)]+ #[cfg_attr(miri, ignore)]fn traps_cross_continuation_stacks_and_host_frames() -> Result<()> {let mut config = Config::new();config.wasm_stack_switching(true);@@ -550,9 +546,10 @@ mod host {error: Option<Error>,}- // TODO(dhil): Enable ASAN.+ // Also run this under ASan to cover returning to parent frames after a+ // host function catches a trap from a continuation.#[test]- #[cfg_attr(any(asan, miri), ignore)]+ #[cfg_attr(miri, ignore)]fn parent_frames_resume_after_host_catches_trap() -> Result<()> {let mut config = Config::new();config.wasm_stack_switching(true);@@ -620,7 +617,7 @@ mod host {Ok(())}- #[cfg_attr(any(asan, miri), ignore)]+ #[cfg_attr(miri, ignore)]#[test]/// Tests calling a host function from within a wasm function running inside a continuation./// Call chain:@@ -651,7 +648,7 @@ mod host {Ok(())}- #[cfg_attr(any(asan, miri), ignore)]+ #[cfg_attr(miri, ignore)]#[test]/// We re-enter wasm from a host function and execute a continuation./// Call chain:@@ -693,7 +690,7 @@ mod host {Ok(())}- #[cfg_attr(any(asan, miri), ignore)]+ #[cfg_attr(miri, ignore)]#[test]/// Similar to `re_enter_wasm_ok2, but we run a continuation before the host call./// Call chain:@@ -739,7 +736,7 @@ mod host {Ok(())}- #[cfg_attr(any(asan, miri), ignore)]+ #[cfg_attr(miri, ignore)]#[test]/// We re-enter Wasm from a host function while already running on a/// continuation stack.@@ -778,7 +775,7 @@ mod host {Ok(())}- #[cfg_attr(any(asan, miri), ignore)]+ #[cfg_attr(miri, ignore)]#[test]/// After crossing from the host back into wasm, we suspend to a tag that is/// handled by the surrounding function (i.e., without needing to cross the@@ -830,7 +827,7 @@ mod host {Ok(())}- #[cfg_attr(any(asan, miri), ignore)]+ #[cfg_attr(miri, ignore)]#[test]/// Similar to `call_host_from_continuation_nested_suspend_ok`. However,/// we suspend to a tag that is only handled if we were to cross a host function@@ -926,7 +923,7 @@ mod traps {assert!(actual_func_name_it.eq(expected_func_name_it));}- #[cfg_attr(any(asan, miri), ignore)]+ #[cfg_attr(miri, ignore)]#[test]/// Tests that we get correct backtraces if we trap deep inside multiple continuations./// Call chain:@@ -977,7 +974,7 @@ mod traps {Ok(())}- #[cfg_attr(any(asan, miri), ignore)]+ #[cfg_attr(miri, ignore)]#[test]/// Tests that we get correct backtraces if we trap after returning from one/// continuation to its parent.@@ -1022,7 +1019,7 @@ mod traps {Ok(())}- #[cfg_attr(any(asan, miri), ignore)]+ #[cfg_attr(miri, ignore)]#[test]/// Tests that we get correct backtraces if we trap after returning from/// several continuations back to the main stack.@@ -1063,7 +1060,7 @@ mod traps {Ok(())}- #[cfg_attr(any(asan, miri), ignore)]+ #[cfg_attr(miri, ignore)]#[test]/// Tests that we get correct backtraces after suspending a continuation.fn trap_in_continuation_suspend() -> Result<()> {@@ -1115,7 +1112,7 @@ mod traps {Ok(())}- #[cfg_attr(any(asan, miri), ignore)]+ #[cfg_attr(miri, ignore)]#[test]/// Tests that we get correct backtraces after suspending a continuation and/// then resuming it from a different stack frame.@@ -1178,7 +1175,7 @@ mod traps {Ok(())}- #[cfg_attr(any(asan, miri), ignore)]+ #[cfg_attr(miri, ignore)]#[test]/// Tests that we get correct backtraces after suspending a continuation/// where we need to forward to an outer handler.@@ -1229,7 +1226,7 @@ mod traps {Ok(())}- #[cfg_attr(any(asan, miri), ignore)]+ #[cfg_attr(miri, ignore)]#[test]/// Tests that we get correct backtraces after suspending a continuation/// where we need to forward to an outer handler. We then resume the@@ -1290,7 +1287,7 @@ mod traps {Ok(())}- #[cfg_attr(any(asan, miri), ignore)]+ #[cfg_attr(miri, ignore)]#[test]/// Tests that we get correct backtraces after switch./// We first create the a stack with the following shape:@@ -1359,7 +1356,7 @@ mod traps {Ok(())}- #[cfg_attr(any(asan, miri), ignore)]+ #[cfg_attr(miri, ignore)]#[test]/// Tests that we get correct panic payloads if we panic deep inside multiple/// continuations. Note that wasmtime does not create its own backtraces for panics.@@ -1409,7 +1406,7 @@ mod traps {Ok(())}- #[cfg_attr(any(asan, miri), ignore)]+ #[cfg_attr(miri, ignore)]#[test]fn stack_overflow_in_continuation() -> Result<()> {let wat = r#"diff --git a/tests/disas/stack-switching/resume-suspend-data-passing.wat b/tests/disas/stack-switching/resume-suspend-data-passing.watindex fc0ccbfadb..230cc2e0e2 100644--- a/tests/disas/stack-switching/resume-suspend-data-passing.wat+++ b/tests/disas/stack-switching/resume-suspend-data-passing.wat@@ -42,15 +42,15 @@;; region0 = 123 "";; region1 = 160 "";; region2 = 106 ""-;; region3 = 225 ""+;; region3 = 153 "";; region4 = 214 "";; region5 = 13 "";; region6 = 55 ""-;; region7 = 153 ""+;; region7 = 211 "";; region8 = 118 "";; region9 = 82 "";; region10 = 255 ""-;; region11 = 211 ""+;; region11 = 26 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -61,10 +61,10 @@;; block0(v0: i64, v1: i64):;; @003c v3 = iconst.i32 10;; @0044 v7 = load.i64 notrap aligned readonly can_move region0 v0+8-;; @0044 v31 = iconst.i64 144+;; @0044 v31 = iconst.i64 160;; @0044 v34 = stack_addr.i64 ss0;; @0044 v37 = iconst.i64 0-;; @0044 v47 = iconst.i64 96+;; @0044 v47 = iconst.i64 112;; @0044 v50 = iconst.i64 -24;; v77 = iconst.i64 0x0002_0000_0000;; @0044 v43 = iconst.i64 32@@ -86,8 +86,8 @@;; @0044 jump block5;;;; block5:-;; @0044 v14 = load.i64 notrap aligned region3 v11+64-;; @0044 v15 = load.i64 notrap aligned region3 v11+72+;; @0044 v14 = load.i64 notrap aligned region3 v11+80+;; @0044 v15 = load.i64 notrap aligned region3 v11+88;; v82 = iconst.i64 40;; v83 = iadd v15, v82 ; v82 = 40;; @0044 v18 = load.i64 notrap aligned region4 v83+8@@ -116,10 +116,10 @@;; @0044 brif v88, block8, block6(v90);;;; block8:-;; @0044 store.i64 notrap aligned region7 v11, v9+80+;; @0044 store.i64 notrap aligned region7 v11, v9+96;; v91 = iconst.i32 1-;; v92 = iconst.i64 144-;; v93 = iadd.i64 v9, v92 ; v92 = 144+;; v92 = iconst.i64 160+;; v93 = iadd.i64 v9, v92 ; v92 = 160;; @0044 store notrap aligned region8 v91, v93+4 ; v91 = 1;; @0044 store.i64 notrap aligned region4 v34, v93+8;; @0044 store.i32 notrap aligned region6 v4, v34@@ -127,10 +127,10 @@;; v94 = iconst.i32 3;; @0044 store notrap aligned region10 v94, v9+32 ; v94 = 3;; v95 = iconst.i64 0-;; @0044 store notrap aligned region3 v95, v11+64 ; v95 = 0-;; @0044 store notrap aligned region3 v95, v11+72 ; v95 = 0-;; v96 = iconst.i64 96-;; v97 = iadd.i64 v11, v96 ; v96 = 96+;; @0044 store notrap aligned region3 v95, v11+80 ; v95 = 0+;; @0044 store notrap aligned region3 v95, v11+88 ; v95 = 0+;; v96 = iconst.i64 112+;; v97 = iadd.i64 v11, v96 ; v96 = 112;; @0044 v49 = load.i64 notrap aligned region11 v97;; v98 = iconst.i64 -24;; v99 = iadd v49, v98 ; v98 = -24@@ -182,10 +182,10 @@;; ss0 = explicit_slot 8, align = 256;; region0 = 123 "";; region1 = 160 ""-;; region2 = 206 ""-;; region3 = 153 ""+;; region2 = 28 ""+;; region3 = 211 "";; region4 = 106 ""-;; region5 = 225 ""+;; region5 = 153 "";; region6 = 255 "";; region7 = 231 "";; region8 = 243 ""@@ -198,7 +198,7 @@;; region15 = 214 "";; region16 = 55 "";; region17 = 82 ""-;; region18 = 211 ""+;; region18 = 26 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -215,7 +215,7 @@;; @0056 v3 = call fn0(v0, v2) ; v2 = 0;; @0058 trapz v3, user16;; @0058 v7 = call fn1(v0, v3, v2, v2, v2) ; v2 = 0, v2 = 0, v2 = 0-;; @0058 v8 = load.i64 notrap aligned region2 v7+88+;; @0058 v8 = load.i64 notrap aligned region2 v7+104;; @0058 v10 = uextend.i128 v8;; @0058 v11 = iconst.i64 64;; v139 = ishl v10, v11 ; v11 = 64@@ -231,12 +231,12 @@;; @0062 v52 = stack_addr.i64 ss0;; @0062 v53 = iconst.i64 48;; @0062 v54 = iadd v0, v53 ; v53 = 48-;; @0062 v61 = iconst.i64 96+;; @0062 v61 = iconst.i64 112;; @0062 v64 = iconst.i64 -24;; v143 = iconst.i64 0x0001_0000_0000;; @0062 v59 = iconst.i64 32;; @0062 v77 = iconst.i64 4-;; @0062 v119 = iconst.i64 144+;; @0062 v119 = iconst.i64 160;; @005c jump block2(v14);;;; block2(v15: i128):@@ -245,7 +245,7 @@;; block5:;; @0062 v16 = ireduce.i64 v15;; @0062 trapz v16, user16-;; @0062 v21 = load.i64 notrap aligned region2 v16+88+;; @0062 v21 = load.i64 notrap aligned region2 v16+104;; v146 = iconst.i64 64;; v147 = ushr.i128 v15, v146 ; v146 = 64;; @0062 v20 = ireduce.i64 v147@@ -253,14 +253,14 @@;; @0062 trapz v22, user23;; v148 = iconst.i64 1;; v149 = iadd v21, v148 ; v148 = 1-;; @0062 store notrap aligned region2 v149, v16+88-;; @0062 v25 = load.i64 notrap aligned region3 v16+80+;; @0062 store notrap aligned region2 v149, v16+104+;; @0062 v25 = load.i64 notrap aligned region3 v16+96;; @0062 v27 = load.i64 notrap aligned region4 v26+88;; @0062 v28 = load.i64 notrap aligned region4 v26+96-;; @0062 store notrap aligned region5 v27, v25+64-;; @0062 store notrap aligned region5 v28, v25+72+;; @0062 store notrap aligned region5 v27, v25+80+;; @0062 store notrap aligned region5 v28, v25+88;; v150 = iconst.i64 0-;; @0062 store notrap aligned region3 v150, v16+80 ; v150 = 0+;; @0062 store notrap aligned region3 v150, v16+96 ; v150 = 0;; v151 = iconst.i64 2;; @0062 store notrap aligned region4 v151, v26+88 ; v151 = 2;; @0062 store notrap aligned region4 v16, v26+96@@ -292,8 +292,8 @@;; @0062 store notrap aligned region16 v156, v52;; @0062 store notrap aligned region17 v152, v155 ; v152 = 1;; @0062 store notrap aligned region12 v152, v28+56 ; v152 = 1-;; v157 = iconst.i64 96-;; v158 = iadd v25, v157 ; v157 = 96+;; v157 = iconst.i64 112+;; v158 = iadd v25, v157 ; v157 = 112;; @0062 v63 = load.i64 notrap aligned region18 v158;; v159 = iconst.i64 -24;; v160 = iadd v63, v159 ; v159 = -24@@ -330,14 +330,14 @@;; @0062 v87 = load.i64 notrap aligned region12 v28+24;; @0062 store notrap aligned region9 v87, v26+80;; v174 = iconst.i32 0-;; v175 = iconst.i64 120-;; v176 = iadd.i64 v69, v175 ; v175 = 120+;; v175 = iconst.i64 136+;; v176 = iadd.i64 v69, v175 ; v175 = 136;; @0062 store notrap aligned region17 v174, v176 ; v174 = 0;; @0062 store notrap aligned region14 v174, v176+4 ; v174 = 0;; v177 = iconst.i64 0;; @0062 store notrap aligned region15 v177, v176+8 ; v177 = 0-;; v178 = iconst.i64 144-;; v179 = iadd.i64 v69, v178 ; v178 = 144+;; v178 = iconst.i64 160+;; v179 = iadd.i64 v69, v178 ; v178 = 160;; @0062 store notrap aligned region17 v174, v179 ; v174 = 0;; @0062 store notrap aligned region14 v174, v179+4 ; v174 = 0;; @0062 store notrap aligned region15 v177, v179+8 ; v177 = 0@@ -361,15 +361,15 @@;; @0062 store notrap aligned region8 v109, v26+64;; @0062 v110 = load.i64 notrap aligned region12 v28+24;; @0062 store notrap aligned region9 v110, v26+80-;; @0062 v112 = load.i64 notrap aligned region2 v69+88+;; @0062 v112 = load.i64 notrap aligned region2 v69+104;; @0062 jump block10;;;; block12 cold:;; @0062 trap user12;;;; block13:-;; v169 = iconst.i64 144-;; v170 = iadd.i64 v69, v169 ; v169 = 144+;; v169 = iconst.i64 160+;; v170 = iadd.i64 v69, v169 ; v169 = 160;; @0062 v121 = load.i64 notrap aligned region15 v170+8;; @0062 v122 = load.i32 notrap aligned region16 v121;; v171 = iconst.i32 0@@ -391,8 +391,8 @@;; @0062 store notrap aligned region9 v129, v26+80;; @0062 v132 = iconst.i32 4;; @0062 store notrap aligned region6 v132, v69+32 ; v132 = 4-;; @0062 v133 = iconst.i64 120-;; @0062 v134 = iadd.i64 v69, v133 ; v133 = 120+;; @0062 v133 = iconst.i64 136+;; @0062 v134 = iadd.i64 v69, v133 ; v133 = 136;; @0062 v135 = load.i64 notrap aligned region15 v134+8;; v163 = iconst.i32 0;; @0062 store notrap aligned region17 v163, v134 ; v163 = 0diff --git a/tests/disas/stack-switching/resume-suspend.wat b/tests/disas/stack-switching/resume-suspend.watindex ff5c9192fb..c00d4a95f8 100644--- a/tests/disas/stack-switching/resume-suspend.wat+++ b/tests/disas/stack-switching/resume-suspend.wat@@ -27,14 +27,14 @@;; region0 = 123 "";; region1 = 160 "";; region2 = 106 ""-;; region3 = 225 ""+;; region3 = 153 "";; region4 = 214 "";; region5 = 13 "";; region6 = 55 ""-;; region7 = 153 ""+;; region7 = 211 "";; region8 = 118 "";; region9 = 255 ""-;; region10 = 211 ""+;; region10 = 26 "";; region11 = 82 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8@@ -59,8 +59,8 @@;; @003b jump block3;;;; block3:-;; @003b v11 = load.i64 notrap aligned region3 v8+64-;; @003b v12 = load.i64 notrap aligned region3 v8+72+;; @003b v11 = load.i64 notrap aligned region3 v8+80+;; @003b v12 = load.i64 notrap aligned region3 v8+88;; v73 = iconst.i64 40;; v74 = iadd v12, v73 ; v73 = 40;; @003b v15 = load.i64 notrap aligned region4 v74+8@@ -89,20 +89,20 @@;; @003b brif v79, block6, block4(v81);;;; block6:-;; @003b store.i64 notrap aligned region7 v8, v6+80+;; @003b store.i64 notrap aligned region7 v8, v6+96;; v82 = iconst.i32 1-;; @003b v28 = iconst.i64 144-;; @003b v29 = iadd.i64 v6, v28 ; v28 = 144+;; @003b v28 = iconst.i64 160+;; @003b v29 = iadd.i64 v6, v28 ; v28 = 160;; @003b store notrap aligned region8 v82, v29+4 ; v82 = 1;; @003b v31 = stack_addr.i64 ss0;; @003b store notrap aligned region4 v31, v29+8;; v83 = iconst.i32 3;; @003b store notrap aligned region9 v83, v6+32 ; v83 = 3;; @003b v32 = iconst.i64 0-;; @003b store notrap aligned region3 v32, v8+64 ; v32 = 0-;; @003b store notrap aligned region3 v32, v8+72 ; v32 = 0-;; @003b v42 = iconst.i64 96-;; @003b v43 = iadd.i64 v8, v42 ; v42 = 96+;; @003b store notrap aligned region3 v32, v8+80 ; v32 = 0+;; @003b store notrap aligned region3 v32, v8+88 ; v32 = 0+;; @003b v42 = iconst.i64 112+;; @003b v43 = iadd.i64 v8, v42 ; v42 = 112;; @003b v44 = load.i64 notrap aligned region10 v43;; @003b v45 = iconst.i64 -24;; @003b v46 = iadd v44, v45 ; v45 = -24@@ -117,7 +117,7 @@;; @003b brif v51, block8, block9;;;; block8 cold:-;; v87 = iadd.i64 v6, v28 ; v28 = 144+;; v87 = iadd.i64 v6, v28 ; v28 = 160;; @003b v54 = load.i64 notrap aligned region4 v87+8;; @003b v55 = load.i32 notrap aligned region6 v54;; v88 = iconst.i32 0@@ -131,7 +131,7 @@;; @003b trap user12;;;; block9:-;; v84 = iadd.i64 v6, v28 ; v28 = 144+;; v84 = iadd.i64 v6, v28 ; v28 = 160;; @003b v61 = load.i64 notrap aligned region4 v84+8;; v85 = iconst.i32 0;; @003b store notrap aligned region11 v85, v84 ; v85 = 0@@ -148,10 +148,10 @@;; ss0 = explicit_slot 8, align = 256;; region0 = 123 "";; region1 = 160 ""-;; region2 = 206 ""-;; region3 = 153 ""+;; region2 = 28 ""+;; region3 = 211 "";; region4 = 106 ""-;; region5 = 225 ""+;; region5 = 153 "";; region6 = 255 "";; region7 = 231 "";; region8 = 243 ""@@ -164,7 +164,7 @@;; region15 = 214 "";; region16 = 55 "";; region17 = 82 ""-;; region18 = 211 ""+;; region18 = 26 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -181,7 +181,7 @@;; @0043 v10 = call fn0(v0, v9) ; v9 = 0;; @0045 trapz v10, user16;; @0045 v14 = call fn1(v0, v10, v9, v9, v9) ; v9 = 0, v9 = 0, v9 = 0-;; @0045 v15 = load.i64 notrap aligned region2 v14+88+;; @0045 v15 = load.i64 notrap aligned region2 v14+104;; @004e jump block3;;;; block3:@@ -191,7 +191,7 @@;; v156 = ireduce.i64 v154;; v158 = bor v156, v14;; @004e trapz v158, user16-;; @004e v27 = load.i64 notrap aligned region2 v158+88+;; @004e v27 = load.i64 notrap aligned region2 v158+104;; @0045 v16 = uextend.i128 v14;; @0045 v21 = bor v154, v16;; v160 = ushr v21, v5 ; v5 = 64@@ -200,15 +200,15 @@;; @004e trapz v28, user23;; @004e v29 = iconst.i64 1;; @004e v30 = iadd v27, v29 ; v29 = 1-;; @004e store notrap aligned region2 v30, v158+88-;; @004e v31 = load.i64 notrap aligned region3 v158+80+;; @004e store notrap aligned region2 v30, v158+104+;; @004e v31 = load.i64 notrap aligned region3 v158+96;; @004e v32 = load.i64 notrap aligned readonly can_move region0 v0+8;; @004e v33 = load.i64 notrap aligned region4 v32+88;; @004e v34 = load.i64 notrap aligned region4 v32+96-;; @004e store notrap aligned region5 v33, v31+64-;; @004e store notrap aligned region5 v34, v31+72+;; @004e store notrap aligned region5 v33, v31+80+;; @004e store notrap aligned region5 v34, v31+88;; @0040 v2 = iconst.i64 0-;; @004e store notrap aligned region3 v2, v158+80 ; v2 = 0+;; @004e store notrap aligned region3 v2, v158+96 ; v2 = 0;; @004e v36 = iconst.i64 2;; @004e store notrap aligned region4 v36, v32+88 ; v36 = 2;; @004e store notrap aligned region4 v158, v32+96@@ -242,8 +242,8 @@;; @004e store notrap aligned region16 v60, v58;; @004e store notrap aligned region17 v40, v56 ; v40 = 1;; @004e store notrap aligned region12 v40, v34+56 ; v40 = 1-;; @004e v67 = iconst.i64 96-;; @004e v68 = iadd v31, v67 ; v67 = 96+;; @004e v67 = iconst.i64 112+;; @004e v68 = iadd v31, v67 ; v67 = 112;; @004e v69 = load.i64 notrap aligned region18 v68;; @004e v70 = iconst.i64 -24;; @004e v71 = iadd v69, v70 ; v70 = -24@@ -280,14 +280,14 @@;; @004e v93 = load.i64 notrap aligned region12 v34+24;; @004e store notrap aligned region9 v93, v32+80;; v174 = iconst.i32 0-;; v175 = iconst.i64 120-;; v176 = iadd.i64 v75, v175 ; v175 = 120+;; v175 = iconst.i64 136+;; v176 = iadd.i64 v75, v175 ; v175 = 136;; @004e store notrap aligned region17 v174, v176 ; v174 = 0;; @004e store notrap aligned region14 v174, v176+4 ; v174 = 0;; v177 = iconst.i64 0;; @004e store notrap aligned region15 v177, v176+8 ; v177 = 0-;; v178 = iconst.i64 144-;; v179 = iadd.i64 v75, v178 ; v178 = 144+;; v178 = iconst.i64 160+;; v179 = iadd.i64 v75, v178 ; v178 = 160;; @004e store notrap aligned region17 v174, v179 ; v174 = 0;; @004e store notrap aligned region14 v174, v179+4 ; v174 = 0;; @004e store notrap aligned region15 v177, v179+8 ; v177 = 0@@ -311,15 +311,15 @@;; @004e store notrap aligned region8 v115, v32+64;; @004e v116 = load.i64 notrap aligned region12 v34+24;; @004e store notrap aligned region9 v116, v32+80-;; @004e v118 = load.i64 notrap aligned region2 v75+88+;; @004e v118 = load.i64 notrap aligned region2 v75+104;; @004e jump block8;;;; block10 cold:;; @004e trap user12;;;; block11:-;; @004e v125 = iconst.i64 144-;; @004e v126 = iadd.i64 v75, v125 ; v125 = 144+;; @004e v125 = iconst.i64 160+;; @004e v126 = iadd.i64 v75, v125 ; v125 = 160;; @004e v127 = load.i64 notrap aligned region15 v126+8;; v171 = iconst.i32 0;; @004e store notrap aligned region17 v171, v126 ; v171 = 0@@ -345,8 +345,8 @@;; @004e store notrap aligned region9 v134, v32+80;; @004e v137 = iconst.i32 4;; @004e store notrap aligned region6 v137, v75+32 ; v137 = 4-;; @004e v138 = iconst.i64 120-;; @004e v139 = iadd.i64 v75, v138 ; v138 = 120+;; @004e v138 = iconst.i64 136+;; @004e v139 = iadd.i64 v75, v138 ; v138 = 136;; @004e v140 = load.i64 notrap aligned region15 v139+8;; v166 = iconst.i32 0;; @004e store notrap aligned region17 v166, v139 ; v166 = 0diff --git a/tests/disas/stack-switching/symmetric-switch.wat b/tests/disas/stack-switching/symmetric-switch.watindex 9747d7298d..edb6dbb5f0 100644--- a/tests/disas/stack-switching/symmetric-switch.wat+++ b/tests/disas/stack-switching/symmetric-switch.wat@@ -30,14 +30,14 @@;; ss1 = explicit_slot 24, align = 256;; region0 = 123 "";; region1 = 160 ""-;; region2 = 206 ""+;; region2 = 28 "";; region3 = 106 ""-;; region4 = 225 ""+;; region4 = 153 "";; region5 = 214 "";; region6 = 13 "";; region7 = 82 "";; region8 = 55 ""-;; region9 = 153 ""+;; region9 = 211 "";; region10 = 118 "";; region11 = 255 "";; region12 = 231 ""@@ -46,7 +46,7 @@;; region15 = 23 "";; region16 = 224 "";; region17 = 179 ""-;; region18 = 211 ""+;; region18 = 26 "";; region19 = 187 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8@@ -67,7 +67,7 @@;; @003c v5 = iconst.i32 0;; @003c v6 = iconst.i32 0;; @003c v7 = call fn1(v0, v3, v4, v5, v6) ; v4 = 1, v5 = 0, v6 = 0-;; @003c v8 = load.i64 notrap aligned region2 v7+88+;; @003c v8 = load.i64 notrap aligned region2 v7+104;; @003c v9 = uextend.i128 v7;; @003c v10 = uextend.i128 v8;; @003c v11 = iconst.i64 64@@ -80,12 +80,12 @@;; @003e v18 = ushr v14, v17;; @003e v19 = ireduce.i64 v18;; @003e trapz v15, user16-;; @003e v20 = load.i64 notrap aligned region2 v15+88+;; @003e v20 = load.i64 notrap aligned region2 v15+104;; @003e v21 = icmp eq v20, v19;; @003e trapz v21, user23;; @003e v22 = iconst.i64 1;; @003e v23 = iadd v20, v22 ; v22 = 1-;; @003e store notrap aligned region2 v23, v15+88+;; @003e store notrap aligned region2 v23, v15+104;; @003e v24 = iconst.i64 48;; @003e v25 = iadd v0, v24 ; v24 = 48;; @003e v26 = load.i64 notrap aligned readonly can_move region0 v0+8@@ -99,8 +99,8 @@;; @003e brif v32, block7, block3;;;; block3:-;; @003e v33 = load.i64 notrap aligned region4 v30+64-;; @003e v34 = load.i64 notrap aligned region4 v30+72+;; @003e v33 = load.i64 notrap aligned region4 v30+80+;; @003e v34 = load.i64 notrap aligned region4 v30+88;; @003e v35 = iconst.i64 40;; @003e v36 = iadd v34, v35 ; v35 = 40;; @003e v37 = load.i64 notrap aligned region5 v36+8@@ -127,9 +127,9 @@;; @003e trap user22;;;; block6:-;; @003e store.i64 notrap aligned region9 v30, v28+80-;; @003e v50 = iconst.i64 144-;; @003e v51 = iadd.i64 v28, v50 ; v50 = 144+;; @003e store.i64 notrap aligned region9 v30, v28+96+;; @003e v50 = iconst.i64 160+;; @003e v51 = iadd.i64 v28, v50 ; v50 = 160;; @003e v52 = iconst.i32 1;; @003e v53 = stack_addr.i64 ss0;; @003e store notrap aligned region10 v52, v51+4 ; v52 = 1@@ -140,8 +140,8 @@;; @003e store notrap aligned region11 v56, v55+32 ; v56 = 3;; @003e v57 = iconst.i64 0;; @003e v58 = iconst.i64 0-;; @003e store notrap aligned region4 v57, v30+64 ; v57 = 0-;; @003e store notrap aligned region4 v58, v30+72 ; v58 = 0+;; @003e store notrap aligned region4 v57, v30+80 ; v57 = 0+;; @003e store notrap aligned region4 v58, v30+88 ; v58 = 0;; @003e v59 = load.i64 notrap aligned readonly can_move region0 v0+8;; @003e v60 = iconst.i64 0;; @003e v61 = iadd v55, v60 ; v60 = 0@@ -151,7 +151,7 @@;; @003e store notrap aligned region15 v62, v61+8;; @003e store notrap aligned region16 v63, v61+16;; @003e store notrap aligned region6 v64, v61+24-;; @003e v65 = load.i64 notrap aligned region2 v28+88+;; @003e v65 = load.i64 notrap aligned region2 v28+104;; @003e v66 = uextend.i128 v28;; @003e v67 = uextend.i128 v65;; @003e v68 = iconst.i64 64@@ -166,8 +166,8 @@;; @003e brif v77, block9, block8;;;; block8:-;; @003e v78 = iconst.i64 120-;; @003e v79 = iadd.i64 v15, v78 ; v78 = 120+;; @003e v78 = iconst.i64 136+;; @003e v79 = iadd.i64 v15, v78 ; v78 = 136;; @003e v80 = load.i64 notrap aligned region5 v79+8;; @003e v81 = load.i32 notrap aligned region7 v79;; @003e v82 = iconst.i32 1@@ -180,8 +180,8 @@;; @003e jump block10(v87);;;; block9:-;; @003e v88 = iconst.i64 144-;; @003e v89 = iadd.i64 v15, v88 ; v88 = 144+;; @003e v88 = iconst.i64 160+;; @003e v89 = iadd.i64 v15, v88 ; v88 = 160;; @003e v90 = load.i64 notrap aligned region5 v89+8;; @003e v91 = load.i32 notrap aligned region7 v89;; @003e v92 = iconst.i32 1@@ -199,9 +199,9 @@;; @003e v99 = iadd.i64 v15, v98 ; v98 = 0;; @003e v100 = iconst.i32 1;; @003e store notrap aligned region11 v100, v99+32 ; v100 = 1-;; @003e v101 = load.i64 notrap aligned region9 v15+80-;; @003e store.i64 notrap aligned region4 v33, v101+64-;; @003e store.i64 notrap aligned region4 v34, v101+72+;; @003e v101 = load.i64 notrap aligned region9 v15+96+;; @003e store.i64 notrap aligned region4 v33, v101+80+;; @003e store.i64 notrap aligned region4 v34, v101+88;; @003e v102 = iconst.i64 2;; @003e v103 = load.i64 notrap aligned readonly can_move region0 v0+8;; @003e store notrap aligned region3 v102, v103+88 ; v102 = 2@@ -216,13 +216,13 @@;; @003e store notrap aligned region13 v108, v59+64;; @003e v109 = load.i64 notrap aligned region6 v105+24;; @003e store notrap aligned region14 v109, v59+80-;; @003e v110 = iconst.i64 96-;; @003e v111 = iadd.i64 v30, v110 ; v110 = 96+;; @003e v110 = iconst.i64 112+;; @003e v111 = iadd.i64 v30, v110 ; v110 = 112;; @003e v112 = load.i64 notrap aligned region18 v111;; @003e v113 = iconst.i64 -24;; @003e v114 = iadd v112, v113 ; v113 = -24-;; @003e v115 = iconst.i64 96-;; @003e v116 = iadd v101, v115 ; v115 = 96+;; @003e v115 = iconst.i64 112+;; @003e v116 = iadd v101, v115 ; v115 = 112;; @003e v117 = load.i64 notrap aligned region18 v116;; @003e v118 = iconst.i64 -24;; @003e v119 = iadd v117, v118 ; v118 = -24@@ -250,8 +250,8 @@;; @003e brif v134, block11, block12;;;; block11 cold:-;; @003e v135 = iconst.i64 144-;; @003e v136 = iadd.i64 v28, v135 ; v135 = 144+;; @003e v135 = iconst.i64 160+;; @003e v136 = iadd.i64 v28, v135 ; v135 = 160;; @003e v137 = load.i64 notrap aligned region5 v136+8;; @003e v138 = load.i32 notrap aligned region8 v137;; @003e v139 = iconst.i32 0@@ -266,8 +266,8 @@;; @003e trap user12;;;; block12:-;; @003e v142 = iconst.i64 144-;; @003e v143 = iadd.i64 v28, v142 ; v142 = 144+;; @003e v142 = iconst.i64 160+;; @003e v143 = iadd.i64 v28, v142 ; v142 = 160;; @003e v144 = load.i64 notrap aligned region5 v143+8;; @003e v145 = iconst.i32 0;; @003e store notrap aligned region7 v145, v143 ; v145 = 0@@ -300,10 +300,10 @@;; ss0 = explicit_slot 8, align = 256;; region0 = 123 "";; region1 = 160 ""-;; region2 = 206 ""-;; region3 = 153 ""+;; region2 = 28 ""+;; region3 = 211 "";; region4 = 106 ""-;; region5 = 225 ""+;; region5 = 153 "";; region6 = 255 "";; region7 = 231 "";; region8 = 243 ""@@ -316,7 +316,7 @@;; region15 = 214 "";; region16 = 55 "";; region17 = 82 ""-;; region18 = 211 ""+;; region18 = 26 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -336,7 +336,7 @@;; @0049 v5 = iconst.i32 0;; @0049 v6 = iconst.i32 0;; @0049 v7 = call fn1(v0, v3, v4, v5, v6) ; v4 = 0, v5 = 0, v6 = 0-;; @0049 v8 = load.i64 notrap aligned region2 v7+88+;; @0049 v8 = load.i64 notrap aligned region2 v7+104;; @0049 v9 = uextend.i128 v7;; @0049 v10 = uextend.i128 v8;; @0049 v11 = iconst.i64 64@@ -352,20 +352,20 @@;; @004b v18 = ushr.i128 v14, v17;; @004b v19 = ireduce.i64 v18;; @004b trapz v15, user16-;; @004b v20 = load.i64 notrap aligned region2 v15+88+;; @004b v20 = load.i64 notrap aligned region2 v15+104;; @004b v21 = icmp eq v20, v19;; @004b trapz v21, user23;; @004b v22 = iconst.i64 1;; @004b v23 = iadd v20, v22 ; v22 = 1-;; @004b store notrap aligned region2 v23, v15+88-;; @004b v24 = load.i64 notrap aligned region3 v15+80+;; @004b store notrap aligned region2 v23, v15+104+;; @004b v24 = load.i64 notrap aligned region3 v15+96;; @004b v25 = load.i64 notrap aligned readonly can_move region0 v0+8;; @004b v26 = load.i64 notrap aligned region4 v25+88;; @004b v27 = load.i64 notrap aligned region4 v25+96-;; @004b store notrap aligned region5 v26, v24+64-;; @004b store notrap aligned region5 v27, v24+72+;; @004b store notrap aligned region5 v26, v24+80+;; @004b store notrap aligned region5 v27, v24+88;; @004b v28 = iconst.i64 0-;; @004b store notrap aligned region3 v28, v15+80 ; v28 = 0+;; @004b store notrap aligned region3 v28, v15+96 ; v28 = 0;; @004b v29 = iconst.i64 2;; @004b v30 = load.i64 notrap aligned readonly can_move region0 v0+8;; @004b store notrap aligned region4 v29, v30+88 ; v29 = 2@@ -414,8 +414,8 @@;; @004b v57 = iconst.i64 1;; @004b v58 = iconst.i64 32;; @004b v59 = ishl v57, v58 ; v57 = 1, v58 = 32-;; @004b v60 = iconst.i64 96-;; @004b v61 = iadd v24, v60 ; v60 = 96+;; @004b v60 = iconst.i64 112+;; @004b v61 = iadd v24, v60 ; v60 = 112;; @004b v62 = load.i64 notrap aligned region18 v61;; @004b v63 = iconst.i64 -24;; @004b v64 = iadd v62, v63 ; v63 = -24@@ -459,16 +459,16 @@;; @004b store notrap aligned region8 v85, v35+64;; @004b v86 = load.i64 notrap aligned region12 v82+24;; @004b store notrap aligned region9 v86, v35+80-;; @004b v87 = iconst.i64 120-;; @004b v88 = iadd.i64 v68, v87 ; v87 = 120+;; @004b v87 = iconst.i64 136+;; @004b v88 = iadd.i64 v68, v87 ; v87 = 136;; @004b v89 = iconst.i32 0;; @004b store notrap aligned region17 v89, v88 ; v89 = 0;; @004b v90 = iconst.i32 0;; @004b store notrap aligned region14 v90, v88+4 ; v90 = 0;; @004b v91 = iconst.i64 0;; @004b store notrap aligned region15 v91, v88+8 ; v91 = 0-;; @004b v92 = iconst.i64 144-;; @004b v93 = iadd.i64 v68, v92 ; v92 = 144+;; @004b v92 = iconst.i64 160+;; @004b v93 = iadd.i64 v68, v92 ; v92 = 160;; @004b v94 = iconst.i32 0;; @004b store notrap aligned region17 v94, v93 ; v94 = 0;; @004b v95 = iconst.i32 0@@ -502,7 +502,7 @@;; @004b v109 = load.i64 notrap aligned region12 v105+24;; @004b store notrap aligned region9 v109, v35+80;; @004b v110 = ireduce.i32 v65-;; @004b v111 = load.i64 notrap aligned region2 v68+88+;; @004b v111 = load.i64 notrap aligned region2 v68+104;; @004b v112 = uextend.i128 v68;; @004b v113 = uextend.i128 v111;; @004b v114 = iconst.i64 64@@ -532,8 +532,8 @@;; @004b v125 = iadd.i64 v68, v124 ; v124 = 0;; @004b v126 = iconst.i32 4;; @004b store notrap aligned region6 v126, v125+32 ; v126 = 4-;; @004b v127 = iconst.i64 120-;; @004b v128 = iadd.i64 v68, v127 ; v127 = 120+;; @004b v127 = iconst.i64 136+;; @004b v128 = iadd.i64 v68, v127 ; v127 = 136;; @004b v129 = load.i64 notrap aligned region15 v128+8;; @004b v130 = iconst.i32 0;; @004b store notrap aligned region17 v130, v128 ; v130 = 0