A lightweight WebAssembly runtime that is fast, secure, and standards-compliant
Optimize the implementation of `ref.func` (#14683)
Alex Crichtond27e208d9142
diff --git a/cranelift/codegen/src/ir/memflags.rs b/cranelift/codegen/src/ir/memflags.rsindex 184080311e..dc63a5aa6e 100644--- a/cranelift/codegen/src/ir/memflags.rs+++ b/cranelift/codegen/src/ir/memflags.rs@@ -344,9 +344,14 @@ impl MemFlagsData {/// Test if the `readonly` flag is set.///- /// Loads with this flag have no memory dependencies.- /// This results in undefined behavior if the dereferenced memory is mutated at any time- /// between when the function is called and when it is exited.+ /// Loads with this flag may be eliminated if a previous `readonly` load+ /// loaded from the same location. The previous load must dominate this+ /// load, and otherwise it does not matter what happens in between.+ ///+ /// Note that if this load is `can_move` then the memory must be readonly+ /// for the entire function that this load is within. If the load is NOT+ /// `can_move`, then mutations may happen before this load but cannot+ /// happen after this load.pub const fn readonly(self) -> bool {self.flags.readonly()}diff --git a/cranelift/codegen/src/isa/aarch64/inst/mod.rs b/cranelift/codegen/src/isa/aarch64/inst/mod.rsindex 333896deb4..26f2782477 100644--- a/cranelift/codegen/src/isa/aarch64/inst/mod.rs+++ b/cranelift/codegen/src/isa/aarch64/inst/mod.rs@@ -3225,6 +3225,16 @@ pub enum LabelUse {/// 32-bit PC relative constant offset (from address of constant itself),/// signed. Used in jump tables.PCRel32,+ /// 21-bit page offset for ADRP. The immediate is the signed difference+ /// between the 4KiB page of the label and the 4KiB page of the ADRP+ /// instruction, with high 19 bits in bits 23:5 and low 2 bits in bits+ /// 30:29. Equivalent to the `R_AARCH64_ADR_PREL_PG_HI21` relocation.+ AdrpPage21,+ /// Low 12 bits of the label's address in the 12-bit immediate of an ADD+ /// (immediate), bits 21:10. Equivalent to the `R_AARCH64_ADD_ABS_LO12_NC`+ /// relocation. This has the same 4KiB-alignment requirement as+ /// `AdrpPage21`, with which it is paired.+ AddLo12,}impl MachInstLabelUse for LabelUse {@@ -3245,6 +3255,10 @@ impl MachInstLabelUse for LabelUse {// range.LabelUse::Adr21 => (1 << 20) - 1,LabelUse::PCRel32 => 0x7fffffff,+ // `adrp` technically has +/-4GiB of range, but cap it to the same+ // range as other 32-bit uses to keep offset arithmetic within+ // `u32`.+ LabelUse::AdrpPage21 | LabelUse::AddLo12 => 0x7fffffff,}}@@ -3263,11 +3277,27 @@ impl MachInstLabelUse for LabelUse {/// Perform the patch.fn patch(self, buffer: &mut [u8], use_offset: CodeOffset, label_offset: CodeOffset) {+ let insn_word = u32::from_le_bytes([buffer[0], buffer[1], buffer[2], buffer[3]]);+ match self {+ LabelUse::AdrpPage21 => {+ let page_delta = i64::from(label_offset >> 12) - i64::from(use_offset >> 12);+ let imm = page_delta as u32;+ let insn_word = (insn_word & !0x60ffffe0) | (imm & 0x1ffffc) << 3 | (imm & 3) << 29;+ buffer[0..4].clone_from_slice(&u32::to_le_bytes(insn_word));+ return;+ }+ LabelUse::AddLo12 => {+ let imm12 = label_offset & 0xfff;+ let insn_word = (insn_word & !(0xfff << 10)) | imm12 << 10;+ buffer[0..4].clone_from_slice(&u32::to_le_bytes(insn_word));+ return;+ }+ _ => {}+ }let pc_rel = (label_offset as i64) - (use_offset as i64);assert!(pc_rel <= self.max_pos_range() as i64);assert!(pc_rel >= -(self.max_neg_range() as i64));let pc_rel = pc_rel as u32;- let insn_word = u32::from_le_bytes([buffer[0], buffer[1], buffer[2], buffer[3]]);let mask = match self {LabelUse::Branch14 => 0x0007ffe0, // bits 18..5 inclusiveLabelUse::Branch19 => 0x00ffffe0, // bits 23..5 inclusive@@ -3275,6 +3305,7 @@ impl MachInstLabelUse for LabelUse {LabelUse::Ldr19 => 0x00ffffe0, // bits 23..5 inclusiveLabelUse::Adr21 => 0x60ffffe0, // bits 30..29, 25..5 inclusiveLabelUse::PCRel32 => 0xffffffff,+ LabelUse::AdrpPage21 | LabelUse::AddLo12 => unreachable!(),};let pc_rel_shifted = match self {LabelUse::Adr21 | LabelUse::PCRel32 => pc_rel,@@ -3291,6 +3322,7 @@ impl MachInstLabelUse for LabelUse {// *high* bits (30, 29).LabelUse::Adr21 => (pc_rel_shifted & 0x1ffffc) << 3 | (pc_rel_shifted & 3) << 29,LabelUse::PCRel32 => pc_rel_shifted,+ LabelUse::AdrpPage21 | LabelUse::AddLo12 => unreachable!(),};let is_add = match self {LabelUse::PCRel32 => true,@@ -3381,6 +3413,8 @@ impl MachInstLabelUse for LabelUse {fn from_reloc(reloc: Reloc, addend: Addend) -> Option<LabelUse> {match (reloc, addend) {(Reloc::Arm64Call, 0) => Some(LabelUse::Branch26),+ (Reloc::Aarch64AdrPrelPgHi21, 0) => Some(LabelUse::AdrpPage21),+ (Reloc::Aarch64AddAbsLo12Nc, 0) => Some(LabelUse::AddLo12),_ => None,}}diff --git a/cranelift/codegen/src/isa/riscv64/inst/mod.rs b/cranelift/codegen/src/isa/riscv64/inst/mod.rsindex 056e0c4b9f..e55a895101 100644--- a/cranelift/codegen/src/isa/riscv64/inst/mod.rs+++ b/cranelift/codegen/src/isa/riscv64/inst/mod.rs@@ -1822,6 +1822,12 @@ impl MachInstLabelUse for LabelUse {fn from_reloc(reloc: Reloc, addend: Addend) -> Option<LabelUse> {match (reloc, addend) {(Reloc::RiscvCallPlt, _) => Some(Self::PCRel32),+ (Reloc::RiscvPCRelHi20, 0) => Some(Self::PCRelHi20),+ // Note that, unlike `R_RISCV_PCREL_LO12_I`, `PCRelLo12I` is+ // resolved against the final target rather than the label of the+ // paired `auipc`, which must be the immediately preceding+ // instruction. This is the shape of `LoadExtNameNear`.+ (Reloc::RiscvPCRelLo12I, 0) => Some(Self::PCRelLo12I),_ => None,}}diff --git a/crates/cranelift/src/alias_region.rs b/crates/cranelift/src/alias_region.rsindex 31b4c8d0a8..9f469aeab8 100644--- a/crates/cranelift/src/alias_region.rs+++ b/crates/cranelift/src/alias_region.rs@@ -581,6 +581,23 @@ impl<'a, Offsets> Field<'a, Offsets> {.ins().store(flags, value, ptr, i32::try_from(self.offset).unwrap());}++ /// Like [`Self::store`], except removes the `readonly` flag for this region+ /// if one would otherwise be specified.+ ///+ /// This is useful for `#[readonly]` fields that are initialized precisely+ /// once before use, such as `VMFuncRef` fields.+ pub fn store_without_readonly(+ &mut self,+ cursor: &mut FuncCursor<'_>,+ ptr: ir::Value,+ value: ir::Value,+ ) {+ let flags = self.flags_with_region(cursor.func).with_readonly(false);+ cursor+ .ins()+ .store(flags, value, ptr, i32::try_from(self.offset).unwrap());+ }}/// Define, for each `VM*` type, an `AliasRegions` accessor that returns adiff --git a/crates/cranelift/src/compiled_function.rs b/crates/cranelift/src/compiled_function.rsindex ad60d745c2..287d318326 100644--- a/crates/cranelift/src/compiled_function.rs+++ b/crates/cranelift/src/compiled_function.rs@@ -2,8 +2,8 @@ use std::ops::Range;use crate::{Relocation, mach_reloc_to_reloc, mach_trap_to_trap};use cranelift_codegen::{- MachBufferFinalized, MachBufferFrameLayout, MachSrcLoc, ValueLabelsRanges, ir,- isa::unwind::CfaUnwindInfo, isa::unwind::UnwindInfo,+ MachBufferFinalized, MachBufferFrameLayout, MachSrcLoc, RelocTarget, ValueLabelsRanges,+ binemit::Reloc, ir, isa::unwind::CfaUnwindInfo, isa::unwind::UnwindInfo,};use wasmtime_environ::{FilePos, FrameStateSlotBuilder, InstructionAddressMap, ModulePC, PrimaryMap, TrapInformation,@@ -145,10 +145,31 @@ impl CompiledFunction {/// Returns an iterator to the function's relocation information.pub fn relocations(&self) -> impl Iterator<Item = Relocation> + '_ {- self.buffer- .relocs()- .iter()- .map(|r| mach_reloc_to_reloc(r, &self.name_map))+ let mut prev_hi20 = None;+ self.buffer.relocs().iter().map(move |r| {+ // On riscv64 this relocation points to the previous instruction+ // which is `auipc` and has its own relocation. To more easily+ // handle that here the target of the relocation is rewritten to the+ // target of the previous `auipc` relocation.+ if let (Reloc::RiscvPCRelLo12I, RelocTarget::Label(_)) = (r.kind, &r.target) {+ let hi20: Relocation = prev_hi20+ .take()+ .expect("PCREL_LO12_I relocation without a preceding PCREL_HI20");+ assert_eq!(hi20.offset + 4, r.offset);+ return Relocation {+ offset: r.offset,+ reloc: r.kind,+ ..hi20+ };+ }+ let reloc = mach_reloc_to_reloc(r, &self.name_map);+ prev_hi20 = if reloc.reloc == Reloc::RiscvPCRelHi20 {+ Some(reloc.clone())+ } else {+ None+ };+ reloc+ })}/// Returns an iterator to the function's trap information.diff --git a/crates/cranelift/src/func_environ.rs b/crates/cranelift/src/func_environ.rsindex 303d42a905..eeb40ccec4 100644--- a/crates/cranelift/src/func_environ.rs+++ b/crates/cranelift/src/func_environ.rs@@ -3382,12 +3382,82 @@ impl FuncEnvironment<'_> {mut pos: cranelift_codegen::cursor::FuncCursor<'_>,func_index: FuncIndex,) -> WasmResult<ir::Value> {- let func_index = pos.ins().iconst(I32, func_index.as_u32() as i64);- let ref_func = self.builtin_functions.ref_func(&mut pos.func);- let vmctx = self.vmctx_val(&mut pos);+ match self.module.defined_func_index(func_index) {+ Some(def_index) => Ok(self.translate_ref_defined_func(&mut pos, def_index)),+ // `VMFunctionImport` has the same layout as `VMFuncRef` and is+ // fully initialized before any wasm runs, so a reference to an+ // imported function is just a pointer into the `vmctx`.+ None => {+ let offset = self.offsets.imported_functions().at(func_index);+ let vmctx = self.vmctx_val(&mut pos);+ Ok(pos.ins().iadd_imm_s(vmctx, i64::from(offset)))+ }+ }+ }++ fn translate_ref_defined_func(+ &mut self,+ pos: &mut FuncCursor<'_>,+ def_index: DefinedFuncIndex,+ ) -> ir::Value {+ // NB: this mirrors `vm::Instance::initialize_and_return_funcref` and+ // needs to be kept in-sync with that method.+ let func_index = self.module.func_index(def_index);+ let pointer_type = self.pointer_type();+ let func = &self.module.functions[func_index];+ assert!(func.is_escaping());+ let func_ref_offset = self.offsets.func_refs().at(func.func_ref);+ let sig = func.signature.unwrap_module_type_index();++ let wasm_func = self.get_or_create_defined_func_ref(pos.func, def_index);+ let wasm_call = pos.ins().func_addr(pointer_type, wasm_func);++ let key = FuncKey::ArrayToWasmTrampoline(self.translation.module_index(), def_index);+ let (namespace, index) = key.into_raw_parts();+ let name = ir::ExternalName::User(+ pos.func+ .declare_imported_user_function(ir::UserExternalName { namespace, index }),+ );+ let signature = pos+ .func+ .import_signature(crate::array_call_signature(self.isa));+ let array_func = pos.func.import_function(ir::ExtFuncData {+ name,+ signature,+ colocated: true,+ patchable: false,+ });+ let array_call = pos.ins().func_addr(pointer_type, array_func);++ let type_index = self.module_interned_to_shared_ty(pos, sig);+ let vmctx = self.vmctx_val(pos);- let call_inst = pos.ins().call(ref_func, &[vmctx, func_index]);- Ok(pos.func.dfg.first_result(call_inst))+ // Note that these fields by default are `#[readonly]` which would+ // produce invalid CLIF with the default `store` method, so go out of+ // our way to remove the `readonly` flag here for these lazily+ // initialized fields.+ let regions = &mut self.alias_regions;+ regions+ .vm_func_ref()+ .array_call()+ .relative_to(func_ref_offset)+ .store_without_readonly(pos, vmctx, array_call);+ regions+ .vm_func_ref()+ .wasm_call()+ .relative_to(func_ref_offset)+ .store_without_readonly(pos, vmctx, wasm_call);+ regions+ .vm_func_ref()+ .vmctx()+ .relative_to(func_ref_offset)+ .store_without_readonly(pos, vmctx, vmctx);+ regions+ .vm_func_ref()+ .type_index()+ .relative_to(func_ref_offset)+ .store_without_readonly(pos, vmctx, type_index);+ pos.ins().iadd_imm_s(vmctx, i64::from(func_ref_offset))}pub(crate) fn translate_global_get(diff --git a/crates/environ/src/builtin.rs b/crates/environ/src/builtin.rsindex bc4e2f5554..8ccfdd77aa 100644--- a/crates/environ/src/builtin.rs+++ b/crates/environ/src/builtin.rs@@ -15,8 +15,6 @@ macro_rules! foreach_builtin_function {passive_elem_segment_base(vmctx: vmctx, elem: u32) -> pointer;// Guts of `elem.drop` for passive data segments.passive_elem_segment_drop(vmctx: vmctx, elem: u32) -> bool;- // Returns a value for wasm's `ref.func` instruction.- ref_func(vmctx: vmctx, func: u32) -> pointer;// Returns a table entry after lazily initializing it.table_get_lazy_init_func_ref(vmctx: vmctx, table: u32, index: u64) -> pointer;// Grows `table` by `delta` elements, returning the destination@@ -413,7 +411,6 @@ impl BuiltinFunctionIndex {(@get get_interned_func_ref pointer) => (TrapSentinel::NegativeOne);// These libcalls can't trap- (@get ref_func pointer) => (return None);(@get table_get_lazy_init_func_ref pointer) => (return None);(@get intern_func_ref_for_gc_heap u64) => (return None);(@get intern_contref_for_gc_heap u64) => (return None);diff --git a/crates/wasmtime/src/runtime/code_memory.rs b/crates/wasmtime/src/runtime/code_memory.rsindex 6130c7f641..54fccea45f 100644--- a/crates/wasmtime/src/runtime/code_memory.rs+++ b/crates/wasmtime/src/runtime/code_memory.rs@@ -490,6 +490,17 @@ impl CodeMemory {let text_addr = text.as_ptr() as usize;assert_eq!(text_addr & (mem.required_alignment() - 1), 0);+ // Native aarch64 code uses `adrp`-based page-relative relocations+ // within the text section which are only correct if the text+ // section starts on a 4KiB boundary. Memory from `mmap` is always+ // page-aligned, but custom code memory might not be.+ if cfg!(target_arch = "aarch64") {+ ensure!(+ text_addr % 4096 == 0,+ "text section is not 4KiB-aligned in memory"+ );+ }+// The custom code memory handler will ensure the// memory is executable and also handle icache// coherence.diff --git a/crates/wasmtime/src/runtime/vm/instance.rs b/crates/wasmtime/src/runtime/vm/instance.rsindex 7ecfa1eaf0..c512ae83bf 100644--- a/crates/wasmtime/src/runtime/vm/instance.rs+++ b/crates/wasmtime/src/runtime/vm/instance.rs@@ -947,6 +947,10 @@ impl Instance {// We arrived at this design because zeroing memory is expensive, so// it's better for instantiation performance if we don't have to track// "is-initialized" state at all!+ //+ // Note that this function is duplicated with compiled code generated by+ // the `translate_ref_defined_func` method and needs to be kept in-sync+ // with that.let module_with_code = ModuleWithCode::in_store(registry,diff --git a/crates/wasmtime/src/runtime/vm/libcalls.rs b/crates/wasmtime/src/runtime/vm/libcalls.rsindex 7bd010bc9f..7b4acc6883 100644--- a/crates/wasmtime/src/runtime/vm/libcalls.rs+++ b/crates/wasmtime/src/runtime/vm/libcalls.rs@@ -65,13 +65,11 @@ use crate::runtime::vm::{self, HostResultHasUnwindSentinel, VMStore, f32x4, f64x#[cfg(all(feature = "gc", feature = "stack-switching"))]use crate::vm::vmcontext::VMRawContObj;use core::convert::Infallible;-use core::ptr::NonNull;#[cfg(feature = "threads")]use core::time::Duration;use wasmtime_core::math::WasmFloat;use wasmtime_environ::{- CompiledTrap, DefinedMemoryIndex, DefinedTableIndex, FuncIndex, PassiveElemIndex, TableIndex,- Trap,+ CompiledTrap, DefinedMemoryIndex, DefinedTableIndex, PassiveElemIndex, TableIndex, Trap,};#[cfg(feature = "wmemcheck")]use wasmtime_wmemcheck::AccessError::{@@ -396,15 +394,6 @@ unsafe fn memory_fill(}}-// Implementation of `ref.func`.-fn ref_func(store: &mut dyn VMStore, instance: InstanceId, func_index: u32) -> NonNull<u8> {- let (instance, registry) = store.instance_and_module_registry_mut(instance);- instance- .get_func_ref(registry, FuncIndex::from_u32(func_index))- .expect("ref_func: funcref should always be available for given func index")- .cast()-}-// Returns a table entry after lazily initializing it.fn table_get_lazy_init_func_ref(store: &mut dyn VMStore,@@ -653,6 +642,7 @@ unsafe fn get_interned_contref(out_result: *mut u8,) -> Result<()> {use crate::store::AutoAssertNoGc;+ use core::ptr::NonNull;let store = AutoAssertNoGc::new(store.store_opaque_mut());let contobj = store.unwrap_gc_store().cont_ref_table.get(contref_id)?;diff --git a/tests/disas/aarch64-ref-func.wat b/tests/disas/aarch64-ref-func.watnew file mode 100644index 0000000000..e46256da9d--- /dev/null+++ b/tests/disas/aarch64-ref-func.wat@@ -0,0 +1,34 @@+;;! target = "aarch64"+;;! test = "compile"++;; `ref.func` of a defined function initializes its `VMFuncRef` within the+;; `vmctx` inline, using relocations for the function's code pointers.++(module+ (elem declare func $f)+ (func $f (result i32) i32.const 42)+ (func (export "ref-func") (result funcref)+ (ref.func $f)))+;; wasm[0]::function[0]::f:+;; stp x29, x30, [sp, #-0x10]!+;; mov x29, sp+;; mov w2, #0x2a+;; ldp x29, x30, [sp], #0x10+;; ret+;;+;; wasm[0]::function[1]:+;; stp x29, x30, [sp, #-0x10]!+;; mov x29, sp+;; adrp x6, #0+;; add x6, x6, #0x5c+;; str x6, [x2, #0x50]+;; adrp x7, #0+;; add x7, x7, #0+;; str x7, [x2, #0x58]+;; str x2, [x2, #0x68]+;; ldr x9, [x2, #0x28]+;; ldr w9, [x9]+;; str w9, [x2, #0x60]+;; add x2, x2, #0x50+;; ldp x29, x30, [sp], #0x10+;; retdiff --git a/tests/disas/alias-region-tables.wat b/tests/disas/alias-region-tables.watindex 3ac5f5239a..606bd6de7d 100644--- a/tests/disas/alias-region-tables.wat+++ b/tests/disas/alias-region-tables.wat@@ -32,7 +32,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64) -> i32 tail;; sig1 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig1+;; fn0 = colocated u805306368:6 sig1;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i64):diff --git a/tests/disas/array-fill-funcref.wat b/tests/disas/array-fill-funcref.watindex 3112d15930..ac977ca605 100644--- a/tests/disas/array-fill-funcref.wat+++ b/tests/disas/array-fill-funcref.wat@@ -31,7 +31,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64) -> i64 tail-;; fn0 = colocated u805306368:25 sig0+;; fn0 = colocated u805306368:24 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i64, v5: i32):@@ -93,7 +93,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64) -> i64 tail-;; fn0 = colocated u805306368:25 sig0+;; fn0 = colocated u805306368:24 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32):@@ -146,68 +146,78 @@;; };;;; function u0:2(i64 vmctx, i64, i32, i32, i32) tail {-;; ss0 = explicit_slot 4, align = 4;; region0 = 123 "";; region1 = 160 ""-;; region2 = 196 ""-;; region3 = 206 ""-;; region4 = 108 ""-;; region5 = 5 ""-;; region6 = 135 ""+;; region2 = 130 ""+;; region3 = 197 ""+;; region4 = 44 ""+;; region5 = 120 ""+;; region6 = 100 ""+;; region7 = 196 ""+;; region8 = 206 ""+;; region9 = 108 ""+;; region10 = 5 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24-;; sig0 = (i64 vmctx, i32) -> i64 tail-;; sig1 = (i64 vmctx, i64) -> i64 tail-;; fn0 = colocated u805306368:6 sig0-;; fn1 = colocated u805306368:25 sig1+;; sig0 = (i64 vmctx, i64) tail+;; sig1 = (i64 vmctx, i64, i64, i64) -> i8 system_v+;; sig2 = (i64 vmctx, i64) -> i64 tail+;; fn0 = colocated u0:3 sig0+;; fn1 = colocated u268435456:3 sig1+;; fn2 = colocated u805306368:24 sig2;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32):-;; v56 = stack_addr.i64 ss0-;; store notrap aligned region6 v2, v56-;; @0053 v5 = iconst.i32 3-;; @0053 v6 = call fn0(v0, v5), stack_map=[i32 @ ss0+0] ; v5 = 3-;; v55 = load.i32 notrap aligned region6 v56-;; @0057 trapz v55, user16-;; @0057 v8 = load.i64 notrap aligned readonly can_move region0 v0+8-;; @0057 v9 = load.i64 notrap aligned readonly can_move region2 v8+32-;; @0057 v7 = uextend.i64 v55-;; @0057 v10 = iadd v9, v7-;; @0057 v11 = iconst.i64 16-;; @0057 v12 = iadd v10, v11 ; v11 = 16-;; @0057 v13 = load.i32 user2 readonly region4 v12-;; @0057 v15 = uextend.i64 v3-;; @0057 v16 = uextend.i64 v4-;; @0057 v19 = iadd v15, v16-;; @0057 v14 = uextend.i64 v13-;; @0057 v20 = icmp ugt v19, v14-;; @0057 trapnz v20, user17-;; @0057 v37 = load.i64 notrap aligned region3 v8+40-;; @0057 v25 = iconst.i64 20-;; @0057 v26 = iadd v10, v25 ; v25 = 20-;; v59 = iconst.i64 2-;; v60 = ishl v15, v59 ; v59 = 2-;; @0057 v30 = iadd v26, v60-;; v62 = ishl v16, v59 ; v59 = 2-;; @0057 v39 = uadd_overflow_trap v30, v62, user2-;; @0057 v38 = iadd v9, v37-;; @0057 v40 = icmp ugt v39, v38-;; @0057 trapnz v40, user2-;; @0057 v41 = call fn1(v0, v6)-;; v64 = iconst.i32 0-;; v65 = icmp eq v4, v64 ; v64 = 0-;; @0057 v42 = ireduce.i32 v41-;; @0057 v28 = iconst.i64 4-;; @0057 v43 = iadd v30, v62-;; @0057 brif v65, block3, block2(v30)-;;-;; block2(v46: i64):-;; @0057 store.i32 notrap aligned little region5 v42, v46-;; v67 = iconst.i64 4-;; v68 = iadd v46, v67 ; v67 = 4-;; @0057 v49 = icmp eq v68, v43-;; @0057 brif v49, block3, block2(v68)+;; @0053 v6 = func_addr.i64 fn1+;; @0053 store notrap aligned region4 v6, v0+48+;; @0053 v5 = func_addr.i64 fn0+;; @0053 store notrap aligned region5 v5, v0+56+;; @0053 store notrap aligned region6 v0, v0+72+;; @0053 v7 = load.i64 notrap aligned readonly can_move region2 v0+40+;; @0053 v8 = load.i32 notrap aligned readonly can_move region3 v7+20+;; @0053 store notrap aligned region1 v8, v0+64+;; @0057 trapz v2, user16+;; @0057 v12 = load.i64 notrap aligned readonly can_move region0 v0+8+;; @0057 v13 = load.i64 notrap aligned readonly can_move region7 v12+32+;; @0057 v11 = uextend.i64 v2+;; @0057 v14 = iadd v13, v11+;; @0057 v15 = iconst.i64 16+;; @0057 v16 = iadd v14, v15 ; v15 = 16+;; @0057 v17 = load.i32 user2 readonly region9 v16+;; @0057 v19 = uextend.i64 v3+;; @0057 v20 = uextend.i64 v4+;; @0057 v23 = iadd v19, v20+;; @0057 v18 = uextend.i64 v17+;; @0057 v24 = icmp ugt v23, v18+;; @0057 trapnz v24, user17+;; @0057 v41 = load.i64 notrap aligned region8 v12+40+;; @0057 v29 = iconst.i64 20+;; @0057 v30 = iadd v14, v29 ; v29 = 20+;; v56 = iconst.i64 2+;; v57 = ishl v19, v56 ; v56 = 2+;; @0057 v34 = iadd v30, v57+;; v59 = ishl v20, v56 ; v56 = 2+;; @0057 v43 = uadd_overflow_trap v34, v59, user2+;; @0057 v42 = iadd v13, v41+;; @0057 v44 = icmp ugt v43, v42+;; @0057 trapnz v44, user2+;; @0053 v9 = iconst.i64 48+;; @0053 v10 = iadd v0, v9 ; v9 = 48+;; @0057 v45 = call fn2(v0, v10)+;; v61 = iconst.i32 0+;; v62 = icmp eq v4, v61 ; v61 = 0+;; @0057 v46 = ireduce.i32 v45+;; @0057 v32 = iconst.i64 4+;; @0057 v47 = iadd v34, v59+;; @0057 brif v62, block3, block2(v34)+;;+;; block2(v50: i64):+;; @0057 store.i32 notrap aligned little region10 v46, v50+;; v64 = iconst.i64 4+;; v65 = iadd v50, v64 ; v64 = 4+;; @0057 v53 = icmp eq v65, v47+;; @0057 brif v53, block3, block2(v65);;;; block3:;; @005a jump block1diff --git a/tests/disas/call-indirect-with-gc.wat b/tests/disas/call-indirect-with-gc.watindex 4928cf016c..a51346ea94 100644--- a/tests/disas/call-indirect-with-gc.wat+++ b/tests/disas/call-indirect-with-gc.wat@@ -24,7 +24,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64, i32) -> i32 tail;; sig1 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig1+;; fn0 = colocated u805306368:6 sig1;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32):diff --git a/tests/disas/call-indirect-without-gc.wat b/tests/disas/call-indirect-without-gc.watindex 300b52024a..d3a23a260c 100644--- a/tests/disas/call-indirect-without-gc.wat+++ b/tests/disas/call-indirect-without-gc.wat@@ -24,7 +24,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64, i32) -> i32 tail;; sig1 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig1+;; fn0 = colocated u805306368:6 sig1;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32):diff --git a/tests/disas/call-indirect.wat b/tests/disas/call-indirect.watindex 237772bab6..4d60d12656 100644--- a/tests/disas/call-indirect.wat+++ b/tests/disas/call-indirect.wat@@ -22,7 +22,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64, i32) -> i32 tail;; sig1 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig1+;; fn0 = colocated u805306368:6 sig1;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32):diff --git a/tests/disas/component-may-leave-without-signals-based-traps.wat b/tests/disas/component-may-leave-without-signals-based-traps.watindex d9834361ea..04661e158f 100644--- a/tests/disas/component-may-leave-without-signals-based-traps.wat+++ b/tests/disas/component-may-leave-without-signals-based-traps.wat@@ -44,7 +44,7 @@;; retq;; 126: movq %rbx, %rsi;; 129: movq 0x10(%rsi), %rax-;; 12d: movq 0x148(%rax), %rax+;; 12d: movq 0x140(%rax), %rax;; 134: movq %rbx, %rdi;; 137: callq *%rax;; 139: ud2diff --git a/tests/disas/component-model/known-imported-entities.wat b/tests/disas/component-model/known-imported-entities.watindex f8a5bcc216..44c37ac18a 100644--- a/tests/disas/component-model/known-imported-entities.wat+++ b/tests/disas/component-model/known-imported-entities.wat@@ -90,7 +90,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig0+;; fn0 = colocated u805306368:6 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):@@ -171,7 +171,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig0+;; fn0 = colocated u805306368:6 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):diff --git a/tests/disas/component-model/multiple-instantiations-makes-imports-unknown.wat b/tests/disas/component-model/multiple-instantiations-makes-imports-unknown.watindex eeaa1e1994..f1a5f2c4b8 100644--- a/tests/disas/component-model/multiple-instantiations-makes-imports-unknown.wat+++ b/tests/disas/component-model/multiple-instantiations-makes-imports-unknown.wat@@ -112,7 +112,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig0+;; fn0 = colocated u805306368:6 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):@@ -188,7 +188,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig0+;; fn0 = colocated u805306368:6 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):@@ -269,7 +269,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig0+;; fn0 = colocated u805306368:6 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):diff --git a/tests/disas/component-model/reexported-ambiguous-entities.wat b/tests/disas/component-model/reexported-ambiguous-entities.watindex 03dfefe783..638f17b049 100644--- a/tests/disas/component-model/reexported-ambiguous-entities.wat+++ b/tests/disas/component-model/reexported-ambiguous-entities.wat@@ -135,7 +135,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig0+;; fn0 = colocated u805306368:6 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):@@ -211,7 +211,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig0+;; fn0 = colocated u805306368:6 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):@@ -292,7 +292,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig0+;; fn0 = colocated u805306368:6 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):@@ -374,7 +374,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig0+;; fn0 = colocated u805306368:6 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):diff --git a/tests/disas/component-model/reexported-entities-to-imported-module.wat b/tests/disas/component-model/reexported-entities-to-imported-module.watindex c8e0246f1d..abdd38ace6 100644--- a/tests/disas/component-model/reexported-entities-to-imported-module.wat+++ b/tests/disas/component-model/reexported-entities-to-imported-module.wat@@ -108,7 +108,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig0+;; fn0 = colocated u805306368:6 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):@@ -189,7 +189,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig0+;; fn0 = colocated u805306368:6 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):diff --git a/tests/disas/component-model/reexported-known-entities.wat b/tests/disas/component-model/reexported-known-entities.watindex b172f07f3e..c6705033d8 100644--- a/tests/disas/component-model/reexported-known-entities.wat+++ b/tests/disas/component-model/reexported-known-entities.wat@@ -114,7 +114,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig0+;; fn0 = colocated u805306368:6 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):@@ -195,7 +195,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig0+;; fn0 = colocated u805306368:6 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):@@ -277,7 +277,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig0+;; fn0 = colocated u805306368:6 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):diff --git a/tests/disas/debug.wat b/tests/disas/debug.watindex 5feaca7b62..fcb16f88f7 100644--- a/tests/disas/debug.wat+++ b/tests/disas/debug.wat@@ -135,7 +135,7 @@;; popq %rbp;; retq;; 1a2: movq 0x10(%rbx), %rax-;; 1a6: movq 0x148(%rax), %rax+;; 1a6: movq 0x140(%rax), %rax;; 1ad: movq %rbx, %rdi;; 1b0: callq *%rax;; 1b2: ud2@@ -150,7 +150,7 @@;; movq 8(%r10), %r11;; movq %r11, 0x38(%r9);; movq 0x10(%rdi), %r11-;; movq 0x140(%r11), %r11+;; movq 0x138(%r11), %r11;; movzbq %sil, %rsi;; callq *%r11;; movq %rbp, %rsp@@ -167,7 +167,7 @@;; movq 8(%r9), %r9;; movq %r9, 0x38(%r8);; movq 0x10(%rdi), %r9-;; movq 0x148(%r9), %r9+;; movq 0x140(%r9), %r9;; callq *%r9;; movq %rbp, %rsp;; popq %rbp@@ -212,7 +212,7 @@;; movq %r11, 0x38(%r9);; movq 0x10(%rdi), %r12;; movq %rdi, %r13-;; movq 0x170(%r12), %r11+;; movq 0x168(%r12), %r11;; callq *%r11;; testb %al, %al;; je 0x3e9@@ -247,7 +247,7 @@;; movq %rbp, %rsp;; popq %rbp;; retq-;; 3e9: movq 0x148(%r12), %rax+;; 3e9: movq 0x140(%r12), %rax;; 3f1: movq %r13, %rdi;; 3f4: callq *%rax;; 3f6: ud2diff --git a/tests/disas/duplicate-function-types.wat b/tests/disas/duplicate-function-types.watindex f006c310e3..758cd38383 100644--- a/tests/disas/duplicate-function-types.wat+++ b/tests/disas/duplicate-function-types.wat@@ -32,7 +32,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64) -> i32 tail;; sig1 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig1+;; fn0 = colocated u805306368:6 sig1;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32):diff --git a/tests/disas/elem-segment.wat b/tests/disas/elem-segment.watindex 8fef96eea2..c413322c41 100644--- a/tests/disas/elem-segment.wat+++ b/tests/disas/elem-segment.wat@@ -44,20 +44,39 @@;; };;;; function u2415919104:0(i64 vmctx, i64) tail {-;; region0 = 116 ""+;; region0 = 130 ""+;; region1 = 134 ""+;; region2 = 44 ""+;; region3 = 120 ""+;; region4 = 100 ""+;; region5 = 160 ""+;; region6 = 116 "";; sig0 = (i64 vmctx, i32) -> i64 tail-;; sig1 = (i64 vmctx, i32) -> i64 tail+;; sig1 = (i64 vmctx, i64) tail+;; sig2 = (i64 vmctx, i64, i64, i64) -> i8 system_v+;; sig3 = (i64 vmctx, i64, i64, i64) -> i8 system_v+;; sig4 = (i64 vmctx, i64, i64, i64) -> i8 system_v;; fn0 = colocated u805306368:4 sig0-;; fn1 = colocated u805306368:6 sig1+;; fn1 = colocated u0:0 sig1+;; fn2 = colocated u268435456:0 sig2+;; fn3 = colocated u268435456:0 sig3+;; fn4 = colocated u268435456:0 sig4;;;; block0(v0: i64, v1: i64):;; v2 = iconst.i32 0;; v3 = call fn0(v0, v2) ; v2 = 0-;; v5 = call fn1(v0, v2) ; v2 = 0-;; store notrap aligned little region0 v5, v3-;; v7 = call fn1(v0, v2) ; v2 = 0-;; store notrap aligned little region0 v7, v3+16-;; v9 = call fn1(v0, v2) ; v2 = 0-;; store notrap aligned little region0 v9, v3+32+;; v8 = iconst.i64 48+;; v9 = iadd v0, v8 ; v8 = 48+;; store notrap aligned little region6 v9, v3+;; store notrap aligned little region6 v9, v3+16+;; v17 = func_addr.i64 fn4+;; store notrap aligned region2 v17, v0+48+;; v4 = func_addr.i64 fn1+;; store notrap aligned region3 v4, v0+56+;; store notrap aligned region4 v0, v0+72+;; v6 = load.i64 notrap aligned readonly can_move region0 v0+40+;; v7 = load.i32 notrap aligned readonly can_move region1 v6+;; store notrap aligned region5 v7, v0+64+;; store notrap aligned little region6 v9, v3+32;; return;; }diff --git a/tests/disas/epoch-interruption.wat b/tests/disas/epoch-interruption.watindex 3315e69e36..978c9083c7 100644--- a/tests/disas/epoch-interruption.wat+++ b/tests/disas/epoch-interruption.wat@@ -14,7 +14,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx) -> i64 tail-;; fn0 = colocated u805306368:13 sig0+;; fn0 = colocated u805306368:12 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):diff --git a/tests/disas/foo.wat b/tests/disas/foo.watindex e0b4960e53..65c14af1d4 100644--- a/tests/disas/foo.wat+++ b/tests/disas/foo.wat@@ -33,7 +33,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64, i32) -> i32 tail;; sig1 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig1+;; fn0 = colocated u805306368:6 sig1;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32):diff --git a/tests/disas/funcref-readonly-loads.wat b/tests/disas/funcref-readonly-loads.watnew file mode 100644index 0000000000..3359932f81--- /dev/null+++ b/tests/disas/funcref-readonly-loads.wat@@ -0,0 +1,33 @@+;;! target = "x86_64"+;;! test = "optimize"++(module+ (type $f (func))+ (func (param $x (ref $f))+ (call_ref $f (local.get $x))+ (call_ref $f (local.get $x))+ )+)+;; function u0:0(i64 vmctx, i64, i64) tail {+;; region0 = 123 ""+;; region1 = 160 ""+;; region2 = 120 ""+;; region3 = 100 ""+;; gv0 = vmctx+;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8+;; gv2 = load.i64 notrap aligned region1 gv1+24+;; sig0 = (i64 vmctx, i64) tail+;; stack_limit = gv2+;;+;; block0(v0: i64, v1: i64, v2: i64):+;; @001e v3 = load.i64 user16 aligned readonly region2 v2+8+;; @001e v4 = load.i64 notrap aligned readonly region3 v2+24+;; @001e call_indirect sig0, v3(v4, v0)+;; @0022 v5 = load.i64 user16 aligned readonly region2 v2+8+;; @0022 v6 = load.i64 notrap aligned readonly region3 v2+24+;; @0022 call_indirect sig0, v5(v6, v0)+;; @0024 jump block1+;;+;; block1:+;; @0024 return+;; }diff --git a/tests/disas/gc/alias-region-exn-payload.wat b/tests/disas/gc/alias-region-exn-payload.watindex 078c519225..eb82d987df 100644--- a/tests/disas/gc/alias-region-exn-payload.wat+++ b/tests/disas/gc/alias-region-exn-payload.wat@@ -45,9 +45,9 @@;; sig0 = (i64 vmctx) -> i32 tail;; sig1 = (i64 vmctx, i64) -> i8 tail;; sig2 = (i64 vmctx, i32) -> i8 tail-;; fn0 = colocated u805306368:43 sig0-;; fn1 = colocated u805306368:23 sig1-;; fn2 = colocated u805306368:44 sig2+;; fn0 = colocated u805306368:42 sig0+;; fn1 = colocated u805306368:22 sig1+;; fn2 = colocated u805306368:43 sig2;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i64):diff --git a/tests/disas/gc/array-copy-with-fuel.wat b/tests/disas/gc/array-copy-with-fuel.watindex 8ebcb4ee0c..f1ba124942 100644--- a/tests/disas/gc/array-copy-with-fuel.wat+++ b/tests/disas/gc/array-copy-with-fuel.wat@@ -25,7 +25,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx) -> i8 tail-;; fn0 = colocated u805306368:12 sig0+;; fn0 = colocated u805306368:11 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32, v5: i32, v6: i32):diff --git a/tests/disas/gc/array-new-data.wat b/tests/disas/gc/array-new-data.watindex 5dcbbadf20..5c41ecaf62 100644--- a/tests/disas/gc/array-new-data.wat+++ b/tests/disas/gc/array-new-data.wat@@ -98,7 +98,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail;; sig1 = (i64 vmctx, i64, i64, i64) tail-;; fn0 = colocated u805306368:24 sig0+;; fn0 = colocated u805306368:23 sig0;; fn1 = colocated u805306368:1 sig1;; stack_limit = gv2;;diff --git a/tests/disas/gc/array-new-default-anyref.wat b/tests/disas/gc/array-new-default-anyref.watindex 9b9c3adc64..38948f9e36 100644--- a/tests/disas/gc/array-new-default-anyref.wat+++ b/tests/disas/gc/array-new-default-anyref.wat@@ -28,7 +28,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail-;; fn0 = colocated u805306368:24 sig0+;; fn0 = colocated u805306368:23 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32):diff --git a/tests/disas/gc/array-new-default-exnref.wat b/tests/disas/gc/array-new-default-exnref.watindex b052e1f304..e3660b4312 100644--- a/tests/disas/gc/array-new-default-exnref.wat+++ b/tests/disas/gc/array-new-default-exnref.wat@@ -28,7 +28,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail-;; fn0 = colocated u805306368:24 sig0+;; fn0 = colocated u805306368:23 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32):diff --git a/tests/disas/gc/array-new-default-externref.wat b/tests/disas/gc/array-new-default-externref.watindex ef0fd6503f..a96c551978 100644--- a/tests/disas/gc/array-new-default-externref.wat+++ b/tests/disas/gc/array-new-default-externref.wat@@ -28,7 +28,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail-;; fn0 = colocated u805306368:24 sig0+;; fn0 = colocated u805306368:23 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32):diff --git a/tests/disas/gc/array-new-default-f32.wat b/tests/disas/gc/array-new-default-f32.watindex 3362c95b83..7d91be2f87 100644--- a/tests/disas/gc/array-new-default-f32.wat+++ b/tests/disas/gc/array-new-default-f32.wat@@ -30,7 +30,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail;; sig1 = (i64 vmctx, i64, i32, i64) tail-;; fn0 = colocated u805306368:24 sig0+;; fn0 = colocated u805306368:23 sig0;; fn1 = colocated u805306368:2 sig1;; stack_limit = gv2;;diff --git a/tests/disas/gc/array-new-default-f64.wat b/tests/disas/gc/array-new-default-f64.watindex 47aab21ead..180e150d14 100644--- a/tests/disas/gc/array-new-default-f64.wat+++ b/tests/disas/gc/array-new-default-f64.wat@@ -30,7 +30,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail;; sig1 = (i64 vmctx, i64, i32, i64) tail-;; fn0 = colocated u805306368:24 sig0+;; fn0 = colocated u805306368:23 sig0;; fn1 = colocated u805306368:2 sig1;; stack_limit = gv2;;diff --git a/tests/disas/gc/array-new-default-funcref.wat b/tests/disas/gc/array-new-default-funcref.watindex b0837b1c7a..bf39c0b657 100644--- a/tests/disas/gc/array-new-default-funcref.wat+++ b/tests/disas/gc/array-new-default-funcref.wat@@ -31,8 +31,8 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail;; sig1 = (i64 vmctx, i64) -> i64 tail-;; fn0 = colocated u805306368:24 sig0-;; fn1 = colocated u805306368:25 sig1+;; fn0 = colocated u805306368:23 sig0+;; fn1 = colocated u805306368:24 sig1;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32):diff --git a/tests/disas/gc/array-new-default-i16.wat b/tests/disas/gc/array-new-default-i16.watindex ddd4bccd95..a68ddec090 100644--- a/tests/disas/gc/array-new-default-i16.wat+++ b/tests/disas/gc/array-new-default-i16.wat@@ -30,7 +30,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail;; sig1 = (i64 vmctx, i64, i32, i64) tail-;; fn0 = colocated u805306368:24 sig0+;; fn0 = colocated u805306368:23 sig0;; fn1 = colocated u805306368:2 sig1;; stack_limit = gv2;;diff --git a/tests/disas/gc/array-new-default-i32.wat b/tests/disas/gc/array-new-default-i32.watindex 79a1e7e59b..805043dbb1 100644--- a/tests/disas/gc/array-new-default-i32.wat+++ b/tests/disas/gc/array-new-default-i32.wat@@ -30,7 +30,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail;; sig1 = (i64 vmctx, i64, i32, i64) tail-;; fn0 = colocated u805306368:24 sig0+;; fn0 = colocated u805306368:23 sig0;; fn1 = colocated u805306368:2 sig1;; stack_limit = gv2;;diff --git a/tests/disas/gc/array-new-default-i64.wat b/tests/disas/gc/array-new-default-i64.watindex c1c426eb5e..b467ae6503 100644--- a/tests/disas/gc/array-new-default-i64.wat+++ b/tests/disas/gc/array-new-default-i64.wat@@ -30,7 +30,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail;; sig1 = (i64 vmctx, i64, i32, i64) tail-;; fn0 = colocated u805306368:24 sig0+;; fn0 = colocated u805306368:23 sig0;; fn1 = colocated u805306368:2 sig1;; stack_limit = gv2;;diff --git a/tests/disas/gc/array-new-default-i8.wat b/tests/disas/gc/array-new-default-i8.watindex 79cf13f574..cd040313d5 100644--- a/tests/disas/gc/array-new-default-i8.wat+++ b/tests/disas/gc/array-new-default-i8.wat@@ -30,7 +30,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail;; sig1 = (i64 vmctx, i64, i32, i64) tail-;; fn0 = colocated u805306368:24 sig0+;; fn0 = colocated u805306368:23 sig0;; fn1 = colocated u805306368:2 sig1;; stack_limit = gv2;;diff --git a/tests/disas/gc/call-indirect-final-type.wat b/tests/disas/gc/call-indirect-final-type.watindex 84183829a8..7242a922b8 100644--- a/tests/disas/gc/call-indirect-final-type.wat+++ b/tests/disas/gc/call-indirect-final-type.wat@@ -30,7 +30,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64, i32) -> i32 tail;; sig1 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig1+;; fn0 = colocated u805306368:6 sig1;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32):@@ -84,7 +84,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64, i32) -> i32 tail;; sig1 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig1+;; fn0 = colocated u805306368:6 sig1;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32):diff --git a/tests/disas/gc/copying/alias-region-header.wat b/tests/disas/gc/copying/alias-region-header.watindex bf07e168c4..cb6c7fa47f 100644--- a/tests/disas/gc/copying/alias-region-header.wat+++ b/tests/disas/gc/copying/alias-region-header.wat@@ -33,7 +33,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail-;; fn0 = colocated u805306368:24 sig0+;; fn0 = colocated u805306368:23 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32):diff --git a/tests/disas/gc/copying/array-new-fixed-of-gc-refs.wat b/tests/disas/gc/copying/array-new-fixed-of-gc-refs.watindex 5043f7765b..db824b0822 100644--- a/tests/disas/gc/copying/array-new-fixed-of-gc-refs.wat+++ b/tests/disas/gc/copying/array-new-fixed-of-gc-refs.wat@@ -33,7 +33,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail-;; fn0 = colocated u805306368:24 sig0+;; fn0 = colocated u805306368:23 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32):diff --git a/tests/disas/gc/copying/array-new-fixed.wat b/tests/disas/gc/copying/array-new-fixed.watindex 3f956429b1..8a891e3e8c 100644--- a/tests/disas/gc/copying/array-new-fixed.wat+++ b/tests/disas/gc/copying/array-new-fixed.wat@@ -27,7 +27,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail-;; fn0 = colocated u805306368:24 sig0+;; fn0 = colocated u805306368:23 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i64, v3: i64, v4: i64):diff --git a/tests/disas/gc/copying/array-new.wat b/tests/disas/gc/copying/array-new.watindex ee56de0691..93fb114125 100644--- a/tests/disas/gc/copying/array-new.wat+++ b/tests/disas/gc/copying/array-new.wat@@ -27,7 +27,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail-;; fn0 = colocated u805306368:24 sig0+;; fn0 = colocated u805306368:23 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i64, v3: i32):diff --git a/tests/disas/gc/copying/call-indirect-and-subtyping.wat b/tests/disas/gc/copying/call-indirect-and-subtyping.watindex 5c1a419d86..069b596cec 100644--- a/tests/disas/gc/copying/call-indirect-and-subtyping.wat+++ b/tests/disas/gc/copying/call-indirect-and-subtyping.wat@@ -30,8 +30,8 @@;; sig0 = (i64 vmctx, i64) tail;; sig1 = (i64 vmctx, i32, i64) -> i64 tail;; sig2 = (i64 vmctx, i32, i32) -> i32 tail-;; fn0 = colocated u805306368:7 sig1-;; fn1 = colocated u805306368:27 sig2+;; fn0 = colocated u805306368:6 sig1+;; fn1 = colocated u805306368:26 sig2;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32):diff --git a/tests/disas/gc/copying/funcref-in-gc-heap-get.wat b/tests/disas/gc/copying/funcref-in-gc-heap-get.watindex c79a2f0857..e9b3cb64d8 100644--- a/tests/disas/gc/copying/funcref-in-gc-heap-get.wat+++ b/tests/disas/gc/copying/funcref-in-gc-heap-get.wat@@ -18,7 +18,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32) -> i64 tail-;; fn0 = colocated u805306368:26 sig0+;; fn0 = colocated u805306368:25 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32):diff --git a/tests/disas/gc/copying/funcref-in-gc-heap-new.wat b/tests/disas/gc/copying/funcref-in-gc-heap-new.watindex 71292c0652..63a32c84ed 100644--- a/tests/disas/gc/copying/funcref-in-gc-heap-new.wat+++ b/tests/disas/gc/copying/funcref-in-gc-heap-new.wat@@ -28,8 +28,8 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail;; sig1 = (i64 vmctx, i64) -> i64 tail-;; fn0 = colocated u805306368:24 sig0-;; fn1 = colocated u805306368:25 sig1+;; fn0 = colocated u805306368:23 sig0+;; fn1 = colocated u805306368:24 sig1;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i64):diff --git a/tests/disas/gc/copying/funcref-in-gc-heap-set.wat b/tests/disas/gc/copying/funcref-in-gc-heap-set.watindex 6df206f4b7..ecc63b7bea 100644--- a/tests/disas/gc/copying/funcref-in-gc-heap-set.wat+++ b/tests/disas/gc/copying/funcref-in-gc-heap-set.wat@@ -18,7 +18,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64) -> i64 tail-;; fn0 = colocated u805306368:25 sig0+;; fn0 = colocated u805306368:24 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i64):diff --git a/tests/disas/gc/copying/struct-new-default.wat b/tests/disas/gc/copying/struct-new-default.watindex 199fe07aec..bd5574a9ac 100644--- a/tests/disas/gc/copying/struct-new-default.wat+++ b/tests/disas/gc/copying/struct-new-default.wat@@ -29,7 +29,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail-;; fn0 = colocated u805306368:24 sig0+;; fn0 = colocated u805306368:23 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):diff --git a/tests/disas/gc/copying/struct-new.wat b/tests/disas/gc/copying/struct-new.watindex 0343960120..3848722294 100644--- a/tests/disas/gc/copying/struct-new.wat+++ b/tests/disas/gc/copying/struct-new.wat@@ -31,7 +31,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail-;; fn0 = colocated u805306368:24 sig0+;; fn0 = colocated u805306368:23 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: f32, v3: i32, v4: i32):diff --git a/tests/disas/gc/drc/alias-region-header.wat b/tests/disas/gc/drc/alias-region-header.watindex b700e3e4d5..8d092eb7e7 100644--- a/tests/disas/gc/drc/alias-region-header.wat+++ b/tests/disas/gc/drc/alias-region-header.wat@@ -39,8 +39,8 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32) tail;; sig1 = (i64 vmctx) -> i8 tail-;; fn0 = colocated u805306368:22 sig0-;; fn1 = colocated u805306368:45 sig1+;; fn0 = colocated u805306368:21 sig0+;; fn1 = colocated u805306368:44 sig1;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32):diff --git a/tests/disas/gc/drc/array-new-fixed-of-gc-refs.wat b/tests/disas/gc/drc/array-new-fixed-of-gc-refs.watindex 0082297d47..faba65d4b1 100644--- a/tests/disas/gc/drc/array-new-fixed-of-gc-refs.wat+++ b/tests/disas/gc/drc/array-new-fixed-of-gc-refs.wat@@ -29,7 +29,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail-;; fn0 = colocated u805306368:24 sig0+;; fn0 = colocated u805306368:23 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32):diff --git a/tests/disas/gc/drc/array-new-fixed.wat b/tests/disas/gc/drc/array-new-fixed.watindex f4f2862ac0..6a3f28f3a6 100644--- a/tests/disas/gc/drc/array-new-fixed.wat+++ b/tests/disas/gc/drc/array-new-fixed.wat@@ -22,7 +22,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail-;; fn0 = colocated u805306368:24 sig0+;; fn0 = colocated u805306368:23 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i64, v3: i64, v4: i64):diff --git a/tests/disas/gc/drc/array-new.wat b/tests/disas/gc/drc/array-new.watindex d1d8d47bc8..0f967666db 100644--- a/tests/disas/gc/drc/array-new.wat+++ b/tests/disas/gc/drc/array-new.wat@@ -22,7 +22,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail-;; fn0 = colocated u805306368:24 sig0+;; fn0 = colocated u805306368:23 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i64, v3: i32):diff --git a/tests/disas/gc/drc/call-indirect-and-subtyping.wat b/tests/disas/gc/drc/call-indirect-and-subtyping.watindex 224e220af9..cbf3b03a74 100644--- a/tests/disas/gc/drc/call-indirect-and-subtyping.wat+++ b/tests/disas/gc/drc/call-indirect-and-subtyping.wat@@ -31,8 +31,8 @@;; sig0 = (i64 vmctx, i64) tail;; sig1 = (i64 vmctx, i32, i64) -> i64 tail;; sig2 = (i64 vmctx, i32, i32) -> i32 tail-;; fn0 = colocated u805306368:7 sig1-;; fn1 = colocated u805306368:27 sig2+;; fn0 = colocated u805306368:6 sig1+;; fn1 = colocated u805306368:26 sig2;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32):diff --git a/tests/disas/gc/drc/externref-globals.wat b/tests/disas/gc/drc/externref-globals.watindex b3fc04db3c..7690c77cd2 100644--- a/tests/disas/gc/drc/externref-globals.wat+++ b/tests/disas/gc/drc/externref-globals.wat@@ -31,7 +31,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx) -> i8 tail-;; fn0 = colocated u805306368:45 sig0+;; fn0 = colocated u805306368:44 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):@@ -111,7 +111,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32) tail-;; fn0 = colocated u805306368:22 sig0+;; fn0 = colocated u805306368:21 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32):diff --git a/tests/disas/gc/drc/funcref-in-gc-heap-get.wat b/tests/disas/gc/drc/funcref-in-gc-heap-get.watindex 54cbd4883b..91830abbde 100644--- a/tests/disas/gc/drc/funcref-in-gc-heap-get.wat+++ b/tests/disas/gc/drc/funcref-in-gc-heap-get.wat@@ -19,7 +19,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32) -> i64 tail-;; fn0 = colocated u805306368:26 sig0+;; fn0 = colocated u805306368:25 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32):diff --git a/tests/disas/gc/drc/funcref-in-gc-heap-new.wat b/tests/disas/gc/drc/funcref-in-gc-heap-new.watindex ad886b0ed9..1699d4f9b1 100644--- a/tests/disas/gc/drc/funcref-in-gc-heap-new.wat+++ b/tests/disas/gc/drc/funcref-in-gc-heap-new.wat@@ -23,8 +23,8 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail;; sig1 = (i64 vmctx, i64) -> i64 tail-;; fn0 = colocated u805306368:24 sig0-;; fn1 = colocated u805306368:25 sig1+;; fn0 = colocated u805306368:23 sig0+;; fn1 = colocated u805306368:24 sig1;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i64):diff --git a/tests/disas/gc/drc/funcref-in-gc-heap-set.wat b/tests/disas/gc/drc/funcref-in-gc-heap-set.watindex bfed4dcbe7..5b6808f35c 100644--- a/tests/disas/gc/drc/funcref-in-gc-heap-set.wat+++ b/tests/disas/gc/drc/funcref-in-gc-heap-set.wat@@ -19,7 +19,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64) -> i64 tail-;; fn0 = colocated u805306368:25 sig0+;; fn0 = colocated u805306368:24 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i64):diff --git a/tests/disas/gc/drc/struct-get.wat b/tests/disas/gc/drc/struct-get.watindex 086f08f5d4..b370a29f96 100644--- a/tests/disas/gc/drc/struct-get.wat+++ b/tests/disas/gc/drc/struct-get.wat@@ -122,7 +122,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx) -> i8 tail-;; fn0 = colocated u805306368:45 sig0+;; fn0 = colocated u805306368:44 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32):diff --git a/tests/disas/gc/drc/struct-new-default.wat b/tests/disas/gc/drc/struct-new-default.watindex 53d5e381da..fbf9c48e17 100644--- a/tests/disas/gc/drc/struct-new-default.wat+++ b/tests/disas/gc/drc/struct-new-default.wat@@ -26,7 +26,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail-;; fn0 = colocated u805306368:24 sig0+;; fn0 = colocated u805306368:23 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):diff --git a/tests/disas/gc/drc/struct-new.wat b/tests/disas/gc/drc/struct-new.watindex ffb7d5a009..2944b5750e 100644--- a/tests/disas/gc/drc/struct-new.wat+++ b/tests/disas/gc/drc/struct-new.wat@@ -28,7 +28,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail-;; fn0 = colocated u805306368:24 sig0+;; fn0 = colocated u805306368:23 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: f32, v3: i32, v4: i32):diff --git a/tests/disas/gc/drc/struct-set.wat b/tests/disas/gc/drc/struct-set.watindex 3c4389e239..f1ccea98c2 100644--- a/tests/disas/gc/drc/struct-set.wat+++ b/tests/disas/gc/drc/struct-set.wat@@ -82,7 +82,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32) tail-;; fn0 = colocated u805306368:22 sig0+;; fn0 = colocated u805306368:21 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32):diff --git a/tests/disas/gc/issue-14452.wat b/tests/disas/gc/issue-14452.watindex 28fa5a1c15..369482cfc6 100644--- a/tests/disas/gc/issue-14452.wat+++ b/tests/disas/gc/issue-14452.wat@@ -53,9 +53,9 @@;; sig1 = (i64 vmctx) -> i32 tail;; sig2 = (i64 vmctx, i32) -> i8 tail;; sig3 = (i64 vmctx, i64) tail-;; fn0 = colocated u805306368:24 sig0-;; fn1 = colocated u805306368:43 sig1-;; fn2 = colocated u805306368:44 sig2+;; fn0 = colocated u805306368:23 sig0+;; fn1 = colocated u805306368:42 sig1+;; fn2 = colocated u805306368:43 sig2;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):diff --git a/tests/disas/gc/null/alias-region-header.wat b/tests/disas/gc/null/alias-region-header.watindex 4181985971..95948cdba6 100644--- a/tests/disas/gc/null/alias-region-header.wat+++ b/tests/disas/gc/null/alias-region-header.wat@@ -42,7 +42,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64) -> i8 tail-;; fn0 = colocated u805306368:23 sig0+;; fn0 = colocated u805306368:22 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32):diff --git a/tests/disas/gc/null/array-new-fixed-of-gc-refs.wat b/tests/disas/gc/null/array-new-fixed-of-gc-refs.watindex b43279f30c..85942eef7f 100644--- a/tests/disas/gc/null/array-new-fixed-of-gc-refs.wat+++ b/tests/disas/gc/null/array-new-fixed-of-gc-refs.wat@@ -32,7 +32,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64) -> i8 tail-;; fn0 = colocated u805306368:23 sig0+;; fn0 = colocated u805306368:22 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32):diff --git a/tests/disas/gc/null/array-new-fixed.wat b/tests/disas/gc/null/array-new-fixed.watindex 85ab516b33..b365197a4e 100644--- a/tests/disas/gc/null/array-new-fixed.wat+++ b/tests/disas/gc/null/array-new-fixed.wat@@ -26,7 +26,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64) -> i8 tail-;; fn0 = colocated u805306368:23 sig0+;; fn0 = colocated u805306368:22 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i64, v3: i64, v4: i64):diff --git a/tests/disas/gc/null/array-new.wat b/tests/disas/gc/null/array-new.watindex 55cccaf921..3c26b925aa 100644--- a/tests/disas/gc/null/array-new.wat+++ b/tests/disas/gc/null/array-new.wat@@ -26,7 +26,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64) -> i8 tail-;; fn0 = colocated u805306368:23 sig0+;; fn0 = colocated u805306368:22 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i64, v3: i32):diff --git a/tests/disas/gc/null/call-indirect-and-subtyping.wat b/tests/disas/gc/null/call-indirect-and-subtyping.watindex 97b32b9eef..3a6094ad0b 100644--- a/tests/disas/gc/null/call-indirect-and-subtyping.wat+++ b/tests/disas/gc/null/call-indirect-and-subtyping.wat@@ -31,8 +31,8 @@;; sig0 = (i64 vmctx, i64) tail;; sig1 = (i64 vmctx, i32, i64) -> i64 tail;; sig2 = (i64 vmctx, i32, i32) -> i32 tail-;; fn0 = colocated u805306368:7 sig1-;; fn1 = colocated u805306368:27 sig2+;; fn0 = colocated u805306368:6 sig1+;; fn1 = colocated u805306368:26 sig2;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32):diff --git a/tests/disas/gc/null/funcref-in-gc-heap-get.wat b/tests/disas/gc/null/funcref-in-gc-heap-get.watindex bf75705dc9..154687ad61 100644--- a/tests/disas/gc/null/funcref-in-gc-heap-get.wat+++ b/tests/disas/gc/null/funcref-in-gc-heap-get.wat@@ -19,7 +19,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32) -> i64 tail-;; fn0 = colocated u805306368:26 sig0+;; fn0 = colocated u805306368:25 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32):diff --git a/tests/disas/gc/null/funcref-in-gc-heap-new.wat b/tests/disas/gc/null/funcref-in-gc-heap-new.watindex 6d817cedd0..3fba86a6d9 100644--- a/tests/disas/gc/null/funcref-in-gc-heap-new.wat+++ b/tests/disas/gc/null/funcref-in-gc-heap-new.wat@@ -26,8 +26,8 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64) -> i8 tail;; sig1 = (i64 vmctx, i64) -> i64 tail-;; fn0 = colocated u805306368:23 sig0-;; fn1 = colocated u805306368:25 sig1+;; fn0 = colocated u805306368:22 sig0+;; fn1 = colocated u805306368:24 sig1;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i64):diff --git a/tests/disas/gc/null/funcref-in-gc-heap-set.wat b/tests/disas/gc/null/funcref-in-gc-heap-set.watindex f1724a115a..54dee14bca 100644--- a/tests/disas/gc/null/funcref-in-gc-heap-set.wat+++ b/tests/disas/gc/null/funcref-in-gc-heap-set.wat@@ -19,7 +19,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64) -> i64 tail-;; fn0 = colocated u805306368:25 sig0+;; fn0 = colocated u805306368:24 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i64):diff --git a/tests/disas/gc/null/struct-new-default.wat b/tests/disas/gc/null/struct-new-default.watindex 29ad75f12a..975de993f0 100644--- a/tests/disas/gc/null/struct-new-default.wat+++ b/tests/disas/gc/null/struct-new-default.wat@@ -29,7 +29,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64) -> i8 tail-;; fn0 = colocated u805306368:23 sig0+;; fn0 = colocated u805306368:22 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):diff --git a/tests/disas/gc/null/struct-new.wat b/tests/disas/gc/null/struct-new.watindex 2c9ea8eaad..7f2485c5b4 100644--- a/tests/disas/gc/null/struct-new.wat+++ b/tests/disas/gc/null/struct-new.wat@@ -31,7 +31,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64) -> i8 tail-;; fn0 = colocated u805306368:23 sig0+;; fn0 = colocated u805306368:22 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: f32, v3: i32, v4: i32):diff --git a/tests/disas/gc/struct-new-default.wat b/tests/disas/gc/struct-new-default.watindex b40dbb77b6..72d25825a7 100644--- a/tests/disas/gc/struct-new-default.wat+++ b/tests/disas/gc/struct-new-default.wat@@ -32,7 +32,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail-;; fn0 = colocated u805306368:24 sig0+;; fn0 = colocated u805306368:23 sig0;; const0 = 0x00000000000000000000000000000000;; stack_limit = gv2;;diff --git a/tests/disas/gc/struct-new.wat b/tests/disas/gc/struct-new.watindex 757a858e68..97b912c089 100644--- a/tests/disas/gc/struct-new.wat+++ b/tests/disas/gc/struct-new.wat@@ -32,7 +32,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail-;; fn0 = colocated u805306368:24 sig0+;; fn0 = colocated u805306368:23 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: f32, v3: i32, v4: i32):diff --git a/tests/disas/guest-debugging.wat b/tests/disas/guest-debugging.watindex c5b9d00e51..a87718deb9 100644--- a/tests/disas/guest-debugging.wat+++ b/tests/disas/guest-debugging.wat@@ -26,9 +26,9 @@;; sig0 = (i64 vmctx, i8) tail;; sig1 = (i64 vmctx) tail;; sig2 = (i64) preserve_all-;; fn0 = colocated u805306368:40 sig0-;; fn1 = colocated u805306368:41 sig1-;; fn2 = colocated patchable u1073741824:46 sig2+;; fn0 = colocated u805306368:39 sig0+;; fn1 = colocated u805306368:40 sig1+;; fn2 = colocated patchable u1073741824:45 sig2;;;; block0(v0: i64, v1: i64, v2: i32):;; @0018 v3 = stack_addr.i64 ss0+8diff --git a/tests/disas/icall-loop.wat b/tests/disas/icall-loop.watindex e62e4f8342..5c7429093b 100644--- a/tests/disas/icall-loop.wat+++ b/tests/disas/icall-loop.wat@@ -36,7 +36,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64) -> i32 tail;; sig1 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig1+;; fn0 = colocated u805306368:6 sig1;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32):@@ -90,7 +90,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64) -> i32 tail;; sig1 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig1+;; fn0 = colocated u805306368:6 sig1;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):diff --git a/tests/disas/icall-simd.wat b/tests/disas/icall-simd.watindex a5f396e73e..f4dce9df07 100644--- a/tests/disas/icall-simd.wat+++ b/tests/disas/icall-simd.wat@@ -22,7 +22,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64, i8x16) -> i8x16 tail;; sig1 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig1+;; fn0 = colocated u805306368:6 sig1;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i8x16):diff --git a/tests/disas/icall.wat b/tests/disas/icall.watindex 3f40285704..d5f0b9776f 100644--- a/tests/disas/icall.wat+++ b/tests/disas/icall.wat@@ -22,7 +22,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64, f32) -> i32 tail;; sig1 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig1+;; fn0 = colocated u805306368:6 sig1;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: f32):diff --git a/tests/disas/indirect-call-no-caching.wat b/tests/disas/indirect-call-no-caching.watindex 10f0a2c5a2..6c865f81db 100644--- a/tests/disas/indirect-call-no-caching.wat+++ b/tests/disas/indirect-call-no-caching.wat@@ -82,7 +82,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64) -> i32 tail;; sig1 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig1+;; fn0 = colocated u805306368:6 sig1;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32):diff --git a/tests/disas/memory-copy-epochs.wat b/tests/disas/memory-copy-epochs.watindex 9fa6e2bc32..c432bdb48f 100644--- a/tests/disas/memory-copy-epochs.wat+++ b/tests/disas/memory-copy-epochs.wat@@ -21,7 +21,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx) -> i64 tail;; sig1 = (i64 vmctx, i64, i64, i64) tail-;; fn0 = colocated u805306368:13 sig0+;; fn0 = colocated u805306368:12 sig0;; fn1 = colocated u805306368:1 sig1;; stack_limit = gv2;;diff --git a/tests/disas/memory-copy-fuel-const-len.wat b/tests/disas/memory-copy-fuel-const-len.watindex 275a4dc9e7..edc6dd0e65 100644--- a/tests/disas/memory-copy-fuel-const-len.wat+++ b/tests/disas/memory-copy-fuel-const-len.wat@@ -25,7 +25,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx) -> i8 tail-;; fn0 = colocated u805306368:12 sig0+;; fn0 = colocated u805306368:11 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32):@@ -80,7 +80,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx) -> i8 tail;; sig1 = (i64 vmctx, i64, i32, i64) tail-;; fn0 = colocated u805306368:12 sig0+;; fn0 = colocated u805306368:11 sig0;; fn1 = colocated u805306368:2 sig1;; stack_limit = gv2;;@@ -131,7 +131,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx) -> i8 tail;; sig1 = (i64 vmctx, i64, i32, i64) tail-;; fn0 = colocated u805306368:12 sig0+;; fn0 = colocated u805306368:11 sig0;; fn1 = colocated u805306368:2 sig1;; stack_limit = gv2;;diff --git a/tests/disas/memory-copy-fuel.wat b/tests/disas/memory-copy-fuel.watindex fb711f1d7d..9eb922fa97 100644--- a/tests/disas/memory-copy-fuel.wat+++ b/tests/disas/memory-copy-fuel.wat@@ -19,7 +19,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx) -> i8 tail;; sig1 = (i64 vmctx, i64, i64, i64) tail-;; fn0 = colocated u805306368:12 sig0+;; fn0 = colocated u805306368:11 sig0;; fn1 = colocated u805306368:1 sig1;; stack_limit = gv2;;diff --git a/tests/disas/metadata-for-internal-asserts.wat b/tests/disas/metadata-for-internal-asserts.watindex f75dba39e0..bc6bbfc7a8 100644--- a/tests/disas/metadata-for-internal-asserts.wat+++ b/tests/disas/metadata-for-internal-asserts.wat@@ -39,7 +39,7 @@;; popq %rbp;; retq;; 5e: movq 0x10(%rbx), %rax-;; 62: movq 0x148(%rax), %rax+;; 62: movq 0x140(%rax), %rax;; 69: movq %rbx, %rdi;; 6c: callq *%rax;; 6e: ud2diff --git a/tests/disas/readonly-funcrefs.wat b/tests/disas/readonly-funcrefs.watindex d272af04bc..040e8a3ebf 100644--- a/tests/disas/readonly-funcrefs.wat+++ b/tests/disas/readonly-funcrefs.wat@@ -47,7 +47,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64) tail;; sig1 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig1+;; fn0 = colocated u805306368:6 sig1;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32):diff --git a/tests/disas/riscv64-component-builtins-asm.wat b/tests/disas/riscv64-component-builtins-asm.watindex 9a71f7ea30..cab8a39d88 100644--- a/tests/disas/riscv64-component-builtins-asm.wat+++ b/tests/disas/riscv64-component-builtins-asm.wat@@ -53,7 +53,7 @@;; ret;; mv a1, s4;; ld a0, 0x10(a1)-;; ld a2, 0x148(a0)+;; ld a2, 0x140(a0);; mv a0, a1;; jalr a2;; .byte 0x00, 0x00, 0x00, 0x00diff --git a/tests/disas/riscv64-component-builtins.wat b/tests/disas/riscv64-component-builtins.watindex efeb97057e..9d6b85e7a3 100644--- a/tests/disas/riscv64-component-builtins.wat+++ b/tests/disas/riscv64-component-builtins.wat@@ -18,7 +18,7 @@;; region4 = 99 "";; region5 = 112 "";; region6 = 12 ""-;; region7 = 122 ""+;; region7 = 233 "";; sig0 = (i64 sext, i32 sext, i32 sext, i32 sext) -> i64 sext system_v;; sig1 = (i64 sext vmctx) system_v;;@@ -40,7 +40,7 @@;;;; block1 cold:;; v14 = load.i64 notrap aligned readonly can_move region6 v1+16-;; v15 = load.i64 notrap aligned readonly can_move region7 v14+328+;; v15 = load.i64 notrap aligned readonly can_move region7 v14+320;; call_indirect sig1, v15(v1);; trap user1;;diff --git a/tests/disas/riscv64-ref-func.wat b/tests/disas/riscv64-ref-func.watnew file mode 100644index 0000000000..89c96e5c5d--- /dev/null+++ b/tests/disas/riscv64-ref-func.wat@@ -0,0 +1,42 @@+;;! target = "riscv64"+;;! test = "compile"++;; `ref.func` of a defined function initializes its `VMFuncRef` within the+;; `vmctx` inline, using relocations for the function's code pointers.++(module+ (elem declare func $f)+ (func $f (result i32) i32.const 42)+ (func (export "ref-func") (result funcref)+ (ref.func $f)))+;; wasm[0]::function[0]::f:+;; addi sp, sp, -0x10+;; sd ra, 8(sp)+;; sd s0, 0(sp)+;; mv s0, sp+;; addi a0, zero, 0x2a+;; ld ra, 8(sp)+;; ld s0, 0(sp)+;; addi sp, sp, 0x10+;; ret+;;+;; wasm[0]::function[1]:+;; addi sp, sp, -0x10+;; sd ra, 8(sp)+;; sd s0, 0(sp)+;; mv s0, sp+;; auipc a1, 0+;; addi a1, a1, 0x3c+;; sd a1, 0x50(a0)+;; auipc a1, 0+;; addi a1, a1, -0x40+;; sd a1, 0x58(a0)+;; sd a0, 0x68(a0)+;; ld a1, 0x28(a0)+;; lw a1, 0(a1)+;; sw a1, 0x60(a0)+;; addi a0, a0, 0x50+;; ld ra, 8(sp)+;; ld s0, 0(sp)+;; addi sp, sp, 0x10+;; retdiff --git a/tests/disas/stack-switching/resume-suspend-data-passing.wat b/tests/disas/stack-switching/resume-suspend-data-passing.watindex ede3a6ebd0..eb85b89a34 100644--- a/tests/disas/stack-switching/resume-suspend-data-passing.wat+++ b/tests/disas/stack-switching/resume-suspend-data-passing.wat@@ -54,7 +54,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32) -> i8 tail-;; fn0 = colocated u805306368:44 sig0+;; fn0 = colocated u805306368:43 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):@@ -181,230 +181,245 @@;; ss0 = explicit_slot 8, align = 8;; region0 = 123 "";; region1 = 160 ""-;; region2 = 191 ""-;; region3 = 192 ""-;; region4 = 106 ""-;; region5 = 125 ""-;; region6 = 144 ""-;; region7 = 231 ""-;; region8 = 243 ""-;; region9 = 209 ""-;; region10 = 100 ""-;; region11 = 176 ""-;; region12 = 62 ""-;; region13 = 198 ""-;; region14 = 145 ""-;; region15 = 139 ""-;; region16 = 82 ""-;; region17 = 234 ""-;; region18 = 124 ""+;; region2 = 130 ""+;; region3 = 134 ""+;; region4 = 44 ""+;; region5 = 120 ""+;; region6 = 100 ""+;; region7 = 191 ""+;; region8 = 192 ""+;; region9 = 106 ""+;; region10 = 125 ""+;; region11 = 144 ""+;; region12 = 231 ""+;; region13 = 243 ""+;; region14 = 209 ""+;; region15 = 176 ""+;; region16 = 62 ""+;; region17 = 198 ""+;; region18 = 145 ""+;; region19 = 139 ""+;; region20 = 82 ""+;; region21 = 234 ""+;; region22 = 124 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24-;; sig0 = (i64 vmctx, i32) -> i64 tail-;; sig1 = (i64 vmctx, i64, i32, i32, i32) -> i64 tail-;; sig2 = (i64 vmctx) tail-;; fn0 = colocated u805306368:6 sig0-;; fn1 = colocated u805306368:42 sig1+;; sig0 = (i64 vmctx, i64) tail+;; sig1 = (i64 vmctx, i64, i64, i64) -> i8 system_v+;; sig2 = (i64 vmctx, i64, i32, i32, i32) -> i64 tail+;; sig3 = (i64 vmctx) tail+;; fn0 = colocated u0:0 sig0+;; fn1 = colocated u268435456:0 sig1;; fn2 = colocated u805306368:41 sig2+;; fn3 = colocated u805306368:40 sig3;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):-;; @0056 v2 = iconst.i32 0-;; @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+104-;; @0058 v10 = uextend.i128 v8-;; @0058 v11 = iconst.i64 64-;; v139 = ishl v10, v11 ; v11 = 64-;; @0058 v9 = uextend.i128 v7-;; @0058 v14 = bor v139, v9-;; @0062 v23 = iconst.i64 1-;; @0062 v26 = load.i64 notrap aligned readonly can_move region0 v0+8-;; @0062 v29 = iconst.i64 0-;; @0062 v30 = iconst.i64 2-;; @0062 v34 = iconst.i32 1-;; @0062 v35 = iconst.i32 2-;; @0062 v49 = iconst.i64 40-;; @0062 v52 = stack_addr.i64 ss0-;; @0062 v53 = iconst.i64 48-;; @0062 v54 = iadd v0, v53 ; v53 = 48-;; @0062 v61 = iconst.i64 120-;; @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 168-;; @005c jump block2(v14)+;; @0056 v3 = func_addr.i64 fn1+;; @0056 store notrap aligned region4 v3, v0+88+;; @0056 v2 = func_addr.i64 fn0+;; @0056 store notrap aligned region5 v2, v0+96+;; @0056 store notrap aligned region6 v0, v0+112+;; @0056 v4 = load.i64 notrap aligned readonly can_move region2 v0+40+;; @0056 v5 = load.i32 notrap aligned readonly can_move region3 v4+;; @0056 store notrap aligned region1 v5, v0+104+;; @0056 v6 = iconst.i64 88+;; @0056 v7 = iadd v0, v6 ; v6 = 88+;; @0058 trapz v7, user16+;; @0058 v8 = iconst.i32 0+;; @0058 v11 = call fn2(v0, v7, v8, v8, v8) ; v8 = 0, v8 = 0, v8 = 0+;; @0058 v12 = load.i64 notrap aligned region7 v11+104+;; @0058 v14 = uextend.i128 v12+;; @0058 v15 = iconst.i64 64+;; v143 = ishl v14, v15 ; v15 = 64+;; @0058 v13 = uextend.i128 v11+;; @0058 v18 = bor v143, v13+;; @0062 v27 = iconst.i64 1+;; @0062 v30 = load.i64 notrap aligned readonly can_move region0 v0+8+;; @0062 v33 = iconst.i64 0+;; @0062 v34 = iconst.i64 2+;; @0062 v38 = iconst.i32 1+;; @0062 v39 = iconst.i32 2+;; @0062 v53 = iconst.i64 40+;; @0062 v56 = stack_addr.i64 ss0+;; @0062 v57 = iconst.i64 48+;; @0062 v58 = iadd v0, v57 ; v57 = 48+;; @0062 v65 = iconst.i64 120+;; @0062 v68 = iconst.i64 -24+;; v147 = iconst.i64 0x0001_0000_0000+;; @0062 v63 = iconst.i64 32+;; @0062 v81 = iconst.i64 4+;; @0062 v123 = iconst.i64 168+;; @005c jump block2(v18);;-;; block2(v15: i128):+;; block2(v19: i128):;; @0062 jump block5;;;; block5:-;; @0062 v16 = ireduce.i64 v15-;; @0062 trapz v16, user16-;; @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-;; @0062 v22 = icmp eq v21, v20-;; @0062 trapz v22, user23-;; v148 = iconst.i64 1-;; v149 = iadd v21, v148 ; v148 = 1-;; @0062 store notrap aligned region2 v149, v16+104-;; @0062 v25 = load.i64 notrap aligned region3 v16+112-;; @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+88-;; @0062 store notrap aligned region5 v28, v25+96-;; v150 = iconst.i64 0-;; @0062 store notrap aligned region3 v150, v16+112 ; v150 = 0-;; v151 = iconst.i64 2-;; @0062 store notrap aligned region4 v151, v26+88 ; v151 = 2-;; @0062 store notrap aligned region4 v16, v26+96-;; v152 = iconst.i32 1-;; @0062 store notrap aligned region6 v152, v16+32 ; v152 = 1-;; v153 = iconst.i32 2-;; @0062 store notrap aligned region6 v153, v28+32 ; v153 = 2-;; @0062 v39 = load.i64 notrap aligned region7 v26+72-;; @0062 v40 = load.i64 notrap aligned region8 v26+64-;; @0062 v41 = load.i64 notrap aligned region9 v26+80-;; @0062 store notrap aligned region10 v39, v28+8-;; @0062 store notrap aligned region11 v40, v28+16-;; @0062 store notrap aligned region12 v41, v28+24-;; @0062 v42 = load.i64 notrap aligned region1 v26+24-;; @0062 store notrap aligned region13 v42, v28-;; @0062 v45 = load.i64 notrap aligned region13 v16-;; @0062 store notrap aligned region1 v45, v26+24-;; @0062 v46 = load.i64 notrap aligned region10 v16+8-;; @0062 store notrap aligned region7 v46, v26+72-;; @0062 v47 = load.i64 notrap aligned region11 v16+16-;; @0062 store notrap aligned region8 v47, v26+64-;; @0062 v48 = load.i64 notrap aligned region12 v16+24-;; @0062 store notrap aligned region9 v48, v26+80-;; v154 = iconst.i64 40-;; v155 = iadd v28, v154 ; v154 = 40-;; @0062 store notrap aligned region14 v152, v155+4 ; v152 = 1-;; @0062 store.i64 notrap aligned region15 v52, v155+8-;; v156 = iadd.i64 v0, v53 ; v53 = 48-;; @0062 store notrap aligned region16 v156, v52-;; @0062 store notrap aligned region15 v152, v155 ; v152 = 1-;; @0062 store notrap aligned region17 v152, v28+56 ; v152 = 1-;; v157 = iconst.i64 120-;; v158 = iadd v25, v157 ; v157 = 120-;; @0062 v63 = load.i64 notrap aligned region18 v158-;; v159 = iconst.i64 -24-;; v160 = iadd v63, v159 ; v159 = -24-;; v161 = iconst.i64 0x0001_0000_0000-;; @0062 v66 = stack_switch v160, v160, v161 ; v161 = 0x0001_0000_0000-;; @0062 v68 = load.i64 notrap aligned region4 v26+88-;; @0062 v69 = load.i64 notrap aligned region4 v26+96-;; @0062 store notrap aligned region4 v27, v26+88-;; @0062 store notrap aligned region4 v28, v26+96-;; @0062 store notrap aligned region6 v152, v28+32 ; v152 = 1-;; v162 = iconst.i32 0-;; @0062 store notrap aligned region15 v162, v155 ; v162 = 0-;; @0062 store notrap aligned region14 v162, v155+4 ; v162 = 0-;; @0062 store notrap aligned region15 v150, v155+8 ; v150 = 0-;; @0062 store notrap aligned region17 v150, v28+56 ; v150 = 0-;; @0062 brif v66, block9, block6+;; @0062 v20 = ireduce.i64 v19+;; @0062 trapz v20, user16+;; @0062 v25 = load.i64 notrap aligned region7 v20+104+;; v150 = iconst.i64 64+;; v151 = ushr.i128 v19, v150 ; v150 = 64+;; @0062 v24 = ireduce.i64 v151+;; @0062 v26 = icmp eq v25, v24+;; @0062 trapz v26, user23+;; v152 = iconst.i64 1+;; v153 = iadd v25, v152 ; v152 = 1+;; @0062 store notrap aligned region7 v153, v20+104+;; @0062 v29 = load.i64 notrap aligned region8 v20+112+;; @0062 v31 = load.i64 notrap aligned region9 v30+88+;; @0062 v32 = load.i64 notrap aligned region9 v30+96+;; @0062 store notrap aligned region10 v31, v29+88+;; @0062 store notrap aligned region10 v32, v29+96+;; v154 = iconst.i64 0+;; @0062 store notrap aligned region8 v154, v20+112 ; v154 = 0+;; v155 = iconst.i64 2+;; @0062 store notrap aligned region9 v155, v30+88 ; v155 = 2+;; @0062 store notrap aligned region9 v20, v30+96+;; v156 = iconst.i32 1+;; @0062 store notrap aligned region11 v156, v20+32 ; v156 = 1+;; v157 = iconst.i32 2+;; @0062 store notrap aligned region11 v157, v32+32 ; v157 = 2+;; @0062 v43 = load.i64 notrap aligned region12 v30+72+;; @0062 v44 = load.i64 notrap aligned region13 v30+64+;; @0062 v45 = load.i64 notrap aligned region14 v30+80+;; @0062 store notrap aligned region6 v43, v32+8+;; @0062 store notrap aligned region15 v44, v32+16+;; @0062 store notrap aligned region16 v45, v32+24+;; @0062 v46 = load.i64 notrap aligned region1 v30+24+;; @0062 store notrap aligned region17 v46, v32+;; @0062 v49 = load.i64 notrap aligned region17 v20+;; @0062 store notrap aligned region1 v49, v30+24+;; @0062 v50 = load.i64 notrap aligned region6 v20+8+;; @0062 store notrap aligned region12 v50, v30+72+;; @0062 v51 = load.i64 notrap aligned region15 v20+16+;; @0062 store notrap aligned region13 v51, v30+64+;; @0062 v52 = load.i64 notrap aligned region16 v20+24+;; @0062 store notrap aligned region14 v52, v30+80+;; v158 = iconst.i64 40+;; v159 = iadd v32, v158 ; v158 = 40+;; @0062 store notrap aligned region18 v156, v159+4 ; v156 = 1+;; @0062 store.i64 notrap aligned region19 v56, v159+8+;; v160 = iadd.i64 v0, v57 ; v57 = 48+;; @0062 store notrap aligned region20 v160, v56+;; @0062 store notrap aligned region19 v156, v159 ; v156 = 1+;; @0062 store notrap aligned region21 v156, v32+56 ; v156 = 1+;; v161 = iconst.i64 120+;; v162 = iadd v29, v161 ; v161 = 120+;; @0062 v67 = load.i64 notrap aligned region22 v162+;; v163 = iconst.i64 -24+;; v164 = iadd v67, v163 ; v163 = -24+;; v165 = iconst.i64 0x0001_0000_0000+;; @0062 v70 = stack_switch v164, v164, v165 ; v165 = 0x0001_0000_0000+;; @0062 v72 = load.i64 notrap aligned region9 v30+88+;; @0062 v73 = load.i64 notrap aligned region9 v30+96+;; @0062 store notrap aligned region9 v31, v30+88+;; @0062 store notrap aligned region9 v32, v30+96+;; @0062 store notrap aligned region11 v156, v32+32 ; v156 = 1+;; v166 = iconst.i32 0+;; @0062 store notrap aligned region19 v166, v159 ; v166 = 0+;; @0062 store notrap aligned region18 v166, v159+4 ; v166 = 0+;; @0062 store notrap aligned region19 v154, v159+8 ; v154 = 0+;; @0062 store notrap aligned region21 v154, v32+56 ; v154 = 0+;; @0062 brif v70, block9, block6;;;; block9:-;; v165 = iconst.i64 32-;; v166 = ushr.i64 v66, v165 ; v165 = 32-;; v167 = iconst.i64 4-;; v168 = icmp eq v166, v167 ; v167 = 4-;; @0062 brif v168, block8, block7+;; v169 = iconst.i64 32+;; v170 = ushr.i64 v70, v169 ; v169 = 32+;; v171 = iconst.i64 4+;; v172 = icmp eq v170, v171 ; v171 = 4+;; @0062 brif v172, block8, block7;;;; block8 cold:-;; @0062 v81 = iconst.i32 5-;; @0062 store notrap aligned region6 v81, v69+32 ; v81 = 5-;; @0062 v84 = load.i64 notrap aligned region13 v28-;; @0062 store notrap aligned region1 v84, v26+24-;; @0062 v85 = load.i64 notrap aligned region10 v28+8-;; @0062 store notrap aligned region7 v85, v26+72-;; @0062 v86 = load.i64 notrap aligned region11 v28+16-;; @0062 store notrap aligned region8 v86, v26+64-;; @0062 v87 = load.i64 notrap aligned region12 v28+24-;; @0062 store notrap aligned region9 v87, v26+80-;; v174 = iconst.i32 0-;; v175 = iconst.i64 144-;; v176 = iadd.i64 v69, v175 ; v175 = 144-;; @0062 store notrap aligned region15 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 168-;; v179 = iadd.i64 v69, v178 ; v178 = 168-;; @0062 store notrap aligned region15 v174, v179 ; v174 = 0-;; @0062 store notrap aligned region14 v174, v179+4 ; v174 = 0-;; @0062 store notrap aligned region15 v177, v179+8 ; v177 = 0-;; @0062 try_call fn2(v0), sig2, block11, [ context v0 ]+;; @0062 v85 = iconst.i32 5+;; @0062 store notrap aligned region11 v85, v73+32 ; v85 = 5+;; @0062 v88 = load.i64 notrap aligned region17 v32+;; @0062 store notrap aligned region1 v88, v30+24+;; @0062 v89 = load.i64 notrap aligned region6 v32+8+;; @0062 store notrap aligned region12 v89, v30+72+;; @0062 v90 = load.i64 notrap aligned region15 v32+16+;; @0062 store notrap aligned region13 v90, v30+64+;; @0062 v91 = load.i64 notrap aligned region16 v32+24+;; @0062 store notrap aligned region14 v91, v30+80+;; v178 = iconst.i32 0+;; v179 = iconst.i64 144+;; v180 = iadd.i64 v73, v179 ; v179 = 144+;; @0062 store notrap aligned region19 v178, v180 ; v178 = 0+;; @0062 store notrap aligned region18 v178, v180+4 ; v178 = 0+;; v181 = iconst.i64 0+;; @0062 store notrap aligned region19 v181, v180+8 ; v181 = 0+;; v182 = iconst.i64 168+;; v183 = iadd.i64 v73, v182 ; v182 = 168+;; @0062 store notrap aligned region19 v178, v183 ; v178 = 0+;; @0062 store notrap aligned region18 v178, v183+4 ; v178 = 0+;; @0062 store notrap aligned region19 v181, v183+8 ; v181 = 0+;; @0062 try_call fn3(v0), sig3, block11, [ context v0 ];;;; block11:;; @0062 trap user12;;;; block7:-;; @0062 v102 = load.i64 notrap aligned region7 v26+72-;; @0062 v103 = load.i64 notrap aligned region8 v26+64-;; @0062 v104 = load.i64 notrap aligned region9 v26+80-;; @0062 store notrap aligned region10 v102, v69+8-;; @0062 store notrap aligned region11 v103, v69+16-;; @0062 store notrap aligned region12 v104, v69+24-;; @0062 v107 = load.i64 notrap aligned region13 v28-;; @0062 store notrap aligned region1 v107, v26+24-;; @0062 v108 = load.i64 notrap aligned region10 v28+8-;; @0062 store notrap aligned region7 v108, v26+72-;; @0062 v109 = load.i64 notrap aligned region11 v28+16-;; @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+104+;; @0062 v106 = load.i64 notrap aligned region12 v30+72+;; @0062 v107 = load.i64 notrap aligned region13 v30+64+;; @0062 v108 = load.i64 notrap aligned region14 v30+80+;; @0062 store notrap aligned region6 v106, v73+8+;; @0062 store notrap aligned region15 v107, v73+16+;; @0062 store notrap aligned region16 v108, v73+24+;; @0062 v111 = load.i64 notrap aligned region17 v32+;; @0062 store notrap aligned region1 v111, v30+24+;; @0062 v112 = load.i64 notrap aligned region6 v32+8+;; @0062 store notrap aligned region12 v112, v30+72+;; @0062 v113 = load.i64 notrap aligned region15 v32+16+;; @0062 store notrap aligned region13 v113, v30+64+;; @0062 v114 = load.i64 notrap aligned region16 v32+24+;; @0062 store notrap aligned region14 v114, v30+80+;; @0062 v116 = load.i64 notrap aligned region7 v73+104;; @0062 jump block10;;;; block12 cold:;; @0062 trap user12;;;; block13:-;; v169 = iconst.i64 168-;; v170 = iadd.i64 v69, v169 ; v169 = 168-;; @0062 v121 = load.i64 notrap aligned region15 v170+8-;; @0062 v122 = load.i32 notrap aligned region16 v121-;; v171 = iconst.i32 0-;; @0062 store notrap aligned region15 v171, v170 ; v171 = 0+;; v173 = iconst.i64 168+;; v174 = iadd.i64 v73, v173 ; v173 = 168+;; @0062 v125 = load.i64 notrap aligned region19 v174+8+;; @0062 v126 = load.i32 notrap aligned region20 v125+;; v175 = iconst.i32 0+;; @0062 store notrap aligned region19 v175, v174 ; v175 = 0;; @0062 jump block4;;;; block10:-;; @0062 v111 = ireduce.i32 v66-;; @0062 br_table v111, block12, [block13]+;; @0062 v115 = ireduce.i32 v70+;; @0062 br_table v115, block12, [block13];;;; block6:-;; @0062 v126 = load.i64 notrap aligned region13 v28-;; @0062 store notrap aligned region1 v126, v26+24-;; @0062 v127 = load.i64 notrap aligned region10 v28+8-;; @0062 store notrap aligned region7 v127, v26+72-;; @0062 v128 = load.i64 notrap aligned region11 v28+16-;; @0062 store notrap aligned region8 v128, v26+64-;; @0062 v129 = load.i64 notrap aligned region12 v28+24-;; @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 144-;; @0062 v134 = iadd.i64 v69, v133 ; v133 = 144-;; @0062 v135 = load.i64 notrap aligned region15 v134+8-;; v163 = iconst.i32 0-;; @0062 store notrap aligned region15 v163, v134 ; v163 = 0-;; @0062 store notrap aligned region14 v163, v134+4 ; v163 = 0-;; v164 = iconst.i64 0-;; @0062 store notrap aligned region15 v164, v134+8 ; v164 = 0+;; @0062 v130 = load.i64 notrap aligned region17 v32+;; @0062 store notrap aligned region1 v130, v30+24+;; @0062 v131 = load.i64 notrap aligned region6 v32+8+;; @0062 store notrap aligned region12 v131, v30+72+;; @0062 v132 = load.i64 notrap aligned region15 v32+16+;; @0062 store notrap aligned region13 v132, v30+64+;; @0062 v133 = load.i64 notrap aligned region16 v32+24+;; @0062 store notrap aligned region14 v133, v30+80+;; @0062 v136 = iconst.i32 4+;; @0062 store notrap aligned region11 v136, v73+32 ; v136 = 4+;; @0062 v137 = iconst.i64 144+;; @0062 v138 = iadd.i64 v73, v137 ; v137 = 144+;; @0062 v139 = load.i64 notrap aligned region19 v138+8+;; v167 = iconst.i32 0+;; @0062 store notrap aligned region19 v167, v138 ; v167 = 0+;; @0062 store notrap aligned region18 v167, v138+4 ; v167 = 0+;; v168 = iconst.i64 0+;; @0062 store notrap aligned region19 v168, v138+8 ; v168 = 0;; @0068 return;;;; block4:-;; @0062 v114 = uextend.i128 v112-;; v172 = iconst.i64 64-;; v173 = ishl v114, v172 ; v172 = 64-;; @0062 v113 = uextend.i128 v69-;; @0062 v118 = bor v173, v113-;; @006d jump block2(v118)+;; @0062 v118 = uextend.i128 v116+;; v176 = iconst.i64 64+;; v177 = ishl v118, v176 ; v176 = 64+;; @0062 v117 = uextend.i128 v73+;; @0062 v122 = bor v177, v117+;; @006d jump block2(v122);; }diff --git a/tests/disas/stack-switching/resume-suspend.wat b/tests/disas/stack-switching/resume-suspend.watindex 24fb61d3a3..5a9c999600 100644--- a/tests/disas/stack-switching/resume-suspend.wat+++ b/tests/disas/stack-switching/resume-suspend.wat@@ -39,7 +39,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32) -> i8 tail-;; fn0 = colocated u805306368:44 sig0+;; fn0 = colocated u805306368:43 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):@@ -147,218 +147,233 @@;; ss0 = explicit_slot 8, align = 8;; region0 = 123 "";; region1 = 160 ""-;; region2 = 191 ""-;; region3 = 192 ""-;; region4 = 106 ""-;; region5 = 125 ""-;; region6 = 144 ""-;; region7 = 231 ""-;; region8 = 243 ""-;; region9 = 209 ""-;; region10 = 100 ""-;; region11 = 176 ""-;; region12 = 62 ""-;; region13 = 198 ""-;; region14 = 145 ""-;; region15 = 139 ""-;; region16 = 82 ""-;; region17 = 234 ""-;; region18 = 124 ""+;; region2 = 130 ""+;; region3 = 134 ""+;; region4 = 44 ""+;; region5 = 120 ""+;; region6 = 100 ""+;; region7 = 191 ""+;; region8 = 192 ""+;; region9 = 106 ""+;; region10 = 125 ""+;; region11 = 144 ""+;; region12 = 231 ""+;; region13 = 243 ""+;; region14 = 209 ""+;; region15 = 176 ""+;; region16 = 62 ""+;; region17 = 198 ""+;; region18 = 145 ""+;; region19 = 139 ""+;; region20 = 82 ""+;; region21 = 234 ""+;; region22 = 124 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24-;; sig0 = (i64 vmctx, i32) -> i64 tail-;; sig1 = (i64 vmctx, i64, i32, i32, i32) -> i64 tail-;; sig2 = (i64 vmctx) tail-;; fn0 = colocated u805306368:6 sig0-;; fn1 = colocated u805306368:42 sig1+;; sig0 = (i64 vmctx, i64) tail+;; sig1 = (i64 vmctx, i64, i64, i64) -> i8 system_v+;; sig2 = (i64 vmctx, i64, i32, i32, i32) -> i64 tail+;; sig3 = (i64 vmctx) tail+;; fn0 = colocated u0:0 sig0+;; fn1 = colocated u268435456:0 sig1;; fn2 = colocated u805306368:41 sig2+;; fn3 = colocated u805306368:40 sig3;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):-;; @0043 v9 = iconst.i32 0-;; @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+104+;; @0043 v10 = func_addr.i64 fn1+;; @0043 store notrap aligned region4 v10, v0+88+;; @0043 v9 = func_addr.i64 fn0+;; @0043 store notrap aligned region5 v9, v0+96+;; @0043 store notrap aligned region6 v0, v0+112+;; @0043 v11 = load.i64 notrap aligned readonly can_move region2 v0+40+;; @0043 v12 = load.i32 notrap aligned readonly can_move region3 v11+;; @0043 store notrap aligned region1 v12, v0+104+;; @0043 v13 = iconst.i64 88+;; @0043 v14 = iadd v0, v13 ; v13 = 88+;; @0045 trapz v14, user16+;; @0045 v15 = iconst.i32 0+;; @0045 v18 = call fn2(v0, v14, v15, v15, v15) ; v15 = 0, v15 = 0, v15 = 0+;; @0045 v19 = load.i64 notrap aligned region7 v18+104;; @004e jump block3;;;; block3:-;; @0045 v17 = uextend.i128 v15+;; @0045 v21 = uextend.i128 v19;; @0040 v5 = iconst.i64 64-;; v154 = ishl v17, v5 ; v5 = 64-;; v156 = ireduce.i64 v154-;; v158 = bor v156, v14-;; @004e trapz v158, user16-;; @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-;; @004e v26 = ireduce.i64 v160-;; @004e v28 = icmp eq v27, v26-;; @004e trapz v28, user23-;; @004e v29 = iconst.i64 1-;; @004e v30 = iadd v27, v29 ; v29 = 1-;; @004e store notrap aligned region2 v30, v158+104-;; @004e v31 = load.i64 notrap aligned region3 v158+112-;; @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+88-;; @004e store notrap aligned region5 v34, v31+96+;; v158 = ishl v21, v5 ; v5 = 64+;; v160 = ireduce.i64 v158+;; v162 = bor v160, v18+;; @004e trapz v162, user16+;; @004e v31 = load.i64 notrap aligned region7 v162+104+;; @0045 v20 = uextend.i128 v18+;; @0045 v25 = bor v158, v20+;; v164 = ushr v25, v5 ; v5 = 64+;; @004e v30 = ireduce.i64 v164+;; @004e v32 = icmp eq v31, v30+;; @004e trapz v32, user23+;; @004e v33 = iconst.i64 1+;; @004e v34 = iadd v31, v33 ; v33 = 1+;; @004e store notrap aligned region7 v34, v162+104+;; @004e v35 = load.i64 notrap aligned region8 v162+112+;; @004e v36 = load.i64 notrap aligned readonly can_move region0 v0+8+;; @004e v37 = load.i64 notrap aligned region9 v36+88+;; @004e v38 = load.i64 notrap aligned region9 v36+96+;; @004e store notrap aligned region10 v37, v35+88+;; @004e store notrap aligned region10 v38, v35+96;; @0040 v2 = iconst.i64 0-;; @004e store notrap aligned region3 v2, v158+112 ; 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-;; @004e v40 = iconst.i32 1-;; @004e store notrap aligned region6 v40, v158+32 ; v40 = 1-;; @004e v41 = iconst.i32 2-;; @004e store notrap aligned region6 v41, v34+32 ; v41 = 2-;; @004e v45 = load.i64 notrap aligned region7 v32+72-;; @004e v46 = load.i64 notrap aligned region8 v32+64-;; @004e v47 = load.i64 notrap aligned region9 v32+80-;; @004e store notrap aligned region10 v45, v34+8-;; @004e store notrap aligned region11 v46, v34+16-;; @004e store notrap aligned region12 v47, v34+24-;; @004e v48 = load.i64 notrap aligned region1 v32+24-;; @004e store notrap aligned region13 v48, v34-;; @004e v51 = load.i64 notrap aligned region13 v158-;; @004e store notrap aligned region1 v51, v32+24-;; @004e v52 = load.i64 notrap aligned region10 v158+8-;; @004e store notrap aligned region7 v52, v32+72-;; @004e v53 = load.i64 notrap aligned region11 v158+16-;; @004e store notrap aligned region8 v53, v32+64-;; @004e v54 = load.i64 notrap aligned region12 v158+24-;; @004e store notrap aligned region9 v54, v32+80-;; @004e v55 = iconst.i64 40-;; @004e v56 = iadd v34, v55 ; v55 = 40-;; @004e store notrap aligned region14 v40, v56+4 ; v40 = 1-;; @004e v58 = stack_addr.i64 ss0-;; @004e store notrap aligned region15 v58, v56+8-;; @004e v59 = iconst.i64 48-;; @004e v60 = iadd.i64 v0, v59 ; v59 = 48-;; @004e store notrap aligned region16 v60, v58-;; @004e store notrap aligned region15 v40, v56 ; v40 = 1-;; @004e store notrap aligned region17 v40, v34+56 ; v40 = 1-;; @004e v67 = iconst.i64 120-;; @004e v68 = iadd v31, v67 ; v67 = 120-;; @004e v69 = load.i64 notrap aligned region18 v68-;; @004e v70 = iconst.i64 -24-;; @004e v71 = iadd v69, v70 ; v70 = -24-;; v162 = iconst.i64 0x0001_0000_0000-;; @004e v72 = stack_switch v71, v71, v162 ; v162 = 0x0001_0000_0000-;; @004e v74 = load.i64 notrap aligned region4 v32+88-;; @004e v75 = load.i64 notrap aligned region4 v32+96-;; @004e store notrap aligned region4 v33, v32+88-;; @004e store notrap aligned region4 v34, v32+96-;; @004e store notrap aligned region6 v40, v34+32 ; v40 = 1-;; v165 = iconst.i32 0-;; @004e store notrap aligned region15 v165, v56 ; v165 = 0-;; @004e store notrap aligned region14 v165, v56+4 ; v165 = 0-;; @004e store notrap aligned region15 v2, v56+8 ; v2 = 0-;; @004e store notrap aligned region17 v2, v34+56 ; v2 = 0-;; @004e brif v72, block7, block4+;; @004e store notrap aligned region8 v2, v162+112 ; v2 = 0+;; @004e v40 = iconst.i64 2+;; @004e store notrap aligned region9 v40, v36+88 ; v40 = 2+;; @004e store notrap aligned region9 v162, v36+96+;; @004e v44 = iconst.i32 1+;; @004e store notrap aligned region11 v44, v162+32 ; v44 = 1+;; @004e v45 = iconst.i32 2+;; @004e store notrap aligned region11 v45, v38+32 ; v45 = 2+;; @004e v49 = load.i64 notrap aligned region12 v36+72+;; @004e v50 = load.i64 notrap aligned region13 v36+64+;; @004e v51 = load.i64 notrap aligned region14 v36+80+;; @004e store notrap aligned region6 v49, v38+8+;; @004e store notrap aligned region15 v50, v38+16+;; @004e store notrap aligned region16 v51, v38+24+;; @004e v52 = load.i64 notrap aligned region1 v36+24+;; @004e store notrap aligned region17 v52, v38+;; @004e v55 = load.i64 notrap aligned region17 v162+;; @004e store notrap aligned region1 v55, v36+24+;; @004e v56 = load.i64 notrap aligned region6 v162+8+;; @004e store notrap aligned region12 v56, v36+72+;; @004e v57 = load.i64 notrap aligned region15 v162+16+;; @004e store notrap aligned region13 v57, v36+64+;; @004e v58 = load.i64 notrap aligned region16 v162+24+;; @004e store notrap aligned region14 v58, v36+80+;; @004e v59 = iconst.i64 40+;; @004e v60 = iadd v38, v59 ; v59 = 40+;; @004e store notrap aligned region18 v44, v60+4 ; v44 = 1+;; @004e v62 = stack_addr.i64 ss0+;; @004e store notrap aligned region19 v62, v60+8+;; @004e v63 = iconst.i64 48+;; @004e v64 = iadd.i64 v0, v63 ; v63 = 48+;; @004e store notrap aligned region20 v64, v62+;; @004e store notrap aligned region19 v44, v60 ; v44 = 1+;; @004e store notrap aligned region21 v44, v38+56 ; v44 = 1+;; @004e v71 = iconst.i64 120+;; @004e v72 = iadd v35, v71 ; v71 = 120+;; @004e v73 = load.i64 notrap aligned region22 v72+;; @004e v74 = iconst.i64 -24+;; @004e v75 = iadd v73, v74 ; v74 = -24+;; v166 = iconst.i64 0x0001_0000_0000+;; @004e v76 = stack_switch v75, v75, v166 ; v166 = 0x0001_0000_0000+;; @004e v78 = load.i64 notrap aligned region9 v36+88+;; @004e v79 = load.i64 notrap aligned region9 v36+96+;; @004e store notrap aligned region9 v37, v36+88+;; @004e store notrap aligned region9 v38, v36+96+;; @004e store notrap aligned region11 v44, v38+32 ; v44 = 1+;; v169 = iconst.i32 0+;; @004e store notrap aligned region19 v169, v60 ; v169 = 0+;; @004e store notrap aligned region18 v169, v60+4 ; v169 = 0+;; @004e store notrap aligned region19 v2, v60+8 ; v2 = 0+;; @004e store notrap aligned region21 v2, v38+56 ; v2 = 0+;; @004e brif v76, block7, block4;;;; block7:-;; @004e v65 = iconst.i64 32-;; @004e v82 = ushr.i64 v72, v65 ; v65 = 32-;; @004e v83 = iconst.i64 4-;; @004e v84 = icmp eq v82, v83 ; v83 = 4-;; @004e brif v84, block6, block5+;; @004e v69 = iconst.i64 32+;; @004e v86 = ushr.i64 v76, v69 ; v69 = 32+;; @004e v87 = iconst.i64 4+;; @004e v88 = icmp eq v86, v87 ; v87 = 4+;; @004e brif v88, block6, block5;;;; block6 cold:-;; @004e v87 = iconst.i32 5-;; @004e store notrap aligned region6 v87, v75+32 ; v87 = 5-;; @004e v90 = load.i64 notrap aligned region13 v34-;; @004e store notrap aligned region1 v90, v32+24-;; @004e v91 = load.i64 notrap aligned region10 v34+8-;; @004e store notrap aligned region7 v91, v32+72-;; @004e v92 = load.i64 notrap aligned region11 v34+16-;; @004e store notrap aligned region8 v92, v32+64-;; @004e v93 = load.i64 notrap aligned region12 v34+24-;; @004e store notrap aligned region9 v93, v32+80-;; v174 = iconst.i32 0-;; v175 = iconst.i64 144-;; v176 = iadd.i64 v75, v175 ; v175 = 144-;; @004e store notrap aligned region15 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 168-;; v179 = iadd.i64 v75, v178 ; v178 = 168-;; @004e store notrap aligned region15 v174, v179 ; v174 = 0-;; @004e store notrap aligned region14 v174, v179+4 ; v174 = 0-;; @004e store notrap aligned region15 v177, v179+8 ; v177 = 0-;; @004e try_call fn2(v0), sig2, block9, [ context v0 ]+;; @004e v91 = iconst.i32 5+;; @004e store notrap aligned region11 v91, v79+32 ; v91 = 5+;; @004e v94 = load.i64 notrap aligned region17 v38+;; @004e store notrap aligned region1 v94, v36+24+;; @004e v95 = load.i64 notrap aligned region6 v38+8+;; @004e store notrap aligned region12 v95, v36+72+;; @004e v96 = load.i64 notrap aligned region15 v38+16+;; @004e store notrap aligned region13 v96, v36+64+;; @004e v97 = load.i64 notrap aligned region16 v38+24+;; @004e store notrap aligned region14 v97, v36+80+;; v178 = iconst.i32 0+;; v179 = iconst.i64 144+;; v180 = iadd.i64 v79, v179 ; v179 = 144+;; @004e store notrap aligned region19 v178, v180 ; v178 = 0+;; @004e store notrap aligned region18 v178, v180+4 ; v178 = 0+;; v181 = iconst.i64 0+;; @004e store notrap aligned region19 v181, v180+8 ; v181 = 0+;; v182 = iconst.i64 168+;; v183 = iadd.i64 v79, v182 ; v182 = 168+;; @004e store notrap aligned region19 v178, v183 ; v178 = 0+;; @004e store notrap aligned region18 v178, v183+4 ; v178 = 0+;; @004e store notrap aligned region19 v181, v183+8 ; v181 = 0+;; @004e try_call fn3(v0), sig3, block9, [ context v0 ];;;; block9:;; @004e trap user12;;;; block5:-;; @004e v108 = load.i64 notrap aligned region7 v32+72-;; @004e v109 = load.i64 notrap aligned region8 v32+64-;; @004e v110 = load.i64 notrap aligned region9 v32+80-;; @004e store notrap aligned region10 v108, v75+8-;; @004e store notrap aligned region11 v109, v75+16-;; @004e store notrap aligned region12 v110, v75+24-;; @004e v113 = load.i64 notrap aligned region13 v34-;; @004e store notrap aligned region1 v113, v32+24-;; @004e v114 = load.i64 notrap aligned region10 v34+8-;; @004e store notrap aligned region7 v114, v32+72-;; @004e v115 = load.i64 notrap aligned region11 v34+16-;; @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+104+;; @004e v112 = load.i64 notrap aligned region12 v36+72+;; @004e v113 = load.i64 notrap aligned region13 v36+64+;; @004e v114 = load.i64 notrap aligned region14 v36+80+;; @004e store notrap aligned region6 v112, v79+8+;; @004e store notrap aligned region15 v113, v79+16+;; @004e store notrap aligned region16 v114, v79+24+;; @004e v117 = load.i64 notrap aligned region17 v38+;; @004e store notrap aligned region1 v117, v36+24+;; @004e v118 = load.i64 notrap aligned region6 v38+8+;; @004e store notrap aligned region12 v118, v36+72+;; @004e v119 = load.i64 notrap aligned region15 v38+16+;; @004e store notrap aligned region13 v119, v36+64+;; @004e v120 = load.i64 notrap aligned region16 v38+24+;; @004e store notrap aligned region14 v120, v36+80+;; @004e v122 = load.i64 notrap aligned region7 v79+104;; @004e jump block8;;;; block10 cold:;; @004e trap user12;;;; block11:-;; @004e v125 = iconst.i64 168-;; @004e v126 = iadd.i64 v75, v125 ; v125 = 168-;; @004e v127 = load.i64 notrap aligned region15 v126+8-;; v171 = iconst.i32 0-;; @004e store notrap aligned region15 v171, v126 ; v171 = 0-;; @004e v120 = uextend.i128 v118-;; v172 = iconst.i64 64-;; v173 = ishl v120, v172 ; v172 = 64-;; @004e v119 = uextend.i128 v75-;; @004e v124 = bor v173, v119-;; @004e jump block2(v124)+;; @004e v129 = iconst.i64 168+;; @004e v130 = iadd.i64 v79, v129 ; v129 = 168+;; @004e v131 = load.i64 notrap aligned region19 v130+8+;; v175 = iconst.i32 0+;; @004e store notrap aligned region19 v175, v130 ; v175 = 0+;; @004e v124 = uextend.i128 v122+;; v176 = iconst.i64 64+;; v177 = ishl v124, v176 ; v176 = 64+;; @004e v123 = uextend.i128 v79+;; @004e v128 = bor v177, v123+;; @004e jump block2(v128);;;; block8:-;; @004e v117 = ireduce.i32 v72-;; @004e br_table v117, block10, [block11]+;; @004e v121 = ireduce.i32 v76+;; @004e br_table v121, block10, [block11];;;; block4:-;; @004e v131 = load.i64 notrap aligned region13 v34-;; @004e store notrap aligned region1 v131, v32+24-;; @004e v132 = load.i64 notrap aligned region10 v34+8-;; @004e store notrap aligned region7 v132, v32+72-;; @004e v133 = load.i64 notrap aligned region11 v34+16-;; @004e store notrap aligned region8 v133, v32+64-;; @004e v134 = load.i64 notrap aligned region12 v34+24-;; @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 144-;; @004e v139 = iadd.i64 v75, v138 ; v138 = 144-;; @004e v140 = load.i64 notrap aligned region15 v139+8-;; v166 = iconst.i32 0-;; @004e store notrap aligned region15 v166, v139 ; v166 = 0-;; @004e store notrap aligned region14 v166, v139+4 ; v166 = 0-;; v167 = iconst.i64 0-;; @004e store notrap aligned region15 v167, v139+8 ; v167 = 0-;; v168 = uextend.i128 v167 ; v167 = 0-;; v169 = iconst.i64 64-;; v170 = ishl v168, v169 ; v169 = 64-;; @0040 v8 = bor v170, v168+;; @004e v135 = load.i64 notrap aligned region17 v38+;; @004e store notrap aligned region1 v135, v36+24+;; @004e v136 = load.i64 notrap aligned region6 v38+8+;; @004e store notrap aligned region12 v136, v36+72+;; @004e v137 = load.i64 notrap aligned region15 v38+16+;; @004e store notrap aligned region13 v137, v36+64+;; @004e v138 = load.i64 notrap aligned region16 v38+24+;; @004e store notrap aligned region14 v138, v36+80+;; @004e v141 = iconst.i32 4+;; @004e store notrap aligned region11 v141, v79+32 ; v141 = 4+;; @004e v142 = iconst.i64 144+;; @004e v143 = iadd.i64 v79, v142 ; v142 = 144+;; @004e v144 = load.i64 notrap aligned region19 v143+8+;; v170 = iconst.i32 0+;; @004e store notrap aligned region19 v170, v143 ; v170 = 0+;; @004e store notrap aligned region18 v170, v143+4 ; v170 = 0+;; v171 = iconst.i64 0+;; @004e store notrap aligned region19 v171, v143+8 ; v171 = 0+;; v172 = uextend.i128 v171 ; v171 = 0+;; v173 = iconst.i64 64+;; v174 = ishl v172, v173 ; v173 = 64+;; @0040 v8 = bor v174, v172;; @0056 jump block2(v8);;-;; block2(v151: i128):+;; block2(v155: i128):;; @0058 jump block1;;;; block1:diff --git a/tests/disas/stack-switching/symmetric-switch.wat b/tests/disas/stack-switching/symmetric-switch.watindex 8ed1d475e8..34e96ce48f 100644--- a/tests/disas/stack-switching/symmetric-switch.wat+++ b/tests/disas/stack-switching/symmetric-switch.wat@@ -30,261 +30,275 @@;; ss1 = explicit_slot 24, align = 8;; region0 = 123 "";; region1 = 160 ""-;; region2 = 191 ""-;; region3 = 106 ""-;; region4 = 125 ""-;; region5 = 139 ""-;; region6 = 234 ""-;; region7 = 82 ""-;; region8 = 192 ""-;; region9 = 145 ""-;; region10 = 144 ""-;; region11 = 231 ""-;; region12 = 243 ""-;; region13 = 209 ""-;; region14 = 100 ""-;; region15 = 176 ""-;; region16 = 62 ""-;; region17 = 198 ""-;; region18 = 124 ""-;; region19 = 187 ""+;; region2 = 130 ""+;; region3 = 116 ""+;; region4 = 44 ""+;; region5 = 120 ""+;; region6 = 100 ""+;; region7 = 191 ""+;; region8 = 106 ""+;; region9 = 125 ""+;; region10 = 139 ""+;; region11 = 234 ""+;; region12 = 82 ""+;; region13 = 192 ""+;; region14 = 145 ""+;; region15 = 144 ""+;; region16 = 231 ""+;; region17 = 243 ""+;; region18 = 209 ""+;; region19 = 176 ""+;; region20 = 62 ""+;; region21 = 198 ""+;; region22 = 124 ""+;; region23 = 187 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24-;; sig0 = (i64 vmctx, i32) -> i64 tail-;; sig1 = (i64 vmctx, i64, i32, i32, i32) -> i64 tail-;; sig2 = (i64 vmctx, i32) -> i8 tail-;; fn0 = colocated u805306368:6 sig0-;; fn1 = colocated u805306368:42 sig1-;; fn2 = colocated u805306368:44 sig2+;; sig0 = (i64 vmctx, i64, i128) tail+;; sig1 = (i64 vmctx, i64, i64, i64) -> i8 system_v+;; sig2 = (i64 vmctx, i64, i32, i32, i32) -> i64 tail+;; sig3 = (i64 vmctx, i32) -> i8 tail+;; fn0 = colocated u0:1 sig0+;; fn1 = colocated u268435456:1 sig1+;; fn2 = colocated u805306368:41 sig2+;; fn3 = colocated u805306368:43 sig3;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):-;; @003a v2 = iconst.i32 1-;; @003a v3 = call fn0(v0, v2) ; v2 = 1-;; @003c trapz v3, user16-;; @003c v4 = iconst.i32 1-;; @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+104-;; @003c v9 = uextend.i128 v7-;; @003c v10 = uextend.i128 v8-;; @003c v11 = iconst.i64 64-;; @003c v12 = uextend.i128 v11 ; v11 = 64-;; @003c v13 = ishl v10, v12-;; @003c v14 = bor v13, v9-;; @003e v15 = ireduce.i64 v14-;; @003e v16 = iconst.i64 64-;; @003e v17 = uextend.i128 v16 ; v16 = 64-;; @003e v18 = ushr v14, v17+;; @003a v2 = func_addr.i64 fn0+;; @003a v3 = func_addr.i64 fn1+;; @003a v4 = load.i64 notrap aligned readonly can_move region2 v0+40+;; @003a v5 = load.i32 notrap aligned readonly can_move region3 v4+8+;; @003a store notrap aligned region4 v3, v0+120+;; @003a store notrap aligned region5 v2, v0+128+;; @003a store notrap aligned region6 v0, v0+144+;; @003a store notrap aligned region1 v5, v0+136+;; @003a v6 = iconst.i64 120+;; @003a v7 = iadd v0, v6 ; v6 = 120+;; @003c trapz v7, user16+;; @003c v8 = iconst.i32 1+;; @003c v9 = iconst.i32 0+;; @003c v10 = iconst.i32 0+;; @003c v11 = call fn2(v0, v7, v8, v9, v10) ; v8 = 1, v9 = 0, v10 = 0+;; @003c v12 = load.i64 notrap aligned region7 v11+104+;; @003c v13 = uextend.i128 v11+;; @003c v14 = uextend.i128 v12+;; @003c v15 = iconst.i64 64+;; @003c v16 = uextend.i128 v15 ; v15 = 64+;; @003c v17 = ishl v14, v16+;; @003c v18 = bor v17, v13;; @003e v19 = ireduce.i64 v18-;; @003e trapz v15, user16-;; @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+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-;; @003e v27 = load.i64 notrap aligned region3 v26+88-;; @003e v28 = load.i64 notrap aligned region3 v26+96-;; @003e jump block2(v27, v28)+;; @003e v20 = iconst.i64 64+;; @003e v21 = uextend.i128 v20 ; v20 = 64+;; @003e v22 = ushr v18, v21+;; @003e v23 = ireduce.i64 v22+;; @003e trapz v19, user16+;; @003e v24 = load.i64 notrap aligned region7 v19+104+;; @003e v25 = icmp eq v24, v23+;; @003e trapz v25, user23+;; @003e v26 = iconst.i64 1+;; @003e v27 = iadd v24, v26 ; v26 = 1+;; @003e store notrap aligned region7 v27, v19+104+;; @003e v28 = iconst.i64 48+;; @003e v29 = iadd v0, v28 ; v28 = 48+;; @003e v30 = load.i64 notrap aligned readonly can_move region0 v0+8+;; @003e v31 = load.i64 notrap aligned region8 v30+88+;; @003e v32 = load.i64 notrap aligned region8 v30+96+;; @003e jump block2(v31, v32);;-;; block2(v29: i64, v30: i64):-;; @003e v31 = iconst.i64 1-;; @003e v32 = icmp eq v29, v31 ; v31 = 1-;; @003e brif v32, block7, block3+;; block2(v33: i64, v34: i64):+;; @003e v35 = iconst.i64 1+;; @003e v36 = icmp eq v33, v35 ; v35 = 1+;; @003e brif v36, block7, block3;;;; block3:-;; @003e v33 = load.i64 notrap aligned region4 v30+88-;; @003e v34 = load.i64 notrap aligned region4 v30+96-;; @003e v35 = iconst.i64 40-;; @003e v36 = iadd v34, v35 ; v35 = 40-;; @003e v37 = load.i64 notrap aligned region5 v36+8-;; @003e v38 = load.i32 notrap aligned region6 v34+56-;; @003e v39 = load.i32 notrap aligned region5 v36-;; @003e jump block4(v38)+;; @003e v37 = load.i64 notrap aligned region9 v34+88+;; @003e v38 = load.i64 notrap aligned region9 v34+96+;; @003e v39 = iconst.i64 40+;; @003e v40 = iadd v38, v39 ; v39 = 40+;; @003e v41 = load.i64 notrap aligned region10 v40+8+;; @003e v42 = load.i32 notrap aligned region11 v38+56+;; @003e v43 = load.i32 notrap aligned region10 v40+;; @003e jump block4(v42);;-;; block4(v40: i32):-;; @003e v41 = icmp ult v40, v39-;; @003e brif v41, block5, block2(v33, v34)+;; block4(v44: i32):+;; @003e v45 = icmp ult v44, v43+;; @003e brif v45, block5, block2(v37, v38);;;; block5:-;; @003e v42 = iconst.i32 8-;; @003e v43 = imul.i32 v40, v42 ; v42 = 8-;; @003e v44 = uextend.i64 v43-;; @003e v45 = iadd.i64 v37, v44-;; @003e v46 = load.i64 notrap aligned region7 v45-;; @003e v47 = icmp eq v46, v25-;; @003e v48 = iconst.i32 1-;; @003e v49 = iadd.i32 v40, v48 ; v48 = 1-;; @003e brif v47, block6, block4(v49)+;; @003e v46 = iconst.i32 8+;; @003e v47 = imul.i32 v44, v46 ; v46 = 8+;; @003e v48 = uextend.i64 v47+;; @003e v49 = iadd.i64 v41, v48+;; @003e v50 = load.i64 notrap aligned region12 v49+;; @003e v51 = icmp eq v50, v29+;; @003e v52 = iconst.i32 1+;; @003e v53 = iadd.i32 v44, v52 ; v52 = 1+;; @003e brif v51, block6, block4(v53);;;; block7 cold:;; @003e trap user22;;;; block6:-;; @003e store.i64 notrap aligned region8 v30, v28+112-;; @003e v50 = iconst.i64 168-;; @003e v51 = iadd.i64 v28, v50 ; v50 = 168-;; @003e v52 = iconst.i32 1-;; @003e v53 = stack_addr.i64 ss0-;; @003e store notrap aligned region9 v52, v51+4 ; v52 = 1-;; @003e store notrap aligned region5 v53, v51+8-;; @003e v54 = iconst.i64 0-;; @003e v55 = iadd.i64 v28, v54 ; v54 = 0-;; @003e v56 = iconst.i32 3-;; @003e store notrap aligned region10 v56, v55+32 ; v56 = 3-;; @003e v57 = iconst.i64 0+;; @003e store.i64 notrap aligned region13 v34, v32+112+;; @003e v54 = iconst.i64 168+;; @003e v55 = iadd.i64 v32, v54 ; v54 = 168+;; @003e v56 = iconst.i32 1+;; @003e v57 = stack_addr.i64 ss0+;; @003e store notrap aligned region14 v56, v55+4 ; v56 = 1+;; @003e store notrap aligned region10 v57, v55+8;; @003e v58 = iconst.i64 0-;; @003e store notrap aligned region4 v57, v30+88 ; v57 = 0-;; @003e store notrap aligned region4 v58, v30+96 ; 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-;; @003e v62 = load.i64 notrap aligned region11 v59+72-;; @003e v63 = load.i64 notrap aligned region12 v59+64-;; @003e v64 = load.i64 notrap aligned region13 v59+80-;; @003e store notrap aligned region14 v62, v61+8-;; @003e store notrap aligned region15 v63, v61+16-;; @003e store notrap aligned region16 v64, v61+24-;; @003e v65 = load.i64 notrap aligned region2 v28+104-;; @003e v66 = uextend.i128 v28-;; @003e v67 = uextend.i128 v65-;; @003e v68 = iconst.i64 64-;; @003e v69 = uextend.i128 v68 ; v68 = 64-;; @003e v70 = ishl v67, v69-;; @003e v71 = bor v70, v66-;; @003e v73 = iconst.i64 0-;; @003e v74 = iadd.i64 v15, v73 ; v73 = 0-;; @003e v75 = load.i32 notrap aligned region10 v74+32-;; @003e v76 = iconst.i32 0-;; @003e v77 = icmp ne v75, v76 ; v76 = 0-;; @003e brif v77, block9, block8+;; @003e v59 = iadd.i64 v32, v58 ; v58 = 0+;; @003e v60 = iconst.i32 3+;; @003e store notrap aligned region15 v60, v59+32 ; v60 = 3+;; @003e v61 = iconst.i64 0+;; @003e v62 = iconst.i64 0+;; @003e store notrap aligned region9 v61, v34+88 ; v61 = 0+;; @003e store notrap aligned region9 v62, v34+96 ; v62 = 0+;; @003e v63 = load.i64 notrap aligned readonly can_move region0 v0+8+;; @003e v64 = iconst.i64 0+;; @003e v65 = iadd v59, v64 ; v64 = 0+;; @003e v66 = load.i64 notrap aligned region16 v63+72+;; @003e v67 = load.i64 notrap aligned region17 v63+64+;; @003e v68 = load.i64 notrap aligned region18 v63+80+;; @003e store notrap aligned region6 v66, v65+8+;; @003e store notrap aligned region19 v67, v65+16+;; @003e store notrap aligned region20 v68, v65+24+;; @003e v69 = load.i64 notrap aligned region7 v32+104+;; @003e v70 = uextend.i128 v32+;; @003e v71 = uextend.i128 v69+;; @003e v72 = iconst.i64 64+;; @003e v73 = uextend.i128 v72 ; v72 = 64+;; @003e v74 = ishl v71, v73+;; @003e v75 = bor v74, v70+;; @003e v77 = iconst.i64 0+;; @003e v78 = iadd.i64 v19, v77 ; v77 = 0+;; @003e v79 = load.i32 notrap aligned region15 v78+32+;; @003e v80 = iconst.i32 0+;; @003e v81 = icmp ne v79, v80 ; v80 = 0+;; @003e brif v81, block9, block8;;;; block8:-;; @003e v78 = iconst.i64 144-;; @003e v79 = iadd.i64 v15, v78 ; v78 = 144-;; @003e v80 = load.i64 notrap aligned region5 v79+8-;; @003e v81 = load.i32 notrap aligned region5 v79-;; @003e v82 = load.i32 notrap aligned region9 v79+4-;; @003e v83 = uextend.i64 v81-;; @003e v84 = uextend.i64 v82-;; @003e v85 = iconst.i64 1-;; @003e v86 = iadd v83, v85 ; v85 = 1-;; @003e v87 = icmp ule v86, v84-;; @003e trapz v87, user1-;; @003e v88 = ireduce.i32 v86-;; @003e store notrap aligned region5 v88, v79-;; @003e v89 = iconst.i64 16-;; @003e v90 = imul v83, v89 ; v89 = 16-;; @003e v91 = iadd v80, v90-;; @003e jump block10(v91)+;; @003e v82 = iconst.i64 144+;; @003e v83 = iadd.i64 v19, v82 ; v82 = 144+;; @003e v84 = load.i64 notrap aligned region10 v83+8+;; @003e v85 = load.i32 notrap aligned region10 v83+;; @003e v86 = load.i32 notrap aligned region14 v83+4+;; @003e v87 = uextend.i64 v85+;; @003e v88 = uextend.i64 v86+;; @003e v89 = iconst.i64 1+;; @003e v90 = iadd v87, v89 ; v89 = 1+;; @003e v91 = icmp ule v90, v88+;; @003e trapz v91, user1+;; @003e v92 = ireduce.i32 v90+;; @003e store notrap aligned region10 v92, v83+;; @003e v93 = iconst.i64 16+;; @003e v94 = imul v87, v93 ; v93 = 16+;; @003e v95 = iadd v84, v94+;; @003e jump block10(v95);;;; block9:-;; @003e v92 = iconst.i64 168-;; @003e v93 = iadd.i64 v15, v92 ; v92 = 168-;; @003e v94 = load.i64 notrap aligned region5 v93+8-;; @003e v95 = load.i32 notrap aligned region5 v93-;; @003e v96 = load.i32 notrap aligned region9 v93+4-;; @003e v97 = uextend.i64 v95-;; @003e v98 = uextend.i64 v96-;; @003e v99 = iconst.i64 1-;; @003e v100 = iadd v97, v99 ; v99 = 1-;; @003e v101 = icmp ule v100, v98-;; @003e trapz v101, user1-;; @003e v102 = ireduce.i32 v100-;; @003e store notrap aligned region5 v102, v93-;; @003e v103 = iconst.i64 16-;; @003e v104 = imul v97, v103 ; v103 = 16-;; @003e v105 = iadd v94, v104-;; @003e jump block10(v105)+;; @003e v96 = iconst.i64 168+;; @003e v97 = iadd.i64 v19, v96 ; v96 = 168+;; @003e v98 = load.i64 notrap aligned region10 v97+8+;; @003e v99 = load.i32 notrap aligned region10 v97+;; @003e v100 = load.i32 notrap aligned region14 v97+4+;; @003e v101 = uextend.i64 v99+;; @003e v102 = uextend.i64 v100+;; @003e v103 = iconst.i64 1+;; @003e v104 = iadd v101, v103 ; v103 = 1+;; @003e v105 = icmp ule v104, v102+;; @003e trapz v105, user1+;; @003e v106 = ireduce.i32 v104+;; @003e store notrap aligned region10 v106, v97+;; @003e v107 = iconst.i64 16+;; @003e v108 = imul v101, v107 ; v107 = 16+;; @003e v109 = iadd v98, v108+;; @003e jump block10(v109);;-;; block10(v72: i64):-;; @003e store.i128 notrap aligned region7 v71, v72-;; @003e v106 = iconst.i64 0-;; @003e v107 = iadd.i64 v15, v106 ; v106 = 0-;; @003e v108 = iconst.i32 1-;; @003e store notrap aligned region10 v108, v107+32 ; v108 = 1-;; @003e v109 = load.i64 notrap aligned region8 v15+112-;; @003e store.i64 notrap aligned region4 v33, v109+88-;; @003e store.i64 notrap aligned region4 v34, v109+96-;; @003e v110 = iconst.i64 2-;; @003e v111 = load.i64 notrap aligned readonly can_move region0 v0+8-;; @003e store notrap aligned region3 v110, v111+88 ; v110 = 2-;; @003e store.i64 notrap aligned region3 v15, v111+96-;; @003e v112 = iconst.i64 0-;; @003e v113 = iadd v107, v112 ; v112 = 0-;; @003e v114 = load.i64 notrap aligned region17 v113-;; @003e store notrap aligned region1 v114, v59+24-;; @003e v115 = load.i64 notrap aligned region14 v113+8-;; @003e store notrap aligned region11 v115, v59+72-;; @003e v116 = load.i64 notrap aligned region15 v113+16-;; @003e store notrap aligned region12 v116, v59+64-;; @003e v117 = load.i64 notrap aligned region16 v113+24-;; @003e store notrap aligned region13 v117, v59+80-;; @003e v118 = iconst.i64 120-;; @003e v119 = iadd.i64 v30, v118 ; v118 = 120-;; @003e v120 = load.i64 notrap aligned region18 v119-;; @003e v121 = iconst.i64 -24-;; @003e v122 = iadd v120, v121 ; v121 = -24-;; @003e v123 = iconst.i64 120-;; @003e v124 = iadd v109, v123 ; v123 = 120-;; @003e v125 = load.i64 notrap aligned region18 v124-;; @003e v126 = iconst.i64 -24-;; @003e v127 = iadd v125, v126 ; v126 = -24-;; @003e v128 = stack_addr.i64 ss1-;; @003e v129 = load.i64 notrap aligned region7 v127-;; @003e store notrap aligned region19 v129, v128-;; @003e v130 = load.i64 notrap aligned region7 v122-;; @003e store notrap aligned region7 v130, v127-;; @003e v131 = load.i64 notrap aligned region7 v127+8-;; @003e store notrap aligned region19 v131, v128+8-;; @003e v132 = load.i64 notrap aligned region7 v122+8-;; @003e store notrap aligned region7 v132, v127+8-;; @003e v133 = load.i64 notrap aligned region7 v127+16-;; @003e store notrap aligned region19 v133, v128+16-;; @003e v134 = load.i64 notrap aligned region7 v122+16-;; @003e store notrap aligned region7 v134, v127+16-;; @003e v135 = iconst.i64 3-;; @003e v136 = iconst.i64 32-;; @003e v137 = ishl v135, v136 ; v135 = 3, v136 = 32-;; @003e v138 = stack_switch v122, v128, v137-;; @003e v139 = iconst.i64 32-;; @003e v140 = ushr v138, v139 ; v139 = 32-;; @003e v141 = iconst.i64 5-;; @003e v142 = icmp eq v140, v141 ; v141 = 5-;; @003e brif v142, block11, block12+;; block10(v76: i64):+;; @003e store.i128 notrap aligned region12 v75, v76+;; @003e v110 = iconst.i64 0+;; @003e v111 = iadd.i64 v19, v110 ; v110 = 0+;; @003e v112 = iconst.i32 1+;; @003e store notrap aligned region15 v112, v111+32 ; v112 = 1+;; @003e v113 = load.i64 notrap aligned region13 v19+112+;; @003e store.i64 notrap aligned region9 v37, v113+88+;; @003e store.i64 notrap aligned region9 v38, v113+96+;; @003e v114 = iconst.i64 2+;; @003e v115 = load.i64 notrap aligned readonly can_move region0 v0+8+;; @003e store notrap aligned region8 v114, v115+88 ; v114 = 2+;; @003e store.i64 notrap aligned region8 v19, v115+96+;; @003e v116 = iconst.i64 0+;; @003e v117 = iadd v111, v116 ; v116 = 0+;; @003e v118 = load.i64 notrap aligned region21 v117+;; @003e store notrap aligned region1 v118, v63+24+;; @003e v119 = load.i64 notrap aligned region6 v117+8+;; @003e store notrap aligned region16 v119, v63+72+;; @003e v120 = load.i64 notrap aligned region19 v117+16+;; @003e store notrap aligned region17 v120, v63+64+;; @003e v121 = load.i64 notrap aligned region20 v117+24+;; @003e store notrap aligned region18 v121, v63+80+;; @003e v122 = iconst.i64 120+;; @003e v123 = iadd.i64 v34, v122 ; v122 = 120+;; @003e v124 = load.i64 notrap aligned region22 v123+;; @003e v125 = iconst.i64 -24+;; @003e v126 = iadd v124, v125 ; v125 = -24+;; @003e v127 = iconst.i64 120+;; @003e v128 = iadd v113, v127 ; v127 = 120+;; @003e v129 = load.i64 notrap aligned region22 v128+;; @003e v130 = iconst.i64 -24+;; @003e v131 = iadd v129, v130 ; v130 = -24+;; @003e v132 = stack_addr.i64 ss1+;; @003e v133 = load.i64 notrap aligned region12 v131+;; @003e store notrap aligned region23 v133, v132+;; @003e v134 = load.i64 notrap aligned region12 v126+;; @003e store notrap aligned region12 v134, v131+;; @003e v135 = load.i64 notrap aligned region12 v131+8+;; @003e store notrap aligned region23 v135, v132+8+;; @003e v136 = load.i64 notrap aligned region12 v126+8+;; @003e store notrap aligned region12 v136, v131+8+;; @003e v137 = load.i64 notrap aligned region12 v131+16+;; @003e store notrap aligned region23 v137, v132+16+;; @003e v138 = load.i64 notrap aligned region12 v126+16+;; @003e store notrap aligned region12 v138, v131+16+;; @003e v139 = iconst.i64 3+;; @003e v140 = iconst.i64 32+;; @003e v141 = ishl v139, v140 ; v139 = 3, v140 = 32+;; @003e v142 = stack_switch v126, v132, v141+;; @003e v143 = iconst.i64 32+;; @003e v144 = ushr v142, v143 ; v143 = 32+;; @003e v145 = iconst.i64 5+;; @003e v146 = icmp eq v144, v145 ; v145 = 5+;; @003e brif v146, block11, block12;;;; block11 cold:-;; @003e v143 = iconst.i64 168-;; @003e v144 = iadd.i64 v28, v143 ; v143 = 168-;; @003e v145 = load.i64 notrap aligned region5 v144+8-;; @003e v146 = load.i32 notrap aligned region7 v145-;; @003e v147 = iconst.i32 0-;; @003e store notrap aligned region5 v147, v144 ; v147 = 0-;; @003e v148 = iconst.i32 0-;; @003e store notrap aligned region9 v148, v144+4 ; v148 = 0-;; @003e v149 = iconst.i64 0-;; @003e store notrap aligned region5 v149, v144+8 ; v149 = 0-;; @003e try_call fn2(v0, v146), sig2, block13, [ context v0 ]+;; @003e v147 = iconst.i64 168+;; @003e v148 = iadd.i64 v32, v147 ; v147 = 168+;; @003e v149 = load.i64 notrap aligned region10 v148+8+;; @003e v150 = load.i32 notrap aligned region12 v149+;; @003e v151 = iconst.i32 0+;; @003e store notrap aligned region10 v151, v148 ; v151 = 0+;; @003e v152 = iconst.i32 0+;; @003e store notrap aligned region14 v152, v148+4 ; v152 = 0+;; @003e v153 = iconst.i64 0+;; @003e store notrap aligned region10 v153, v148+8 ; v153 = 0+;; @003e try_call fn3(v0, v150), sig3, block13, [ context v0 ];;;; block13:;; @003e trap user12;;;; block12:-;; @003e v150 = iconst.i64 168-;; @003e v151 = iadd.i64 v28, v150 ; v150 = 168-;; @003e v152 = load.i64 notrap aligned region5 v151+8-;; @003e v153 = iconst.i32 0-;; @003e store notrap aligned region5 v153, v151 ; v153 = 0-;; @003e v154 = iconst.i32 0-;; @003e store notrap aligned region9 v154, v151+4 ; v154 = 0-;; @003e v155 = iconst.i64 0-;; @003e store notrap aligned region5 v155, v151+8 ; v155 = 0+;; @003e v154 = iconst.i64 168+;; @003e v155 = iadd.i64 v32, v154 ; v154 = 168+;; @003e v156 = load.i64 notrap aligned region10 v155+8+;; @003e v157 = iconst.i32 0+;; @003e store notrap aligned region10 v157, v155 ; v157 = 0+;; @003e v158 = iconst.i32 0+;; @003e store notrap aligned region14 v158, v155+4 ; v158 = 0+;; @003e v159 = iconst.i64 0+;; @003e store notrap aligned region10 v159, v155+8 ; v159 = 0;; @0041 jump block1;;;; block1:@@ -310,247 +324,261 @@;; ss0 = explicit_slot 8, align = 8;; region0 = 123 "";; region1 = 160 ""-;; region2 = 191 ""-;; region3 = 192 ""-;; region4 = 106 ""-;; region5 = 125 ""-;; region6 = 144 ""-;; region7 = 231 ""-;; region8 = 243 ""-;; region9 = 209 ""-;; region10 = 100 ""-;; region11 = 176 ""-;; region12 = 62 ""-;; region13 = 198 ""-;; region14 = 145 ""-;; region15 = 139 ""-;; region16 = 82 ""-;; region17 = 234 ""-;; region18 = 124 ""+;; region2 = 130 ""+;; region3 = 134 ""+;; region4 = 44 ""+;; region5 = 120 ""+;; region6 = 100 ""+;; region7 = 191 ""+;; region8 = 192 ""+;; region9 = 106 ""+;; region10 = 125 ""+;; region11 = 144 ""+;; region12 = 231 ""+;; region13 = 243 ""+;; region14 = 209 ""+;; region15 = 176 ""+;; region16 = 62 ""+;; region17 = 198 ""+;; region18 = 145 ""+;; region19 = 139 ""+;; region20 = 82 ""+;; region21 = 234 ""+;; region22 = 124 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24-;; sig0 = (i64 vmctx, i32) -> i64 tail-;; sig1 = (i64 vmctx, i64, i32, i32, i32) -> i64 tail-;; sig2 = (i64 vmctx) tail-;; fn0 = colocated u805306368:6 sig0-;; fn1 = colocated u805306368:42 sig1+;; sig0 = (i64 vmctx, i64) tail+;; sig1 = (i64 vmctx, i64, i64, i64) -> i8 system_v+;; sig2 = (i64 vmctx, i64, i32, i32, i32) -> i64 tail+;; sig3 = (i64 vmctx) tail+;; fn0 = colocated u0:0 sig0+;; fn1 = colocated u268435456:0 sig1;; fn2 = colocated u805306368:41 sig2+;; fn3 = colocated u805306368:40 sig3;; stack_limit = gv2;;;; block0(v0: i64, v1: i64):-;; @0047 v2 = iconst.i32 0-;; @0047 v3 = call fn0(v0, v2) ; v2 = 0-;; @0049 trapz v3, user16-;; @0049 v4 = iconst.i32 0-;; @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+104-;; @0049 v9 = uextend.i128 v7-;; @0049 v10 = uextend.i128 v8-;; @0049 v11 = iconst.i64 64-;; @0049 v12 = uextend.i128 v11 ; v11 = 64-;; @0049 v13 = ishl v10, v12-;; @0049 v14 = bor v13, v9+;; @0047 v2 = func_addr.i64 fn0+;; @0047 v3 = func_addr.i64 fn1+;; @0047 v4 = load.i64 notrap aligned readonly can_move region2 v0+40+;; @0047 v5 = load.i32 notrap aligned readonly can_move region3 v4+;; @0047 store notrap aligned region4 v3, v0+88+;; @0047 store notrap aligned region5 v2, v0+96+;; @0047 store notrap aligned region6 v0, v0+112+;; @0047 store notrap aligned region1 v5, v0+104+;; @0047 v6 = iconst.i64 88+;; @0047 v7 = iadd v0, v6 ; v6 = 88+;; @0049 trapz v7, user16+;; @0049 v8 = iconst.i32 0+;; @0049 v9 = iconst.i32 0+;; @0049 v10 = iconst.i32 0+;; @0049 v11 = call fn2(v0, v7, v8, v9, v10) ; v8 = 0, v9 = 0, v10 = 0+;; @0049 v12 = load.i64 notrap aligned region7 v11+104+;; @0049 v13 = uextend.i128 v11+;; @0049 v14 = uextend.i128 v12+;; @0049 v15 = iconst.i64 64+;; @0049 v16 = uextend.i128 v15 ; v15 = 64+;; @0049 v17 = ishl v14, v16+;; @0049 v18 = bor v17, v13;; @004b jump block2;;;; block2:-;; @004b v15 = ireduce.i64 v14-;; @004b v16 = iconst.i64 64-;; @004b v17 = uextend.i128 v16 ; v16 = 64-;; @004b v18 = ushr.i128 v14, v17;; @004b v19 = ireduce.i64 v18-;; @004b trapz v15, user16-;; @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+104-;; @004b v24 = load.i64 notrap aligned region3 v15+112-;; @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+88-;; @004b store notrap aligned region5 v27, v24+96-;; @004b v28 = iconst.i64 0-;; @004b store notrap aligned region3 v28, v15+112 ; 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-;; @004b store notrap aligned region4 v15, v30+96-;; @004b v31 = iconst.i64 0-;; @004b v32 = iadd v15, v31 ; v31 = 0-;; @004b v33 = iconst.i32 1-;; @004b store notrap aligned region6 v33, v32+32 ; v33 = 1-;; @004b v34 = iconst.i32 2-;; @004b store notrap aligned region6 v34, v27+32 ; v34 = 2-;; @004b v35 = load.i64 notrap aligned readonly can_move region0 v0+8-;; @004b v36 = iconst.i64 0-;; @004b v37 = iadd v27, v36 ; v36 = 0-;; @004b v38 = load.i64 notrap aligned region7 v35+72-;; @004b v39 = load.i64 notrap aligned region8 v35+64-;; @004b v40 = load.i64 notrap aligned region9 v35+80-;; @004b store notrap aligned region10 v38, v37+8-;; @004b store notrap aligned region11 v39, v37+16-;; @004b store notrap aligned region12 v40, v37+24-;; @004b v41 = load.i64 notrap aligned region1 v35+24-;; @004b store notrap aligned region13 v41, v37-;; @004b v42 = iconst.i64 0-;; @004b v43 = iadd v32, v42 ; v42 = 0-;; @004b v44 = load.i64 notrap aligned region13 v43-;; @004b store notrap aligned region1 v44, v35+24-;; @004b v45 = load.i64 notrap aligned region10 v43+8-;; @004b store notrap aligned region7 v45, v35+72-;; @004b v46 = load.i64 notrap aligned region11 v43+16-;; @004b store notrap aligned region8 v46, v35+64-;; @004b v47 = load.i64 notrap aligned region12 v43+24-;; @004b store notrap aligned region9 v47, v35+80-;; @004b v48 = iconst.i64 40-;; @004b v49 = iadd v27, v48 ; v48 = 40-;; @004b v50 = iconst.i32 1-;; @004b v51 = stack_addr.i64 ss0-;; @004b store notrap aligned region14 v50, v49+4 ; v50 = 1-;; @004b store notrap aligned region15 v51, v49+8-;; @004b v52 = iconst.i64 48-;; @004b v53 = iadd.i64 v0, v52 ; v52 = 48+;; @004b v20 = iconst.i64 64+;; @004b v21 = uextend.i128 v20 ; v20 = 64+;; @004b v22 = ushr.i128 v18, v21+;; @004b v23 = ireduce.i64 v22+;; @004b trapz v19, user16+;; @004b v24 = load.i64 notrap aligned region7 v19+104+;; @004b v25 = icmp eq v24, v23+;; @004b trapz v25, user23+;; @004b v26 = iconst.i64 1+;; @004b v27 = iadd v24, v26 ; v26 = 1+;; @004b store notrap aligned region7 v27, v19+104+;; @004b v28 = load.i64 notrap aligned region8 v19+112+;; @004b v29 = load.i64 notrap aligned readonly can_move region0 v0+8+;; @004b v30 = load.i64 notrap aligned region9 v29+88+;; @004b v31 = load.i64 notrap aligned region9 v29+96+;; @004b store notrap aligned region10 v30, v28+88+;; @004b store notrap aligned region10 v31, v28+96+;; @004b v32 = iconst.i64 0+;; @004b store notrap aligned region8 v32, v19+112 ; v32 = 0+;; @004b v33 = iconst.i64 2+;; @004b v34 = load.i64 notrap aligned readonly can_move region0 v0+8+;; @004b store notrap aligned region9 v33, v34+88 ; v33 = 2+;; @004b store notrap aligned region9 v19, v34+96+;; @004b v35 = iconst.i64 0+;; @004b v36 = iadd v19, v35 ; v35 = 0+;; @004b v37 = iconst.i32 1+;; @004b store notrap aligned region11 v37, v36+32 ; v37 = 1+;; @004b v38 = iconst.i32 2+;; @004b store notrap aligned region11 v38, v31+32 ; v38 = 2+;; @004b v39 = load.i64 notrap aligned readonly can_move region0 v0+8+;; @004b v40 = iconst.i64 0+;; @004b v41 = iadd v31, v40 ; v40 = 0+;; @004b v42 = load.i64 notrap aligned region12 v39+72+;; @004b v43 = load.i64 notrap aligned region13 v39+64+;; @004b v44 = load.i64 notrap aligned region14 v39+80+;; @004b store notrap aligned region6 v42, v41+8+;; @004b store notrap aligned region15 v43, v41+16+;; @004b store notrap aligned region16 v44, v41+24+;; @004b v45 = load.i64 notrap aligned region1 v39+24+;; @004b store notrap aligned region17 v45, v41+;; @004b v46 = iconst.i64 0+;; @004b v47 = iadd v36, v46 ; v46 = 0+;; @004b v48 = load.i64 notrap aligned region17 v47+;; @004b store notrap aligned region1 v48, v39+24+;; @004b v49 = load.i64 notrap aligned region6 v47+8+;; @004b store notrap aligned region12 v49, v39+72+;; @004b v50 = load.i64 notrap aligned region15 v47+16+;; @004b store notrap aligned region13 v50, v39+64+;; @004b v51 = load.i64 notrap aligned region16 v47+24+;; @004b store notrap aligned region14 v51, v39+80+;; @004b v52 = iconst.i64 40+;; @004b v53 = iadd v31, v52 ; v52 = 40;; @004b v54 = iconst.i32 1-;; @004b v55 = load.i64 notrap aligned region15 v49+8-;; @004b store notrap aligned region16 v53, v55-;; @004b store notrap aligned region15 v54, v49 ; v54 = 1-;; @004b v56 = iconst.i32 0-;; @004b store notrap aligned region17 v56, v27+56 ; v56 = 0-;; @004b v57 = iconst.i64 1-;; @004b v58 = iconst.i64 32-;; @004b v59 = ishl v57, v58 ; v57 = 1, v58 = 32-;; @004b v60 = iconst.i64 120-;; @004b v61 = iadd v24, v60 ; v60 = 120-;; @004b v62 = load.i64 notrap aligned region18 v61-;; @004b v63 = iconst.i64 -24-;; @004b v64 = iadd v62, v63 ; v63 = -24-;; @004b v65 = stack_switch v64, v64, v59-;; @004b v66 = load.i64 notrap aligned readonly can_move region0 v0+8-;; @004b v67 = load.i64 notrap aligned region4 v66+88-;; @004b v68 = load.i64 notrap aligned region4 v66+96-;; @004b v69 = load.i64 notrap aligned readonly can_move region0 v0+8-;; @004b store notrap aligned region4 v26, v69+88-;; @004b store notrap aligned region4 v27, v69+96-;; @004b v70 = iconst.i32 1-;; @004b store notrap aligned region6 v70, v27+32 ; v70 = 1-;; @004b v71 = iconst.i32 0-;; @004b store notrap aligned region15 v71, v49 ; v71 = 0-;; @004b v72 = iconst.i32 0-;; @004b store notrap aligned region14 v72, v49+4 ; v72 = 0-;; @004b v73 = iconst.i64 0-;; @004b store notrap aligned region15 v73, v49+8 ; v73 = 0-;; @004b store notrap aligned region17 v28, v27+56 ; v28 = 0-;; @004b brif v65, block6, block3+;; @004b v55 = stack_addr.i64 ss0+;; @004b store notrap aligned region18 v54, v53+4 ; v54 = 1+;; @004b store notrap aligned region19 v55, v53+8+;; @004b v56 = iconst.i64 48+;; @004b v57 = iadd.i64 v0, v56 ; v56 = 48+;; @004b v58 = iconst.i32 1+;; @004b v59 = load.i64 notrap aligned region19 v53+8+;; @004b store notrap aligned region20 v57, v59+;; @004b store notrap aligned region19 v58, v53 ; v58 = 1+;; @004b v60 = iconst.i32 0+;; @004b store notrap aligned region21 v60, v31+56 ; v60 = 0+;; @004b v61 = iconst.i64 1+;; @004b v62 = iconst.i64 32+;; @004b v63 = ishl v61, v62 ; v61 = 1, v62 = 32+;; @004b v64 = iconst.i64 120+;; @004b v65 = iadd v28, v64 ; v64 = 120+;; @004b v66 = load.i64 notrap aligned region22 v65+;; @004b v67 = iconst.i64 -24+;; @004b v68 = iadd v66, v67 ; v67 = -24+;; @004b v69 = stack_switch v68, v68, v63+;; @004b v70 = load.i64 notrap aligned readonly can_move region0 v0+8+;; @004b v71 = load.i64 notrap aligned region9 v70+88+;; @004b v72 = load.i64 notrap aligned region9 v70+96+;; @004b v73 = load.i64 notrap aligned readonly can_move region0 v0+8+;; @004b store notrap aligned region9 v30, v73+88+;; @004b store notrap aligned region9 v31, v73+96+;; @004b v74 = iconst.i32 1+;; @004b store notrap aligned region11 v74, v31+32 ; v74 = 1+;; @004b v75 = iconst.i32 0+;; @004b store notrap aligned region19 v75, v53 ; v75 = 0+;; @004b v76 = iconst.i32 0+;; @004b store notrap aligned region18 v76, v53+4 ; v76 = 0+;; @004b v77 = iconst.i64 0+;; @004b store notrap aligned region19 v77, v53+8 ; v77 = 0+;; @004b store notrap aligned region21 v32, v31+56 ; v32 = 0+;; @004b brif v69, block6, block3;;;; block6:-;; @004b v74 = iconst.i64 32-;; @004b v75 = ushr.i64 v65, v74 ; v74 = 32-;; @004b v76 = iconst.i64 4-;; @004b v77 = icmp eq v75, v76 ; v76 = 4-;; @004b brif v77, block5, block4+;; @004b v78 = iconst.i64 32+;; @004b v79 = ushr.i64 v69, v78 ; v78 = 32+;; @004b v80 = iconst.i64 4+;; @004b v81 = icmp eq v79, v80 ; v80 = 4+;; @004b brif v81, block5, block4;;;; block5 cold:-;; @004b v78 = iconst.i64 0-;; @004b v79 = iadd.i64 v68, v78 ; v78 = 0-;; @004b v80 = iconst.i32 5-;; @004b store notrap aligned region6 v80, v79+32 ; v80 = 5-;; @004b v81 = iconst.i64 0-;; @004b v82 = iadd.i64 v27, v81 ; v81 = 0-;; @004b v83 = load.i64 notrap aligned region13 v82-;; @004b store notrap aligned region1 v83, v35+24-;; @004b v84 = load.i64 notrap aligned region10 v82+8-;; @004b store notrap aligned region7 v84, v35+72-;; @004b v85 = load.i64 notrap aligned region11 v82+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 144-;; @004b v88 = iadd.i64 v68, v87 ; v87 = 144-;; @004b v89 = iconst.i32 0-;; @004b store notrap aligned region15 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 168-;; @004b v93 = iadd.i64 v68, v92 ; v92 = 168+;; @004b v82 = iconst.i64 0+;; @004b v83 = iadd.i64 v72, v82 ; v82 = 0+;; @004b v84 = iconst.i32 5+;; @004b store notrap aligned region11 v84, v83+32 ; v84 = 5+;; @004b v85 = iconst.i64 0+;; @004b v86 = iadd.i64 v31, v85 ; v85 = 0+;; @004b v87 = load.i64 notrap aligned region17 v86+;; @004b store notrap aligned region1 v87, v39+24+;; @004b v88 = load.i64 notrap aligned region6 v86+8+;; @004b store notrap aligned region12 v88, v39+72+;; @004b v89 = load.i64 notrap aligned region15 v86+16+;; @004b store notrap aligned region13 v89, v39+64+;; @004b v90 = load.i64 notrap aligned region16 v86+24+;; @004b store notrap aligned region14 v90, v39+80+;; @004b v91 = iconst.i64 144+;; @004b v92 = iadd.i64 v72, v91 ; v91 = 144+;; @004b v93 = iconst.i32 0+;; @004b store notrap aligned region19 v93, v92 ; v93 = 0;; @004b v94 = iconst.i32 0-;; @004b store notrap aligned region15 v94, v93 ; v94 = 0-;; @004b v95 = iconst.i32 0-;; @004b store notrap aligned region14 v95, v93+4 ; v95 = 0-;; @004b v96 = iconst.i64 0-;; @004b store notrap aligned region15 v96, v93+8 ; v96 = 0-;; @004b try_call fn2(v0), sig2, block8, [ context v0 ]+;; @004b store notrap aligned region18 v94, v92+4 ; v94 = 0+;; @004b v95 = iconst.i64 0+;; @004b store notrap aligned region19 v95, v92+8 ; v95 = 0+;; @004b v96 = iconst.i64 168+;; @004b v97 = iadd.i64 v72, v96 ; v96 = 168+;; @004b v98 = iconst.i32 0+;; @004b store notrap aligned region19 v98, v97 ; v98 = 0+;; @004b v99 = iconst.i32 0+;; @004b store notrap aligned region18 v99, v97+4 ; v99 = 0+;; @004b v100 = iconst.i64 0+;; @004b store notrap aligned region19 v100, v97+8 ; v100 = 0+;; @004b try_call fn3(v0), sig3, block8, [ context v0 ];;;; block8:;; @004b trap user12;;;; block4:-;; @004b v97 = iconst.i64 0-;; @004b v98 = iadd.i64 v68, v97 ; v97 = 0-;; @004b v99 = iconst.i64 0-;; @004b v100 = iadd v98, v99 ; v99 = 0-;; @004b v101 = load.i64 notrap aligned region7 v35+72-;; @004b v102 = load.i64 notrap aligned region8 v35+64-;; @004b v103 = load.i64 notrap aligned region9 v35+80-;; @004b store notrap aligned region10 v101, v100+8-;; @004b store notrap aligned region11 v102, v100+16-;; @004b store notrap aligned region12 v103, v100+24-;; @004b v104 = iconst.i64 0-;; @004b v105 = iadd.i64 v27, v104 ; v104 = 0-;; @004b v106 = load.i64 notrap aligned region13 v105-;; @004b store notrap aligned region1 v106, v35+24-;; @004b v107 = load.i64 notrap aligned region10 v105+8-;; @004b store notrap aligned region7 v107, v35+72-;; @004b v108 = load.i64 notrap aligned region11 v105+16-;; @004b store notrap aligned region8 v108, v35+64-;; @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+104-;; @004b v112 = uextend.i128 v68-;; @004b v113 = uextend.i128 v111-;; @004b v114 = iconst.i64 64-;; @004b v115 = uextend.i128 v114 ; v114 = 64-;; @004b v116 = ishl v113, v115-;; @004b v117 = bor v116, v112+;; @004b v101 = iconst.i64 0+;; @004b v102 = iadd.i64 v72, v101 ; v101 = 0+;; @004b v103 = iconst.i64 0+;; @004b v104 = iadd v102, v103 ; v103 = 0+;; @004b v105 = load.i64 notrap aligned region12 v39+72+;; @004b v106 = load.i64 notrap aligned region13 v39+64+;; @004b v107 = load.i64 notrap aligned region14 v39+80+;; @004b store notrap aligned region6 v105, v104+8+;; @004b store notrap aligned region15 v106, v104+16+;; @004b store notrap aligned region16 v107, v104+24+;; @004b v108 = iconst.i64 0+;; @004b v109 = iadd.i64 v31, v108 ; v108 = 0+;; @004b v110 = load.i64 notrap aligned region17 v109+;; @004b store notrap aligned region1 v110, v39+24+;; @004b v111 = load.i64 notrap aligned region6 v109+8+;; @004b store notrap aligned region12 v111, v39+72+;; @004b v112 = load.i64 notrap aligned region15 v109+16+;; @004b store notrap aligned region13 v112, v39+64+;; @004b v113 = load.i64 notrap aligned region16 v109+24+;; @004b store notrap aligned region14 v113, v39+80+;; @004b v114 = ireduce.i32 v69+;; @004b v115 = load.i64 notrap aligned region7 v72+104+;; @004b v116 = uextend.i128 v72+;; @004b v117 = uextend.i128 v115+;; @004b v118 = iconst.i64 64+;; @004b v119 = uextend.i128 v118 ; v118 = 64+;; @004b v120 = ishl v117, v119+;; @004b v121 = bor v120, v116;; @004b jump block7;;;; block9 cold:;; @004b trap user12;;;; block7:-;; @004b br_table v110, block9, []+;; @004b br_table v114, block9, [];;;; block3:-;; @004b v118 = iconst.i64 0-;; @004b v119 = iadd.i64 v27, v118 ; v118 = 0-;; @004b v120 = load.i64 notrap aligned region13 v119-;; @004b store notrap aligned region1 v120, v35+24-;; @004b v121 = load.i64 notrap aligned region10 v119+8-;; @004b store notrap aligned region7 v121, v35+72-;; @004b v122 = load.i64 notrap aligned region11 v119+16-;; @004b store notrap aligned region8 v122, v35+64-;; @004b v123 = load.i64 notrap aligned region12 v119+24-;; @004b store notrap aligned region9 v123, v35+80-;; @004b v124 = iconst.i64 0-;; @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 144-;; @004b v128 = iadd.i64 v68, v127 ; v127 = 144-;; @004b v129 = load.i64 notrap aligned region15 v128+8-;; @004b v130 = iconst.i32 0-;; @004b store notrap aligned region15 v130, v128 ; v130 = 0-;; @004b v131 = iconst.i32 0-;; @004b store notrap aligned region14 v131, v128+4 ; v131 = 0-;; @004b v132 = iconst.i64 0-;; @004b store notrap aligned region15 v132, v128+8 ; v132 = 0+;; @004b v122 = iconst.i64 0+;; @004b v123 = iadd.i64 v31, v122 ; v122 = 0+;; @004b v124 = load.i64 notrap aligned region17 v123+;; @004b store notrap aligned region1 v124, v39+24+;; @004b v125 = load.i64 notrap aligned region6 v123+8+;; @004b store notrap aligned region12 v125, v39+72+;; @004b v126 = load.i64 notrap aligned region15 v123+16+;; @004b store notrap aligned region13 v126, v39+64+;; @004b v127 = load.i64 notrap aligned region16 v123+24+;; @004b store notrap aligned region14 v127, v39+80+;; @004b v128 = iconst.i64 0+;; @004b v129 = iadd.i64 v72, v128 ; v128 = 0+;; @004b v130 = iconst.i32 4+;; @004b store notrap aligned region11 v130, v129+32 ; v130 = 4+;; @004b v131 = iconst.i64 144+;; @004b v132 = iadd.i64 v72, v131 ; v131 = 144+;; @004b v133 = load.i64 notrap aligned region19 v132+8+;; @004b v134 = iconst.i32 0+;; @004b store notrap aligned region19 v134, v132 ; v134 = 0+;; @004b v135 = iconst.i32 0+;; @004b store notrap aligned region18 v135, v132+4 ; v135 = 0+;; @004b v136 = iconst.i64 0+;; @004b store notrap aligned region19 v136, v132+8 ; v136 = 0;; @0050 jump block1;;;; block1:diff --git a/tests/disas/table-copy.wat b/tests/disas/table-copy.watindex 24a7981810..91d05b1e2c 100644--- a/tests/disas/table-copy.wat+++ b/tests/disas/table-copy.wat@@ -79,7 +79,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig0+;; fn0 = colocated u805306368:6 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32, v5: i32):@@ -219,7 +219,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig0+;; fn0 = colocated u805306368:6 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32, v5: i32):diff --git a/tests/disas/typed-funcrefs.wat b/tests/disas/typed-funcrefs.watindex ae183b3482..eaf1d3a54b 100644--- a/tests/disas/typed-funcrefs.wat+++ b/tests/disas/typed-funcrefs.wat@@ -140,7 +140,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i32, i64) -> i64 tail;; sig1 = (i64 vmctx, i64, i32, i32, i32, i32) -> i32 tail-;; fn0 = colocated u805306368:7 sig0+;; fn0 = colocated u805306368:6 sig0;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32, v5: i32):@@ -198,7 +198,7 @@;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, i64, i32, i32, i32, i32) -> i32 tail;; sig1 = (i64 vmctx, i32, i64) -> i64 tail-;; fn0 = colocated u805306368:7 sig1+;; fn0 = colocated u805306368:6 sig1;; stack_limit = gv2;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32, v5: i32):diff --git a/tests/disas/winch/aarch64/ref/func.wat b/tests/disas/winch/aarch64/ref/func.watnew file mode 100644index 0000000000..e0ef8fe2f8--- /dev/null+++ b/tests/disas/winch/aarch64/ref/func.wat@@ -0,0 +1,72 @@+;;! target = "aarch64"+;;! test = "winch"++;; `ref.func` of a defined function initializes its `VMFuncRef` within the+;; `vmctx` inline, using relocations for the function's code pointers.++(module+ (elem declare func $f)+ (func $f (result i32) i32.const 42)+ (func (export "ref-func") (result funcref)+ (ref.func $f)))+;; wasm[0]::function[0]::f:+;; stp x29, x30, [sp, #-0x10]!+;; mov x29, sp+;; str x28, [sp, #-0x10]!+;; mov x28, sp+;; ldur x16, [x0, #8]+;; ldur x16, [x16, #0x18]+;; mov x17, #0+;; movk x17, #0x10+;; add x16, x16, x17+;; cmp sp, x16+;; b.lo #0x5c+;; 2c: mov x9, x0+;; sub x28, x28, #0x10+;; mov sp, x28+;; stur x0, [x28, #8]+;; stur x1, [x28]+;; mov x0, #0x2a+;; add x28, x28, #0x10+;; mov sp, x28+;; mov sp, x28+;; ldr x28, [sp], #0x10+;; ldp x29, x30, [sp], #0x10+;; ret+;; 5c: udf #0xc11f+;;+;; wasm[0]::function[1]:+;; stp x29, x30, [sp, #-0x10]!+;; mov x29, sp+;; str x28, [sp, #-0x10]!+;; mov x28, sp+;; ldur x16, [x0, #8]+;; ldur x16, [x16, #0x18]+;; mov x17, #0+;; movk x17, #0x10+;; add x16, x16, x17+;; cmp sp, x16+;; b.lo #0xe4+;; 8c: mov x9, x0+;; sub x28, x28, #0x10+;; mov sp, x28+;; stur x0, [x28, #8]+;; stur x1, [x28]+;; adrp x16, #0+;; add x16, x16, #0xe8+;; stur x16, [x9, #0x50]+;; adrp x16, #0+;; add x16, x16, #0+;; stur x16, [x9, #0x58]+;; stur x9, [x9, #0x68]+;; ldur x16, [x9, #0x28]+;; ldur w16, [x16]+;; stur w16, [x9, #0x60]+;; add x0, x9, #0x50+;; add x28, x28, #0x10+;; mov sp, x28+;; mov sp, x28+;; ldr x28, [sp], #0x10+;; ldp x29, x30, [sp], #0x10+;; ret+;; e4: udf #0xc11fdiff --git a/tests/disas/winch/x64/ref/func-imported.wat b/tests/disas/winch/x64/ref/func-imported.watnew file mode 100644index 0000000000..3aac4f6a77--- /dev/null+++ b/tests/disas/winch/x64/ref/func-imported.wat@@ -0,0 +1,28 @@+;;! target = "x86_64"+;;! test = "winch"++;; `ref.func` of an imported function is a pointer to its `VMFunctionImport`+;; within the `vmctx`.++(module+ (import "env" "f" (func $f (result i32)))+ (elem declare func $f)+ (func (export "ref-func") (result funcref)+ (ref.func $f)))+;; wasm[0]::function[1]:+;; pushq %rbp+;; movq %rsp, %rbp+;; movq 8(%rdi), %r11+;; movq 0x18(%r11), %r11+;; addq $0x10, %r11+;; cmpq %rsp, %r11+;; ja 0x3c+;; 1c: movq %rdi, %r14+;; subq $0x10, %rsp+;; movq %rdi, 8(%rsp)+;; movq %rsi, (%rsp)+;; leaq 0x30(%r14), %rax+;; addq $0x10, %rsp+;; popq %rbp+;; retq+;; 3c: ud2diff --git a/tests/disas/winch/x64/ref/func.wat b/tests/disas/winch/x64/ref/func.watindex 7e384cc3b7..1145942a1e 100644--- a/tests/disas/winch/x64/ref/func.wat+++ b/tests/disas/winch/x64/ref/func.wat@@ -32,16 +32,21 @@;; movq 0x18(%r11), %r11;; addq $0x10, %r11;; cmpq %rsp, %r11-;; ja 0x8a+;; ja 0xa1;; 5c: movq %rdi, %r14;; subq $0x10, %rsp;; movq %rdi, 8(%rsp);; movq %rsi, (%rsp)-;; movq %r14, %rdi-;; movl $0, %esi-;; callq 0x288-;; movq 8(%rsp), %r14+;; leaq 0x2d(%rip), %r11+;; movq %r11, 0x50(%r14)+;; leaq -0x81(%rip), %r11+;; movq %r11, 0x58(%r14)+;; movq %r14, 0x68(%r14)+;; movq 0x28(%r14), %r11+;; movl (%r11), %r11d+;; movl %r11d, 0x60(%r14)+;; leaq 0x50(%r14), %rax;; addq $0x10, %rsp;; popq %rbp;; retq-;; 8a: ud2+;; a1: ud2diff --git a/tests/disas/winch/x64/table/init_copy_drop.wat b/tests/disas/winch/x64/table/init_copy_drop.watindex 0404964112..cf74d708f3 100644--- a/tests/disas/winch/x64/table/init_copy_drop.wat+++ b/tests/disas/winch/x64/table/init_copy_drop.wat@@ -305,7 +305,7 @@;; movq %r14, %rdi;; movl $0, %esi;; movq 8(%rsp), %rdx-;; callq 0x1223+;; callq 0x11f8;; addq $0x10, %rsp;; movq 0x28(%rsp), %r14;; jmp 0x463@@ -389,7 +389,7 @@;; movq %r14, %rdi;; movl $0, %esi;; movq 8(%rsp), %rdx-;; callq 0x1223+;; callq 0x11f8;; addq $0x10, %rsp;; movq 0x28(%rsp), %r14;; jmp 0x5b7@@ -473,7 +473,7 @@;; movq %r14, %rdi;; movl $0, %esi;; movq 8(%rsp), %rdx-;; callq 0x1223+;; callq 0x11f8;; addq $0x10, %rsp;; movq 0x28(%rsp), %r14;; jmp 0x70b@@ -557,7 +557,7 @@;; movq %r14, %rdi;; movl $0, %esi;; movq 8(%rsp), %rdx-;; callq 0x1223+;; callq 0x11f8;; addq $0x10, %rsp;; movq 0x28(%rsp), %r14;; jmp 0x85f@@ -641,7 +641,7 @@;; movq %r14, %rdi;; movl $0, %esi;; movq 8(%rsp), %rdx-;; callq 0x1223+;; callq 0x11f8;; addq $0x10, %rsp;; movq 0x28(%rsp), %r14;; jmp 0x9b3@@ -751,7 +751,7 @@;; movq %r14, %rdi;; movl $0, %esi;; movl 0xc(%rsp), %edx-;; callq 0x1223+;; callq 0x11f8;; addq $0x10, %rsp;; movq 0x18(%rsp), %r14;; jmp 0xb24diff --git a/tests/disas/x64-simd-round-without-sse41.wat b/tests/disas/x64-simd-round-without-sse41.watindex d597b99277..94de2c0af5 100644--- a/tests/disas/x64-simd-round-without-sse41.wat+++ b/tests/disas/x64-simd-round-without-sse41.wat@@ -18,7 +18,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, f32) -> f32 tail-;; fn0 = colocated u805306368:28 sig0+;; fn0 = colocated u805306368:27 sig0;; const0 = 0x00000000000000000000000000000000;; stack_limit = gv2;;@@ -51,7 +51,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, f32) -> f32 tail-;; fn0 = colocated u805306368:30 sig0+;; fn0 = colocated u805306368:29 sig0;; const0 = 0x00000000000000000000000000000000;; stack_limit = gv2;;@@ -84,7 +84,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, f32) -> f32 tail-;; fn0 = colocated u805306368:32 sig0+;; fn0 = colocated u805306368:31 sig0;; const0 = 0x00000000000000000000000000000000;; stack_limit = gv2;;@@ -117,7 +117,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, f32) -> f32 tail-;; fn0 = colocated u805306368:34 sig0+;; fn0 = colocated u805306368:33 sig0;; const0 = 0x00000000000000000000000000000000;; stack_limit = gv2;;@@ -150,7 +150,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, f64) -> f64 tail-;; fn0 = colocated u805306368:29 sig0+;; fn0 = colocated u805306368:28 sig0;; const0 = 0x00000000000000000000000000000000;; stack_limit = gv2;;@@ -177,7 +177,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, f64) -> f64 tail-;; fn0 = colocated u805306368:31 sig0+;; fn0 = colocated u805306368:30 sig0;; const0 = 0x00000000000000000000000000000000;; stack_limit = gv2;;@@ -204,7 +204,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, f64) -> f64 tail-;; fn0 = colocated u805306368:33 sig0+;; fn0 = colocated u805306368:32 sig0;; const0 = 0x00000000000000000000000000000000;; stack_limit = gv2;;@@ -231,7 +231,7 @@;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24;; sig0 = (i64 vmctx, f64) -> f64 tail-;; fn0 = colocated u805306368:35 sig0+;; fn0 = colocated u805306368:34 sig0;; const0 = 0x00000000000000000000000000000000;; stack_limit = gv2;;diff --git a/tests/disas/x64/ref-func.wat b/tests/disas/x64/ref-func.watnew file mode 100644index 0000000000..f326f6d2c3--- /dev/null+++ b/tests/disas/x64/ref-func.wat@@ -0,0 +1,47 @@+;;! target = "x86_64"+;;! test = "compile"++;; `ref.func` of an imported function is a pointer to its `VMFunctionImport`+;; within the `vmctx`.++(module+ (import "env" "f" (func $imported (result i32)))+ (func $defined (result i32) i32.const 42)+ (func (export "ref-func-imported") (result funcref)+ (ref.func $imported))+ (func (export "ref-func-defined") (result funcref)+ (ref.func $defined))++ (elem declare func $imported $defined)+)+;; wasm[0]::function[1]::defined:+;; pushq %rbp+;; movq %rsp, %rbp+;; movl $0x2a, %eax+;; movq %rbp, %rsp+;; popq %rbp+;; retq+;;+;; wasm[0]::function[2]:+;; pushq %rbp+;; movq %rsp, %rbp+;; leaq 0x30(%rdi), %rax+;; movq %rbp, %rsp+;; popq %rbp+;; retq+;;+;; wasm[0]::function[3]:+;; pushq %rbp+;; movq %rsp, %rbp+;; leaq 0x36(%rip), %rsi+;; movq %rsi, 0xb0(%rdi)+;; leaq -0x59(%rip), %r8+;; movq %r8, 0xb8(%rdi)+;; movq %rdi, 0xc8(%rdi)+;; movq 0x28(%rdi), %r9+;; movl (%r9), %r9d+;; movl %r9d, 0xc0(%rdi)+;; leaq 0xb0(%rdi), %rax+;; movq %rbp, %rsp+;; popq %rbp+;; retqdiff --git a/winch/codegen/src/codegen/env.rs b/winch/codegen/src/codegen/env.rsindex 16c8d328f9..fe231b026a 100644--- a/winch/codegen/src/codegen/env.rs+++ b/winch/codegen/src/codegen/env.rs@@ -414,6 +414,17 @@ impl<'a, 'translation, 'data, P: PtrSize> FuncEnv<'a, 'translation, 'data, P> {self.intern_name(UserExternalName { namespace, index })}+ /// Creates a name to reference the array-to-wasm trampoline of the wasm+ /// function `index` provided.+ pub fn name_array_to_wasm_trampoline(+ &mut self,+ def_func: DefinedFuncIndex,+ ) -> UserExternalNameRef {+ let key = FuncKey::ArrayToWasmTrampoline(self.translation.module_index(), def_func);+ let (namespace, index) = key.into_raw_parts();+ self.intern_name(UserExternalName { namespace, index })+ }+/// Interns `name` into a `UserExternalNameRef` and ensures that duplicate/// instances of `name` are given a unique name ref index.fn intern_name(&mut self, name: UserExternalName) -> UserExternalNameRef {diff --git a/winch/codegen/src/codegen/mod.rs b/winch/codegen/src/codegen/mod.rsindex ca6eb00730..a3ba7a2e46 100644--- a/winch/codegen/src/codegen/mod.rs+++ b/winch/codegen/src/codegen/mod.rs@@ -24,9 +24,9 @@ use wasmparser::{};use wasmtime_cranelift::{TRAP_BAD_SIGNATURE, TRAP_HEAP_MISALIGNED, TRAP_TABLE_OUT_OF_BOUNDS};use wasmtime_environ::{- DataIndex, ElemIndex, FUNCREF_INIT_BIT, FUNCREF_MASK, GlobalIndex, IndexType, MemoryIndex,- MemoryKind, MemoryTunables, PtrSize, TableIndex, Tunables, TypeIndex, WasmHeapType,- WasmValType, wasm_unsupported,+ DataIndex, ElemIndex, FUNCREF_INIT_BIT, FUNCREF_MASK, FuncIndex, GlobalIndex, IndexType,+ MemoryIndex, MemoryKind, MemoryTunables, PtrSize, TableIndex, Tunables, TypeIndex,+ WasmHeapType, WasmValType, wasm_unsupported,};mod context;@@ -550,6 +550,86 @@ where== Some(wasmtime_environ::Collector::DeferredReferenceCounting)}+ /// Emits a `ref.func` for the function `index`, pushing a pointer to its+ /// `VMFuncRef` onto the value stack.+ ///+ /// This mirrors `FuncEnvironment::translate_ref_func` in Cranelift, see+ /// there for more information.+ pub fn emit_ref_func(&mut self, index: FuncIndex) -> Result<()> {+ let ptr_type = self.env.ptr_type();+ let ptr_size: OperandSize = ptr_type.try_into()?;+ let module = &self.env.translation.module;+ let dst = self.context.any_gpr(self.masm)?;++ let Some(def_index) = module.defined_func_index(index) else {+ // `VMFunctionImport` has the same layout as `VMFuncRef` and is+ // fully initialized before any wasm runs.+ let offset = self.env.vmoffsets.imported_functions().at(index);+ self.masm.compute_addr(+ self.masm.address_at_vmctx(offset)?,+ writable!(dst),+ ptr_size,+ )?;+ self.context.stack.push(TypedReg::new(ptr_type, dst).into());+ return Ok(());+ };++ // Initialize the `VMFuncRef` for this defined function in place in+ // the `vmctx`.+ let func = &module.functions[index];+ assert!(func.is_escaping());+ let func_ref = self.env.vmoffsets.func_refs().at(func.func_ref);+ let sig = func.signature.unwrap_module_type_index();+ let sig_offset = self.env.shared_type_index_offset(sig);+ let sig_size = OperandSize::from_bytes(self.env.vmoffsets.size_of_vmshared_type_index());+ let type_ids = self.env.vmoffsets.ptr.vmctx().type_ids();+ let fields = self.env.vmoffsets.ptr.vm_func_ref();+ let array_call = func_ref + u32::from(fields.array_call());+ let wasm_call = func_ref + u32::from(fields.wasm_call());+ let vmctx_field = func_ref + u32::from(fields.vmctx());+ let type_index = func_ref + u32::from(fields.type_index());+ let array_name = self.env.name_array_to_wasm_trampoline(def_index);+ let wasm_name = self.env.name_wasm(def_index);++ self.masm.with_scratch::<IntScratch, _>(|masm, scratch| {+ masm.load_func_addr(array_name, scratch.writable())?;+ masm.store(+ scratch.inner().into(),+ masm.address_at_vmctx(array_call)?,+ ptr_size,+ )?;+ masm.load_func_addr(wasm_name, scratch.writable())?;+ masm.store(+ scratch.inner().into(),+ masm.address_at_vmctx(wasm_call)?,+ ptr_size,+ )?;+ masm.store(+ vmctx!(M).into(),+ masm.address_at_vmctx(vmctx_field)?,+ ptr_size,+ )?;+ masm.load_ptr(masm.address_at_vmctx(type_ids.into())?, scratch.writable())?;+ masm.load(+ masm.address_at_reg(scratch.inner(), sig_offset)?,+ scratch.writable(),+ sig_size,+ )?;+ masm.store(+ scratch.inner().into(),+ masm.address_at_vmctx(type_index)?,+ sig_size,+ )+ })?;+ self.masm.compute_addr(+ self.masm.address_at_vmctx(func_ref)?,+ writable!(dst),+ ptr_size,+ )?;+ self.context.stack.push(TypedReg::new(ptr_type, dst).into());+ Ok(())+ }+/// Emits a a series of instructions that will type check a function reference call.pub fn emit_typecheck_funcref(&mut self,diff --git a/winch/codegen/src/isa/aarch64/asm.rs b/winch/codegen/src/isa/aarch64/asm.rsindex 0d3ffaa659..6de5688304 100644--- a/winch/codegen/src/isa/aarch64/asm.rs+++ b/winch/codegen/src/isa/aarch64/asm.rs@@ -1491,6 +1491,16 @@ impl Assembler {})}+ /// Load the address of the function referenced by `name`, which must be+ /// located within the same text section, into `rd`.+ pub fn load_func_addr(&mut self, name: UserExternalNameRef, rd: WritableReg) {+ self.emit(Inst::LoadExtNameNear {+ rd: rd.map(Into::into),+ name: Box::new(ExternalName::user(name)),+ offset: 0,+ });+ }+/// Emit an indirect call to a function whose address is/// stored the `callee` register.pub fn call_with_reg(&mut self, callee: Reg, call_conv: CallingConvention) {diff --git a/winch/codegen/src/isa/aarch64/masm.rs b/winch/codegen/src/isa/aarch64/masm.rsindex 86cd295238..1233141ee6 100644--- a/winch/codegen/src/isa/aarch64/masm.rs+++ b/winch/codegen/src/isa/aarch64/masm.rs@@ -33,7 +33,7 @@ use crate::{use cranelift_codegen::{ExceptionContextLoc, MachBufferFinalized, MachExceptionHandler, MachLabel,binemit::CodeOffset,- ir::{MemFlagsData, RelSourceLoc, SourceLoc, types},+ ir::{MemFlagsData, RelSourceLoc, SourceLoc, UserExternalNameRef, types},isa::aarch64::{self,inst::{@@ -715,6 +715,11 @@ impl Masm for MacroAssembler {self.add_ir(dst, base, I::i64(offset), size)}+ fn load_func_addr(&mut self, name: UserExternalNameRef, dst: WritableReg) -> Result<()> {+ self.asm.load_func_addr(name, dst);+ Ok(())+ }+fn pop(&mut self, dst: WritableReg, size: OperandSize) -> Result<()> {let addr = self.address_from_sp(SPOffset::from_u32(self.sp_offset))?;addr.to_addressing_mode(self, size, |masm, mem| {diff --git a/winch/codegen/src/isa/x64/asm.rs b/winch/codegen/src/isa/x64/asm.rsindex 7183c336d0..beaeb68f8f 100644--- a/winch/codegen/src/isa/x64/asm.rs+++ b/winch/codegen/src/isa/x64/asm.rs@@ -11,7 +11,7 @@ use crate::{};use cranelift_codegen::{CallInfo, MachBuffer, MachBufferFinalized, MachInst, MachInstEmit, MachInstEmitState,- MachLabel, PatchRegion, Writable,+ MachLabel, PatchRegion, RelocDistance, Writable,binemit::Reloc,ir::{ExternalName, MemFlagsData, SourceLoc, TrapCode, Type, UserExternalNameRef, types},isa::{@@ -1630,6 +1630,17 @@ impl Assembler {});}+ /// Load the address of the function referenced by `name`, which must be+ /// located within the same text section, into `dst`.+ pub fn load_func_addr(&mut self, name: UserExternalNameRef, dst: WritableReg) {+ self.emit(Inst::LoadExtName {+ dst: dst.map(Into::into),+ name: Box::new(ExternalName::user(name)),+ offset: 0,+ distance: RelocDistance::Near,+ });+ }+/// Emit a tail jump to an unknown location through a register.pub fn tail_jump_with_reg(&mut self, callee: Reg) {let callee = Gpr::unwrap_new(callee.into());diff --git a/winch/codegen/src/isa/x64/masm.rs b/winch/codegen/src/isa/x64/masm.rsindex 8b2684142e..5132c37379 100644--- a/winch/codegen/src/isa/x64/masm.rs+++ b/winch/codegen/src/isa/x64/masm.rs@@ -37,7 +37,7 @@ use crate::{use cranelift_codegen::{ExceptionContextLoc, MachBufferFinalized, MachExceptionHandler, MachLabel,binemit::CodeOffset,- ir::{MemFlagsData, RelSourceLoc, SourceLoc},+ ir::{MemFlagsData, RelSourceLoc, SourceLoc, UserExternalNameRef},isa::{unwind::UnwindInst,x64::{AtomicRmwSeqOp, args::CC, settings as x64_settings},@@ -477,6 +477,11 @@ impl Masm for MacroAssembler {Ok(())}+ fn load_func_addr(&mut self, name: UserExternalNameRef, dst: WritableReg) -> Result<()> {+ self.asm.load_func_addr(name, dst);+ Ok(())+ }+fn load(&mut self, src: Address, dst: WritableReg, size: OperandSize) -> Result<()> {self.load_impl(src, dst, size, TRUSTED_FLAGS)}diff --git a/winch/codegen/src/masm.rs b/winch/codegen/src/masm.rsindex d22279a9fb..fb6ea8a3db 100644--- a/winch/codegen/src/masm.rs+++ b/winch/codegen/src/masm.rs@@ -1579,6 +1579,10 @@ pub(crate) trait MacroAssembler {_size: OperandSize,) -> Result<()>;+ /// Load the address of the function referenced by `name`, which must be+ /// located within the same text section, into `dst`.+ fn load_func_addr(&mut self, name: UserExternalNameRef, dst: WritableReg) -> Result<()>;+/// Pop a value from the machine stack into the given register.fn pop(&mut self, dst: WritableReg, size: OperandSize) -> Result<()>;diff --git a/winch/codegen/src/visitor.rs b/winch/codegen/src/visitor.rsindex 1c0a74fe5f..fb51feeb10 100644--- a/winch/codegen/src/visitor.rs+++ b/winch/codegen/src/visitor.rs@@ -2310,14 +2310,7 @@ where}fn visit_ref_func(&mut self, function_index: u32) -> Self::Output {- let ref_func = self.env.builtins.ref_func::<M::ABI>()?;- self.context.stack.extend([function_index.try_into()?]);- FnCall::emit::<M>(- &mut self.env,- self.masm,- &mut self.context,- Callee::Builtin(ref_func),- )+ self.emit_ref_func(FuncIndex::from_u32(function_index))}fn visit_i32_load(&mut self, memarg: MemArg) -> Self::Output {