From 9ae42293dbf2a97b03e223e6366a90526f9b1262 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 7 May 2026 15:41:51 -0700 Subject: [PATCH 1/2] Harden Wasmtime's compiled GC code against corruption In the spirit of #13320 this commit goes through the compiled code for the GC proposal to ensure that, in the face of GC corruption, Wasmtime by default can recover and return a "bug" to the embedder. This was also discussed a bit in #13112 as well, and the changes made here are: * Plumbing traps from translation into the runtime now uses a new `CompiledTrap` enum instead of just the normal `Trap`. This new enum has branches for `InternalAssert` (not previously present) and additionally `GcHeapCorrupted` (now added). * Whether or not `CompiledTrap::{InternalAssert,GcHeapCorrupted}` is encoded into the final `*.cwasm` is now a `Tunables` configuration option. Internal asserts are not encoded by default but GC heap corruption is. * Traps caught as `CompiledTrap::{InternalAssert,GcHeapCorrupted}` are turned into `WasmtimeBug` and propagated upwards. Traps stay as normal traps. * All memory accesses to the GC heap now use `CompiledTrap::GcHeapCorrupted` as their trap code. Additionally they're also no longer marked as `readonly` in a few places. * A few locations in GC translation using `InternalAssert` now use `GcHeapCorrupted`, such as the checked arithmetic around array lengths. Other assertions which are about control flow are left untouched. The end state is that faults in the GC heap in compiled code itself should show up as a `bug!` on the other end by default. This requires extra metadata in `*.cwasm`s mapping traps, but this is similar to linear-memory-using-wasms which have lots of trap metadata for loads/stores. Being able to catch `InternalAssert` as a first-class error (as opposed to a signal) is a debugging nicety I've added here but remains off-by-default to avoid bloating `*.cwasm`s for internal debugging. Closes #13112 --- crates/cli-flags/src/lib.rs | 13 +++ crates/cranelift/src/compiled_function.rs | 11 +- crates/cranelift/src/compiler.rs | 5 +- .../cranelift/src/func_environ/gc/enabled.rs | 56 ++++----- .../src/func_environ/gc/enabled/copying.rs | 6 +- .../src/func_environ/gc/enabled/drc.rs | 34 ++---- .../src/func_environ/gc/enabled/null.rs | 14 +-- crates/cranelift/src/lib.rs | 35 ++++-- crates/cranelift/src/trap.rs | 4 +- crates/environ/src/compile/trap_encoding.rs | 2 +- crates/environ/src/trap_encoding.rs | 59 ++++++++-- crates/environ/src/tunables.rs | 10 ++ crates/fuzzing/src/generators/config.rs | 6 + crates/wasmtime/src/config.rs | 20 ++++ crates/wasmtime/src/engine/serialization.rs | 6 + crates/wasmtime/src/runtime.rs | 5 +- crates/wasmtime/src/runtime/bug.rs | 13 ++- crates/wasmtime/src/runtime/code_memory.rs | 4 +- crates/wasmtime/src/runtime/trap.rs | 16 ++- crates/wasmtime/src/runtime/vm/interpreter.rs | 2 +- crates/wasmtime/src/runtime/vm/libcalls.rs | 11 +- .../wasmtime/src/runtime/vm/traphandlers.rs | 4 +- src/commands/objdump.rs | 6 +- tests/disas/arith.wat | 2 +- tests/disas/call-indirect.wat | 6 +- .../direct-adapter-calls-inlining.wat | 2 +- .../component-model/direct-adapter-calls.wat | 2 +- tests/disas/conditional-traps.wat | 4 +- tests/disas/debug-exceptions.wat | 109 ++++++++++-------- tests/disas/duplicate-function-types.wat | 12 +- tests/disas/gc/copying/array-fill.wat | 16 +-- tests/disas/gc/copying/array-get-s.wat | 14 +-- tests/disas/gc/copying/array-get-u.wat | 14 +-- tests/disas/gc/copying/array-get.wat | 14 +-- tests/disas/gc/copying/array-len.wat | 4 +- .../gc/copying/array-new-fixed-of-gc-refs.wat | 8 +- tests/disas/gc/copying/array-new-fixed.wat | 8 +- tests/disas/gc/copying/array-new.wat | 8 +- tests/disas/gc/copying/array-set.wat | 14 +-- tests/disas/gc/copying/br-on-cast-fail.wat | 2 +- tests/disas/gc/copying/br-on-cast.wat | 2 +- .../copying/call-indirect-and-subtyping.wat | 6 +- .../gc/copying/funcref-in-gc-heap-get.wat | 4 +- .../gc/copying/funcref-in-gc-heap-new.wat | 2 +- .../gc/copying/funcref-in-gc-heap-set.wat | 4 +- tests/disas/gc/copying/multiple-array-get.wat | 18 +-- .../disas/gc/copying/multiple-struct-get.wat | 6 +- tests/disas/gc/copying/ref-cast.wat | 4 +- tests/disas/gc/copying/ref-test-array.wat | 2 +- .../copying/ref-test-concrete-func-type.wat | 2 +- .../gc/copying/ref-test-concrete-type.wat | 2 +- tests/disas/gc/copying/ref-test-eq.wat | 2 +- tests/disas/gc/copying/ref-test-struct.wat | 2 +- tests/disas/gc/copying/struct-get.wat | 16 +-- tests/disas/gc/copying/struct-new-default.wat | 6 +- tests/disas/gc/copying/struct-new.wat | 6 +- tests/disas/gc/copying/struct-set.wat | 12 +- tests/disas/gc/copying/v128-fields.wat | 4 +- tests/disas/gc/drc/array-fill.wat | 16 +-- tests/disas/gc/drc/array-get-s.wat | 14 +-- tests/disas/gc/drc/array-get-u.wat | 14 +-- tests/disas/gc/drc/array-get.wat | 14 +-- tests/disas/gc/drc/array-len.wat | 4 +- .../gc/drc/array-new-fixed-of-gc-refs.wat | 20 ++-- tests/disas/gc/drc/array-new-fixed.wat | 8 +- tests/disas/gc/drc/array-new.wat | 8 +- tests/disas/gc/drc/array-set.wat | 14 +-- tests/disas/gc/drc/br-on-cast-fail.wat | 2 +- tests/disas/gc/drc/br-on-cast.wat | 2 +- .../gc/drc/call-indirect-and-subtyping.wat | 6 +- tests/disas/gc/drc/externref-globals.wat | 24 ++-- tests/disas/gc/drc/funcref-in-gc-heap-get.wat | 4 +- tests/disas/gc/drc/funcref-in-gc-heap-new.wat | 2 +- tests/disas/gc/drc/funcref-in-gc-heap-set.wat | 4 +- tests/disas/gc/drc/multiple-array-get.wat | 18 +-- tests/disas/gc/drc/multiple-struct-get.wat | 6 +- tests/disas/gc/drc/ref-cast.wat | 4 +- tests/disas/gc/drc/ref-test-array.wat | 2 +- .../gc/drc/ref-test-concrete-func-type.wat | 2 +- tests/disas/gc/drc/ref-test-concrete-type.wat | 2 +- tests/disas/gc/drc/ref-test-eq.wat | 2 +- tests/disas/gc/drc/ref-test-struct.wat | 2 +- tests/disas/gc/drc/struct-get.wat | 32 ++--- tests/disas/gc/drc/struct-new-default.wat | 10 +- tests/disas/gc/drc/struct-new.wat | 10 +- tests/disas/gc/drc/struct-set.wat | 22 ++-- tests/disas/gc/issue-11753.wat | 6 +- tests/disas/gc/null/array-fill.wat | 16 +-- tests/disas/gc/null/array-get-s.wat | 14 +-- tests/disas/gc/null/array-get-u.wat | 14 +-- tests/disas/gc/null/array-get.wat | 14 +-- tests/disas/gc/null/array-len.wat | 4 +- .../gc/null/array-new-fixed-of-gc-refs.wat | 22 ++-- tests/disas/gc/null/array-new-fixed.wat | 22 ++-- tests/disas/gc/null/array-new.wat | 24 ++-- tests/disas/gc/null/array-set.wat | 14 +-- tests/disas/gc/null/br-on-cast-fail.wat | 2 +- tests/disas/gc/null/br-on-cast.wat | 2 +- .../gc/null/call-indirect-and-subtyping.wat | 6 +- .../disas/gc/null/funcref-in-gc-heap-get.wat | 4 +- .../disas/gc/null/funcref-in-gc-heap-new.wat | 16 +-- .../disas/gc/null/funcref-in-gc-heap-set.wat | 4 +- tests/disas/gc/null/multiple-array-get.wat | 18 +-- tests/disas/gc/null/multiple-struct-get.wat | 6 +- tests/disas/gc/null/ref-cast.wat | 4 +- tests/disas/gc/null/ref-test-array.wat | 2 +- .../gc/null/ref-test-concrete-func-type.wat | 2 +- .../disas/gc/null/ref-test-concrete-type.wat | 2 +- tests/disas/gc/null/ref-test-eq.wat | 2 +- tests/disas/gc/null/ref-test-struct.wat | 2 +- .../disas/gc/null/struct-get-guard-pages.wat | 16 +-- .../gc/null/struct-get-no-guard-pages.wat | 24 ++-- tests/disas/gc/null/struct-get.wat | 16 +-- tests/disas/gc/null/struct-new-default.wat | 20 ++-- tests/disas/gc/null/struct-new.wat | 20 ++-- tests/disas/gc/null/struct-set.wat | 12 +- tests/disas/gc/null/v128-fields.wat | 4 +- tests/disas/gc/struct-new-default.wat | 12 +- tests/disas/gc/struct-new.wat | 10 +- tests/disas/icall-loop.wat | 12 +- tests/disas/icall-simd.wat | 6 +- tests/disas/icall.wat | 6 +- tests/disas/if-reachability-translation-0.wat | 2 +- tests/disas/if-reachability-translation-2.wat | 2 +- tests/disas/if-reachability-translation-3.wat | 2 +- tests/disas/if-reachability-translation-4.wat | 4 +- tests/disas/if-reachability-translation-5.wat | 4 +- tests/disas/if-reachability-translation-6.wat | 4 +- tests/disas/if-unreachable-else-params-2.wat | 2 +- tests/disas/if-unreachable-else-params.wat | 2 +- tests/disas/indirect-call-no-caching.wat | 6 +- tests/disas/metadata-for-internal-asserts.wat | 48 ++++++++ tests/disas/pr2559.wat | 4 +- tests/disas/readonly-funcrefs.wat | 6 +- tests/disas/ref-func-0.wat | 32 ++--- .../disas/riscv64-component-builtins-asm.wat | 2 +- tests/disas/riscv64-component-builtins.wat | 2 +- .../resume-suspend-data-passing.wat | 10 +- .../disas/stack-switching/resume-suspend.wat | 10 +- .../stack-switching/symmetric-switch.wat | 16 +-- tests/disas/table-get-fixed-size.wat | 36 +++--- tests/disas/table-get.wat | 36 +++--- tests/disas/table-set-fixed-size.wat | 24 ++-- tests/disas/table-set.wat | 24 ++-- tests/disas/typed-funcrefs-eager-init.wat | 20 ++-- tests/disas/typed-funcrefs.wat | 20 ++-- tests/disas/unreachable_code.wat | 8 +- tests/disas/x64-simple-load.wat | 4 +- 148 files changed, 911 insertions(+), 748 deletions(-) create mode 100644 tests/disas/metadata-for-internal-asserts.wat diff --git a/crates/cli-flags/src/lib.rs b/crates/cli-flags/src/lib.rs index 37e98b93df82..e8d15bc5bdc7 100644 --- a/crates/cli-flags/src/lib.rs +++ b/crates/cli-flags/src/lib.rs @@ -266,6 +266,13 @@ wasmtime_option_group! { #[serde(deserialize_with = "crate::opt::cli_parse_wrapper")] pub inlining: Option, + /// Whether or not trap metadata is present for wasm internal assertions + /// in compiled code. + pub metadata_for_internal_asserts: Option, + /// Whether or not trap metadata is present for detection of gc + /// corruption in compiled code. + pub metadata_for_gc_heap_corruption: Option, + #[prefixed = "cranelift"] #[serde(default)] /// Set a cranelift-specific option. Use `wasmtime settings` to see @@ -975,6 +982,12 @@ impl CommonOptions { if let Some(enable) = self.codegen.inlining { config.compiler_inlining(enable); } + if let Some(enable) = self.codegen.metadata_for_internal_asserts { + config.metadata_for_internal_asserts(enable); + } + if let Some(enable) = self.codegen.metadata_for_gc_heap_corruption { + config.metadata_for_gc_heap_corruption(enable); + } // async_stack_size enabled by either async or stack-switching, so // cannot directly use match_feature! diff --git a/crates/cranelift/src/compiled_function.rs b/crates/cranelift/src/compiled_function.rs index b28f2d5349a6..8641bb7feced 100644 --- a/crates/cranelift/src/compiled_function.rs +++ b/crates/cranelift/src/compiled_function.rs @@ -7,6 +7,7 @@ use cranelift_codegen::{ }; use wasmtime_environ::{ FilePos, FrameStateSlotBuilder, InstructionAddressMap, ModulePC, PrimaryMap, TrapInformation, + Tunables, }; #[derive(Debug, Clone, PartialEq, Eq, Default)] @@ -144,8 +145,14 @@ impl CompiledFunction { } /// Returns an iterator to the function's trap information. - pub fn traps(&self) -> impl Iterator + '_ { - self.buffer.traps().iter().filter_map(mach_trap_to_trap) + pub fn traps<'a>( + &'a self, + tunables: &'a Tunables, + ) -> impl Iterator + 'a { + self.buffer + .traps() + .iter() + .filter_map(move |t| mach_trap_to_trap(t, tunables)) } /// Get the function's address map from the metadata. diff --git a/crates/cranelift/src/compiler.rs b/crates/cranelift/src/compiler.rs index dc2df655745e..546b6ad36bc9 100644 --- a/crates/cranelift/src/compiler.rs +++ b/crates/cranelift/src/compiler.rs @@ -540,7 +540,10 @@ impl wasmtime_environ::Compiler for Compiler { func.buffer.user_stack_maps(), ); - traps.push(range.clone(), &func.traps().collect::>()); + traps.push( + range.clone(), + &func.traps(&self.tunables).collect::>(), + ); clif_to_env_exception_tables( &mut exception_tables, range.clone(), diff --git a/crates/cranelift/src/func_environ/gc/enabled.rs b/crates/cranelift/src/func_environ/gc/enabled.rs index 0ed775f7f3c8..2a19af06af91 100644 --- a/crates/cranelift/src/func_environ/gc/enabled.rs +++ b/crates/cranelift/src/func_environ/gc/enabled.rs @@ -3,7 +3,7 @@ use crate::bounds_checks::BoundsCheck; use crate::func_environ::{Extension, FuncEnvironment}; use crate::translate::{Heap, HeapData, MemoryKind, StructFieldsVec, TargetEnvironment}; use crate::trap::TranslateTrap; -use crate::{Reachability, TRAP_INTERNAL_ASSERT}; +use crate::{Reachability, TRAP_GC_HEAP_CORRUPT, TRAP_INTERNAL_ASSERT}; use cranelift_codegen::ir::immediates::Offset32; use cranelift_codegen::ir::{BlockArg, ExceptionTableData, ExceptionTableItem}; use cranelift_codegen::{ @@ -27,6 +27,9 @@ mod null; #[cfg(feature = "gc-copying")] mod copying; +const GC_MEMFLAGS: ir::MemFlags = + ir::MemFlags::new().with_trap_code(Some(crate::TRAP_GC_HEAP_CORRUPT)); + /// Get the default GC compiler. pub fn gc_compiler(func_env: &mut FuncEnvironment<'_>) -> WasmResult> { // If this function requires a GC compiler, that is not too bad of an @@ -161,12 +164,9 @@ fn emit_gc_kind_assert( object_size: wasmtime_environ::VM_GC_HEADER_SIZE, }, ); - let kind_and_reserved_bits = builder.ins().load( - ir::types::I32, - ir::MemFlags::trusted().with_readonly(), - kind_addr, - 0, - ); + let kind_and_reserved_bits = builder + .ins() + .load(ir::types::I32, GC_MEMFLAGS, kind_addr, 0); let kind_mask = builder .ins() .iconst(ir::types::I32, i64::from(VMGcKind::MASK)); @@ -202,7 +202,7 @@ fn read_field_at_addr( ); // Data inside GC objects is always little endian. - let flags = ir::MemFlags::trusted().with_endianness(ir::Endianness::Little); + let flags = GC_MEMFLAGS.with_endianness(ir::Endianness::Little); let value = match ty { WasmStorageType::I8 => builder.ins().load(ir::types::I8, flags, addr, 0), @@ -321,7 +321,7 @@ fn write_field_at_addr( new_val: ir::Value, ) -> WasmResult<()> { // Data inside GC objects is always little endian. - let flags = ir::MemFlags::trusted().with_endianness(ir::Endianness::Little); + let flags = GC_MEMFLAGS.with_endianness(ir::Endianness::Little); match field_ty { WasmStorageType::I8 => { @@ -928,12 +928,9 @@ pub fn translate_array_len( access_size: u8::try_from(ir::types::I32.bytes()).unwrap(), }, ); - let result = builder.ins().load( - ir::types::I32, - ir::MemFlags::trusted().with_readonly(), - len_field, - 0, - ); + let result = builder + .ins() + .load(ir::types::I32, GC_MEMFLAGS, len_field, 0); log::trace!("translate_array_len(..) -> {result:?}"); Ok(result) } @@ -973,7 +970,7 @@ fn emit_array_size_info( let all_elems_size = builder.ins().imul(one_elem_size, array_len); let high_bits = builder.ins().ushr_imm(all_elems_size, 32); - builder.ins().trapnz(high_bits, TRAP_INTERNAL_ASSERT); + builder.ins().trapnz(high_bits, TRAP_GC_HEAP_CORRUPT); let all_elems_size = builder.ins().ireduce(ir::types::I32, all_elems_size); let base_size = builder @@ -982,7 +979,7 @@ fn emit_array_size_info( let obj_size = builder .ins() - .uadd_overflow_trap(all_elems_size, base_size, TRAP_INTERNAL_ASSERT); + .uadd_overflow_trap(all_elems_size, base_size, TRAP_GC_HEAP_CORRUPT); let one_elem_size = builder.ins().ireduce(ir::types::I32, one_elem_size); @@ -1244,12 +1241,9 @@ pub fn translate_ref_test( object_size: wasmtime_environ::VM_GC_HEADER_SIZE, }, ); - let actual_kind = builder.ins().load( - ir::types::I32, - ir::MemFlags::trusted().with_readonly(), - kind_addr, - 0, - ); + let actual_kind = builder + .ins() + .load(ir::types::I32, GC_MEMFLAGS, kind_addr, 0); let expected_kind = builder .ins() .iconst(ir::types::I32, i64::from(expected_kind.as_u32())); @@ -1301,12 +1295,7 @@ pub fn translate_ref_test( access_size: func_env.offsets.size_of_vmshared_type_index(), }, ); - let actual_shared_ty = builder.ins().load( - ir::types::I32, - ir::MemFlags::trusted().with_readonly(), - ty_addr, - 0, - ); + let actual_shared_ty = builder.ins().load(ir::types::I32, GC_MEMFLAGS, ty_addr, 0); func_env.is_subtype(builder, actual_shared_ty, expected_shared_ty) } @@ -1319,11 +1308,8 @@ pub fn translate_ref_test( let expected_shared_ty = func_env.module_interned_to_shared_ty(&mut builder.cursor(), expected_interned_ty); - let actual_shared_ty = func_env.load_funcref_type_index( - &mut builder.cursor(), - ir::MemFlags::trusted().with_readonly(), - val, - ); + let actual_shared_ty = + func_env.load_funcref_type_index(&mut builder.cursor(), GC_MEMFLAGS, val); func_env.is_subtype(builder, actual_shared_ty, expected_shared_ty) } @@ -1594,7 +1580,7 @@ impl FuncEnvironment<'_> { &gc_heap, gc_ref, bounds_check, - crate::TRAP_INTERNAL_ASSERT, + crate::TRAP_GC_HEAP_CORRUPT, ) { Reachability::Reachable(v) => v, Reachability::Unreachable => { diff --git a/crates/cranelift/src/func_environ/gc/enabled/copying.rs b/crates/cranelift/src/func_environ/gc/enabled/copying.rs index 1c82ddea03bb..b473df203d5c 100644 --- a/crates/cranelift/src/func_environ/gc/enabled/copying.rs +++ b/crates/cranelift/src/func_environ/gc/enabled/copying.rs @@ -33,7 +33,7 @@ impl CopyingCompiler { val: ir::Value, ) -> WasmResult<()> { // Data inside GC objects is always little endian. - let flags = ir::MemFlags::trusted().with_endianness(ir::Endianness::Little); + let flags = GC_MEMFLAGS.with_endianness(ir::Endianness::Little); match ty { WasmStorageType::Val(WasmValType::Ref(r)) => match r.heap_type.top() { @@ -109,9 +109,7 @@ impl GcCompiler for CopyingCompiler { let object_addr = builder.ins().iadd(base, extended_array_ref); let len_addr = builder.ins().iadd_imm(object_addr, i64::from(len_offset)); let len = init.len(&mut builder.cursor()); - builder - .ins() - .store(ir::MemFlags::trusted(), len, len_addr, 0); + builder.ins().store(GC_MEMFLAGS, len, len_addr, 0); // Initialize elements. let len_to_elems_delta = builder.ins().iconst(ptr_ty, i64::from(len_to_elems_delta)); diff --git a/crates/cranelift/src/func_environ/gc/enabled/drc.rs b/crates/cranelift/src/func_environ/gc/enabled/drc.rs index 66d9667c972c..fb04425195ef 100644 --- a/crates/cranelift/src/func_environ/gc/enabled/drc.rs +++ b/crates/cranelift/src/func_environ/gc/enabled/drc.rs @@ -39,9 +39,7 @@ impl DrcCompiler { access_size: u8::try_from(ir::types::I64.bytes()).unwrap(), }, ); - builder - .ins() - .load(ir::types::I64, ir::MemFlags::trusted(), pointer, 0) + builder.ins().load(ir::types::I64, GC_MEMFLAGS, pointer, 0) } /// Generate code to update the given GC reference's ref count to the new @@ -64,9 +62,7 @@ impl DrcCompiler { access_size: u8::try_from(ir::types::I64.bytes()).unwrap(), }, ); - builder - .ins() - .store(ir::MemFlags::trusted(), new_ref_count, pointer, 0); + builder.ins().store(GC_MEMFLAGS, new_ref_count, pointer, 0); } /// Generate code to increment or decrement the given GC reference's ref @@ -108,9 +104,7 @@ impl DrcCompiler { // Load the current first list element, which will be our new next list // element. - let next = builder - .ins() - .load(ir::types::I32, ir::MemFlags::trusted(), head, 0); + let next = builder.ins().load(ir::types::I32, GC_MEMFLAGS, head, 0); // Update our object's header to point to `next` and consider itself part of the list. self.set_next_over_approximated_stack_root(func_env, builder, gc_ref, next); @@ -120,9 +114,7 @@ impl DrcCompiler { self.mutate_ref_count(func_env, builder, gc_ref, 1); // Commit this object as the new head of the list. - builder - .ins() - .store(ir::MemFlags::trusted(), gc_ref, head, 0); + builder.ins().store(GC_MEMFLAGS, gc_ref, head, 0); } /// Load a pointer to the first element of the DRC heap's @@ -137,7 +129,7 @@ impl DrcCompiler { let vmctx = builder.ins().global_value(ptr_ty, vmctx); builder.ins().load( ptr_ty, - ir::MemFlags::trusted().with_readonly(), + GC_MEMFLAGS, vmctx, i32::from(func_env.offsets.ptr.vmctx_gc_heap_data()), ) @@ -163,7 +155,7 @@ impl DrcCompiler { access_size: u8::try_from(ir::types::I32.bytes()).unwrap(), }, ); - builder.ins().store(ir::MemFlags::trusted(), next, ptr, 0); + builder.ins().store(GC_MEMFLAGS, next, ptr, 0); } /// Set the in-over-approximated-stack-roots list bit in a `VMDrcHeader`'s @@ -199,9 +191,7 @@ impl DrcCompiler { access_size: u8::try_from(ir::types::I32.bytes()).unwrap(), }, ); - builder - .ins() - .store(ir::MemFlags::trusted(), new_reserved, ptr, 0); + builder.ins().store(GC_MEMFLAGS, new_reserved, ptr, 0); } /// Write to an uninitialized field or element inside a GC object. @@ -214,7 +204,7 @@ impl DrcCompiler { val: ir::Value, ) -> WasmResult<()> { // Data inside GC objects is always little endian. - let flags = ir::MemFlags::trusted().with_endianness(ir::Endianness::Little); + let flags = GC_MEMFLAGS.with_endianness(ir::Endianness::Little); match ty { WasmStorageType::Val(WasmValType::Ref(r)) => match r.heap_type.top() { @@ -396,9 +386,7 @@ impl GcCompiler for DrcCompiler { let object_addr = builder.ins().iadd(base, extended_array_ref); let len_addr = builder.ins().iadd_imm(object_addr, i64::from(len_offset)); let len = init.len(&mut builder.cursor()); - builder - .ins() - .store(ir::MemFlags::trusted(), len, len_addr, 0); + builder.ins().store(GC_MEMFLAGS, len, len_addr, 0); // Finally, initialize the elements. let len_to_elems_delta = builder.ins().iconst(ptr_ty, i64::from(len_to_elems_delta)); @@ -666,9 +654,7 @@ impl GcCompiler for DrcCompiler { access_size: u8::try_from(ir::types::I32.bytes()).unwrap(), }, ); - let reserved = builder - .ins() - .load(ir::types::I32, ir::MemFlags::trusted(), ptr, 0); + let reserved = builder.ins().load(ir::types::I32, GC_MEMFLAGS, ptr, 0); let in_set_bit = builder.ins().iconst( ir::types::I32, i64::from(wasmtime_environ::drc::HEADER_IN_OVER_APPROX_LIST_BIT), diff --git a/crates/cranelift/src/func_environ/gc/enabled/null.rs b/crates/cranelift/src/func_environ/gc/enabled/null.rs index 6d3b59d37373..474abf87b982 100644 --- a/crates/cranelift/src/func_environ/gc/enabled/null.rs +++ b/crates/cranelift/src/func_environ/gc/enabled/null.rs @@ -73,13 +73,13 @@ impl NullCompiler { let vmctx = func_env.vmctx_val(&mut builder.cursor()); let ptr_to_next = builder.ins().load( pointer_type, - ir::MemFlags::trusted().with_readonly(), + GC_MEMFLAGS, vmctx, i32::from(func_env.offsets.ptr.vmctx_gc_heap_data()), ); let next = builder .ins() - .load(ir::types::I32, ir::MemFlags::trusted(), ptr_to_next, 0); + .load(ir::types::I32, GC_MEMFLAGS, ptr_to_next, 0); // Increment the bump "pointer" to the requested alignment: // @@ -157,20 +157,20 @@ impl NullCompiler { ), }; builder.ins().store( - ir::MemFlags::trusted(), + GC_MEMFLAGS, kind_and_size, ptr_to_object, i32::try_from(wasmtime_environ::VM_GC_HEADER_KIND_OFFSET).unwrap(), ); builder.ins().store( - ir::MemFlags::trusted(), + GC_MEMFLAGS, ty, ptr_to_object, i32::try_from(wasmtime_environ::VM_GC_HEADER_TYPE_INDEX_OFFSET).unwrap(), ); builder .ins() - .store(ir::MemFlags::trusted(), end_of_object, ptr_to_next, 0); + .store(GC_MEMFLAGS, end_of_object, ptr_to_next, 0); log::trace!("emit_inline_alloc(..) -> ({aligned}, {ptr_to_object})"); (aligned, ptr_to_object) @@ -223,9 +223,7 @@ impl GcCompiler for NullCompiler { // any pointers or offsets out from the (untrusted) GC heap. let len_addr = builder.ins().iadd_imm(ptr_to_object, i64::from(len_offset)); let len = init.len(&mut builder.cursor()); - builder - .ins() - .store(ir::MemFlags::trusted(), len, len_addr, 0); + builder.ins().store(GC_MEMFLAGS, len, len_addr, 0); // Finally, initialize the elements. let len_to_elems_delta = builder.ins().iconst(ptr_ty, i64::from(len_to_elems_delta)); diff --git a/crates/cranelift/src/lib.rs b/crates/cranelift/src/lib.rs index 8c0a2da908db..aaa33ecda026 100644 --- a/crates/cranelift/src/lib.rs +++ b/crates/cranelift/src/lib.rs @@ -25,8 +25,8 @@ use cranelift_entity::PrimaryMap; use target_lexicon::Architecture; use wasmtime_environ::{ - BuiltinFunctionIndex, FlagValue, FuncKey, Trap, TrapInformation, Tunables, WasmFuncType, - WasmHeapTopType, WasmHeapType, WasmValType, + BuiltinFunctionIndex, CompiledTrap, FlagValue, FuncKey, Trap, TrapInformation, Tunables, + WasmFuncType, WasmHeapTopType, WasmHeapType, WasmValType, }; pub use builder::builder; @@ -48,7 +48,8 @@ mod trap; use self::compiler::Compiler; const TRAP_INTERNAL_ASSERT: TrapCode = TrapCode::unwrap_user(1); -const TRAP_OFFSET: u8 = 2; +const TRAP_GC_HEAP_CORRUPT: TrapCode = TrapCode::unwrap_user(2); +const TRAP_OFFSET: u8 = 3; pub const TRAP_CANNOT_LEAVE_COMPONENT: TrapCode = TrapCode::unwrap_user(Trap::CannotLeaveComponent as u8 + TRAP_OFFSET); pub const TRAP_INDIRECT_CALL_TO_NULL: TrapCode = @@ -254,29 +255,39 @@ fn to_flag_value(v: &settings::Value) -> FlagValue<'static> { } /// Converts machine traps to trap information. -pub fn mach_trap_to_trap(trap: &MachTrap) -> Option { +pub fn mach_trap_to_trap(trap: &MachTrap, tunables: &Tunables) -> Option { let &MachTrap { offset, code } = trap; Some(TrapInformation { code_offset: offset, - trap_code: clif_trap_to_env_trap(code)?, + trap_code: clif_trap_to_env_trap(code, tunables)?, }) } -fn clif_trap_to_env_trap(trap: ir::TrapCode) -> Option { - Some(match trap { +fn clif_trap_to_env_trap(trap: ir::TrapCode, tunables: &Tunables) -> Option { + Some(CompiledTrap::Normal(match trap { ir::TrapCode::STACK_OVERFLOW => Trap::StackOverflow, ir::TrapCode::HEAP_OUT_OF_BOUNDS => Trap::MemoryOutOfBounds, ir::TrapCode::INTEGER_OVERFLOW => Trap::IntegerOverflow, ir::TrapCode::INTEGER_DIVISION_BY_ZERO => Trap::IntegerDivisionByZero, ir::TrapCode::BAD_CONVERSION_TO_INTEGER => Trap::BadConversionToInteger, - // These do not get converted to wasmtime traps, since they - // shouldn't ever be hit in theory. Instead of catching and handling - // these, we let the signal crash the process. - TRAP_INTERNAL_ASSERT => return None, + TRAP_INTERNAL_ASSERT => { + return if tunables.metadata_for_internal_asserts { + Some(CompiledTrap::InternalAssert) + } else { + None + }; + } + TRAP_GC_HEAP_CORRUPT => { + return if tunables.metadata_for_gc_heap_corruption { + Some(CompiledTrap::GcHeapCorrupt) + } else { + None + }; + } other => Trap::from_u8(other.as_raw().get() - TRAP_OFFSET).unwrap(), - }) + })) } /// Converts machine relocations to relocation information diff --git a/crates/cranelift/src/trap.rs b/crates/cranelift/src/trap.rs index 3b72f0282ab1..158f3239e73b 100644 --- a/crates/cranelift/src/trap.rs +++ b/crates/cranelift/src/trap.rs @@ -27,7 +27,7 @@ pub trait TranslateTrap { fn trap(&mut self, builder: &mut FunctionBuilder, trap: ir::TrapCode) { match ( self.clif_instruction_traps_enabled(), - crate::clif_trap_to_env_trap(trap), + crate::clif_trap_to_env_trap(trap, self.compiler().tunables()), ) { // If libcall traps are disabled or there's no wasmtime-defined trap // code for this, then emit a native trap instruction. @@ -42,7 +42,7 @@ pub trait TranslateTrap { let debug_tags = self.debug_tags(builder.srcloc()); let trap_libcall = self.builtin_funcref(builder, BuiltinFunctionIndex::trap()); let vmctx = self.vmctx_val(&mut builder.cursor()); - let trap_code = builder.ins().iconst(I8, i64::from(trap as u8)); + let trap_code = builder.ins().iconst(I8, i64::from(trap.as_u8())); builder.ins().call(trap_libcall, &[vmctx, trap_code]); let raise_libcall = self.builtin_funcref(builder, BuiltinFunctionIndex::raise()); let inst = builder.ins().call(raise_libcall, &[vmctx]); diff --git a/crates/environ/src/compile/trap_encoding.rs b/crates/environ/src/compile/trap_encoding.rs index c5d5b63a54ea..139c85a7eed4 100644 --- a/crates/environ/src/compile/trap_encoding.rs +++ b/crates/environ/src/compile/trap_encoding.rs @@ -46,7 +46,7 @@ impl TrapEncodingBuilder { let pos = func_start + info.code_offset; assert!(pos >= self.last_offset); self.offsets.push(U32::new(LittleEndian, pos)); - self.traps.push(info.trap_code as u8); + self.traps.push(info.trap_code.as_u8()); self.last_offset = pos; } diff --git a/crates/environ/src/trap_encoding.rs b/crates/environ/src/trap_encoding.rs index 4a8d89a8ce6e..12964b1eedd8 100644 --- a/crates/environ/src/trap_encoding.rs +++ b/crates/environ/src/trap_encoding.rs @@ -10,7 +10,46 @@ pub struct TrapInformation { pub code_offset: u32, /// Code of the trap. - pub trap_code: Trap, + pub trap_code: CompiledTrap, +} + +/// Possible traps that can be compiled into WebAssembly modules. +#[derive(Debug, PartialEq, Eq, Clone)] +pub enum CompiledTrap { + /// A normal trap, expected to possibly be hit at runtime. + Normal(Trap), + /// An internal assertion in the compiled code itself. + InternalAssert, + /// The GC heap was detected as being corrupt. + GcHeapCorrupt, +} + +impl CompiledTrap { + /// Encodes this as a byte. + pub fn as_u8(&self) -> u8 { + match self { + CompiledTrap::Normal(trap) => *trap as u8, + CompiledTrap::InternalAssert => 0xFF, + CompiledTrap::GcHeapCorrupt => 0xFE, + } + } + + /// Decodes a byte as a trap. + pub fn from_u8(byte: u8) -> Option { + if byte == 0xFF { + Some(CompiledTrap::InternalAssert) + } else if byte == 0xFE { + Some(CompiledTrap::GcHeapCorrupt) + } else { + Trap::from_u8(byte).map(CompiledTrap::Normal) + } + } +} + +impl From for CompiledTrap { + fn from(trap: Trap) -> CompiledTrap { + CompiledTrap::Normal(trap) + } } macro_rules! generate_trap_type { @@ -239,7 +278,7 @@ impl core::error::Error for Trap {} /// The `section` provided is expected to have been built by /// `TrapEncodingBuilder` above. Additionally the `offset` should be a relative /// offset within the text section of the compilation image. -pub fn lookup_trap_code(section: &[u8], offset: usize) -> Option { +pub fn lookup_trap_code(section: &[u8], offset: usize) -> Option { let (offsets, traps) = parse(section)?; // The `offsets` table is sorted in the trap section so perform a binary @@ -258,7 +297,7 @@ pub fn lookup_trap_code(section: &[u8], offset: usize) -> Option { debug_assert!(index < traps.len()); let byte = *traps.get(index)?; - let trap = Trap::from_u8(byte); + let trap = CompiledTrap::from_u8(byte); debug_assert!(trap.is_some(), "missing mapping for {byte}"); trap } @@ -275,12 +314,12 @@ fn parse(section: &[u8]) -> Option<(&[U32], &[u8])> { /// Returns an iterator over all of the traps encoded in `section`, which should /// have been produced by `TrapEncodingBuilder`. -pub fn iterate_traps(section: &[u8]) -> Option + '_> { +pub fn iterate_traps(section: &[u8]) -> Option + '_> { let (offsets, traps) = parse(section)?; - Some( - offsets - .iter() - .zip(traps) - .map(|(offset, trap)| (offset.get(LittleEndian), Trap::from_u8(*trap).unwrap())), - ) + Some(offsets.iter().zip(traps).map(|(offset, trap)| { + ( + offset.get(LittleEndian), + CompiledTrap::from_u8(*trap).unwrap(), + ) + })) } diff --git a/crates/environ/src/tunables.rs b/crates/environ/src/tunables.rs index 0c3aa7b5c20c..113eb9e9abf6 100644 --- a/crates/environ/src/tunables.rs +++ b/crates/environ/src/tunables.rs @@ -180,6 +180,14 @@ define_tunables! { /// /// This is the same as `memory_may_move` but for GC heaps. pub gc_heap_may_move: bool, + + /// Boolean to track whether compiled code retains metadata necessary to + /// report extra information on internal assertions failing. + pub metadata_for_internal_asserts: bool, + + /// Boolean to track whether compiled code retains metadata necessary to + /// report extra information on gc heap corruption being detected. + pub metadata_for_gc_heap_corruption: bool, } pub struct ConfigTunables { @@ -263,6 +271,8 @@ impl Tunables { gc_heap_guard_size: 0, gc_heap_reservation_for_growth: 0, gc_heap_may_move: true, + metadata_for_internal_asserts: false, + metadata_for_gc_heap_corruption: true, } } diff --git a/crates/fuzzing/src/generators/config.rs b/crates/fuzzing/src/generators/config.rs index 372909b7c18a..f3fea142f498 100644 --- a/crates/fuzzing/src/generators/config.rs +++ b/crates/fuzzing/src/generators/config.rs @@ -350,6 +350,10 @@ impl Config { cfg.wasm.relaxed_simd = Some(false); } cfg.codegen.collector = Some(self.wasmtime.collector.to_wasmtime()); + cfg.codegen.metadata_for_internal_asserts = + Some(self.wasmtime.metadata_for_internal_asserts); + cfg.codegen.metadata_for_gc_heap_corruption = + Some(self.wasmtime.metadata_for_gc_heap_corruption); let compiler_strategy = &self.wasmtime.compiler_strategy; let cranelift_strategy = match compiler_strategy { @@ -599,6 +603,8 @@ pub struct WasmtimeConfig { collector: Collector, gc_zeal_alloc_counter: Option, table_lazy_init: bool, + metadata_for_internal_asserts: bool, + metadata_for_gc_heap_corruption: bool, /// Configuration for whether wasm is invoked in an async fashion and how /// it's cooperatively time-sliced. diff --git a/crates/wasmtime/src/config.rs b/crates/wasmtime/src/config.rs index 71a92566ee02..7a167448e997 100644 --- a/crates/wasmtime/src/config.rs +++ b/crates/wasmtime/src/config.rs @@ -3255,6 +3255,26 @@ impl Config { self.rr_config = cfg; self } + + /// Whether or not trap metadata is generated in compiled wasms for internal + /// asserts in the compiled code itself. + /// + /// This is intended as a debugging option and is set to `false` by + /// default. + pub fn metadata_for_internal_asserts(&mut self, enable: bool) -> &mut Self { + self.tunables.metadata_for_internal_asserts = Some(enable); + self + } + + /// Whether or not trap metadata is generated in compiled wasms for + /// detection of corruption in the GC heap. + /// + /// This is intended as a defense-in-depth option for generated code in the + /// face of GC heap corruption and is `true` by default. + pub fn metadata_for_gc_heap_corruption(&mut self, enable: bool) -> &mut Self { + self.tunables.metadata_for_gc_heap_corruption = Some(enable); + self + } } impl Default for Config { diff --git a/crates/wasmtime/src/engine/serialization.rs b/crates/wasmtime/src/engine/serialization.rs index 55f68805ee33..b4a216f31f21 100644 --- a/crates/wasmtime/src/engine/serialization.rs +++ b/crates/wasmtime/src/engine/serialization.rs @@ -336,6 +336,12 @@ impl Metadata<'_> { // This doesn't affect compilation, it's just a runtime setting. gc_heap_reservation_for_growth: _, + + // No need to match whether or not this metadata is emitted, if it + // is or isn't then that's fine, the runtime handles it the same + // way. + metadata_for_internal_asserts: _, + metadata_for_gc_heap_corruption: _, } = self.tunables; Self::check_collector(collector, other.collector)?; diff --git a/crates/wasmtime/src/runtime.rs b/crates/wasmtime/src/runtime.rs index d19e8b7824a6..97e43a30bc42 100644 --- a/crates/wasmtime/src/runtime.rs +++ b/crates/wasmtime/src/runtime.rs @@ -31,7 +31,6 @@ use core::marker; use core::pin::Pin; use core::task::{Context, Poll}; -#[cfg(feature = "component-model-async")] mod bug; #[macro_use] @@ -81,10 +80,8 @@ cfg_if::cfg_if! { } } -#[cfg(feature = "component-model-async")] pub use bug::WasmtimeBug; -#[cfg(feature = "component-model-async")] -pub(crate) use bug::bail_bug; +pub(crate) use bug::{bail_bug, bug}; pub use code_memory::CodeMemory; #[cfg(feature = "debug")] pub use debug::*; diff --git a/crates/wasmtime/src/runtime/bug.rs b/crates/wasmtime/src/runtime/bug.rs index 1864a3ea3102..9982509139bd 100644 --- a/crates/wasmtime/src/runtime/bug.rs +++ b/crates/wasmtime/src/runtime/bug.rs @@ -24,16 +24,23 @@ use core::fmt; /// good alternative to panicking in the case that this is actually executed at /// runtime. macro_rules! bail_bug { + ($($arg:tt)*) => {{ + $crate::bail!($crate::bug!($($arg)*)) + }} +} +pub(crate) use bail_bug; + +/// Similar to `bail_bug`, but just returns a `WasmtimeBug`. +macro_rules! bug { ($($arg:tt)*) => {{ // Minimize argument passing to the `new` function by placing the // file/line in a static which is passed by reference to just pass a // single extra pointer argument. static POS: (&'static str, u32) = (file!(), line!()); - $crate::bail!(crate::WasmtimeBug::new(format_args!($($arg)*), &POS)) + crate::WasmtimeBug::new(format_args!($($arg)*), &POS) }} } - -pub(crate) use bail_bug; +pub(crate) use bug; /// Error which indicates a bug in Wasmtime. /// diff --git a/crates/wasmtime/src/runtime/code_memory.rs b/crates/wasmtime/src/runtime/code_memory.rs index 5c972a3547af..3aee69d99135 100644 --- a/crates/wasmtime/src/runtime/code_memory.rs +++ b/crates/wasmtime/src/runtime/code_memory.rs @@ -13,7 +13,7 @@ use object::{ read::elf::{FileHeader as _, SectionHeader as _}, }; use wasmtime_environ::StaticModuleIndex; -use wasmtime_environ::{Trap, lookup_trap_code, obj}; +use wasmtime_environ::{CompiledTrap, lookup_trap_code, obj}; use wasmtime_unwinder::ExceptionTable; /// Management of executable memory within a `MmapVec` @@ -613,7 +613,7 @@ impl CodeMemory { /// Looks up the given offset within this module's text section and returns /// the trap code associated with that instruction, if there is one. - pub fn lookup_trap_code(&self, text_offset: usize) -> Option { + pub fn lookup_trap_code(&self, text_offset: usize) -> Option { lookup_trap_code(self.trap_data(), text_offset) } diff --git a/crates/wasmtime/src/runtime/trap.rs b/crates/wasmtime/src/runtime/trap.rs index 7a80dff0af1f..d3c782077810 100644 --- a/crates/wasmtime/src/runtime/trap.rs +++ b/crates/wasmtime/src/runtime/trap.rs @@ -2,10 +2,12 @@ use super::coredump::WasmCoreDump; use crate::prelude::*; use crate::store::StoreOpaque; -use crate::{AsContext, Module}; +use crate::{AsContext, Module, bug}; use core::fmt; use core::num::NonZeroUsize; -use wasmtime_environ::{FilePos, demangle_function_name, demangle_function_name_or_index}; +use wasmtime_environ::{ + CompiledTrap, FilePos, demangle_function_name, demangle_function_name_or_index, +}; /// Representation of a WebAssembly trap and what caused it to occur. /// @@ -103,7 +105,15 @@ pub(crate) fn from_runtime_box( faulting_addr, trap, } => { - let mut err: Error = trap.into(); + let mut err: Error = match trap { + CompiledTrap::Normal(trap) => trap.into(), + CompiledTrap::InternalAssert => { + bug!("internal assert triggered in compiled code").into() + } + CompiledTrap::GcHeapCorrupt => { + bug!("gc heap corruption detected in compiled code").into() + } + }; // If a fault address was present, for example with segfaults, // then simultaneously assert that it's within a known linear memory diff --git a/crates/wasmtime/src/runtime/vm/interpreter.rs b/crates/wasmtime/src/runtime/vm/interpreter.rs index 7d64312d92ee..71f4ecdb6df3 100644 --- a/crates/wasmtime/src/runtime/vm/interpreter.rs +++ b/crates/wasmtime/src/runtime/vm/interpreter.rs @@ -471,7 +471,7 @@ impl InterpreterRef<'_> { TrapKind::DisabledOpcode => Trap::DisabledOpcode, TrapKind::StackOverflow => Trap::StackOverflow, }; - s.set_jit_trap(regs, None, trap); + s.set_jit_trap(regs, None, trap.into()); s.entry_trap_handler() } None => { diff --git a/crates/wasmtime/src/runtime/vm/libcalls.rs b/crates/wasmtime/src/runtime/vm/libcalls.rs index 2ef761ed3527..b65d5a9113cb 100644 --- a/crates/wasmtime/src/runtime/vm/libcalls.rs +++ b/crates/wasmtime/src/runtime/vm/libcalls.rs @@ -56,6 +56,7 @@ #[cfg(feature = "stack-switching")] use super::stack_switching::VMContObj; +use crate::bail_bug; use crate::prelude::*; use crate::runtime::store::{Asyncness, InstanceId, StoreInstanceId, StoreOpaque}; #[cfg(feature = "gc")] @@ -71,8 +72,8 @@ use core::ptr::NonNull; use core::time::Duration; use wasmtime_core::math::WasmFloat; use wasmtime_environ::{ - DataIndex, DefinedMemoryIndex, DefinedTableIndex, ElemIndex, FuncIndex, MemoryIndex, - TableIndex, Trap, + CompiledTrap, DataIndex, DefinedMemoryIndex, DefinedTableIndex, ElemIndex, FuncIndex, + MemoryIndex, TableIndex, Trap, }; #[cfg(feature = "wmemcheck")] use wasmtime_wmemcheck::AccessError::{ @@ -1744,7 +1745,11 @@ fn fma_f64x2( /// only ever returns an error, and this hooks into the machinery to handle /// `Result` values to record such trap information. fn trap(_store: &mut dyn VMStore, _instance: InstanceId, code: u8) -> Result { - Err(wasmtime_environ::Trap::from_u8(code).unwrap().into()) + match CompiledTrap::from_u8(code).unwrap() { + CompiledTrap::Normal(trap) => Err(trap.into()), + CompiledTrap::InternalAssert => bail_bug!("internal assert hit in wasm"), + CompiledTrap::GcHeapCorrupt => bail_bug!("GC heap corruption detected"), + } } fn raise(store: &mut dyn VMStore, _instance: InstanceId) { diff --git a/crates/wasmtime/src/runtime/vm/traphandlers.rs b/crates/wasmtime/src/runtime/vm/traphandlers.rs index 3df7153d0136..afd9168ba633 100644 --- a/crates/wasmtime/src/runtime/vm/traphandlers.rs +++ b/crates/wasmtime/src/runtime/vm/traphandlers.rs @@ -391,7 +391,7 @@ pub enum TrapReason { faulting_addr: Option, /// The trap code associated with this trap. - trap: wasmtime_environ::Trap, + trap: wasmtime_environ::CompiledTrap, }, } @@ -970,7 +970,7 @@ impl CallThreadState { &self, TrapRegisters { pc, fp, .. }: TrapRegisters, faulting_addr: Option, - trap: wasmtime_environ::Trap, + trap: wasmtime_environ::CompiledTrap, ) { let mut unwind = UnwindReason::from(TrapReason::Jit { pc, diff --git a/src/commands/objdump.rs b/src/commands/objdump.rs index d5560f22c6bf..a81dc2a8be5f 100644 --- a/src/commands/objdump.rs +++ b/src/commands/objdump.rs @@ -11,8 +11,8 @@ use std::path::{Path, PathBuf}; use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor}; use wasmtime::{Engine, Result, bail, error::Context as _}; use wasmtime_environ::{ - FilePos, FrameInstPos, FrameStackShape, FrameStateSlot, FrameTable, FrameTableDescriptorIndex, - ModulePC, StackMap, Trap, obj, + CompiledTrap, FilePos, FrameInstPos, FrameStackShape, FrameStateSlot, FrameTable, + FrameTableDescriptorIndex, ModulePC, StackMap, obj, }; use wasmtime_unwinder::{ExceptionHandler, ExceptionTable}; @@ -429,7 +429,7 @@ enum Func { struct Decorator<'a> { objdump: &'a ObjdumpCommand, addrmap: Option + 'a>>>, - traps: Option + 'a>>>, + traps: Option + 'a>>>, stack_maps: Option)> + 'a>>>, exception_tables: Option, Vec)> + 'a>>>, diff --git a/tests/disas/arith.wat b/tests/disas/arith.wat index 4c11e3205104..c4b35bf67c17 100644 --- a/tests/disas/arith.wat +++ b/tests/disas/arith.wat @@ -25,7 +25,7 @@ ;; @0021 v3 = iconst.i32 4 ;; @0023 v4 = iconst.i32 4 ;; @0025 v5 = isub v3, v4 ; v3 = 4, v4 = 4 -;; @002c trapnz v5, user11 +;; @002c trapnz v5, user12 ;; @002a jump block4 ;; ;; block4: diff --git a/tests/disas/call-indirect.wat b/tests/disas/call-indirect.wat index 03eea1afdefb..728a32da4a41 100644 --- a/tests/disas/call-indirect.wat +++ b/tests/disas/call-indirect.wat @@ -30,7 +30,7 @@ ;; @0035 v11 = iadd v9, v10 ;; @0035 v12 = iconst.i64 0 ;; @0035 v13 = select_spectre_guard v7, v12, v11 ; v12 = 0 -;; @0035 v14 = load.i64 user5 aligned table v13 +;; @0035 v14 = load.i64 user6 aligned table v13 ;; v29 = iconst.i64 -2 ;; @0035 v15 = band v14, v29 ; v29 = -2 ;; @0035 brif v14, block3(v15), block2 @@ -44,9 +44,9 @@ ;; block3(v16: i64): ;; @0035 v22 = load.i64 notrap aligned readonly can_move v0+40 ;; @0035 v23 = load.i32 notrap aligned readonly can_move v22+4 -;; @0035 v24 = load.i32 user6 aligned readonly v16+16 +;; @0035 v24 = load.i32 user7 aligned readonly v16+16 ;; @0035 v25 = icmp eq v24, v23 -;; @0035 trapz v25, user7 +;; @0035 trapz v25, user8 ;; @0035 v26 = load.i64 notrap aligned readonly v16+8 ;; @0035 v27 = load.i64 notrap aligned readonly v16+24 ;; @0035 v28 = call_indirect sig0, v26(v27, v0, v2) diff --git a/tests/disas/component-model/direct-adapter-calls-inlining.wat b/tests/disas/component-model/direct-adapter-calls-inlining.wat index 3f45198ab215..321b7789ab41 100644 --- a/tests/disas/component-model/direct-adapter-calls-inlining.wat +++ b/tests/disas/component-model/direct-adapter-calls-inlining.wat @@ -94,7 +94,7 @@ ;; v20 = load.i64 notrap aligned readonly can_move v5+104 ;; v19 = iconst.i32 23 ;; call_indirect sig1, v21(v20, v5, v19) ; v19 = 23 -;; trap user11 +;; trap user12 ;; ;; block5: ;; v22 = load.i64 notrap aligned readonly can_move v5+112 diff --git a/tests/disas/component-model/direct-adapter-calls.wat b/tests/disas/component-model/direct-adapter-calls.wat index 278158af83f3..88678699446f 100644 --- a/tests/disas/component-model/direct-adapter-calls.wat +++ b/tests/disas/component-model/direct-adapter-calls.wat @@ -118,7 +118,7 @@ ;; @0081 v13 = load.i64 notrap aligned readonly can_move v0+104 ;; @007f v11 = iconst.i32 23 ;; @0081 call_indirect sig0, v14(v13, v0, v11) ; v11 = 23 -;; @0083 trap user11 +;; @0083 trap user12 ;; ;; block3: ;; @0085 v15 = load.i64 notrap aligned readonly can_move v0+112 diff --git a/tests/disas/conditional-traps.wat b/tests/disas/conditional-traps.wat index 3b05dafecbb0..afca9ed8e006 100644 --- a/tests/disas/conditional-traps.wat +++ b/tests/disas/conditional-traps.wat @@ -28,7 +28,7 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @0031 trapnz v2, user11 +;; @0031 trapnz v2, user12 ;; @002f jump block3 ;; ;; block3: @@ -48,7 +48,7 @@ ;; v5 = iconst.i32 0 ;; @0038 v3 = icmp eq v2, v5 ; v5 = 0 ;; @0038 v4 = uextend.i32 v3 -;; @003b trapnz v4, user11 +;; @003b trapnz v4, user12 ;; @0039 jump block3 ;; ;; block3: diff --git a/tests/disas/debug-exceptions.wat b/tests/disas/debug-exceptions.wat index 5937806cb9cc..a95b35ceb327 100644 --- a/tests/disas/debug-exceptions.wat +++ b/tests/disas/debug-exceptions.wat @@ -30,35 +30,35 @@ ;; ldr x0, [x0, #0x18] ;; mov x1, sp ;; cmp x1, x0 -;; b.lo #0x194 +;; b.lo #0x1c0 ;; 44: stur x2, [sp] ;; mov x0, x2 ;; stur x2, [sp, #0x10] ;; nop ;; ├─╼ debug frame state (after previous inst): func key DefinedWasmFunction(StaticModuleIndex(0), DefinedFuncIndex(0)), wasm PC 0x35, slot at FP-0xc0, locals , stack -;; ╰─╼ breakpoint patch: wasm PC 0x35, patch bytes [37, 1, 0, 148] +;; ╰─╼ breakpoint patch: wasm PC 0x35, patch bytes [46, 1, 0, 148] ;; ldur x0, [sp, #0x10] ;; nop ;; ├─╼ debug frame state (after previous inst): func key DefinedWasmFunction(StaticModuleIndex(0), DefinedFuncIndex(0)), wasm PC 0x37, slot at FP-0xc0, locals , stack -;; ╰─╼ breakpoint patch: wasm PC 0x37, patch bytes [35, 1, 0, 148] +;; ╰─╼ breakpoint patch: wasm PC 0x37, patch bytes [44, 1, 0, 148] ;; ldur x0, [sp, #0x10] ;; nop ;; ├─╼ debug frame state (after previous inst): func key DefinedWasmFunction(StaticModuleIndex(0), DefinedFuncIndex(0)), wasm PC 0x3d, slot at FP-0xc0, locals , stack -;; ╰─╼ breakpoint patch: wasm PC 0x3d, patch bytes [33, 1, 0, 148] +;; ╰─╼ breakpoint patch: wasm PC 0x3d, patch bytes [42, 1, 0, 148] ;; mov w19, #0x2a ;; stur w19, [sp, #8] ;; nop ;; ├─╼ debug frame state (after previous inst): func key DefinedWasmFunction(StaticModuleIndex(0), DefinedFuncIndex(0)), wasm PC 0x3f, slot at FP-0xc0, locals , stack I32 @ slot+0x8 -;; ╰─╼ breakpoint patch: wasm PC 0x3f, patch bytes [30, 1, 0, 148] +;; ╰─╼ breakpoint patch: wasm PC 0x3f, patch bytes [39, 1, 0, 148] ;; nop ;; ├─╼ debug frame state (after previous inst): func key DefinedWasmFunction(StaticModuleIndex(0), DefinedFuncIndex(0)), wasm PC 0x40, slot at FP-0xc0, locals , stack -;; ╰─╼ breakpoint patch: wasm PC 0x40, patch bytes [29, 1, 0, 148] +;; ╰─╼ breakpoint patch: wasm PC 0x40, patch bytes [38, 1, 0, 148] ;; stur w19, [sp, #8] ;; nop ;; ├─╼ debug frame state (after previous inst): func key DefinedWasmFunction(StaticModuleIndex(0), DefinedFuncIndex(0)), wasm PC 0x42, slot at FP-0xc0, locals , stack I32 @ slot+0x8 -;; ╰─╼ breakpoint patch: wasm PC 0x42, patch bytes [27, 1, 0, 148] +;; ╰─╼ breakpoint patch: wasm PC 0x42, patch bytes [36, 1, 0, 148] ;; ldur x2, [sp, #0x10] -;; bl #0x444 +;; bl #0x468 ;; 84: mov x20, x2 ;; mov w3, #0x4000000 ;; ldur x0, [sp, #0x10] @@ -67,64 +67,63 @@ ;; mov w5, #0x28 ;; mov w6, #8 ;; ldur x2, [sp, #0x10] -;; bl #0x368 +;; bl #0x38c ;; a8: ldur x0, [sp, #0x10] -;; ldr x5, [x0, #8] -;; ldr x6, [x5, #0x20] -;; stur x5, [sp, #0x20] -;; add x3, x6, #0x20 -;; str w19, [x3, w2, uxtw] -;; add x3, x6, #0x18 -;; mov x0, x20 +;; ldr x0, [x0, #8] +;; ldr x4, [x0, #0x20] +;; stur x0, [sp, #0x20] +;; add x0, x4, #0x20 +;; str w19, [x0, w2, uxtw] +;; add x0, x4, #0x18 +;; mov x1, x20 +;; str w1, [x0, w2, uxtw] +;; mov w0, #0 +;; add x3, x4, #0x1c +;; stur x4, [sp, #0x18] ;; str w0, [x3, w2, uxtw] -;; mov w3, #0 -;; add x4, x6, #0x1c -;; stur x6, [sp, #0x18] -;; str w3, [x4, w2, uxtw] ;; mov x3, x2 ;; ldur x2, [sp, #0x10] -;; bl #0x47c +;; bl #0x4a0 ;; ├─╼ exception frame offset: SP = FP - 0xc0 ;; ╰─╼ exception handler: tag=0, context at [SP+0x10], handler=0x100 ;; e8: mov w3, #9 ;; ldur x2, [sp, #0x10] -;; bl #0x3d8 +;; bl #0x3fc ;; f4: ldur x2, [sp, #0x10] -;; bl #0x410 +;; bl #0x434 ;; ╰─╼ debug frame state (after previous inst): func key DefinedWasmFunction(StaticModuleIndex(0), DefinedFuncIndex(0)), wasm PC 0x42, slot at FP-0xc0, locals , stack I32 @ slot+0x8 ;; fc: .byte 0x1f, 0xc1, 0x00, 0x00 -;; mov x2, x0 -;; mov w3, w2 -;; mov x4, #0x28 -;; adds x3, x3, x4 -;; cset x4, hs -;; tst w4, #0xff -;; b.ne #0x1ac -;; 11c: ldur x5, [sp, #0x20] -;; ldr x1, [x5, #0x28] -;; cmp x3, x1 -;; b.hi #0x1b0 -;; 12c: ldur x6, [sp, #0x18] -;; add x0, x6, #0x20 -;; ldr w0, [x0, w2, uxtw] +;; mov w2, w0 +;; mov x3, #0x28 +;; adds x2, x2, x3 +;; cset x3, hs +;; tst w3, #0xff +;; b.ne #0x1a8 +;; 118: ldur x1, [sp, #0x20] +;; ldr x3, [x1, #0x28] +;; cmp x2, x3 +;; b.hi #0x190 +;; 128: ldur x4, [sp, #0x18] +;; add x1, x4, #0x20 +;; ldr w0, [x1, w0, uxtw] ;; stur w0, [sp, #8] ;; ldur x0, [sp, #0x10] ;; nop ;; ├─╼ debug frame state (after previous inst): func key DefinedWasmFunction(StaticModuleIndex(0), DefinedFuncIndex(0)), wasm PC 0x48, slot at FP-0xc0, locals , stack I32 @ slot+0x8 -;; ╰─╼ breakpoint patch: wasm PC 0x48, patch bytes [233, 0, 0, 148] +;; ╰─╼ breakpoint patch: wasm PC 0x48, patch bytes [243, 0, 0, 148] ;; ldur x1, [sp, #0x10] ;; ldr x0, [x1, #0x38] ;; ldr x2, [x1, #0x48] ;; ldur x3, [sp, #0x10] ;; blr x0 ;; ╰─╼ debug frame state (after previous inst): func key DefinedWasmFunction(StaticModuleIndex(0), DefinedFuncIndex(0)), wasm PC 0x4a, slot at FP-0xc0, locals , stack I32 @ slot+0x8 -;; 158: ldur x0, [sp, #0x10] +;; 154: ldur x0, [sp, #0x10] ;; nop ;; ├─╼ debug frame state (after previous inst): func key DefinedWasmFunction(StaticModuleIndex(0), DefinedFuncIndex(0)), wasm PC 0x4a, slot at FP-0xc0, locals , stack I32 @ slot+0x8 -;; ╰─╼ breakpoint patch: wasm PC 0x4a, patch bytes [226, 0, 0, 148] +;; ╰─╼ breakpoint patch: wasm PC 0x4a, patch bytes [236, 0, 0, 148] ;; nop ;; ├─╼ debug frame state (after previous inst): func key DefinedWasmFunction(StaticModuleIndex(0), DefinedFuncIndex(0)), wasm PC 0x4b, slot at FP-0xc0, locals , stack -;; ╰─╼ breakpoint patch: wasm PC 0x4b, patch bytes [225, 0, 0, 148] +;; ╰─╼ breakpoint patch: wasm PC 0x4b, patch bytes [235, 0, 0, 148] ;; add sp, sp, #0x30 ;; ldp d8, d9, [sp], #0x10 ;; ldp d10, d11, [sp], #0x10 @@ -137,12 +136,24 @@ ;; ldp x27, x28, [sp], #0x10 ;; ldp x29, x30, [sp], #0x10 ;; ret -;; 194: stur x2, [sp, #0x10] -;; 198: mov w3, #0 -;; 19c: bl #0x3d8 -;; 1a0: ldur x2, [sp, #0x10] -;; 1a4: bl #0x410 +;; 190: mov w3, #0xfe +;; 194: ldur x2, [sp, #0x10] +;; 198: bl #0x3fc +;; 19c: ldur x2, [sp, #0x10] +;; 1a0: bl #0x434 +;; ╰─╼ debug frame state (after previous inst): func key DefinedWasmFunction(StaticModuleIndex(0), DefinedFuncIndex(0)), wasm PC 0x37, slot at FP-0xc0, locals , stack +;; 1a4: .byte 0x1f, 0xc1, 0x00, 0x00 +;; 1a8: mov w3, #0xfe +;; 1ac: ldur x2, [sp, #0x10] +;; 1b0: bl #0x3fc +;; 1b4: ldur x2, [sp, #0x10] +;; 1b8: bl #0x434 +;; ╰─╼ debug frame state (after previous inst): func key DefinedWasmFunction(StaticModuleIndex(0), DefinedFuncIndex(0)), wasm PC 0x37, slot at FP-0xc0, locals , stack +;; 1bc: .byte 0x1f, 0xc1, 0x00, 0x00 +;; 1c0: stur x2, [sp, #0x10] +;; 1c4: mov w3, #0 +;; 1c8: bl #0x3fc +;; 1cc: ldur x2, [sp, #0x10] +;; 1d0: bl #0x434 ;; ╰─╼ debug frame state (after previous inst): func key DefinedWasmFunction(StaticModuleIndex(0), DefinedFuncIndex(0)), wasm PC 0x34, slot at FP-0xc0, locals , stack -;; 1a8: .byte 0x1f, 0xc1, 0x00, 0x00 -;; 1ac: .byte 0x1f, 0xc1, 0x00, 0x00 -;; 1b0: .byte 0x1f, 0xc1, 0x00, 0x00 +;; 1d4: .byte 0x1f, 0xc1, 0x00, 0x00 diff --git a/tests/disas/duplicate-function-types.wat b/tests/disas/duplicate-function-types.wat index 05352ffdb3d5..0682b674494f 100644 --- a/tests/disas/duplicate-function-types.wat +++ b/tests/disas/duplicate-function-types.wat @@ -42,7 +42,7 @@ ;; @002d v11 = iadd v9, v10 ;; @002d v12 = iconst.i64 0 ;; @002d v13 = select_spectre_guard v7, v12, v11 ; v12 = 0 -;; @002d v14 = load.i64 user5 aligned table v13 +;; @002d v14 = load.i64 user6 aligned table v13 ;; v60 = iconst.i64 -2 ;; @002d v15 = band v14, v60 ; v60 = -2 ;; @002d brif v14, block3(v15), block2 @@ -56,9 +56,9 @@ ;; block3(v16: i64): ;; @002d v22 = load.i64 notrap aligned readonly can_move v0+40 ;; @002d v23 = load.i32 notrap aligned readonly can_move v22 -;; @002d v24 = load.i32 user6 aligned readonly v16+16 +;; @002d v24 = load.i32 user7 aligned readonly v16+16 ;; @002d v25 = icmp eq v24, v23 -;; @002d trapz v25, user7 +;; @002d trapz v25, user8 ;; @002d v26 = load.i64 notrap aligned readonly v16+8 ;; @002d v27 = load.i64 notrap aligned readonly v16+24 ;; @002d v28 = call_indirect sig0, v26(v27, v0) @@ -74,7 +74,7 @@ ;; @0032 v36 = iadd v34, v35 ;; @0032 v37 = iconst.i64 0 ;; @0032 v38 = select_spectre_guard v32, v37, v36 ; v37 = 0 -;; @0032 v39 = load.i64 user5 aligned table v38 +;; @0032 v39 = load.i64 user6 aligned table v38 ;; v54 = iconst.i64 -2 ;; @0032 v40 = band v39, v54 ; v54 = -2 ;; @0032 brif v39, block5(v40), block4 @@ -88,9 +88,9 @@ ;; block5(v41: i64): ;; @0032 v47 = load.i64 notrap aligned readonly can_move v0+40 ;; @0032 v48 = load.i32 notrap aligned readonly can_move v47 -;; @0032 v49 = load.i32 user6 aligned readonly v41+16 +;; @0032 v49 = load.i32 user7 aligned readonly v41+16 ;; @0032 v50 = icmp eq v49, v48 -;; @0032 trapz v50, user7 +;; @0032 trapz v50, user8 ;; @0032 v51 = load.i64 notrap aligned readonly v41+8 ;; @0032 v52 = load.i64 notrap aligned readonly v41+24 ;; @0032 v53 = call_indirect sig0, v51(v52, v0) diff --git a/tests/disas/gc/copying/array-fill.wat b/tests/disas/gc/copying/array-fill.wat index 978c00170b04..afc37e65d883 100644 --- a/tests/disas/gc/copying/array-fill.wat +++ b/tests/disas/gc/copying/array-fill.wat @@ -19,28 +19,28 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i64, v5: i32): -;; @0027 trapz v2, user15 +;; @0027 trapz v2, user16 ;; @0027 v41 = load.i64 notrap aligned readonly can_move v0+8 ;; @0027 v7 = load.i64 notrap aligned readonly can_move v41+32 ;; @0027 v6 = uextend.i64 v2 ;; @0027 v8 = iadd v7, v6 ;; @0027 v9 = iconst.i64 16 ;; @0027 v10 = iadd v8, v9 ; v9 = 16 -;; @0027 v11 = load.i32 notrap aligned readonly v10 -;; @0027 v12 = uadd_overflow_trap v3, v5, user16 +;; @0027 v11 = load.i32 user2 v10 +;; @0027 v12 = uadd_overflow_trap v3, v5, user17 ;; @0027 v13 = icmp ugt v12, v11 -;; @0027 trapnz v13, user16 +;; @0027 trapnz v13, user17 ;; @0027 v15 = uextend.i64 v11 ;; v43 = iconst.i64 3 ;; v44 = ishl v15, v43 ; v43 = 3 ;; v40 = iconst.i64 32 ;; @0027 v17 = ushr v44, v40 ; v40 = 32 -;; @0027 trapnz v17, user1 +;; @0027 trapnz v17, user2 ;; v53 = iconst.i32 3 ;; v54 = ishl v11, v53 ; v53 = 3 ;; @0027 v19 = iconst.i32 24 -;; @0027 v20 = uadd_overflow_trap v54, v19, user1 ; v19 = 24 -;; @0027 v24 = uadd_overflow_trap v2, v20, user1 +;; @0027 v20 = uadd_overflow_trap v54, v19, user2 ; v19 = 24 +;; @0027 v24 = uadd_overflow_trap v2, v20, user2 ;; @0027 v25 = uextend.i64 v24 ;; @0027 v27 = iadd v7, v25 ;; v60 = ishl v3, v53 ; v53 = 3 @@ -59,7 +59,7 @@ ;; @0027 brif v36, block4, block3 ;; ;; block3: -;; @0027 store.i64 notrap aligned little v4, v35 +;; @0027 store.i64 user2 little v4, v35 ;; v66 = iconst.i64 8 ;; v67 = iadd.i64 v35, v66 ; v66 = 8 ;; @0027 jump block2(v67) diff --git a/tests/disas/gc/copying/array-get-s.wat b/tests/disas/gc/copying/array-get-s.wat index 85e1a41e2d84..e29b2f755db6 100644 --- a/tests/disas/gc/copying/array-get-s.wat +++ b/tests/disas/gc/copying/array-get-s.wat @@ -19,30 +19,30 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32): -;; @0022 trapz v2, user15 +;; @0022 trapz v2, user16 ;; @0022 v34 = load.i64 notrap aligned readonly can_move v0+8 ;; @0022 v6 = load.i64 notrap aligned readonly can_move v34+32 ;; @0022 v5 = uextend.i64 v2 ;; @0022 v7 = iadd v6, v5 ;; @0022 v8 = iconst.i64 16 ;; @0022 v9 = iadd v7, v8 ; v8 = 16 -;; @0022 v10 = load.i32 notrap aligned readonly v9 +;; @0022 v10 = load.i32 user2 v9 ;; @0022 v11 = icmp ult v3, v10 -;; @0022 trapz v11, user16 +;; @0022 trapz v11, user17 ;; @0022 v13 = uextend.i64 v10 ;; v33 = iconst.i64 32 ;; @0022 v15 = ushr v13, v33 ; v33 = 32 -;; @0022 trapnz v15, user1 +;; @0022 trapnz v15, user2 ;; @0022 v17 = iconst.i32 20 -;; @0022 v18 = uadd_overflow_trap v10, v17, user1 ; v17 = 20 -;; @0022 v22 = uadd_overflow_trap v2, v18, user1 +;; @0022 v18 = uadd_overflow_trap v10, v17, user2 ; v17 = 20 +;; @0022 v22 = uadd_overflow_trap v2, v18, user2 ;; @0022 v23 = uextend.i64 v22 ;; @0022 v25 = iadd v6, v23 ;; @0022 v21 = iadd v3, v17 ; v17 = 20 ;; @0022 v26 = isub v18, v21 ;; @0022 v27 = uextend.i64 v26 ;; @0022 v28 = isub v25, v27 -;; @0022 v29 = load.i8 notrap aligned little v28 +;; @0022 v29 = load.i8 user2 little v28 ;; @0025 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/copying/array-get-u.wat b/tests/disas/gc/copying/array-get-u.wat index cf48d8a2ee45..99653395a049 100644 --- a/tests/disas/gc/copying/array-get-u.wat +++ b/tests/disas/gc/copying/array-get-u.wat @@ -19,30 +19,30 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32): -;; @0022 trapz v2, user15 +;; @0022 trapz v2, user16 ;; @0022 v34 = load.i64 notrap aligned readonly can_move v0+8 ;; @0022 v6 = load.i64 notrap aligned readonly can_move v34+32 ;; @0022 v5 = uextend.i64 v2 ;; @0022 v7 = iadd v6, v5 ;; @0022 v8 = iconst.i64 16 ;; @0022 v9 = iadd v7, v8 ; v8 = 16 -;; @0022 v10 = load.i32 notrap aligned readonly v9 +;; @0022 v10 = load.i32 user2 v9 ;; @0022 v11 = icmp ult v3, v10 -;; @0022 trapz v11, user16 +;; @0022 trapz v11, user17 ;; @0022 v13 = uextend.i64 v10 ;; v33 = iconst.i64 32 ;; @0022 v15 = ushr v13, v33 ; v33 = 32 -;; @0022 trapnz v15, user1 +;; @0022 trapnz v15, user2 ;; @0022 v17 = iconst.i32 20 -;; @0022 v18 = uadd_overflow_trap v10, v17, user1 ; v17 = 20 -;; @0022 v22 = uadd_overflow_trap v2, v18, user1 +;; @0022 v18 = uadd_overflow_trap v10, v17, user2 ; v17 = 20 +;; @0022 v22 = uadd_overflow_trap v2, v18, user2 ;; @0022 v23 = uextend.i64 v22 ;; @0022 v25 = iadd v6, v23 ;; @0022 v21 = iadd v3, v17 ; v17 = 20 ;; @0022 v26 = isub v18, v21 ;; @0022 v27 = uextend.i64 v26 ;; @0022 v28 = isub v25, v27 -;; @0022 v29 = load.i8 notrap aligned little v28 +;; @0022 v29 = load.i8 user2 little v28 ;; @0025 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/copying/array-get.wat b/tests/disas/gc/copying/array-get.wat index d943abc4a37d..b6d9c5e1fa01 100644 --- a/tests/disas/gc/copying/array-get.wat +++ b/tests/disas/gc/copying/array-get.wat @@ -19,27 +19,27 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32): -;; @0022 trapz v2, user15 +;; @0022 trapz v2, user16 ;; @0022 v33 = load.i64 notrap aligned readonly can_move v0+8 ;; @0022 v6 = load.i64 notrap aligned readonly can_move v33+32 ;; @0022 v5 = uextend.i64 v2 ;; @0022 v7 = iadd v6, v5 ;; @0022 v8 = iconst.i64 16 ;; @0022 v9 = iadd v7, v8 ; v8 = 16 -;; @0022 v10 = load.i32 notrap aligned readonly v9 +;; @0022 v10 = load.i32 user2 v9 ;; @0022 v11 = icmp ult v3, v10 -;; @0022 trapz v11, user16 +;; @0022 trapz v11, user17 ;; @0022 v13 = uextend.i64 v10 ;; v35 = iconst.i64 3 ;; v36 = ishl v13, v35 ; v35 = 3 ;; v32 = iconst.i64 32 ;; @0022 v15 = ushr v36, v32 ; v32 = 32 -;; @0022 trapnz v15, user1 +;; @0022 trapnz v15, user2 ;; v45 = iconst.i32 3 ;; v46 = ishl v10, v45 ; v45 = 3 ;; @0022 v17 = iconst.i32 24 -;; @0022 v18 = uadd_overflow_trap v46, v17, user1 ; v17 = 24 -;; @0022 v22 = uadd_overflow_trap v2, v18, user1 +;; @0022 v18 = uadd_overflow_trap v46, v17, user2 ; v17 = 24 +;; @0022 v22 = uadd_overflow_trap v2, v18, user2 ;; @0022 v23 = uextend.i64 v22 ;; @0022 v25 = iadd v6, v23 ;; v52 = ishl v3, v45 ; v45 = 3 @@ -47,7 +47,7 @@ ;; @0022 v26 = isub v18, v21 ;; @0022 v27 = uextend.i64 v26 ;; @0022 v28 = isub v25, v27 -;; @0022 v29 = load.i64 notrap aligned little v28 +;; @0022 v29 = load.i64 user2 little v28 ;; @0025 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/copying/array-len.wat b/tests/disas/gc/copying/array-len.wat index e7ad10b65bdb..f44db43ff45b 100644 --- a/tests/disas/gc/copying/array-len.wat +++ b/tests/disas/gc/copying/array-len.wat @@ -19,14 +19,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @001f trapz v2, user15 +;; @001f trapz v2, user16 ;; @001f v10 = load.i64 notrap aligned readonly can_move v0+8 ;; @001f v5 = load.i64 notrap aligned readonly can_move v10+32 ;; @001f v4 = uextend.i64 v2 ;; @001f v6 = iadd v5, v4 ;; @001f v7 = iconst.i64 16 ;; @001f v8 = iadd v6, v7 ; v7 = 16 -;; @001f v9 = load.i32 notrap aligned readonly v8 +;; @001f v9 = load.i32 user2 v8 ;; @0021 jump block1 ;; ;; block1: 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.wat index d73275c023b8..5ca1fa830f4b 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 @@ -42,19 +42,19 @@ ;; @0025 v22 = iadd v20, v21 ;; v37 = iconst.i64 16 ;; @0025 v23 = iadd v22, v37 ; v37 = 16 -;; @0025 store notrap aligned v6, v23 ; v6 = 3 +;; @0025 store user2 v6, v23 ; v6 = 3 ;; v33 = load.i32 notrap v44 ;; v58 = iconst.i64 20 ;; v63 = iadd v22, v58 ; v58 = 20 -;; @0025 store notrap aligned little v33, v63 +;; @0025 store user2 little v33, v63 ;; v32 = load.i32 notrap v43 ;; v66 = iconst.i64 24 ;; v71 = iadd v22, v66 ; v66 = 24 -;; @0025 store notrap aligned little v32, v71 +;; @0025 store user2 little v32, v71 ;; v31 = load.i32 notrap v42 ;; v87 = iconst.i64 28 ;; v92 = iadd v22, v87 ; v87 = 28 -;; @0025 store notrap aligned little v31, v92 +;; @0025 store user2 little v31, v92 ;; @0029 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/copying/array-new-fixed.wat b/tests/disas/gc/copying/array-new-fixed.wat index 726abb420411..5928563469de 100644 --- a/tests/disas/gc/copying/array-new-fixed.wat +++ b/tests/disas/gc/copying/array-new-fixed.wat @@ -33,16 +33,16 @@ ;; @0025 v22 = iadd v20, v21 ;; v31 = iconst.i64 16 ;; @0025 v23 = iadd v22, v31 ; v31 = 16 -;; @0025 store notrap aligned v6, v23 ; v6 = 3 +;; @0025 store user2 v6, v23 ; v6 = 3 ;; v37 = iconst.i64 24 ;; v51 = iadd v22, v37 ; v37 = 24 -;; @0025 store notrap aligned little v2, v51 +;; @0025 store user2 little v2, v51 ;; v34 = iconst.i64 32 ;; v58 = iadd v22, v34 ; v34 = 32 -;; @0025 store notrap aligned little v3, v58 +;; @0025 store user2 little v3, v58 ;; v73 = iconst.i64 40 ;; v78 = iadd v22, v73 ; v73 = 40 -;; @0025 store notrap aligned little v4, v78 +;; @0025 store user2 little v4, v78 ;; @0029 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/copying/array-new.wat b/tests/disas/gc/copying/array-new.wat index 8f5539acc1d7..e086966824f5 100644 --- a/tests/disas/gc/copying/array-new.wat +++ b/tests/disas/gc/copying/array-new.wat @@ -25,11 +25,11 @@ ;; v38 = ishl v6, v37 ; v37 = 3 ;; v35 = iconst.i64 32 ;; @0022 v8 = ushr v38, v35 ; v35 = 32 -;; @0022 trapnz v8, user17 +;; @0022 trapnz v8, user18 ;; @0022 v5 = iconst.i32 24 ;; v44 = iconst.i32 3 ;; v45 = ishl v3, v44 ; v44 = 3 -;; @0022 v10 = uadd_overflow_trap v5, v45, user17 ; v5 = 24 +;; @0022 v10 = uadd_overflow_trap v5, v45, user18 ; v5 = 24 ;; @0022 v12 = iconst.i32 -1476395008 ;; @0022 v14 = load.i64 notrap aligned readonly can_move v0+40 ;; @0022 v15 = load.i32 notrap aligned readonly can_move v14 @@ -41,7 +41,7 @@ ;; @0022 v20 = iadd v18, v19 ;; v32 = iconst.i64 16 ;; @0022 v21 = iadd v20, v32 ; v32 = 16 -;; @0022 store notrap aligned v3, v21 +;; @0022 store user2 v3, v21 ;; v49 = iconst.i64 24 ;; v54 = iadd v20, v49 ; v49 = 24 ;; @0022 v27 = uextend.i64 v10 @@ -54,7 +54,7 @@ ;; @0022 brif v30, block4, block3 ;; ;; block3: -;; @0022 store.i64 notrap aligned little v2, v29 +;; @0022 store.i64 user2 little v2, v29 ;; v59 = iconst.i64 8 ;; v60 = iadd.i64 v29, v59 ; v59 = 8 ;; @0022 jump block2(v60) diff --git a/tests/disas/gc/copying/array-set.wat b/tests/disas/gc/copying/array-set.wat index 9e98afd8e5ae..edc20f9ee65b 100644 --- a/tests/disas/gc/copying/array-set.wat +++ b/tests/disas/gc/copying/array-set.wat @@ -19,27 +19,27 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i64): -;; @0024 trapz v2, user15 +;; @0024 trapz v2, user16 ;; @0024 v32 = load.i64 notrap aligned readonly can_move v0+8 ;; @0024 v6 = load.i64 notrap aligned readonly can_move v32+32 ;; @0024 v5 = uextend.i64 v2 ;; @0024 v7 = iadd v6, v5 ;; @0024 v8 = iconst.i64 16 ;; @0024 v9 = iadd v7, v8 ; v8 = 16 -;; @0024 v10 = load.i32 notrap aligned readonly v9 +;; @0024 v10 = load.i32 user2 v9 ;; @0024 v11 = icmp ult v3, v10 -;; @0024 trapz v11, user16 +;; @0024 trapz v11, user17 ;; @0024 v13 = uextend.i64 v10 ;; v34 = iconst.i64 3 ;; v35 = ishl v13, v34 ; v34 = 3 ;; v31 = iconst.i64 32 ;; @0024 v15 = ushr v35, v31 ; v31 = 32 -;; @0024 trapnz v15, user1 +;; @0024 trapnz v15, user2 ;; v44 = iconst.i32 3 ;; v45 = ishl v10, v44 ; v44 = 3 ;; @0024 v17 = iconst.i32 24 -;; @0024 v18 = uadd_overflow_trap v45, v17, user1 ; v17 = 24 -;; @0024 v22 = uadd_overflow_trap v2, v18, user1 +;; @0024 v18 = uadd_overflow_trap v45, v17, user2 ; v17 = 24 +;; @0024 v22 = uadd_overflow_trap v2, v18, user2 ;; @0024 v23 = uextend.i64 v22 ;; @0024 v25 = iadd v6, v23 ;; v51 = ishl v3, v44 ; v44 = 3 @@ -47,7 +47,7 @@ ;; @0024 v26 = isub v18, v21 ;; @0024 v27 = uextend.i64 v26 ;; @0024 v28 = isub v25, v27 -;; @0024 store notrap aligned little v4, v28 +;; @0024 store user2 little v4, v28 ;; @0027 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/copying/br-on-cast-fail.wat b/tests/disas/gc/copying/br-on-cast-fail.wat index 870ebdd429db..bbfe2aa2f706 100644 --- a/tests/disas/gc/copying/br-on-cast-fail.wat +++ b/tests/disas/gc/copying/br-on-cast-fail.wat @@ -50,7 +50,7 @@ ;; @002e v15 = iadd v14, v13 ;; @002e v16 = iconst.i64 4 ;; @002e v17 = iadd v15, v16 ; v16 = 4 -;; @002e v18 = load.i32 notrap aligned readonly v17 +;; @002e v18 = load.i32 user2 v17 ;; @002e v11 = load.i64 notrap aligned readonly can_move v0+40 ;; @002e v12 = load.i32 notrap aligned readonly can_move v11 ;; @002e v19 = icmp eq v18, v12 diff --git a/tests/disas/gc/copying/br-on-cast.wat b/tests/disas/gc/copying/br-on-cast.wat index 749a37889aea..e280f4bab640 100644 --- a/tests/disas/gc/copying/br-on-cast.wat +++ b/tests/disas/gc/copying/br-on-cast.wat @@ -50,7 +50,7 @@ ;; @002f v15 = iadd v14, v13 ;; @002f v16 = iconst.i64 4 ;; @002f v17 = iadd v15, v16 ; v16 = 4 -;; @002f v18 = load.i32 notrap aligned readonly v17 +;; @002f v18 = load.i32 user2 v17 ;; @002f v11 = load.i64 notrap aligned readonly can_move v0+40 ;; @002f v12 = load.i32 notrap aligned readonly can_move v11 ;; @002f v19 = icmp eq v18, v12 diff --git a/tests/disas/gc/copying/call-indirect-and-subtyping.wat b/tests/disas/gc/copying/call-indirect-and-subtyping.wat index ae9499242888..1b3d1758ce15 100644 --- a/tests/disas/gc/copying/call-indirect-and-subtyping.wat +++ b/tests/disas/gc/copying/call-indirect-and-subtyping.wat @@ -38,7 +38,7 @@ ;; @005c v7 = ishl v5, v30 ; v30 = 3 ;; @005c v8 = iadd v6, v7 ;; @005c v10 = select_spectre_guard v4, v9, v8 ; v9 = 0 -;; @005c v11 = load.i64 user5 aligned table v10 +;; @005c v11 = load.i64 user6 aligned table v10 ;; v29 = iconst.i64 -2 ;; @005c v12 = band v11, v29 ; v29 = -2 ;; @005c brif v11, block3(v12), block2 @@ -49,7 +49,7 @@ ;; @005c jump block3(v17) ;; ;; block3(v13: i64): -;; @005c v21 = load.i32 user6 aligned readonly v13+16 +;; @005c v21 = load.i32 user7 aligned readonly v13+16 ;; @005c v19 = load.i64 notrap aligned readonly can_move v0+40 ;; @005c v20 = load.i32 notrap aligned readonly can_move v19 ;; @005c v22 = icmp eq v21, v20 @@ -61,7 +61,7 @@ ;; @005c jump block5(v25) ;; ;; block5(v26: i32): -;; @005c trapz v26, user7 +;; @005c trapz v26, user8 ;; @005c v27 = load.i64 notrap aligned readonly v13+8 ;; @005c v28 = load.i64 notrap aligned readonly v13+24 ;; @005c call_indirect sig0, v27(v28, v0) diff --git a/tests/disas/gc/copying/funcref-in-gc-heap-get.wat b/tests/disas/gc/copying/funcref-in-gc-heap-get.wat index fa9b4401baa2..bb3c5b6de0b3 100644 --- a/tests/disas/gc/copying/funcref-in-gc-heap-get.wat +++ b/tests/disas/gc/copying/funcref-in-gc-heap-get.wat @@ -21,14 +21,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @0020 trapz v2, user15 +;; @0020 trapz v2, user16 ;; @0020 v13 = load.i64 notrap aligned readonly can_move v0+8 ;; @0020 v5 = load.i64 notrap aligned readonly can_move v13+32 ;; @0020 v4 = uextend.i64 v2 ;; @0020 v6 = iadd v5, v4 ;; @0020 v7 = iconst.i64 16 ;; @0020 v8 = iadd v6, v7 ; v7 = 16 -;; @0020 v11 = load.i32 notrap aligned little v8 +;; @0020 v11 = load.i32 user2 little v8 ;; @0020 v9 = iconst.i32 -1 ;; @0020 v12 = call fn0(v0, v11, v9) ; v9 = -1 ;; @0024 jump block1 diff --git a/tests/disas/gc/copying/funcref-in-gc-heap-new.wat b/tests/disas/gc/copying/funcref-in-gc-heap-new.wat index 08b5e03b1953..0e1593a9d103 100644 --- a/tests/disas/gc/copying/funcref-in-gc-heap-new.wat +++ b/tests/disas/gc/copying/funcref-in-gc-heap-new.wat @@ -39,7 +39,7 @@ ;; @0020 v14 = iadd v12, v13 ;; v22 = iconst.i64 16 ;; @0020 v15 = iadd v14, v22 ; v22 = 16 -;; @0020 store notrap aligned little v18, v15 +;; @0020 store user2 little v18, v15 ;; v19 = load.i32 notrap v26 ;; @0023 jump block1 ;; diff --git a/tests/disas/gc/copying/funcref-in-gc-heap-set.wat b/tests/disas/gc/copying/funcref-in-gc-heap-set.wat index 4555355a152b..2e9835209ca8 100644 --- a/tests/disas/gc/copying/funcref-in-gc-heap-set.wat +++ b/tests/disas/gc/copying/funcref-in-gc-heap-set.wat @@ -21,7 +21,7 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i64): -;; @0022 trapz v2, user15 +;; @0022 trapz v2, user16 ;; @0022 v10 = call fn0(v0, v3) ;; @0022 v11 = ireduce.i32 v10 ;; @0022 v12 = load.i64 notrap aligned readonly can_move v0+8 @@ -30,7 +30,7 @@ ;; @0022 v6 = iadd v5, v4 ;; @0022 v7 = iconst.i64 16 ;; @0022 v8 = iadd v6, v7 ; v7 = 16 -;; @0022 store notrap aligned little v11, v8 +;; @0022 store user2 little v11, v8 ;; @0026 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/copying/multiple-array-get.wat b/tests/disas/gc/copying/multiple-array-get.wat index 24d7d3b0f6e5..cc531852beb0 100644 --- a/tests/disas/gc/copying/multiple-array-get.wat +++ b/tests/disas/gc/copying/multiple-array-get.wat @@ -20,27 +20,27 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32): -;; @0024 trapz v2, user15 +;; @0024 trapz v2, user16 ;; @0024 v65 = load.i64 notrap aligned readonly can_move v0+8 ;; @0024 v8 = load.i64 notrap aligned readonly can_move v65+32 ;; @0024 v7 = uextend.i64 v2 ;; @0024 v9 = iadd v8, v7 ;; @0024 v10 = iconst.i64 16 ;; @0024 v11 = iadd v9, v10 ; v10 = 16 -;; @0024 v12 = load.i32 notrap aligned readonly v11 +;; @0024 v12 = load.i32 user2 v11 ;; @0024 v13 = icmp ult v3, v12 -;; @0024 trapz v13, user16 +;; @0024 trapz v13, user17 ;; @0024 v15 = uextend.i64 v12 ;; v67 = iconst.i64 3 ;; v68 = ishl v15, v67 ; v67 = 3 ;; v64 = iconst.i64 32 ;; @0024 v17 = ushr v68, v64 ; v64 = 32 -;; @0024 trapnz v17, user1 +;; @0024 trapnz v17, user2 ;; v77 = iconst.i32 3 ;; v78 = ishl v12, v77 ; v77 = 3 ;; @0024 v19 = iconst.i32 24 -;; @0024 v20 = uadd_overflow_trap v78, v19, user1 ; v19 = 24 -;; @0024 v24 = uadd_overflow_trap v2, v20, user1 +;; @0024 v20 = uadd_overflow_trap v78, v19, user2 ; v19 = 24 +;; @0024 v24 = uadd_overflow_trap v2, v20, user2 ;; @0024 v25 = uextend.i64 v24 ;; @0024 v27 = iadd v8, v25 ;; v84 = ishl v3, v77 ; v77 = 3 @@ -48,15 +48,15 @@ ;; @0024 v28 = isub v20, v23 ;; @0024 v29 = uextend.i64 v28 ;; @0024 v30 = isub v27, v29 -;; @0024 v31 = load.i64 notrap aligned little v30 +;; @0024 v31 = load.i64 user2 little v30 ;; @002b v38 = icmp ult v4, v12 -;; @002b trapz v38, user16 +;; @002b trapz v38, user17 ;; v86 = ishl v4, v77 ; v77 = 3 ;; @002b v48 = iadd v86, v19 ; v19 = 24 ;; @002b v53 = isub v20, v48 ;; @002b v54 = uextend.i64 v53 ;; @002b v55 = isub v27, v54 -;; @002b v56 = load.i64 notrap aligned little v55 +;; @002b v56 = load.i64 user2 little v55 ;; @002e jump block1 ;; ;; block1: diff --git a/tests/disas/gc/copying/multiple-struct-get.wat b/tests/disas/gc/copying/multiple-struct-get.wat index a7cc16ec1f37..8f70d28037b3 100644 --- a/tests/disas/gc/copying/multiple-struct-get.wat +++ b/tests/disas/gc/copying/multiple-struct-get.wat @@ -21,17 +21,17 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @0023 trapz v2, user15 +;; @0023 trapz v2, user16 ;; @0023 v20 = load.i64 notrap aligned readonly can_move v0+8 ;; @0023 v6 = load.i64 notrap aligned readonly can_move v20+32 ;; @0023 v5 = uextend.i64 v2 ;; @0023 v7 = iadd v6, v5 ;; @0023 v8 = iconst.i64 16 ;; @0023 v9 = iadd v7, v8 ; v8 = 16 -;; @0023 v10 = load.f32 notrap aligned little v9 +;; @0023 v10 = load.f32 user2 little v9 ;; @0029 v14 = iconst.i64 20 ;; @0029 v15 = iadd v7, v14 ; v14 = 20 -;; @0029 v16 = load.i8 notrap aligned little v15 +;; @0029 v16 = load.i8 user2 little v15 ;; @002d jump block1 ;; ;; block1: diff --git a/tests/disas/gc/copying/ref-cast.wat b/tests/disas/gc/copying/ref-cast.wat index 03df9934f193..211c3cad172b 100644 --- a/tests/disas/gc/copying/ref-cast.wat +++ b/tests/disas/gc/copying/ref-cast.wat @@ -41,7 +41,7 @@ ;; @001e v15 = iadd v14, v13 ;; @001e v16 = iconst.i64 4 ;; @001e v17 = iadd v15, v16 ; v16 = 4 -;; @001e v18 = load.i32 notrap aligned readonly v17 +;; @001e v18 = load.i32 user2 v17 ;; @001e v11 = load.i64 notrap aligned readonly can_move v0+40 ;; @001e v12 = load.i32 notrap aligned readonly can_move v11 ;; @001e v19 = icmp eq v18, v12 @@ -56,7 +56,7 @@ ;; @001e jump block4(v23) ;; ;; block4(v24: i32): -;; @001e trapz v24, user18 +;; @001e trapz v24, user19 ;; v25 = load.i32 notrap v36 ;; @0021 jump block1 ;; diff --git a/tests/disas/gc/copying/ref-test-array.wat b/tests/disas/gc/copying/ref-test-array.wat index 2fdd661104de..878f9ea872ea 100644 --- a/tests/disas/gc/copying/ref-test-array.wat +++ b/tests/disas/gc/copying/ref-test-array.wat @@ -33,7 +33,7 @@ ;; @001b v11 = load.i64 notrap aligned readonly can_move v21+32 ;; @001b v10 = uextend.i64 v2 ;; @001b v12 = iadd v11, v10 -;; @001b v15 = load.i32 notrap aligned readonly v12 +;; @001b v15 = load.i32 user2 v12 ;; @001b v16 = iconst.i32 -1476395008 ;; @001b v17 = band v15, v16 ; v16 = -1476395008 ;; @001b v18 = icmp eq v17, v16 ; v16 = -1476395008 diff --git a/tests/disas/gc/copying/ref-test-concrete-func-type.wat b/tests/disas/gc/copying/ref-test-concrete-func-type.wat index a90fec130790..06a2f9390fbd 100644 --- a/tests/disas/gc/copying/ref-test-concrete-func-type.wat +++ b/tests/disas/gc/copying/ref-test-concrete-func-type.wat @@ -27,7 +27,7 @@ ;; @0020 jump block3 ;; ;; block3: -;; @0020 v10 = load.i32 notrap aligned readonly v2+16 +;; @0020 v10 = load.i32 user2 v2+16 ;; @0020 v8 = load.i64 notrap aligned readonly can_move v0+40 ;; @0020 v9 = load.i32 notrap aligned readonly can_move v8 ;; @0020 v11 = icmp eq v10, v9 diff --git a/tests/disas/gc/copying/ref-test-concrete-type.wat b/tests/disas/gc/copying/ref-test-concrete-type.wat index b61febcda020..cd17e94ac478 100644 --- a/tests/disas/gc/copying/ref-test-concrete-type.wat +++ b/tests/disas/gc/copying/ref-test-concrete-type.wat @@ -38,7 +38,7 @@ ;; @001d v15 = iadd v14, v13 ;; @001d v16 = iconst.i64 4 ;; @001d v17 = iadd v15, v16 ; v16 = 4 -;; @001d v18 = load.i32 notrap aligned readonly v17 +;; @001d v18 = load.i32 user2 v17 ;; @001d v11 = load.i64 notrap aligned readonly can_move v0+40 ;; @001d v12 = load.i32 notrap aligned readonly can_move v11 ;; @001d v19 = icmp eq v18, v12 diff --git a/tests/disas/gc/copying/ref-test-eq.wat b/tests/disas/gc/copying/ref-test-eq.wat index 1e7b56465e73..ca4d16e9f5ce 100644 --- a/tests/disas/gc/copying/ref-test-eq.wat +++ b/tests/disas/gc/copying/ref-test-eq.wat @@ -32,7 +32,7 @@ ;; @001b v11 = load.i64 notrap aligned readonly can_move v21+32 ;; @001b v10 = uextend.i64 v2 ;; @001b v12 = iadd v11, v10 -;; @001b v15 = load.i32 notrap aligned readonly v12 +;; @001b v15 = load.i32 user2 v12 ;; @001b v16 = iconst.i32 -1610612736 ;; @001b v17 = band v15, v16 ; v16 = -1610612736 ;; @001b v18 = icmp eq v17, v16 ; v16 = -1610612736 diff --git a/tests/disas/gc/copying/ref-test-struct.wat b/tests/disas/gc/copying/ref-test-struct.wat index 9dfa56397f0c..92bd81fd01d9 100644 --- a/tests/disas/gc/copying/ref-test-struct.wat +++ b/tests/disas/gc/copying/ref-test-struct.wat @@ -33,7 +33,7 @@ ;; @001b v11 = load.i64 notrap aligned readonly can_move v21+32 ;; @001b v10 = uextend.i64 v2 ;; @001b v12 = iadd v11, v10 -;; @001b v15 = load.i32 notrap aligned readonly v12 +;; @001b v15 = load.i32 user2 v12 ;; @001b v16 = iconst.i32 -1342177280 ;; @001b v17 = band v15, v16 ; v16 = -1342177280 ;; @001b v18 = icmp eq v17, v16 ; v16 = -1342177280 diff --git a/tests/disas/gc/copying/struct-get.wat b/tests/disas/gc/copying/struct-get.wat index f9c33ecc017b..5ea9a9ec983f 100644 --- a/tests/disas/gc/copying/struct-get.wat +++ b/tests/disas/gc/copying/struct-get.wat @@ -33,14 +33,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @0033 trapz v2, user15 +;; @0033 trapz v2, user16 ;; @0033 v10 = load.i64 notrap aligned readonly can_move v0+8 ;; @0033 v5 = load.i64 notrap aligned readonly can_move v10+32 ;; @0033 v4 = uextend.i64 v2 ;; @0033 v6 = iadd v5, v4 ;; @0033 v7 = iconst.i64 16 ;; @0033 v8 = iadd v6, v7 ; v7 = 16 -;; @0033 v9 = load.f32 notrap aligned little v8 +;; @0033 v9 = load.f32 user2 little v8 ;; @0037 jump block1 ;; ;; block1: @@ -58,14 +58,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @003c trapz v2, user15 +;; @003c trapz v2, user16 ;; @003c v11 = load.i64 notrap aligned readonly can_move v0+8 ;; @003c v5 = load.i64 notrap aligned readonly can_move v11+32 ;; @003c v4 = uextend.i64 v2 ;; @003c v6 = iadd v5, v4 ;; @003c v7 = iconst.i64 20 ;; @003c v8 = iadd v6, v7 ; v7 = 20 -;; @003c v9 = load.i8 notrap aligned little v8 +;; @003c v9 = load.i8 user2 little v8 ;; @0040 jump block1 ;; ;; block1: @@ -84,14 +84,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @0045 trapz v2, user15 +;; @0045 trapz v2, user16 ;; @0045 v11 = load.i64 notrap aligned readonly can_move v0+8 ;; @0045 v5 = load.i64 notrap aligned readonly can_move v11+32 ;; @0045 v4 = uextend.i64 v2 ;; @0045 v6 = iadd v5, v4 ;; @0045 v7 = iconst.i64 20 ;; @0045 v8 = iadd v6, v7 ; v7 = 20 -;; @0045 v9 = load.i8 notrap aligned little v8 +;; @0045 v9 = load.i8 user2 little v8 ;; @0049 jump block1 ;; ;; block1: @@ -110,14 +110,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @004e trapz v2, user15 +;; @004e trapz v2, user16 ;; @004e v10 = load.i64 notrap aligned readonly can_move v0+8 ;; @004e v5 = load.i64 notrap aligned readonly can_move v10+32 ;; @004e v4 = uextend.i64 v2 ;; @004e v6 = iadd v5, v4 ;; @004e v7 = iconst.i64 24 ;; @004e v8 = iadd v6, v7 ; v7 = 24 -;; @004e v9 = load.i32 notrap aligned little v8 +;; @004e v9 = load.i32 user2 little v8 ;; @0052 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/copying/struct-new-default.wat b/tests/disas/gc/copying/struct-new-default.wat index 5d0cf530968f..4f716339d093 100644 --- a/tests/disas/gc/copying/struct-new-default.wat +++ b/tests/disas/gc/copying/struct-new-default.wat @@ -35,14 +35,14 @@ ;; @0021 v16 = iadd v14, v15 ;; v22 = iconst.i64 16 ;; @0021 v17 = iadd v16, v22 ; v22 = 16 -;; @0021 store notrap aligned little v3, v17 ; v3 = 0.0 +;; @0021 store user2 little v3, v17 ; v3 = 0.0 ;; @0021 v4 = iconst.i32 0 ;; v21 = iconst.i64 20 ;; @0021 v18 = iadd v16, v21 ; v21 = 20 -;; @0021 istore8 notrap aligned little v4, v18 ; v4 = 0 +;; @0021 istore8 user2 little v4, v18 ; v4 = 0 ;; v20 = iconst.i64 24 ;; @0021 v19 = iadd v16, v20 ; v20 = 24 -;; @0021 store notrap aligned little v4, v19 ; v4 = 0 +;; @0021 store user2 little v4, v19 ; v4 = 0 ;; @0024 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/copying/struct-new.wat b/tests/disas/gc/copying/struct-new.wat index ee3b8c7a8d27..bdadffcc2d6f 100644 --- a/tests/disas/gc/copying/struct-new.wat +++ b/tests/disas/gc/copying/struct-new.wat @@ -37,14 +37,14 @@ ;; @002a v16 = iadd v14, v15 ;; v24 = iconst.i64 16 ;; @002a v17 = iadd v16, v24 ; v24 = 16 -;; @002a store notrap aligned little v2, v17 +;; @002a store user2 little v2, v17 ;; v23 = iconst.i64 20 ;; @002a v18 = iadd v16, v23 ; v23 = 20 -;; @002a istore8 notrap aligned little v3, v18 +;; @002a istore8 user2 little v3, v18 ;; v20 = load.i32 notrap v27 ;; v22 = iconst.i64 24 ;; @002a v19 = iadd v16, v22 ; v22 = 24 -;; @002a store notrap aligned little v20, v19 +;; @002a store user2 little v20, v19 ;; @002d jump block1 ;; ;; block1: diff --git a/tests/disas/gc/copying/struct-set.wat b/tests/disas/gc/copying/struct-set.wat index 1a6b8bfcd529..7173bec35719 100644 --- a/tests/disas/gc/copying/struct-set.wat +++ b/tests/disas/gc/copying/struct-set.wat @@ -29,14 +29,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: f32): -;; @0034 trapz v2, user15 +;; @0034 trapz v2, user16 ;; @0034 v9 = load.i64 notrap aligned readonly can_move v0+8 ;; @0034 v5 = load.i64 notrap aligned readonly can_move v9+32 ;; @0034 v4 = uextend.i64 v2 ;; @0034 v6 = iadd v5, v4 ;; @0034 v7 = iconst.i64 16 ;; @0034 v8 = iadd v6, v7 ; v7 = 16 -;; @0034 store notrap aligned little v3, v8 +;; @0034 store user2 little v3, v8 ;; @0038 jump block1 ;; ;; block1: @@ -54,14 +54,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32): -;; @003f trapz v2, user15 +;; @003f trapz v2, user16 ;; @003f v9 = load.i64 notrap aligned readonly can_move v0+8 ;; @003f v5 = load.i64 notrap aligned readonly can_move v9+32 ;; @003f v4 = uextend.i64 v2 ;; @003f v6 = iadd v5, v4 ;; @003f v7 = iconst.i64 20 ;; @003f v8 = iadd v6, v7 ; v7 = 20 -;; @003f istore8 notrap aligned little v3, v8 +;; @003f istore8 user2 little v3, v8 ;; @0043 jump block1 ;; ;; block1: @@ -79,14 +79,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32): -;; @004a trapz v2, user15 +;; @004a trapz v2, user16 ;; @004a v9 = load.i64 notrap aligned readonly can_move v0+8 ;; @004a v5 = load.i64 notrap aligned readonly can_move v9+32 ;; @004a v4 = uextend.i64 v2 ;; @004a v6 = iadd v5, v4 ;; @004a v7 = iconst.i64 24 ;; @004a v8 = iadd v6, v7 ; v7 = 24 -;; @004a store notrap aligned little v3, v8 +;; @004a store user2 little v3, v8 ;; @004e jump block1 ;; ;; block1: diff --git a/tests/disas/gc/copying/v128-fields.wat b/tests/disas/gc/copying/v128-fields.wat index 34b8e3aa6411..7ece5c978b97 100644 --- a/tests/disas/gc/copying/v128-fields.wat +++ b/tests/disas/gc/copying/v128-fields.wat @@ -21,14 +21,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @0022 trapz v2, user15 +;; @0022 trapz v2, user16 ;; @0022 v19 = load.i64 notrap aligned readonly can_move v0+8 ;; @0022 v5 = load.i64 notrap aligned readonly can_move v19+32 ;; @0022 v4 = uextend.i64 v2 ;; @0022 v6 = iadd v5, v4 ;; @0022 v7 = iconst.i64 16 ;; @0022 v8 = iadd v6, v7 ; v7 = 16 -;; @0022 v9 = load.i8x16 notrap aligned little v8 +;; @0022 v9 = load.i8x16 user2 little v8 ;; @002e jump block1 ;; ;; block1: diff --git a/tests/disas/gc/drc/array-fill.wat b/tests/disas/gc/drc/array-fill.wat index bf0be2fe4506..691b01c51265 100644 --- a/tests/disas/gc/drc/array-fill.wat +++ b/tests/disas/gc/drc/array-fill.wat @@ -20,28 +20,28 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i64, v5: i32): -;; @0027 trapz v2, user15 +;; @0027 trapz v2, user16 ;; @0027 v41 = load.i64 notrap aligned readonly can_move v0+8 ;; @0027 v7 = load.i64 notrap aligned readonly can_move v41+32 ;; @0027 v6 = uextend.i64 v2 ;; @0027 v8 = iadd v7, v6 ;; @0027 v9 = iconst.i64 24 ;; @0027 v10 = iadd v8, v9 ; v9 = 24 -;; @0027 v11 = load.i32 notrap aligned readonly v10 -;; @0027 v12 = uadd_overflow_trap v3, v5, user16 +;; @0027 v11 = load.i32 user2 v10 +;; @0027 v12 = uadd_overflow_trap v3, v5, user17 ;; @0027 v13 = icmp ugt v12, v11 -;; @0027 trapnz v13, user16 +;; @0027 trapnz v13, user17 ;; @0027 v15 = uextend.i64 v11 ;; v43 = iconst.i64 3 ;; v44 = ishl v15, v43 ; v43 = 3 ;; v40 = iconst.i64 32 ;; @0027 v17 = ushr v44, v40 ; v40 = 32 -;; @0027 trapnz v17, user1 +;; @0027 trapnz v17, user2 ;; v53 = iconst.i32 3 ;; v54 = ishl v11, v53 ; v53 = 3 ;; @0027 v19 = iconst.i32 32 -;; @0027 v20 = uadd_overflow_trap v54, v19, user1 ; v19 = 32 -;; @0027 v24 = uadd_overflow_trap v2, v20, user1 +;; @0027 v20 = uadd_overflow_trap v54, v19, user2 ; v19 = 32 +;; @0027 v24 = uadd_overflow_trap v2, v20, user2 ;; @0027 v25 = uextend.i64 v24 ;; @0027 v27 = iadd v7, v25 ;; v60 = ishl v3, v53 ; v53 = 3 @@ -60,7 +60,7 @@ ;; @0027 brif v36, block4, block3 ;; ;; block3: -;; @0027 store.i64 notrap aligned little v4, v35 +;; @0027 store.i64 user2 little v4, v35 ;; v66 = iconst.i64 8 ;; v67 = iadd.i64 v35, v66 ; v66 = 8 ;; @0027 jump block2(v67) diff --git a/tests/disas/gc/drc/array-get-s.wat b/tests/disas/gc/drc/array-get-s.wat index 709263f339be..c09c5238a8fb 100644 --- a/tests/disas/gc/drc/array-get-s.wat +++ b/tests/disas/gc/drc/array-get-s.wat @@ -20,30 +20,30 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32): -;; @0022 trapz v2, user15 +;; @0022 trapz v2, user16 ;; @0022 v34 = load.i64 notrap aligned readonly can_move v0+8 ;; @0022 v6 = load.i64 notrap aligned readonly can_move v34+32 ;; @0022 v5 = uextend.i64 v2 ;; @0022 v7 = iadd v6, v5 ;; @0022 v8 = iconst.i64 24 ;; @0022 v9 = iadd v7, v8 ; v8 = 24 -;; @0022 v10 = load.i32 notrap aligned readonly v9 +;; @0022 v10 = load.i32 user2 v9 ;; @0022 v11 = icmp ult v3, v10 -;; @0022 trapz v11, user16 +;; @0022 trapz v11, user17 ;; @0022 v13 = uextend.i64 v10 ;; v33 = iconst.i64 32 ;; @0022 v15 = ushr v13, v33 ; v33 = 32 -;; @0022 trapnz v15, user1 +;; @0022 trapnz v15, user2 ;; @0022 v17 = iconst.i32 28 -;; @0022 v18 = uadd_overflow_trap v10, v17, user1 ; v17 = 28 -;; @0022 v22 = uadd_overflow_trap v2, v18, user1 +;; @0022 v18 = uadd_overflow_trap v10, v17, user2 ; v17 = 28 +;; @0022 v22 = uadd_overflow_trap v2, v18, user2 ;; @0022 v23 = uextend.i64 v22 ;; @0022 v25 = iadd v6, v23 ;; @0022 v21 = iadd v3, v17 ; v17 = 28 ;; @0022 v26 = isub v18, v21 ;; @0022 v27 = uextend.i64 v26 ;; @0022 v28 = isub v25, v27 -;; @0022 v29 = load.i8 notrap aligned little v28 +;; @0022 v29 = load.i8 user2 little v28 ;; @0025 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/drc/array-get-u.wat b/tests/disas/gc/drc/array-get-u.wat index 422e56da9bc4..2c56f7e24dfb 100644 --- a/tests/disas/gc/drc/array-get-u.wat +++ b/tests/disas/gc/drc/array-get-u.wat @@ -20,30 +20,30 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32): -;; @0022 trapz v2, user15 +;; @0022 trapz v2, user16 ;; @0022 v34 = load.i64 notrap aligned readonly can_move v0+8 ;; @0022 v6 = load.i64 notrap aligned readonly can_move v34+32 ;; @0022 v5 = uextend.i64 v2 ;; @0022 v7 = iadd v6, v5 ;; @0022 v8 = iconst.i64 24 ;; @0022 v9 = iadd v7, v8 ; v8 = 24 -;; @0022 v10 = load.i32 notrap aligned readonly v9 +;; @0022 v10 = load.i32 user2 v9 ;; @0022 v11 = icmp ult v3, v10 -;; @0022 trapz v11, user16 +;; @0022 trapz v11, user17 ;; @0022 v13 = uextend.i64 v10 ;; v33 = iconst.i64 32 ;; @0022 v15 = ushr v13, v33 ; v33 = 32 -;; @0022 trapnz v15, user1 +;; @0022 trapnz v15, user2 ;; @0022 v17 = iconst.i32 28 -;; @0022 v18 = uadd_overflow_trap v10, v17, user1 ; v17 = 28 -;; @0022 v22 = uadd_overflow_trap v2, v18, user1 +;; @0022 v18 = uadd_overflow_trap v10, v17, user2 ; v17 = 28 +;; @0022 v22 = uadd_overflow_trap v2, v18, user2 ;; @0022 v23 = uextend.i64 v22 ;; @0022 v25 = iadd v6, v23 ;; @0022 v21 = iadd v3, v17 ; v17 = 28 ;; @0022 v26 = isub v18, v21 ;; @0022 v27 = uextend.i64 v26 ;; @0022 v28 = isub v25, v27 -;; @0022 v29 = load.i8 notrap aligned little v28 +;; @0022 v29 = load.i8 user2 little v28 ;; @0025 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/drc/array-get.wat b/tests/disas/gc/drc/array-get.wat index dfaefc0c158b..0f616ed27d1c 100644 --- a/tests/disas/gc/drc/array-get.wat +++ b/tests/disas/gc/drc/array-get.wat @@ -20,27 +20,27 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32): -;; @0022 trapz v2, user15 +;; @0022 trapz v2, user16 ;; @0022 v33 = load.i64 notrap aligned readonly can_move v0+8 ;; @0022 v6 = load.i64 notrap aligned readonly can_move v33+32 ;; @0022 v5 = uextend.i64 v2 ;; @0022 v7 = iadd v6, v5 ;; @0022 v8 = iconst.i64 24 ;; @0022 v9 = iadd v7, v8 ; v8 = 24 -;; @0022 v10 = load.i32 notrap aligned readonly v9 +;; @0022 v10 = load.i32 user2 v9 ;; @0022 v11 = icmp ult v3, v10 -;; @0022 trapz v11, user16 +;; @0022 trapz v11, user17 ;; @0022 v13 = uextend.i64 v10 ;; v35 = iconst.i64 3 ;; v36 = ishl v13, v35 ; v35 = 3 ;; v32 = iconst.i64 32 ;; @0022 v15 = ushr v36, v32 ; v32 = 32 -;; @0022 trapnz v15, user1 +;; @0022 trapnz v15, user2 ;; v45 = iconst.i32 3 ;; v46 = ishl v10, v45 ; v45 = 3 ;; @0022 v17 = iconst.i32 32 -;; @0022 v18 = uadd_overflow_trap v46, v17, user1 ; v17 = 32 -;; @0022 v22 = uadd_overflow_trap v2, v18, user1 +;; @0022 v18 = uadd_overflow_trap v46, v17, user2 ; v17 = 32 +;; @0022 v22 = uadd_overflow_trap v2, v18, user2 ;; @0022 v23 = uextend.i64 v22 ;; @0022 v25 = iadd v6, v23 ;; v52 = ishl v3, v45 ; v45 = 3 @@ -48,7 +48,7 @@ ;; @0022 v26 = isub v18, v21 ;; @0022 v27 = uextend.i64 v26 ;; @0022 v28 = isub v25, v27 -;; @0022 v29 = load.i64 notrap aligned little v28 +;; @0022 v29 = load.i64 user2 little v28 ;; @0025 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/drc/array-len.wat b/tests/disas/gc/drc/array-len.wat index 93b984a9fc67..f225a84faff6 100644 --- a/tests/disas/gc/drc/array-len.wat +++ b/tests/disas/gc/drc/array-len.wat @@ -20,14 +20,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @001f trapz v2, user15 +;; @001f trapz v2, user16 ;; @001f v10 = load.i64 notrap aligned readonly can_move v0+8 ;; @001f v5 = load.i64 notrap aligned readonly can_move v10+32 ;; @001f v4 = uextend.i64 v2 ;; @001f v6 = iadd v5, v4 ;; @001f v7 = iconst.i64 24 ;; @001f v8 = iadd v6, v7 ; v7 = 24 -;; @001f v9 = load.i32 notrap aligned readonly v8 +;; @001f v9 = load.i32 user2 v8 ;; @0021 jump block1 ;; ;; block1: 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.wat index 9bfd5174bb2e..7dc6f3689a2e 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 @@ -44,7 +44,7 @@ ;; @0025 v22 = iadd v20, v21 ;; v130 = iconst.i64 24 ;; @0025 v23 = iadd v22, v130 ; v130 = 24 -;; @0025 store notrap aligned v6, v23 ; v6 = 3 +;; @0025 store user2 v6, v23 ; v6 = 3 ;; v93 = load.i32 notrap v137 ;; v128 = iconst.i32 1 ;; @0025 v28 = band v93, v128 ; v128 = 1 @@ -59,17 +59,17 @@ ;; @0025 v34 = iadd.i64 v20, v32 ;; v165 = iconst.i64 8 ;; @0025 v36 = iadd v34, v165 ; v165 = 8 -;; @0025 v37 = load.i64 notrap aligned v36 +;; @0025 v37 = load.i64 user2 v36 ;; v98 = iconst.i64 1 ;; @0025 v38 = iadd v37, v98 ; v98 = 1 -;; @0025 store notrap aligned v38, v36 +;; @0025 store user2 v38, v36 ;; @0025 jump block3 ;; ;; block3: ;; v89 = load.i32 notrap v137 ;; v151 = iconst.i64 28 ;; v156 = iadd.i64 v22, v151 ; v151 = 28 -;; @0025 store notrap aligned little v89, v156 +;; @0025 store user2 little v89, v156 ;; v88 = load.i32 notrap v136 ;; v243 = iconst.i32 1 ;; v244 = band v88, v243 ; v243 = 1 @@ -84,17 +84,17 @@ ;; @0025 v51 = iadd.i64 v20, v49 ;; v247 = iconst.i64 8 ;; @0025 v53 = iadd v51, v247 ; v247 = 8 -;; @0025 v54 = load.i64 notrap aligned v53 +;; @0025 v54 = load.i64 user2 v53 ;; v248 = iconst.i64 1 ;; @0025 v55 = iadd v54, v248 ; v248 = 1 -;; @0025 store notrap aligned v55, v53 +;; @0025 store user2 v55, v53 ;; @0025 jump block5 ;; ;; block5: ;; v84 = load.i32 notrap v136 ;; v133 = iconst.i64 32 ;; v163 = iadd.i64 v22, v133 ; v133 = 32 -;; @0025 store notrap aligned little v84, v163 +;; @0025 store user2 little v84, v163 ;; v83 = load.i32 notrap v135 ;; v249 = iconst.i32 1 ;; v250 = band v83, v249 ; v249 = 1 @@ -109,17 +109,17 @@ ;; @0025 v68 = iadd.i64 v20, v66 ;; v253 = iconst.i64 8 ;; @0025 v70 = iadd v68, v253 ; v253 = 8 -;; @0025 v71 = load.i64 notrap aligned v70 +;; @0025 v71 = load.i64 user2 v70 ;; v254 = iconst.i64 1 ;; @0025 v72 = iadd v71, v254 ; v254 = 1 -;; @0025 store notrap aligned v72, v70 +;; @0025 store user2 v72, v70 ;; @0025 jump block7 ;; ;; block7: ;; v79 = load.i32 notrap v135 ;; v179 = iconst.i64 36 ;; v184 = iadd.i64 v22, v179 ; v179 = 36 -;; @0025 store notrap aligned little v79, v184 +;; @0025 store user2 little v79, v184 ;; @0029 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/drc/array-new-fixed.wat b/tests/disas/gc/drc/array-new-fixed.wat index f4180313c9f7..985c630a7f59 100644 --- a/tests/disas/gc/drc/array-new-fixed.wat +++ b/tests/disas/gc/drc/array-new-fixed.wat @@ -34,16 +34,16 @@ ;; @0025 v22 = iadd v20, v21 ;; v37 = iconst.i64 24 ;; @0025 v23 = iadd v22, v37 ; v37 = 24 -;; @0025 store notrap aligned v6, v23 ; v6 = 3 +;; @0025 store user2 v6, v23 ; v6 = 3 ;; v34 = iconst.i64 32 ;; v52 = iadd v22, v34 ; v34 = 32 -;; @0025 store notrap aligned little v2, v52 +;; @0025 store user2 little v2, v52 ;; v55 = iconst.i64 40 ;; v60 = iadd v22, v55 ; v55 = 40 -;; @0025 store notrap aligned little v3, v60 +;; @0025 store user2 little v3, v60 ;; v76 = iconst.i64 48 ;; v81 = iadd v22, v76 ; v76 = 48 -;; @0025 store notrap aligned little v4, v81 +;; @0025 store user2 little v4, v81 ;; @0029 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/drc/array-new.wat b/tests/disas/gc/drc/array-new.wat index 9ae2b3118f9b..513ec4378a2a 100644 --- a/tests/disas/gc/drc/array-new.wat +++ b/tests/disas/gc/drc/array-new.wat @@ -26,11 +26,11 @@ ;; v38 = ishl v6, v37 ; v37 = 3 ;; v35 = iconst.i64 32 ;; @0022 v8 = ushr v38, v35 ; v35 = 32 -;; @0022 trapnz v8, user17 +;; @0022 trapnz v8, user18 ;; @0022 v5 = iconst.i32 32 ;; v44 = iconst.i32 3 ;; v45 = ishl v3, v44 ; v44 = 3 -;; @0022 v10 = uadd_overflow_trap v5, v45, user17 ; v5 = 32 +;; @0022 v10 = uadd_overflow_trap v5, v45, user18 ; v5 = 32 ;; @0022 v12 = iconst.i32 -1476395008 ;; @0022 v14 = load.i64 notrap aligned readonly can_move v0+40 ;; @0022 v15 = load.i32 notrap aligned readonly can_move v14 @@ -42,7 +42,7 @@ ;; @0022 v20 = iadd v18, v19 ;; v32 = iconst.i64 24 ;; @0022 v21 = iadd v20, v32 ; v32 = 24 -;; @0022 store notrap aligned v3, v21 +;; @0022 store user2 v3, v21 ;; v53 = iadd v20, v35 ; v35 = 32 ;; @0022 v27 = uextend.i64 v10 ;; @0022 v28 = iadd v20, v27 @@ -54,7 +54,7 @@ ;; @0022 brif v30, block4, block3 ;; ;; block3: -;; @0022 store.i64 notrap aligned little v2, v29 +;; @0022 store.i64 user2 little v2, v29 ;; v58 = iconst.i64 8 ;; v59 = iadd.i64 v29, v58 ; v58 = 8 ;; @0022 jump block2(v59) diff --git a/tests/disas/gc/drc/array-set.wat b/tests/disas/gc/drc/array-set.wat index 4bc559dfce17..d42eb2e346ae 100644 --- a/tests/disas/gc/drc/array-set.wat +++ b/tests/disas/gc/drc/array-set.wat @@ -20,27 +20,27 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i64): -;; @0024 trapz v2, user15 +;; @0024 trapz v2, user16 ;; @0024 v32 = load.i64 notrap aligned readonly can_move v0+8 ;; @0024 v6 = load.i64 notrap aligned readonly can_move v32+32 ;; @0024 v5 = uextend.i64 v2 ;; @0024 v7 = iadd v6, v5 ;; @0024 v8 = iconst.i64 24 ;; @0024 v9 = iadd v7, v8 ; v8 = 24 -;; @0024 v10 = load.i32 notrap aligned readonly v9 +;; @0024 v10 = load.i32 user2 v9 ;; @0024 v11 = icmp ult v3, v10 -;; @0024 trapz v11, user16 +;; @0024 trapz v11, user17 ;; @0024 v13 = uextend.i64 v10 ;; v34 = iconst.i64 3 ;; v35 = ishl v13, v34 ; v34 = 3 ;; v31 = iconst.i64 32 ;; @0024 v15 = ushr v35, v31 ; v31 = 32 -;; @0024 trapnz v15, user1 +;; @0024 trapnz v15, user2 ;; v44 = iconst.i32 3 ;; v45 = ishl v10, v44 ; v44 = 3 ;; @0024 v17 = iconst.i32 32 -;; @0024 v18 = uadd_overflow_trap v45, v17, user1 ; v17 = 32 -;; @0024 v22 = uadd_overflow_trap v2, v18, user1 +;; @0024 v18 = uadd_overflow_trap v45, v17, user2 ; v17 = 32 +;; @0024 v22 = uadd_overflow_trap v2, v18, user2 ;; @0024 v23 = uextend.i64 v22 ;; @0024 v25 = iadd v6, v23 ;; v51 = ishl v3, v44 ; v44 = 3 @@ -48,7 +48,7 @@ ;; @0024 v26 = isub v18, v21 ;; @0024 v27 = uextend.i64 v26 ;; @0024 v28 = isub v25, v27 -;; @0024 store notrap aligned little v4, v28 +;; @0024 store user2 little v4, v28 ;; @0027 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/drc/br-on-cast-fail.wat b/tests/disas/gc/drc/br-on-cast-fail.wat index f0f893c70e1e..926a83883753 100644 --- a/tests/disas/gc/drc/br-on-cast-fail.wat +++ b/tests/disas/gc/drc/br-on-cast-fail.wat @@ -51,7 +51,7 @@ ;; @002e v15 = iadd v14, v13 ;; @002e v16 = iconst.i64 4 ;; @002e v17 = iadd v15, v16 ; v16 = 4 -;; @002e v18 = load.i32 notrap aligned readonly v17 +;; @002e v18 = load.i32 user2 v17 ;; @002e v11 = load.i64 notrap aligned readonly can_move v0+40 ;; @002e v12 = load.i32 notrap aligned readonly can_move v11 ;; @002e v19 = icmp eq v18, v12 diff --git a/tests/disas/gc/drc/br-on-cast.wat b/tests/disas/gc/drc/br-on-cast.wat index 3257ae627c54..f6b209902725 100644 --- a/tests/disas/gc/drc/br-on-cast.wat +++ b/tests/disas/gc/drc/br-on-cast.wat @@ -51,7 +51,7 @@ ;; @002f v15 = iadd v14, v13 ;; @002f v16 = iconst.i64 4 ;; @002f v17 = iadd v15, v16 ; v16 = 4 -;; @002f v18 = load.i32 notrap aligned readonly v17 +;; @002f v18 = load.i32 user2 v17 ;; @002f v11 = load.i64 notrap aligned readonly can_move v0+40 ;; @002f v12 = load.i32 notrap aligned readonly can_move v11 ;; @002f v19 = icmp eq v18, v12 diff --git a/tests/disas/gc/drc/call-indirect-and-subtyping.wat b/tests/disas/gc/drc/call-indirect-and-subtyping.wat index e7fccc198d95..cb164e1b6c37 100644 --- a/tests/disas/gc/drc/call-indirect-and-subtyping.wat +++ b/tests/disas/gc/drc/call-indirect-and-subtyping.wat @@ -39,7 +39,7 @@ ;; @005c v7 = ishl v5, v30 ; v30 = 3 ;; @005c v8 = iadd v6, v7 ;; @005c v10 = select_spectre_guard v4, v9, v8 ; v9 = 0 -;; @005c v11 = load.i64 user5 aligned table v10 +;; @005c v11 = load.i64 user6 aligned table v10 ;; v29 = iconst.i64 -2 ;; @005c v12 = band v11, v29 ; v29 = -2 ;; @005c brif v11, block3(v12), block2 @@ -50,7 +50,7 @@ ;; @005c jump block3(v17) ;; ;; block3(v13: i64): -;; @005c v21 = load.i32 user6 aligned readonly v13+16 +;; @005c v21 = load.i32 user7 aligned readonly v13+16 ;; @005c v19 = load.i64 notrap aligned readonly can_move v0+40 ;; @005c v20 = load.i32 notrap aligned readonly can_move v19 ;; @005c v22 = icmp eq v21, v20 @@ -62,7 +62,7 @@ ;; @005c jump block5(v25) ;; ;; block5(v26: i32): -;; @005c trapz v26, user7 +;; @005c trapz v26, user8 ;; @005c v27 = load.i64 notrap aligned readonly v13+8 ;; @005c v28 = load.i64 notrap aligned readonly v13+24 ;; @005c call_indirect sig0, v27(v28, v0) diff --git a/tests/disas/gc/drc/externref-globals.wat b/tests/disas/gc/drc/externref-globals.wat index 4eea1d58c2a3..0793297f970d 100644 --- a/tests/disas/gc/drc/externref-globals.wat +++ b/tests/disas/gc/drc/externref-globals.wat @@ -39,27 +39,27 @@ ;; @0034 v11 = load.i64 notrap aligned readonly can_move v50+32 ;; @0034 v10 = uextend.i64 v5 ;; @0034 v12 = iadd v11, v10 -;; @0034 v13 = load.i32 notrap aligned v12 +;; @0034 v13 = load.i32 user2 v12 ;; @0034 v14 = iconst.i32 2 ;; @0034 v15 = band v13, v14 ; v14 = 2 ;; @0034 brif v15, block4, block3 ;; ;; block3: -;; @0034 v17 = load.i64 notrap aligned readonly v0+32 -;; @0034 v18 = load.i32 notrap aligned v17 +;; @0034 v17 = load.i64 user2 v0+32 +;; @0034 v18 = load.i32 user2 v17 ;; @0034 v22 = iconst.i64 16 ;; @0034 v23 = iadd.i64 v12, v22 ; v22 = 16 -;; @0034 store notrap aligned v18, v23 +;; @0034 store user2 v18, v23 ;; v55 = iconst.i32 2 ;; v56 = bor.i32 v13, v55 ; v55 = 2 -;; @0034 store notrap aligned v56, v12 +;; @0034 store user2 v56, v12 ;; @0034 v32 = iconst.i64 8 ;; @0034 v33 = iadd.i64 v12, v32 ; v32 = 8 -;; @0034 v34 = load.i64 notrap aligned v33 +;; @0034 v34 = load.i64 user2 v33 ;; v43 = iconst.i64 1 ;; @0034 v35 = iadd v34, v43 ; v43 = 1 -;; @0034 store notrap aligned v35, v33 -;; @0034 store.i32 notrap aligned v5, v17 +;; @0034 store user2 v35, v33 +;; @0034 store.i32 user2 v5, v17 ;; @0034 jump block4 ;; ;; block4: @@ -100,10 +100,10 @@ ;; @003b v12 = iadd v27, v10 ;; @003b v29 = iconst.i64 8 ;; @003b v14 = iadd v12, v29 ; v29 = 8 -;; @003b v15 = load.i64 notrap aligned v14 +;; @003b v15 = load.i64 user2 v14 ;; v63 = iconst.i64 1 ;; @003b v16 = iadd v15, v63 ; v63 = 1 -;; @003b store notrap aligned v16, v14 +;; @003b store user2 v16, v14 ;; @003b jump block3 ;; ;; block3: @@ -124,7 +124,7 @@ ;; @003b v28 = iadd v75, v26 ;; v76 = iconst.i64 8 ;; @003b v30 = iadd v28, v76 ; v76 = 8 -;; @003b v31 = load.i64 notrap aligned v30 +;; @003b v31 = load.i64 user2 v30 ;; v77 = iconst.i64 1 ;; v67 = icmp eq v31, v77 ; v77 = 1 ;; @003b brif v67, block5, block6 @@ -137,7 +137,7 @@ ;; v43 = iconst.i64 -1 ;; @003b v32 = iadd.i64 v31, v43 ; v43 = -1 ;; v78 = iadd.i64 v28, v76 ; v76 = 8 -;; @003b store notrap aligned v32, v78 +;; @003b store user2 v32, v78 ;; @003b jump block7 ;; ;; block7: diff --git a/tests/disas/gc/drc/funcref-in-gc-heap-get.wat b/tests/disas/gc/drc/funcref-in-gc-heap-get.wat index 82674939ba33..710db4657e41 100644 --- a/tests/disas/gc/drc/funcref-in-gc-heap-get.wat +++ b/tests/disas/gc/drc/funcref-in-gc-heap-get.wat @@ -22,14 +22,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @0020 trapz v2, user15 +;; @0020 trapz v2, user16 ;; @0020 v13 = load.i64 notrap aligned readonly can_move v0+8 ;; @0020 v5 = load.i64 notrap aligned readonly can_move v13+32 ;; @0020 v4 = uextend.i64 v2 ;; @0020 v6 = iadd v5, v4 ;; @0020 v7 = iconst.i64 24 ;; @0020 v8 = iadd v6, v7 ; v7 = 24 -;; @0020 v11 = load.i32 notrap aligned little v8 +;; @0020 v11 = load.i32 user2 little v8 ;; @0020 v9 = iconst.i32 -1 ;; @0020 v12 = call fn0(v0, v11, v9) ; v9 = -1 ;; @0024 jump block1 diff --git a/tests/disas/gc/drc/funcref-in-gc-heap-new.wat b/tests/disas/gc/drc/funcref-in-gc-heap-new.wat index 6c17ce97741f..5f9c18aebd48 100644 --- a/tests/disas/gc/drc/funcref-in-gc-heap-new.wat +++ b/tests/disas/gc/drc/funcref-in-gc-heap-new.wat @@ -40,7 +40,7 @@ ;; @0020 v14 = iadd v12, v13 ;; v22 = iconst.i64 24 ;; @0020 v15 = iadd v14, v22 ; v22 = 24 -;; @0020 store notrap aligned little v18, v15 +;; @0020 store user2 little v18, v15 ;; v19 = load.i32 notrap v26 ;; @0023 jump block1 ;; diff --git a/tests/disas/gc/drc/funcref-in-gc-heap-set.wat b/tests/disas/gc/drc/funcref-in-gc-heap-set.wat index c9ffd92e6731..d5b4fbae5fd1 100644 --- a/tests/disas/gc/drc/funcref-in-gc-heap-set.wat +++ b/tests/disas/gc/drc/funcref-in-gc-heap-set.wat @@ -22,7 +22,7 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i64): -;; @0022 trapz v2, user15 +;; @0022 trapz v2, user16 ;; @0022 v10 = call fn0(v0, v3) ;; @0022 v11 = ireduce.i32 v10 ;; @0022 v12 = load.i64 notrap aligned readonly can_move v0+8 @@ -31,7 +31,7 @@ ;; @0022 v6 = iadd v5, v4 ;; @0022 v7 = iconst.i64 24 ;; @0022 v8 = iadd v6, v7 ; v7 = 24 -;; @0022 store notrap aligned little v11, v8 +;; @0022 store user2 little v11, v8 ;; @0026 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/drc/multiple-array-get.wat b/tests/disas/gc/drc/multiple-array-get.wat index 89b3e5e7716f..e21df4b58052 100644 --- a/tests/disas/gc/drc/multiple-array-get.wat +++ b/tests/disas/gc/drc/multiple-array-get.wat @@ -21,27 +21,27 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32): -;; @0024 trapz v2, user15 +;; @0024 trapz v2, user16 ;; @0024 v65 = load.i64 notrap aligned readonly can_move v0+8 ;; @0024 v8 = load.i64 notrap aligned readonly can_move v65+32 ;; @0024 v7 = uextend.i64 v2 ;; @0024 v9 = iadd v8, v7 ;; @0024 v10 = iconst.i64 24 ;; @0024 v11 = iadd v9, v10 ; v10 = 24 -;; @0024 v12 = load.i32 notrap aligned readonly v11 +;; @0024 v12 = load.i32 user2 v11 ;; @0024 v13 = icmp ult v3, v12 -;; @0024 trapz v13, user16 +;; @0024 trapz v13, user17 ;; @0024 v15 = uextend.i64 v12 ;; v67 = iconst.i64 3 ;; v68 = ishl v15, v67 ; v67 = 3 ;; v64 = iconst.i64 32 ;; @0024 v17 = ushr v68, v64 ; v64 = 32 -;; @0024 trapnz v17, user1 +;; @0024 trapnz v17, user2 ;; v77 = iconst.i32 3 ;; v78 = ishl v12, v77 ; v77 = 3 ;; @0024 v19 = iconst.i32 32 -;; @0024 v20 = uadd_overflow_trap v78, v19, user1 ; v19 = 32 -;; @0024 v24 = uadd_overflow_trap v2, v20, user1 +;; @0024 v20 = uadd_overflow_trap v78, v19, user2 ; v19 = 32 +;; @0024 v24 = uadd_overflow_trap v2, v20, user2 ;; @0024 v25 = uextend.i64 v24 ;; @0024 v27 = iadd v8, v25 ;; v84 = ishl v3, v77 ; v77 = 3 @@ -49,15 +49,15 @@ ;; @0024 v28 = isub v20, v23 ;; @0024 v29 = uextend.i64 v28 ;; @0024 v30 = isub v27, v29 -;; @0024 v31 = load.i64 notrap aligned little v30 +;; @0024 v31 = load.i64 user2 little v30 ;; @002b v38 = icmp ult v4, v12 -;; @002b trapz v38, user16 +;; @002b trapz v38, user17 ;; v86 = ishl v4, v77 ; v77 = 3 ;; @002b v48 = iadd v86, v19 ; v19 = 32 ;; @002b v53 = isub v20, v48 ;; @002b v54 = uextend.i64 v53 ;; @002b v55 = isub v27, v54 -;; @002b v56 = load.i64 notrap aligned little v55 +;; @002b v56 = load.i64 user2 little v55 ;; @002e jump block1 ;; ;; block1: diff --git a/tests/disas/gc/drc/multiple-struct-get.wat b/tests/disas/gc/drc/multiple-struct-get.wat index eb6ec1f05659..52d07e60268b 100644 --- a/tests/disas/gc/drc/multiple-struct-get.wat +++ b/tests/disas/gc/drc/multiple-struct-get.wat @@ -22,17 +22,17 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @0023 trapz v2, user15 +;; @0023 trapz v2, user16 ;; @0023 v20 = load.i64 notrap aligned readonly can_move v0+8 ;; @0023 v6 = load.i64 notrap aligned readonly can_move v20+32 ;; @0023 v5 = uextend.i64 v2 ;; @0023 v7 = iadd v6, v5 ;; @0023 v8 = iconst.i64 24 ;; @0023 v9 = iadd v7, v8 ; v8 = 24 -;; @0023 v10 = load.f32 notrap aligned little v9 +;; @0023 v10 = load.f32 user2 little v9 ;; @0029 v14 = iconst.i64 28 ;; @0029 v15 = iadd v7, v14 ; v14 = 28 -;; @0029 v16 = load.i8 notrap aligned little v15 +;; @0029 v16 = load.i8 user2 little v15 ;; @002d jump block1 ;; ;; block1: diff --git a/tests/disas/gc/drc/ref-cast.wat b/tests/disas/gc/drc/ref-cast.wat index 7958e65935a5..35816e9c2643 100644 --- a/tests/disas/gc/drc/ref-cast.wat +++ b/tests/disas/gc/drc/ref-cast.wat @@ -42,7 +42,7 @@ ;; @001e v15 = iadd v14, v13 ;; @001e v16 = iconst.i64 4 ;; @001e v17 = iadd v15, v16 ; v16 = 4 -;; @001e v18 = load.i32 notrap aligned readonly v17 +;; @001e v18 = load.i32 user2 v17 ;; @001e v11 = load.i64 notrap aligned readonly can_move v0+40 ;; @001e v12 = load.i32 notrap aligned readonly can_move v11 ;; @001e v19 = icmp eq v18, v12 @@ -57,7 +57,7 @@ ;; @001e jump block4(v23) ;; ;; block4(v24: i32): -;; @001e trapz v24, user18 +;; @001e trapz v24, user19 ;; v25 = load.i32 notrap v36 ;; @0021 jump block1 ;; diff --git a/tests/disas/gc/drc/ref-test-array.wat b/tests/disas/gc/drc/ref-test-array.wat index 9895604b86e1..6f8818597a80 100644 --- a/tests/disas/gc/drc/ref-test-array.wat +++ b/tests/disas/gc/drc/ref-test-array.wat @@ -34,7 +34,7 @@ ;; @001b v11 = load.i64 notrap aligned readonly can_move v21+32 ;; @001b v10 = uextend.i64 v2 ;; @001b v12 = iadd v11, v10 -;; @001b v15 = load.i32 notrap aligned readonly v12 +;; @001b v15 = load.i32 user2 v12 ;; @001b v16 = iconst.i32 -1476395008 ;; @001b v17 = band v15, v16 ; v16 = -1476395008 ;; @001b v18 = icmp eq v17, v16 ; v16 = -1476395008 diff --git a/tests/disas/gc/drc/ref-test-concrete-func-type.wat b/tests/disas/gc/drc/ref-test-concrete-func-type.wat index d03258a7e45f..26d242712b2a 100644 --- a/tests/disas/gc/drc/ref-test-concrete-func-type.wat +++ b/tests/disas/gc/drc/ref-test-concrete-func-type.wat @@ -28,7 +28,7 @@ ;; @0020 jump block3 ;; ;; block3: -;; @0020 v10 = load.i32 notrap aligned readonly v2+16 +;; @0020 v10 = load.i32 user2 v2+16 ;; @0020 v8 = load.i64 notrap aligned readonly can_move v0+40 ;; @0020 v9 = load.i32 notrap aligned readonly can_move v8 ;; @0020 v11 = icmp eq v10, v9 diff --git a/tests/disas/gc/drc/ref-test-concrete-type.wat b/tests/disas/gc/drc/ref-test-concrete-type.wat index 8498db725345..09b551e31277 100644 --- a/tests/disas/gc/drc/ref-test-concrete-type.wat +++ b/tests/disas/gc/drc/ref-test-concrete-type.wat @@ -39,7 +39,7 @@ ;; @001d v15 = iadd v14, v13 ;; @001d v16 = iconst.i64 4 ;; @001d v17 = iadd v15, v16 ; v16 = 4 -;; @001d v18 = load.i32 notrap aligned readonly v17 +;; @001d v18 = load.i32 user2 v17 ;; @001d v11 = load.i64 notrap aligned readonly can_move v0+40 ;; @001d v12 = load.i32 notrap aligned readonly can_move v11 ;; @001d v19 = icmp eq v18, v12 diff --git a/tests/disas/gc/drc/ref-test-eq.wat b/tests/disas/gc/drc/ref-test-eq.wat index 0161a22282d2..d49fa9565588 100644 --- a/tests/disas/gc/drc/ref-test-eq.wat +++ b/tests/disas/gc/drc/ref-test-eq.wat @@ -33,7 +33,7 @@ ;; @001b v11 = load.i64 notrap aligned readonly can_move v21+32 ;; @001b v10 = uextend.i64 v2 ;; @001b v12 = iadd v11, v10 -;; @001b v15 = load.i32 notrap aligned readonly v12 +;; @001b v15 = load.i32 user2 v12 ;; @001b v16 = iconst.i32 -1610612736 ;; @001b v17 = band v15, v16 ; v16 = -1610612736 ;; @001b v18 = icmp eq v17, v16 ; v16 = -1610612736 diff --git a/tests/disas/gc/drc/ref-test-struct.wat b/tests/disas/gc/drc/ref-test-struct.wat index f5dbc7da1339..b60e5b389ec1 100644 --- a/tests/disas/gc/drc/ref-test-struct.wat +++ b/tests/disas/gc/drc/ref-test-struct.wat @@ -34,7 +34,7 @@ ;; @001b v11 = load.i64 notrap aligned readonly can_move v21+32 ;; @001b v10 = uextend.i64 v2 ;; @001b v12 = iadd v11, v10 -;; @001b v15 = load.i32 notrap aligned readonly v12 +;; @001b v15 = load.i32 user2 v12 ;; @001b v16 = iconst.i32 -1342177280 ;; @001b v17 = band v15, v16 ; v16 = -1342177280 ;; @001b v18 = icmp eq v17, v16 ; v16 = -1342177280 diff --git a/tests/disas/gc/drc/struct-get.wat b/tests/disas/gc/drc/struct-get.wat index 331653692162..957d115ccfde 100644 --- a/tests/disas/gc/drc/struct-get.wat +++ b/tests/disas/gc/drc/struct-get.wat @@ -34,14 +34,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @0033 trapz v2, user15 +;; @0033 trapz v2, user16 ;; @0033 v10 = load.i64 notrap aligned readonly can_move v0+8 ;; @0033 v5 = load.i64 notrap aligned readonly can_move v10+32 ;; @0033 v4 = uextend.i64 v2 ;; @0033 v6 = iadd v5, v4 ;; @0033 v7 = iconst.i64 24 ;; @0033 v8 = iadd v6, v7 ; v7 = 24 -;; @0033 v9 = load.f32 notrap aligned little v8 +;; @0033 v9 = load.f32 user2 little v8 ;; @0037 jump block1 ;; ;; block1: @@ -59,14 +59,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @003c trapz v2, user15 +;; @003c trapz v2, user16 ;; @003c v11 = load.i64 notrap aligned readonly can_move v0+8 ;; @003c v5 = load.i64 notrap aligned readonly can_move v11+32 ;; @003c v4 = uextend.i64 v2 ;; @003c v6 = iadd v5, v4 ;; @003c v7 = iconst.i64 28 ;; @003c v8 = iadd v6, v7 ; v7 = 28 -;; @003c v9 = load.i8 notrap aligned little v8 +;; @003c v9 = load.i8 user2 little v8 ;; @0040 jump block1 ;; ;; block1: @@ -85,14 +85,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @0045 trapz v2, user15 +;; @0045 trapz v2, user16 ;; @0045 v11 = load.i64 notrap aligned readonly can_move v0+8 ;; @0045 v5 = load.i64 notrap aligned readonly can_move v11+32 ;; @0045 v4 = uextend.i64 v2 ;; @0045 v6 = iadd v5, v4 ;; @0045 v7 = iconst.i64 28 ;; @0045 v8 = iadd v6, v7 ; v7 = 28 -;; @0045 v9 = load.i8 notrap aligned little v8 +;; @0045 v9 = load.i8 user2 little v8 ;; @0049 jump block1 ;; ;; block1: @@ -111,14 +111,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @004e trapz v2, user15 +;; @004e trapz v2, user16 ;; @004e v58 = load.i64 notrap aligned readonly can_move v0+8 ;; @004e v5 = load.i64 notrap aligned readonly can_move v58+32 ;; @004e v4 = uextend.i64 v2 ;; @004e v6 = iadd v5, v4 ;; @004e v7 = iconst.i64 32 ;; @004e v8 = iadd v6, v7 ; v7 = 32 -;; @004e v9 = load.i32 notrap aligned little v8 +;; @004e v9 = load.i32 user2 little v8 ;; v57 = iconst.i32 1 ;; @004e v10 = band v9, v57 ; v57 = 1 ;; v56 = iconst.i32 0 @@ -130,27 +130,27 @@ ;; block2: ;; @004e v14 = uextend.i64 v9 ;; @004e v16 = iadd.i64 v5, v14 -;; @004e v17 = load.i32 notrap aligned v16 +;; @004e v17 = load.i32 user2 v16 ;; @004e v18 = iconst.i32 2 ;; @004e v19 = band v17, v18 ; v18 = 2 ;; @004e brif v19, block4, block3 ;; ;; block3: -;; @004e v21 = load.i64 notrap aligned readonly v0+32 -;; @004e v22 = load.i32 notrap aligned v21 +;; @004e v21 = load.i64 user2 v0+32 +;; @004e v22 = load.i32 user2 v21 ;; @004e v26 = iconst.i64 16 ;; @004e v27 = iadd.i64 v16, v26 ; v26 = 16 -;; @004e store notrap aligned v22, v27 +;; @004e store user2 v22, v27 ;; v60 = iconst.i32 2 ;; v61 = bor.i32 v17, v60 ; v60 = 2 -;; @004e store notrap aligned v61, v16 +;; @004e store user2 v61, v16 ;; @004e v36 = iconst.i64 8 ;; @004e v37 = iadd.i64 v16, v36 ; v36 = 8 -;; @004e v38 = load.i64 notrap aligned v37 +;; @004e v38 = load.i64 user2 v37 ;; v47 = iconst.i64 1 ;; @004e v39 = iadd v38, v47 ; v47 = 1 -;; @004e store notrap aligned v39, v37 -;; @004e store.i32 notrap aligned v9, v21 +;; @004e store user2 v39, v37 +;; @004e store.i32 user2 v9, v21 ;; @004e jump block4 ;; ;; block4: diff --git a/tests/disas/gc/drc/struct-new-default.wat b/tests/disas/gc/drc/struct-new-default.wat index 8ecf214196e8..ed0d00e3fca9 100644 --- a/tests/disas/gc/drc/struct-new-default.wat +++ b/tests/disas/gc/drc/struct-new-default.wat @@ -37,28 +37,28 @@ ;; @0021 v16 = iadd v14, v15 ;; v45 = iconst.i64 24 ;; @0021 v17 = iadd v16, v45 ; v45 = 24 -;; @0021 store notrap aligned little v3, v17 ; v3 = 0.0 +;; @0021 store user2 little v3, v17 ; v3 = 0.0 ;; @0021 v4 = iconst.i32 0 ;; v44 = iconst.i64 28 ;; @0021 v18 = iadd v16, v44 ; v44 = 28 -;; @0021 istore8 notrap aligned little v4, v18 ; v4 = 0 +;; @0021 istore8 user2 little v4, v18 ; v4 = 0 ;; v42 = iconst.i32 1 ;; @0021 brif v42, block3, block2 ; v42 = 1 ;; ;; block2: ;; @0021 v27 = iconst.i64 8 ;; @0021 v28 = iadd.i64 v14, v27 ; v27 = 8 -;; @0021 v29 = load.i64 notrap aligned v28 +;; @0021 v29 = load.i64 user2 v28 ;; v38 = iconst.i64 1 ;; @0021 v30 = iadd v29, v38 ; v38 = 1 -;; @0021 store notrap aligned v30, v28 +;; @0021 store user2 v30, v28 ;; @0021 jump block3 ;; ;; block3: ;; v65 = iconst.i32 0 ;; v43 = iconst.i64 32 ;; @0021 v19 = iadd.i64 v16, v43 ; v43 = 32 -;; @0021 store notrap aligned little v65, v19 ; v65 = 0 +;; @0021 store user2 little v65, v19 ; v65 = 0 ;; @0024 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/drc/struct-new.wat b/tests/disas/gc/drc/struct-new.wat index f1cbdf51d536..af99ad5a57a2 100644 --- a/tests/disas/gc/drc/struct-new.wat +++ b/tests/disas/gc/drc/struct-new.wat @@ -39,10 +39,10 @@ ;; @002a v16 = iadd v14, v15 ;; v55 = iconst.i64 24 ;; @002a v17 = iadd v16, v55 ; v55 = 24 -;; @002a store notrap aligned little v2, v17 +;; @002a store user2 little v2, v17 ;; v54 = iconst.i64 28 ;; @002a v18 = iadd v16, v54 ; v54 = 28 -;; @002a istore8 notrap aligned little v3, v18 +;; @002a istore8 user2 little v3, v18 ;; v40 = load.i32 notrap v58 ;; v51 = iconst.i32 1 ;; @002a v20 = band v40, v51 ; v51 = 1 @@ -57,17 +57,17 @@ ;; @002a v26 = iadd.i64 v14, v24 ;; @002a v27 = iconst.i64 8 ;; @002a v28 = iadd v26, v27 ; v27 = 8 -;; @002a v29 = load.i64 notrap aligned v28 +;; @002a v29 = load.i64 user2 v28 ;; v45 = iconst.i64 1 ;; @002a v30 = iadd v29, v45 ; v45 = 1 -;; @002a store notrap aligned v30, v28 +;; @002a store user2 v30, v28 ;; @002a jump block3 ;; ;; block3: ;; v36 = load.i32 notrap v58 ;; v53 = iconst.i64 32 ;; @002a v19 = iadd.i64 v16, v53 ; v53 = 32 -;; @002a store notrap aligned little v36, v19 +;; @002a store user2 little v36, v19 ;; @002d jump block1 ;; ;; block1: diff --git a/tests/disas/gc/drc/struct-set.wat b/tests/disas/gc/drc/struct-set.wat index c4a4cb856a76..20805e5c921a 100644 --- a/tests/disas/gc/drc/struct-set.wat +++ b/tests/disas/gc/drc/struct-set.wat @@ -30,14 +30,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: f32): -;; @0034 trapz v2, user15 +;; @0034 trapz v2, user16 ;; @0034 v9 = load.i64 notrap aligned readonly can_move v0+8 ;; @0034 v5 = load.i64 notrap aligned readonly can_move v9+32 ;; @0034 v4 = uextend.i64 v2 ;; @0034 v6 = iadd v5, v4 ;; @0034 v7 = iconst.i64 24 ;; @0034 v8 = iadd v6, v7 ; v7 = 24 -;; @0034 store notrap aligned little v3, v8 +;; @0034 store user2 little v3, v8 ;; @0038 jump block1 ;; ;; block1: @@ -55,14 +55,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32): -;; @003f trapz v2, user15 +;; @003f trapz v2, user16 ;; @003f v9 = load.i64 notrap aligned readonly can_move v0+8 ;; @003f v5 = load.i64 notrap aligned readonly can_move v9+32 ;; @003f v4 = uextend.i64 v2 ;; @003f v6 = iadd v5, v4 ;; @003f v7 = iconst.i64 28 ;; @003f v8 = iadd v6, v7 ; v7 = 28 -;; @003f istore8 notrap aligned little v3, v8 +;; @003f istore8 user2 little v3, v8 ;; @0043 jump block1 ;; ;; block1: @@ -82,14 +82,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32): -;; @004a trapz v2, user15 +;; @004a trapz v2, user16 ;; @004a v59 = load.i64 notrap aligned readonly can_move v0+8 ;; @004a v5 = load.i64 notrap aligned readonly can_move v59+32 ;; @004a v4 = uextend.i64 v2 ;; @004a v6 = iadd v5, v4 ;; @004a v7 = iconst.i64 32 ;; @004a v8 = iadd v6, v7 ; v7 = 32 -;; @004a v9 = load.i32 notrap aligned little v8 +;; @004a v9 = load.i32 user2 little v8 ;; v58 = iconst.i32 1 ;; @004a v10 = band v3, v58 ; v58 = 1 ;; v57 = iconst.i32 0 @@ -103,15 +103,15 @@ ;; @004a v16 = iadd.i64 v5, v14 ;; @004a v33 = iconst.i64 8 ;; @004a v18 = iadd v16, v33 ; v33 = 8 -;; @004a v19 = load.i64 notrap aligned v18 +;; @004a v19 = load.i64 user2 v18 ;; v68 = iconst.i64 1 ;; @004a v20 = iadd v19, v68 ; v68 = 1 -;; @004a store notrap aligned v20, v18 +;; @004a store user2 v20, v18 ;; @004a jump block3 ;; ;; block3: ;; v74 = iadd.i64 v6, v7 ; v7 = 32 -;; @004a store.i32 notrap aligned little v3, v74 +;; @004a store.i32 user2 little v3, v74 ;; v75 = iconst.i32 1 ;; v76 = band.i32 v9, v75 ; v75 = 1 ;; v77 = iconst.i32 0 @@ -125,7 +125,7 @@ ;; @004a v32 = iadd.i64 v5, v30 ;; v79 = iconst.i64 8 ;; @004a v34 = iadd v32, v79 ; v79 = 8 -;; @004a v35 = load.i64 notrap aligned v34 +;; @004a v35 = load.i64 user2 v34 ;; v80 = iconst.i64 1 ;; v72 = icmp eq v35, v80 ; v80 = 1 ;; @004a brif v72, block5, block6 @@ -138,7 +138,7 @@ ;; v47 = iconst.i64 -1 ;; @004a v36 = iadd.i64 v35, v47 ; v47 = -1 ;; v81 = iadd.i64 v32, v79 ; v79 = 8 -;; @004a store notrap aligned v36, v81 +;; @004a store user2 v36, v81 ;; @004a jump block7 ;; ;; block7: diff --git a/tests/disas/gc/issue-11753.wat b/tests/disas/gc/issue-11753.wat index 0d474a89385d..34ec56fcf2fe 100644 --- a/tests/disas/gc/issue-11753.wat +++ b/tests/disas/gc/issue-11753.wat @@ -50,6 +50,7 @@ ;; movq 0x20(%rcx), %rcx ;; movl %eax, %eax ;; movl $0x2a, 0x18(%rcx, %rax) +;; ╰─╼ trap: GcHeapCorrupt ;; movq %rcx, 0x10(%rsp) ;; movq 0x38(%rbx), %rax ;; movq 0x48(%rbx), %rdi @@ -65,6 +66,7 @@ ;; 95: movl %eax, %eax ;; movq 0x10(%rsp), %rcx ;; movl 0x18(%rcx, %rax), %eax +;; ╰─╼ trap: GcHeapCorrupt ;; movq 0x20(%rsp), %rbx ;; movq 0x28(%rsp), %r12 ;; movq 0x30(%rsp), %r13 @@ -75,6 +77,6 @@ ;; popq %rbp ;; retq ;; c2: ud2 -;; ╰─╼ trap: StackOverflow +;; ╰─╼ trap: Normal(StackOverflow) ;; c4: ud2 -;; ╰─╼ trap: NullReference +;; ╰─╼ trap: Normal(NullReference) diff --git a/tests/disas/gc/null/array-fill.wat b/tests/disas/gc/null/array-fill.wat index 0ee9ed2501af..cd00d672b4ba 100644 --- a/tests/disas/gc/null/array-fill.wat +++ b/tests/disas/gc/null/array-fill.wat @@ -20,28 +20,28 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i64, v5: i32): -;; @0027 trapz v2, user15 +;; @0027 trapz v2, user16 ;; @0027 v41 = load.i64 notrap aligned readonly can_move v0+8 ;; @0027 v7 = load.i64 notrap aligned readonly can_move v41+32 ;; @0027 v6 = uextend.i64 v2 ;; @0027 v8 = iadd v7, v6 ;; @0027 v9 = iconst.i64 8 ;; @0027 v10 = iadd v8, v9 ; v9 = 8 -;; @0027 v11 = load.i32 notrap aligned readonly v10 -;; @0027 v12 = uadd_overflow_trap v3, v5, user16 +;; @0027 v11 = load.i32 user2 v10 +;; @0027 v12 = uadd_overflow_trap v3, v5, user17 ;; @0027 v13 = icmp ugt v12, v11 -;; @0027 trapnz v13, user16 +;; @0027 trapnz v13, user17 ;; @0027 v15 = uextend.i64 v11 ;; v43 = iconst.i64 3 ;; v44 = ishl v15, v43 ; v43 = 3 ;; v40 = iconst.i64 32 ;; @0027 v17 = ushr v44, v40 ; v40 = 32 -;; @0027 trapnz v17, user1 +;; @0027 trapnz v17, user2 ;; v53 = iconst.i32 3 ;; v54 = ishl v11, v53 ; v53 = 3 ;; @0027 v19 = iconst.i32 16 -;; @0027 v20 = uadd_overflow_trap v54, v19, user1 ; v19 = 16 -;; @0027 v24 = uadd_overflow_trap v2, v20, user1 +;; @0027 v20 = uadd_overflow_trap v54, v19, user2 ; v19 = 16 +;; @0027 v24 = uadd_overflow_trap v2, v20, user2 ;; @0027 v25 = uextend.i64 v24 ;; @0027 v27 = iadd v7, v25 ;; v60 = ishl v3, v53 ; v53 = 3 @@ -59,7 +59,7 @@ ;; @0027 brif v36, block4, block3 ;; ;; block3: -;; @0027 store.i64 notrap aligned little v4, v35 +;; @0027 store.i64 user2 little v4, v35 ;; v66 = iconst.i64 8 ;; v67 = iadd.i64 v35, v66 ; v66 = 8 ;; @0027 jump block2(v67) diff --git a/tests/disas/gc/null/array-get-s.wat b/tests/disas/gc/null/array-get-s.wat index 4896b0fd2788..19c47849a121 100644 --- a/tests/disas/gc/null/array-get-s.wat +++ b/tests/disas/gc/null/array-get-s.wat @@ -20,30 +20,30 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32): -;; @0022 trapz v2, user15 +;; @0022 trapz v2, user16 ;; @0022 v34 = load.i64 notrap aligned readonly can_move v0+8 ;; @0022 v6 = load.i64 notrap aligned readonly can_move v34+32 ;; @0022 v5 = uextend.i64 v2 ;; @0022 v7 = iadd v6, v5 ;; @0022 v8 = iconst.i64 8 ;; @0022 v9 = iadd v7, v8 ; v8 = 8 -;; @0022 v10 = load.i32 notrap aligned readonly v9 +;; @0022 v10 = load.i32 user2 v9 ;; @0022 v11 = icmp ult v3, v10 -;; @0022 trapz v11, user16 +;; @0022 trapz v11, user17 ;; @0022 v13 = uextend.i64 v10 ;; v33 = iconst.i64 32 ;; @0022 v15 = ushr v13, v33 ; v33 = 32 -;; @0022 trapnz v15, user1 +;; @0022 trapnz v15, user2 ;; @0022 v17 = iconst.i32 12 -;; @0022 v18 = uadd_overflow_trap v10, v17, user1 ; v17 = 12 -;; @0022 v22 = uadd_overflow_trap v2, v18, user1 +;; @0022 v18 = uadd_overflow_trap v10, v17, user2 ; v17 = 12 +;; @0022 v22 = uadd_overflow_trap v2, v18, user2 ;; @0022 v23 = uextend.i64 v22 ;; @0022 v25 = iadd v6, v23 ;; @0022 v21 = iadd v3, v17 ; v17 = 12 ;; @0022 v26 = isub v18, v21 ;; @0022 v27 = uextend.i64 v26 ;; @0022 v28 = isub v25, v27 -;; @0022 v29 = load.i8 notrap aligned little v28 +;; @0022 v29 = load.i8 user2 little v28 ;; @0025 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/null/array-get-u.wat b/tests/disas/gc/null/array-get-u.wat index b1267fe29067..6826312190e5 100644 --- a/tests/disas/gc/null/array-get-u.wat +++ b/tests/disas/gc/null/array-get-u.wat @@ -20,30 +20,30 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32): -;; @0022 trapz v2, user15 +;; @0022 trapz v2, user16 ;; @0022 v34 = load.i64 notrap aligned readonly can_move v0+8 ;; @0022 v6 = load.i64 notrap aligned readonly can_move v34+32 ;; @0022 v5 = uextend.i64 v2 ;; @0022 v7 = iadd v6, v5 ;; @0022 v8 = iconst.i64 8 ;; @0022 v9 = iadd v7, v8 ; v8 = 8 -;; @0022 v10 = load.i32 notrap aligned readonly v9 +;; @0022 v10 = load.i32 user2 v9 ;; @0022 v11 = icmp ult v3, v10 -;; @0022 trapz v11, user16 +;; @0022 trapz v11, user17 ;; @0022 v13 = uextend.i64 v10 ;; v33 = iconst.i64 32 ;; @0022 v15 = ushr v13, v33 ; v33 = 32 -;; @0022 trapnz v15, user1 +;; @0022 trapnz v15, user2 ;; @0022 v17 = iconst.i32 12 -;; @0022 v18 = uadd_overflow_trap v10, v17, user1 ; v17 = 12 -;; @0022 v22 = uadd_overflow_trap v2, v18, user1 +;; @0022 v18 = uadd_overflow_trap v10, v17, user2 ; v17 = 12 +;; @0022 v22 = uadd_overflow_trap v2, v18, user2 ;; @0022 v23 = uextend.i64 v22 ;; @0022 v25 = iadd v6, v23 ;; @0022 v21 = iadd v3, v17 ; v17 = 12 ;; @0022 v26 = isub v18, v21 ;; @0022 v27 = uextend.i64 v26 ;; @0022 v28 = isub v25, v27 -;; @0022 v29 = load.i8 notrap aligned little v28 +;; @0022 v29 = load.i8 user2 little v28 ;; @0025 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/null/array-get.wat b/tests/disas/gc/null/array-get.wat index 1536cf3cf741..2ed7ce8fc0c4 100644 --- a/tests/disas/gc/null/array-get.wat +++ b/tests/disas/gc/null/array-get.wat @@ -20,27 +20,27 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32): -;; @0022 trapz v2, user15 +;; @0022 trapz v2, user16 ;; @0022 v33 = load.i64 notrap aligned readonly can_move v0+8 ;; @0022 v6 = load.i64 notrap aligned readonly can_move v33+32 ;; @0022 v5 = uextend.i64 v2 ;; @0022 v7 = iadd v6, v5 ;; @0022 v8 = iconst.i64 8 ;; @0022 v9 = iadd v7, v8 ; v8 = 8 -;; @0022 v10 = load.i32 notrap aligned readonly v9 +;; @0022 v10 = load.i32 user2 v9 ;; @0022 v11 = icmp ult v3, v10 -;; @0022 trapz v11, user16 +;; @0022 trapz v11, user17 ;; @0022 v13 = uextend.i64 v10 ;; v35 = iconst.i64 3 ;; v36 = ishl v13, v35 ; v35 = 3 ;; v32 = iconst.i64 32 ;; @0022 v15 = ushr v36, v32 ; v32 = 32 -;; @0022 trapnz v15, user1 +;; @0022 trapnz v15, user2 ;; v45 = iconst.i32 3 ;; v46 = ishl v10, v45 ; v45 = 3 ;; @0022 v17 = iconst.i32 16 -;; @0022 v18 = uadd_overflow_trap v46, v17, user1 ; v17 = 16 -;; @0022 v22 = uadd_overflow_trap v2, v18, user1 +;; @0022 v18 = uadd_overflow_trap v46, v17, user2 ; v17 = 16 +;; @0022 v22 = uadd_overflow_trap v2, v18, user2 ;; @0022 v23 = uextend.i64 v22 ;; @0022 v25 = iadd v6, v23 ;; v52 = ishl v3, v45 ; v45 = 3 @@ -48,7 +48,7 @@ ;; @0022 v26 = isub v18, v21 ;; @0022 v27 = uextend.i64 v26 ;; @0022 v28 = isub v25, v27 -;; @0022 v29 = load.i64 notrap aligned little v28 +;; @0022 v29 = load.i64 user2 little v28 ;; @0025 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/null/array-len.wat b/tests/disas/gc/null/array-len.wat index 8bda2bf10f65..64488e5cfe87 100644 --- a/tests/disas/gc/null/array-len.wat +++ b/tests/disas/gc/null/array-len.wat @@ -20,14 +20,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @001f trapz v2, user15 +;; @001f trapz v2, user16 ;; @001f v10 = load.i64 notrap aligned readonly can_move v0+8 ;; @001f v5 = load.i64 notrap aligned readonly can_move v10+32 ;; @001f v4 = uextend.i64 v2 ;; @001f v6 = iadd v5, v4 ;; @001f v7 = iconst.i64 8 ;; @001f v8 = iadd v6, v7 ; v7 = 8 -;; @001f v9 = load.i32 notrap aligned readonly v8 +;; @001f v9 = load.i32 user2 v8 ;; @0021 jump block1 ;; ;; block1: 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.wat index e03154c83d7e..8790f9c443a1 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 @@ -31,14 +31,14 @@ ;; store notrap v3, v61 ;; v60 = stack_addr.i64 ss0 ;; store notrap v4, v60 -;; @0025 v17 = load.i64 notrap aligned readonly v0+32 -;; @0025 v18 = load.i32 notrap aligned v17 +;; @0025 v17 = load.i64 user2 v0+32 +;; @0025 v18 = load.i32 user2 v17 ;; v80 = iconst.i32 7 -;; @0025 v21 = uadd_overflow_trap v18, v80, user17 ; v80 = 7 +;; @0025 v21 = uadd_overflow_trap v18, v80, user18 ; v80 = 7 ;; v86 = iconst.i32 -8 ;; @0025 v23 = band v21, v86 ; v86 = -8 ;; v73 = iconst.i32 24 -;; @0025 v24 = uadd_overflow_trap v23, v73, user17 ; v73 = 24 +;; @0025 v24 = uadd_overflow_trap v23, v73, user18 ; v73 = 24 ;; @0025 v56 = load.i64 notrap aligned readonly can_move v0+8 ;; @0025 v26 = load.i64 notrap aligned v56+40 ;; @0025 v25 = uextend.i64 v24 @@ -51,27 +51,27 @@ ;; v162 = band.i32 v21, v86 ; v86 = -8 ;; v163 = uextend.i64 v162 ;; @0025 v33 = iadd v31, v163 -;; @0025 store notrap aligned v87, v33 ; v87 = -1476394984 +;; @0025 store user2 v87, v33 ; v87 = -1476394984 ;; @0025 v37 = load.i64 notrap aligned readonly can_move v0+40 ;; @0025 v38 = load.i32 notrap aligned readonly can_move v37 -;; @0025 store notrap aligned v38, v33+4 -;; @0025 store.i32 notrap aligned v24, v17 +;; @0025 store user2 v38, v33+4 +;; @0025 store.i32 user2 v24, v17 ;; @0025 v6 = iconst.i32 3 ;; v53 = iconst.i64 8 ;; @0025 v39 = iadd v33, v53 ; v53 = 8 -;; @0025 store notrap aligned v6, v39 ; v6 = 3 +;; @0025 store user2 v6, v39 ; v6 = 3 ;; v49 = load.i32 notrap v62 ;; v64 = iconst.i64 12 ;; v98 = iadd v33, v64 ; v64 = 12 -;; @0025 store notrap aligned little v49, v98 +;; @0025 store user2 little v49, v98 ;; v48 = load.i32 notrap v61 ;; v101 = iconst.i64 16 ;; v106 = iadd v33, v101 ; v101 = 16 -;; @0025 store notrap aligned little v48, v106 +;; @0025 store user2 little v48, v106 ;; v47 = load.i32 notrap v60 ;; v121 = iconst.i64 20 ;; v126 = iadd v33, v121 ; v121 = 20 -;; @0025 store notrap aligned little v47, v126 +;; @0025 store user2 little v47, v126 ;; @0029 jump block1 ;; ;; block3 cold: diff --git a/tests/disas/gc/null/array-new-fixed.wat b/tests/disas/gc/null/array-new-fixed.wat index 4be809423bc1..f1ad8c465efb 100644 --- a/tests/disas/gc/null/array-new-fixed.wat +++ b/tests/disas/gc/null/array-new-fixed.wat @@ -22,14 +22,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i64, v3: i64, v4: i64): -;; @0025 v17 = load.i64 notrap aligned readonly v0+32 -;; @0025 v18 = load.i32 notrap aligned v17 +;; @0025 v17 = load.i64 user2 v0+32 +;; @0025 v18 = load.i32 user2 v17 ;; v71 = iconst.i32 7 -;; @0025 v21 = uadd_overflow_trap v18, v71, user17 ; v71 = 7 +;; @0025 v21 = uadd_overflow_trap v18, v71, user18 ; v71 = 7 ;; v77 = iconst.i32 -8 ;; @0025 v23 = band v21, v77 ; v77 = -8 ;; v64 = iconst.i32 40 -;; @0025 v24 = uadd_overflow_trap v23, v64, user17 ; v64 = 40 +;; @0025 v24 = uadd_overflow_trap v23, v64, user18 ; v64 = 40 ;; @0025 v50 = load.i64 notrap aligned readonly can_move v0+8 ;; @0025 v26 = load.i64 notrap aligned v50+40 ;; @0025 v25 = uextend.i64 v24 @@ -42,24 +42,24 @@ ;; v140 = band.i32 v21, v77 ; v77 = -8 ;; v141 = uextend.i64 v140 ;; @0025 v33 = iadd v31, v141 -;; @0025 store notrap aligned v78, v33 ; v78 = -1476394968 +;; @0025 store user2 v78, v33 ; v78 = -1476394968 ;; @0025 v37 = load.i64 notrap aligned readonly can_move v0+40 ;; @0025 v38 = load.i32 notrap aligned readonly can_move v37 -;; @0025 store notrap aligned v38, v33+4 -;; @0025 store.i32 notrap aligned v24, v17 +;; @0025 store user2 v38, v33+4 +;; @0025 store.i32 user2 v24, v17 ;; @0025 v6 = iconst.i32 3 ;; v53 = iconst.i64 8 ;; @0025 v39 = iadd v33, v53 ; v53 = 8 -;; @0025 store notrap aligned v6, v39 ; v6 = 3 +;; @0025 store user2 v6, v39 ; v6 = 3 ;; v85 = iconst.i64 16 ;; v90 = iadd v33, v85 ; v85 = 16 -;; @0025 store.i64 notrap aligned little v2, v90 +;; @0025 store.i64 user2 little v2, v90 ;; v55 = iconst.i64 24 ;; v97 = iadd v33, v55 ; v55 = 24 -;; @0025 store.i64 notrap aligned little v3, v97 +;; @0025 store.i64 user2 little v3, v97 ;; v52 = iconst.i64 32 ;; v107 = iadd v33, v52 ; v52 = 32 -;; @0025 store.i64 notrap aligned little v4, v107 +;; @0025 store.i64 user2 little v4, v107 ;; @0029 jump block1 ;; ;; block3 cold: diff --git a/tests/disas/gc/null/array-new.wat b/tests/disas/gc/null/array-new.wat index 1ab68c60f6d6..5fc74635220f 100644 --- a/tests/disas/gc/null/array-new.wat +++ b/tests/disas/gc/null/array-new.wat @@ -27,21 +27,21 @@ ;; v56 = ishl v6, v55 ; v55 = 3 ;; v53 = iconst.i64 32 ;; @0022 v8 = ushr v56, v53 ; v53 = 32 -;; @0022 trapnz v8, user17 +;; @0022 trapnz v8, user18 ;; @0022 v5 = iconst.i32 16 ;; v62 = iconst.i32 3 ;; v63 = ishl v3, v62 ; v62 = 3 -;; @0022 v10 = uadd_overflow_trap v5, v63, user17 ; v5 = 16 +;; @0022 v10 = uadd_overflow_trap v5, v63, user18 ; v5 = 16 ;; @0022 v12 = iconst.i32 -67108864 ;; @0022 v13 = band v10, v12 ; v12 = -67108864 -;; @0022 trapnz v13, user17 -;; @0022 v15 = load.i64 notrap aligned readonly v0+32 -;; @0022 v16 = load.i32 notrap aligned v15 +;; @0022 trapnz v13, user18 +;; @0022 v15 = load.i64 user2 v0+32 +;; @0022 v16 = load.i32 user2 v15 ;; v66 = iconst.i32 7 -;; @0022 v19 = uadd_overflow_trap v16, v66, user17 ; v66 = 7 +;; @0022 v19 = uadd_overflow_trap v16, v66, user18 ; v66 = 7 ;; v72 = iconst.i32 -8 ;; @0022 v21 = band v19, v72 ; v72 = -8 -;; @0022 v22 = uadd_overflow_trap v21, v10, user17 +;; @0022 v22 = uadd_overflow_trap v21, v10, user18 ;; @0022 v51 = load.i64 notrap aligned readonly can_move v0+8 ;; @0022 v24 = load.i64 notrap aligned v51+40 ;; @0022 v23 = uextend.i64 v22 @@ -55,14 +55,14 @@ ;; v86 = band.i32 v19, v72 ; v72 = -8 ;; v87 = uextend.i64 v86 ;; @0022 v31 = iadd v29, v87 -;; @0022 store notrap aligned v73, v31 +;; @0022 store user2 v73, v31 ;; @0022 v35 = load.i64 notrap aligned readonly can_move v0+40 ;; @0022 v36 = load.i32 notrap aligned readonly can_move v35 -;; @0022 store notrap aligned v36, v31+4 -;; @0022 store.i32 notrap aligned v22, v15 +;; @0022 store user2 v36, v31+4 +;; @0022 store.i32 user2 v22, v15 ;; v54 = iconst.i64 8 ;; @0022 v37 = iadd v31, v54 ; v54 = 8 -;; @0022 store.i32 notrap aligned v3, v37 +;; @0022 store.i32 user2 v3, v37 ;; v76 = iconst.i64 16 ;; v81 = iadd v31, v76 ; v76 = 16 ;; @0022 v43 = uextend.i64 v10 @@ -74,7 +74,7 @@ ;; @0022 brif v46, block6, block5 ;; ;; block5: -;; @0022 store.i64 notrap aligned little v2, v45 +;; @0022 store.i64 user2 little v2, v45 ;; v88 = iconst.i64 8 ;; v89 = iadd.i64 v45, v88 ; v88 = 8 ;; @0022 jump block4(v89) diff --git a/tests/disas/gc/null/array-set.wat b/tests/disas/gc/null/array-set.wat index 0fa90539fe2f..9008de5ac2e1 100644 --- a/tests/disas/gc/null/array-set.wat +++ b/tests/disas/gc/null/array-set.wat @@ -20,27 +20,27 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i64): -;; @0024 trapz v2, user15 +;; @0024 trapz v2, user16 ;; @0024 v32 = load.i64 notrap aligned readonly can_move v0+8 ;; @0024 v6 = load.i64 notrap aligned readonly can_move v32+32 ;; @0024 v5 = uextend.i64 v2 ;; @0024 v7 = iadd v6, v5 ;; @0024 v8 = iconst.i64 8 ;; @0024 v9 = iadd v7, v8 ; v8 = 8 -;; @0024 v10 = load.i32 notrap aligned readonly v9 +;; @0024 v10 = load.i32 user2 v9 ;; @0024 v11 = icmp ult v3, v10 -;; @0024 trapz v11, user16 +;; @0024 trapz v11, user17 ;; @0024 v13 = uextend.i64 v10 ;; v34 = iconst.i64 3 ;; v35 = ishl v13, v34 ; v34 = 3 ;; v31 = iconst.i64 32 ;; @0024 v15 = ushr v35, v31 ; v31 = 32 -;; @0024 trapnz v15, user1 +;; @0024 trapnz v15, user2 ;; v44 = iconst.i32 3 ;; v45 = ishl v10, v44 ; v44 = 3 ;; @0024 v17 = iconst.i32 16 -;; @0024 v18 = uadd_overflow_trap v45, v17, user1 ; v17 = 16 -;; @0024 v22 = uadd_overflow_trap v2, v18, user1 +;; @0024 v18 = uadd_overflow_trap v45, v17, user2 ; v17 = 16 +;; @0024 v22 = uadd_overflow_trap v2, v18, user2 ;; @0024 v23 = uextend.i64 v22 ;; @0024 v25 = iadd v6, v23 ;; v51 = ishl v3, v44 ; v44 = 3 @@ -48,7 +48,7 @@ ;; @0024 v26 = isub v18, v21 ;; @0024 v27 = uextend.i64 v26 ;; @0024 v28 = isub v25, v27 -;; @0024 store notrap aligned little v4, v28 +;; @0024 store user2 little v4, v28 ;; @0027 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/null/br-on-cast-fail.wat b/tests/disas/gc/null/br-on-cast-fail.wat index 6392b1e12a23..f75eef9dbabc 100644 --- a/tests/disas/gc/null/br-on-cast-fail.wat +++ b/tests/disas/gc/null/br-on-cast-fail.wat @@ -51,7 +51,7 @@ ;; @002e v15 = iadd v14, v13 ;; @002e v16 = iconst.i64 4 ;; @002e v17 = iadd v15, v16 ; v16 = 4 -;; @002e v18 = load.i32 notrap aligned readonly v17 +;; @002e v18 = load.i32 user2 v17 ;; @002e v11 = load.i64 notrap aligned readonly can_move v0+40 ;; @002e v12 = load.i32 notrap aligned readonly can_move v11 ;; @002e v19 = icmp eq v18, v12 diff --git a/tests/disas/gc/null/br-on-cast.wat b/tests/disas/gc/null/br-on-cast.wat index 70ef4b9335ce..1898e145122a 100644 --- a/tests/disas/gc/null/br-on-cast.wat +++ b/tests/disas/gc/null/br-on-cast.wat @@ -51,7 +51,7 @@ ;; @002f v15 = iadd v14, v13 ;; @002f v16 = iconst.i64 4 ;; @002f v17 = iadd v15, v16 ; v16 = 4 -;; @002f v18 = load.i32 notrap aligned readonly v17 +;; @002f v18 = load.i32 user2 v17 ;; @002f v11 = load.i64 notrap aligned readonly can_move v0+40 ;; @002f v12 = load.i32 notrap aligned readonly can_move v11 ;; @002f v19 = icmp eq v18, v12 diff --git a/tests/disas/gc/null/call-indirect-and-subtyping.wat b/tests/disas/gc/null/call-indirect-and-subtyping.wat index f6114c0441b6..da487877fe27 100644 --- a/tests/disas/gc/null/call-indirect-and-subtyping.wat +++ b/tests/disas/gc/null/call-indirect-and-subtyping.wat @@ -39,7 +39,7 @@ ;; @005c v7 = ishl v5, v30 ; v30 = 3 ;; @005c v8 = iadd v6, v7 ;; @005c v10 = select_spectre_guard v4, v9, v8 ; v9 = 0 -;; @005c v11 = load.i64 user5 aligned table v10 +;; @005c v11 = load.i64 user6 aligned table v10 ;; v29 = iconst.i64 -2 ;; @005c v12 = band v11, v29 ; v29 = -2 ;; @005c brif v11, block3(v12), block2 @@ -50,7 +50,7 @@ ;; @005c jump block3(v17) ;; ;; block3(v13: i64): -;; @005c v21 = load.i32 user6 aligned readonly v13+16 +;; @005c v21 = load.i32 user7 aligned readonly v13+16 ;; @005c v19 = load.i64 notrap aligned readonly can_move v0+40 ;; @005c v20 = load.i32 notrap aligned readonly can_move v19 ;; @005c v22 = icmp eq v21, v20 @@ -62,7 +62,7 @@ ;; @005c jump block5(v25) ;; ;; block5(v26: i32): -;; @005c trapz v26, user7 +;; @005c trapz v26, user8 ;; @005c v27 = load.i64 notrap aligned readonly v13+8 ;; @005c v28 = load.i64 notrap aligned readonly v13+24 ;; @005c call_indirect sig0, v27(v28, v0) diff --git a/tests/disas/gc/null/funcref-in-gc-heap-get.wat b/tests/disas/gc/null/funcref-in-gc-heap-get.wat index 48adc71c27e0..a77b33374988 100644 --- a/tests/disas/gc/null/funcref-in-gc-heap-get.wat +++ b/tests/disas/gc/null/funcref-in-gc-heap-get.wat @@ -22,14 +22,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @0020 trapz v2, user15 +;; @0020 trapz v2, user16 ;; @0020 v13 = load.i64 notrap aligned readonly can_move v0+8 ;; @0020 v5 = load.i64 notrap aligned readonly can_move v13+32 ;; @0020 v4 = uextend.i64 v2 ;; @0020 v6 = iadd v5, v4 ;; @0020 v7 = iconst.i64 8 ;; @0020 v8 = iadd v6, v7 ; v7 = 8 -;; @0020 v11 = load.i32 notrap aligned little v8 +;; @0020 v11 = load.i32 user2 little v8 ;; @0020 v9 = iconst.i32 -1 ;; @0020 v12 = call fn0(v0, v11, v9) ; v9 = -1 ;; @0024 jump block1 diff --git a/tests/disas/gc/null/funcref-in-gc-heap-new.wat b/tests/disas/gc/null/funcref-in-gc-heap-new.wat index 268dddc1be1c..9b4214542133 100644 --- a/tests/disas/gc/null/funcref-in-gc-heap-new.wat +++ b/tests/disas/gc/null/funcref-in-gc-heap-new.wat @@ -24,14 +24,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i64): -;; @0020 v9 = load.i64 notrap aligned readonly v0+32 -;; @0020 v10 = load.i32 notrap aligned v9 +;; @0020 v9 = load.i64 user2 v0+32 +;; @0020 v10 = load.i32 user2 v9 ;; v46 = iconst.i32 7 -;; @0020 v13 = uadd_overflow_trap v10, v46, user17 ; v46 = 7 +;; @0020 v13 = uadd_overflow_trap v10, v46, user18 ; v46 = 7 ;; v52 = iconst.i32 -8 ;; @0020 v15 = band v13, v52 ; v52 = -8 ;; @0020 v4 = iconst.i32 16 -;; @0020 v16 = uadd_overflow_trap v15, v4, user17 ; v4 = 16 +;; @0020 v16 = uadd_overflow_trap v15, v4, user18 ; v4 = 16 ;; @0020 v38 = load.i64 notrap aligned readonly can_move v0+8 ;; @0020 v18 = load.i64 notrap aligned v38+40 ;; @0020 v17 = uextend.i64 v16 @@ -44,16 +44,16 @@ ;; v59 = band.i32 v13, v52 ; v52 = -8 ;; v60 = uextend.i64 v59 ;; @0020 v25 = iadd v23, v60 -;; @0020 store notrap aligned v53, v25 ; v53 = -1342177264 +;; @0020 store user2 v53, v25 ; v53 = -1342177264 ;; @0020 v29 = load.i64 notrap aligned readonly can_move v0+40 ;; @0020 v30 = load.i32 notrap aligned readonly can_move v29 -;; @0020 store notrap aligned v30, v25+4 -;; @0020 store.i32 notrap aligned v16, v9 +;; @0020 store user2 v30, v25+4 +;; @0020 store.i32 user2 v16, v9 ;; @0020 v33 = call fn1(v0, v2) ;; @0020 v34 = ireduce.i32 v33 ;; v35 = iconst.i64 8 ;; @0020 v31 = iadd v25, v35 ; v35 = 8 -;; @0020 store notrap aligned little v34, v31 +;; @0020 store user2 little v34, v31 ;; @0023 jump block1 ;; ;; block3 cold: diff --git a/tests/disas/gc/null/funcref-in-gc-heap-set.wat b/tests/disas/gc/null/funcref-in-gc-heap-set.wat index 7572102ecd48..9d062b9911f6 100644 --- a/tests/disas/gc/null/funcref-in-gc-heap-set.wat +++ b/tests/disas/gc/null/funcref-in-gc-heap-set.wat @@ -22,7 +22,7 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i64): -;; @0022 trapz v2, user15 +;; @0022 trapz v2, user16 ;; @0022 v10 = call fn0(v0, v3) ;; @0022 v11 = ireduce.i32 v10 ;; @0022 v12 = load.i64 notrap aligned readonly can_move v0+8 @@ -31,7 +31,7 @@ ;; @0022 v6 = iadd v5, v4 ;; @0022 v7 = iconst.i64 8 ;; @0022 v8 = iadd v6, v7 ; v7 = 8 -;; @0022 store notrap aligned little v11, v8 +;; @0022 store user2 little v11, v8 ;; @0026 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/null/multiple-array-get.wat b/tests/disas/gc/null/multiple-array-get.wat index ad073e5d1636..d24b22cac04b 100644 --- a/tests/disas/gc/null/multiple-array-get.wat +++ b/tests/disas/gc/null/multiple-array-get.wat @@ -21,27 +21,27 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32): -;; @0024 trapz v2, user15 +;; @0024 trapz v2, user16 ;; @0024 v65 = load.i64 notrap aligned readonly can_move v0+8 ;; @0024 v8 = load.i64 notrap aligned readonly can_move v65+32 ;; @0024 v7 = uextend.i64 v2 ;; @0024 v9 = iadd v8, v7 ;; @0024 v10 = iconst.i64 8 ;; @0024 v11 = iadd v9, v10 ; v10 = 8 -;; @0024 v12 = load.i32 notrap aligned readonly v11 +;; @0024 v12 = load.i32 user2 v11 ;; @0024 v13 = icmp ult v3, v12 -;; @0024 trapz v13, user16 +;; @0024 trapz v13, user17 ;; @0024 v15 = uextend.i64 v12 ;; v67 = iconst.i64 3 ;; v68 = ishl v15, v67 ; v67 = 3 ;; v64 = iconst.i64 32 ;; @0024 v17 = ushr v68, v64 ; v64 = 32 -;; @0024 trapnz v17, user1 +;; @0024 trapnz v17, user2 ;; v77 = iconst.i32 3 ;; v78 = ishl v12, v77 ; v77 = 3 ;; @0024 v19 = iconst.i32 16 -;; @0024 v20 = uadd_overflow_trap v78, v19, user1 ; v19 = 16 -;; @0024 v24 = uadd_overflow_trap v2, v20, user1 +;; @0024 v20 = uadd_overflow_trap v78, v19, user2 ; v19 = 16 +;; @0024 v24 = uadd_overflow_trap v2, v20, user2 ;; @0024 v25 = uextend.i64 v24 ;; @0024 v27 = iadd v8, v25 ;; v84 = ishl v3, v77 ; v77 = 3 @@ -49,15 +49,15 @@ ;; @0024 v28 = isub v20, v23 ;; @0024 v29 = uextend.i64 v28 ;; @0024 v30 = isub v27, v29 -;; @0024 v31 = load.i64 notrap aligned little v30 +;; @0024 v31 = load.i64 user2 little v30 ;; @002b v38 = icmp ult v4, v12 -;; @002b trapz v38, user16 +;; @002b trapz v38, user17 ;; v86 = ishl v4, v77 ; v77 = 3 ;; @002b v48 = iadd v86, v19 ; v19 = 16 ;; @002b v53 = isub v20, v48 ;; @002b v54 = uextend.i64 v53 ;; @002b v55 = isub v27, v54 -;; @002b v56 = load.i64 notrap aligned little v55 +;; @002b v56 = load.i64 user2 little v55 ;; @002e jump block1 ;; ;; block1: diff --git a/tests/disas/gc/null/multiple-struct-get.wat b/tests/disas/gc/null/multiple-struct-get.wat index c1bf36395bd7..bbf1c226543e 100644 --- a/tests/disas/gc/null/multiple-struct-get.wat +++ b/tests/disas/gc/null/multiple-struct-get.wat @@ -22,17 +22,17 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @0023 trapz v2, user15 +;; @0023 trapz v2, user16 ;; @0023 v20 = load.i64 notrap aligned readonly can_move v0+8 ;; @0023 v6 = load.i64 notrap aligned readonly can_move v20+32 ;; @0023 v5 = uextend.i64 v2 ;; @0023 v7 = iadd v6, v5 ;; @0023 v8 = iconst.i64 8 ;; @0023 v9 = iadd v7, v8 ; v8 = 8 -;; @0023 v10 = load.f32 notrap aligned little v9 +;; @0023 v10 = load.f32 user2 little v9 ;; @0029 v14 = iconst.i64 12 ;; @0029 v15 = iadd v7, v14 ; v14 = 12 -;; @0029 v16 = load.i8 notrap aligned little v15 +;; @0029 v16 = load.i8 user2 little v15 ;; @002d jump block1 ;; ;; block1: diff --git a/tests/disas/gc/null/ref-cast.wat b/tests/disas/gc/null/ref-cast.wat index cb4afa15a3a4..f013396f3177 100644 --- a/tests/disas/gc/null/ref-cast.wat +++ b/tests/disas/gc/null/ref-cast.wat @@ -42,7 +42,7 @@ ;; @001e v15 = iadd v14, v13 ;; @001e v16 = iconst.i64 4 ;; @001e v17 = iadd v15, v16 ; v16 = 4 -;; @001e v18 = load.i32 notrap aligned readonly v17 +;; @001e v18 = load.i32 user2 v17 ;; @001e v11 = load.i64 notrap aligned readonly can_move v0+40 ;; @001e v12 = load.i32 notrap aligned readonly can_move v11 ;; @001e v19 = icmp eq v18, v12 @@ -57,7 +57,7 @@ ;; @001e jump block4(v23) ;; ;; block4(v24: i32): -;; @001e trapz v24, user18 +;; @001e trapz v24, user19 ;; v25 = load.i32 notrap v36 ;; @0021 jump block1 ;; diff --git a/tests/disas/gc/null/ref-test-array.wat b/tests/disas/gc/null/ref-test-array.wat index ad44ef52ac5d..a06fe5e84dbb 100644 --- a/tests/disas/gc/null/ref-test-array.wat +++ b/tests/disas/gc/null/ref-test-array.wat @@ -34,7 +34,7 @@ ;; @001b v11 = load.i64 notrap aligned readonly can_move v21+32 ;; @001b v10 = uextend.i64 v2 ;; @001b v12 = iadd v11, v10 -;; @001b v15 = load.i32 notrap aligned readonly v12 +;; @001b v15 = load.i32 user2 v12 ;; @001b v16 = iconst.i32 -1476395008 ;; @001b v17 = band v15, v16 ; v16 = -1476395008 ;; @001b v18 = icmp eq v17, v16 ; v16 = -1476395008 diff --git a/tests/disas/gc/null/ref-test-concrete-func-type.wat b/tests/disas/gc/null/ref-test-concrete-func-type.wat index 7b24dd1003e3..12fb008aaa42 100644 --- a/tests/disas/gc/null/ref-test-concrete-func-type.wat +++ b/tests/disas/gc/null/ref-test-concrete-func-type.wat @@ -28,7 +28,7 @@ ;; @0020 jump block3 ;; ;; block3: -;; @0020 v10 = load.i32 notrap aligned readonly v2+16 +;; @0020 v10 = load.i32 user2 v2+16 ;; @0020 v8 = load.i64 notrap aligned readonly can_move v0+40 ;; @0020 v9 = load.i32 notrap aligned readonly can_move v8 ;; @0020 v11 = icmp eq v10, v9 diff --git a/tests/disas/gc/null/ref-test-concrete-type.wat b/tests/disas/gc/null/ref-test-concrete-type.wat index 698199c1bad7..4413bdffbbed 100644 --- a/tests/disas/gc/null/ref-test-concrete-type.wat +++ b/tests/disas/gc/null/ref-test-concrete-type.wat @@ -39,7 +39,7 @@ ;; @001d v15 = iadd v14, v13 ;; @001d v16 = iconst.i64 4 ;; @001d v17 = iadd v15, v16 ; v16 = 4 -;; @001d v18 = load.i32 notrap aligned readonly v17 +;; @001d v18 = load.i32 user2 v17 ;; @001d v11 = load.i64 notrap aligned readonly can_move v0+40 ;; @001d v12 = load.i32 notrap aligned readonly can_move v11 ;; @001d v19 = icmp eq v18, v12 diff --git a/tests/disas/gc/null/ref-test-eq.wat b/tests/disas/gc/null/ref-test-eq.wat index f64058b78b52..859d3d921688 100644 --- a/tests/disas/gc/null/ref-test-eq.wat +++ b/tests/disas/gc/null/ref-test-eq.wat @@ -33,7 +33,7 @@ ;; @001b v11 = load.i64 notrap aligned readonly can_move v21+32 ;; @001b v10 = uextend.i64 v2 ;; @001b v12 = iadd v11, v10 -;; @001b v15 = load.i32 notrap aligned readonly v12 +;; @001b v15 = load.i32 user2 v12 ;; @001b v16 = iconst.i32 -1610612736 ;; @001b v17 = band v15, v16 ; v16 = -1610612736 ;; @001b v18 = icmp eq v17, v16 ; v16 = -1610612736 diff --git a/tests/disas/gc/null/ref-test-struct.wat b/tests/disas/gc/null/ref-test-struct.wat index adca0039e2de..c9b51cfab676 100644 --- a/tests/disas/gc/null/ref-test-struct.wat +++ b/tests/disas/gc/null/ref-test-struct.wat @@ -34,7 +34,7 @@ ;; @001b v11 = load.i64 notrap aligned readonly can_move v21+32 ;; @001b v10 = uextend.i64 v2 ;; @001b v12 = iadd v11, v10 -;; @001b v15 = load.i32 notrap aligned readonly v12 +;; @001b v15 = load.i32 user2 v12 ;; @001b v16 = iconst.i32 -1342177280 ;; @001b v17 = band v15, v16 ; v16 = -1342177280 ;; @001b v18 = icmp eq v17, v16 ; v16 = -1342177280 diff --git a/tests/disas/gc/null/struct-get-guard-pages.wat b/tests/disas/gc/null/struct-get-guard-pages.wat index 57d473dc84e2..87ffa5d1814a 100644 --- a/tests/disas/gc/null/struct-get-guard-pages.wat +++ b/tests/disas/gc/null/struct-get-guard-pages.wat @@ -34,14 +34,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @0033 trapz v2, user15 +;; @0033 trapz v2, user16 ;; @0033 v10 = load.i64 notrap aligned readonly can_move v0+8 ;; @0033 v5 = load.i64 notrap aligned readonly can_move v10+32 ;; @0033 v4 = uextend.i64 v2 ;; @0033 v6 = iadd v5, v4 ;; @0033 v7 = iconst.i64 8 ;; @0033 v8 = iadd v6, v7 ; v7 = 8 -;; @0033 v9 = load.f32 notrap aligned little v8 +;; @0033 v9 = load.f32 user2 little v8 ;; @0037 jump block1 ;; ;; block1: @@ -59,14 +59,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @003c trapz v2, user15 +;; @003c trapz v2, user16 ;; @003c v11 = load.i64 notrap aligned readonly can_move v0+8 ;; @003c v5 = load.i64 notrap aligned readonly can_move v11+32 ;; @003c v4 = uextend.i64 v2 ;; @003c v6 = iadd v5, v4 ;; @003c v7 = iconst.i64 12 ;; @003c v8 = iadd v6, v7 ; v7 = 12 -;; @003c v9 = load.i8 notrap aligned little v8 +;; @003c v9 = load.i8 user2 little v8 ;; @0040 jump block1 ;; ;; block1: @@ -85,14 +85,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @0045 trapz v2, user15 +;; @0045 trapz v2, user16 ;; @0045 v11 = load.i64 notrap aligned readonly can_move v0+8 ;; @0045 v5 = load.i64 notrap aligned readonly can_move v11+32 ;; @0045 v4 = uextend.i64 v2 ;; @0045 v6 = iadd v5, v4 ;; @0045 v7 = iconst.i64 12 ;; @0045 v8 = iadd v6, v7 ; v7 = 12 -;; @0045 v9 = load.i8 notrap aligned little v8 +;; @0045 v9 = load.i8 user2 little v8 ;; @0049 jump block1 ;; ;; block1: @@ -111,14 +111,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @004e trapz v2, user15 +;; @004e trapz v2, user16 ;; @004e v10 = load.i64 notrap aligned readonly can_move v0+8 ;; @004e v5 = load.i64 notrap aligned readonly can_move v10+32 ;; @004e v4 = uextend.i64 v2 ;; @004e v6 = iadd v5, v4 ;; @004e v7 = iconst.i64 16 ;; @004e v8 = iadd v6, v7 ; v7 = 16 -;; @004e v9 = load.i32 notrap aligned little v8 +;; @004e v9 = load.i32 user2 little v8 ;; @0052 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/null/struct-get-no-guard-pages.wat b/tests/disas/gc/null/struct-get-no-guard-pages.wat index bb64d884c8d6..8c5671bc2412 100644 --- a/tests/disas/gc/null/struct-get-no-guard-pages.wat +++ b/tests/disas/gc/null/struct-get-no-guard-pages.wat @@ -34,10 +34,10 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @0033 trapz v2, user15 +;; @0033 trapz v2, user16 ;; @0033 v4 = uextend.i64 v2 ;; @0033 v5 = iconst.i64 24 -;; @0033 v6 = uadd_overflow_trap v4, v5, user1 ; v5 = 24 +;; @0033 v6 = uadd_overflow_trap v4, v5, user2 ; v5 = 24 ;; @0033 v18 = load.i64 notrap aligned readonly can_move v0+8 ;; @0033 v7 = load.i64 notrap aligned v18+40 ;; @0033 v9 = load.i64 notrap aligned v18+32 @@ -47,7 +47,7 @@ ;; @0033 v12 = select_spectre_guard v8, v11, v10 ; v11 = 0 ;; @0033 v13 = iconst.i64 8 ;; @0033 v14 = iadd v12, v13 ; v13 = 8 -;; @0033 v15 = load.f32 notrap aligned little v14 +;; @0033 v15 = load.f32 user2 little v14 ;; @0037 jump block1 ;; ;; block1: @@ -65,10 +65,10 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @003c trapz v2, user15 +;; @003c trapz v2, user16 ;; @003c v4 = uextend.i64 v2 ;; @003c v5 = iconst.i64 24 -;; @003c v6 = uadd_overflow_trap v4, v5, user1 ; v5 = 24 +;; @003c v6 = uadd_overflow_trap v4, v5, user2 ; v5 = 24 ;; @003c v19 = load.i64 notrap aligned readonly can_move v0+8 ;; @003c v7 = load.i64 notrap aligned v19+40 ;; @003c v9 = load.i64 notrap aligned v19+32 @@ -78,7 +78,7 @@ ;; @003c v12 = select_spectre_guard v8, v11, v10 ; v11 = 0 ;; @003c v13 = iconst.i64 12 ;; @003c v14 = iadd v12, v13 ; v13 = 12 -;; @003c v15 = load.i8 notrap aligned little v14 +;; @003c v15 = load.i8 user2 little v14 ;; @0040 jump block1 ;; ;; block1: @@ -97,10 +97,10 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @0045 trapz v2, user15 +;; @0045 trapz v2, user16 ;; @0045 v4 = uextend.i64 v2 ;; @0045 v5 = iconst.i64 24 -;; @0045 v6 = uadd_overflow_trap v4, v5, user1 ; v5 = 24 +;; @0045 v6 = uadd_overflow_trap v4, v5, user2 ; v5 = 24 ;; @0045 v19 = load.i64 notrap aligned readonly can_move v0+8 ;; @0045 v7 = load.i64 notrap aligned v19+40 ;; @0045 v9 = load.i64 notrap aligned v19+32 @@ -110,7 +110,7 @@ ;; @0045 v12 = select_spectre_guard v8, v11, v10 ; v11 = 0 ;; @0045 v13 = iconst.i64 12 ;; @0045 v14 = iadd v12, v13 ; v13 = 12 -;; @0045 v15 = load.i8 notrap aligned little v14 +;; @0045 v15 = load.i8 user2 little v14 ;; @0049 jump block1 ;; ;; block1: @@ -129,10 +129,10 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @004e trapz v2, user15 +;; @004e trapz v2, user16 ;; @004e v4 = uextend.i64 v2 ;; @004e v5 = iconst.i64 24 -;; @004e v6 = uadd_overflow_trap v4, v5, user1 ; v5 = 24 +;; @004e v6 = uadd_overflow_trap v4, v5, user2 ; v5 = 24 ;; @004e v18 = load.i64 notrap aligned readonly can_move v0+8 ;; @004e v7 = load.i64 notrap aligned v18+40 ;; @004e v9 = load.i64 notrap aligned v18+32 @@ -142,7 +142,7 @@ ;; @004e v12 = select_spectre_guard v8, v11, v10 ; v11 = 0 ;; @004e v13 = iconst.i64 16 ;; @004e v14 = iadd v12, v13 ; v13 = 16 -;; @004e v15 = load.i32 notrap aligned little v14 +;; @004e v15 = load.i32 user2 little v14 ;; @0052 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/null/struct-get.wat b/tests/disas/gc/null/struct-get.wat index 807aa1711bfc..5b996d5d107e 100644 --- a/tests/disas/gc/null/struct-get.wat +++ b/tests/disas/gc/null/struct-get.wat @@ -34,14 +34,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @0033 trapz v2, user15 +;; @0033 trapz v2, user16 ;; @0033 v10 = load.i64 notrap aligned readonly can_move v0+8 ;; @0033 v5 = load.i64 notrap aligned readonly can_move v10+32 ;; @0033 v4 = uextend.i64 v2 ;; @0033 v6 = iadd v5, v4 ;; @0033 v7 = iconst.i64 8 ;; @0033 v8 = iadd v6, v7 ; v7 = 8 -;; @0033 v9 = load.f32 notrap aligned little v8 +;; @0033 v9 = load.f32 user2 little v8 ;; @0037 jump block1 ;; ;; block1: @@ -59,14 +59,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @003c trapz v2, user15 +;; @003c trapz v2, user16 ;; @003c v11 = load.i64 notrap aligned readonly can_move v0+8 ;; @003c v5 = load.i64 notrap aligned readonly can_move v11+32 ;; @003c v4 = uextend.i64 v2 ;; @003c v6 = iadd v5, v4 ;; @003c v7 = iconst.i64 12 ;; @003c v8 = iadd v6, v7 ; v7 = 12 -;; @003c v9 = load.i8 notrap aligned little v8 +;; @003c v9 = load.i8 user2 little v8 ;; @0040 jump block1 ;; ;; block1: @@ -85,14 +85,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @0045 trapz v2, user15 +;; @0045 trapz v2, user16 ;; @0045 v11 = load.i64 notrap aligned readonly can_move v0+8 ;; @0045 v5 = load.i64 notrap aligned readonly can_move v11+32 ;; @0045 v4 = uextend.i64 v2 ;; @0045 v6 = iadd v5, v4 ;; @0045 v7 = iconst.i64 12 ;; @0045 v8 = iadd v6, v7 ; v7 = 12 -;; @0045 v9 = load.i8 notrap aligned little v8 +;; @0045 v9 = load.i8 user2 little v8 ;; @0049 jump block1 ;; ;; block1: @@ -111,14 +111,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @004e trapz v2, user15 +;; @004e trapz v2, user16 ;; @004e v10 = load.i64 notrap aligned readonly can_move v0+8 ;; @004e v5 = load.i64 notrap aligned readonly can_move v10+32 ;; @004e v4 = uextend.i64 v2 ;; @004e v6 = iadd v5, v4 ;; @004e v7 = iconst.i64 16 ;; @004e v8 = iadd v6, v7 ; v7 = 16 -;; @004e v9 = load.i32 notrap aligned little v8 +;; @004e v9 = load.i32 user2 little v8 ;; @0052 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/null/struct-new-default.wat b/tests/disas/gc/null/struct-new-default.wat index 1b39fe1737b1..6dd43d0abfb8 100644 --- a/tests/disas/gc/null/struct-new-default.wat +++ b/tests/disas/gc/null/struct-new-default.wat @@ -24,14 +24,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64): -;; @0021 v11 = load.i64 notrap aligned readonly v0+32 -;; @0021 v12 = load.i32 notrap aligned v11 +;; @0021 v11 = load.i64 user2 v0+32 +;; @0021 v12 = load.i32 user2 v11 ;; v48 = iconst.i32 7 -;; @0021 v15 = uadd_overflow_trap v12, v48, user17 ; v48 = 7 +;; @0021 v15 = uadd_overflow_trap v12, v48, user18 ; v48 = 7 ;; v54 = iconst.i32 -8 ;; @0021 v17 = band v15, v54 ; v54 = -8 ;; @0021 v6 = iconst.i32 24 -;; @0021 v18 = uadd_overflow_trap v17, v6, user17 ; v6 = 24 +;; @0021 v18 = uadd_overflow_trap v17, v6, user18 ; v6 = 24 ;; @0021 v41 = load.i64 notrap aligned readonly can_move v0+8 ;; @0021 v20 = load.i64 notrap aligned v41+40 ;; @0021 v19 = uextend.i64 v18 @@ -44,22 +44,22 @@ ;; v61 = band.i32 v15, v54 ; v54 = -8 ;; v62 = uextend.i64 v61 ;; @0021 v27 = iadd v25, v62 -;; @0021 store notrap aligned v55, v27 ; v55 = -1342177256 +;; @0021 store user2 v55, v27 ; v55 = -1342177256 ;; @0021 v31 = load.i64 notrap aligned readonly can_move v0+40 ;; @0021 v32 = load.i32 notrap aligned readonly can_move v31 -;; @0021 store notrap aligned v32, v27+4 -;; @0021 store.i32 notrap aligned v18, v11 +;; @0021 store user2 v32, v27+4 +;; @0021 store.i32 user2 v18, v11 ;; @0021 v3 = f32const 0.0 ;; v38 = iconst.i64 8 ;; @0021 v33 = iadd v27, v38 ; v38 = 8 -;; @0021 store notrap aligned little v3, v33 ; v3 = 0.0 +;; @0021 store user2 little v3, v33 ; v3 = 0.0 ;; @0021 v4 = iconst.i32 0 ;; v37 = iconst.i64 12 ;; @0021 v34 = iadd v27, v37 ; v37 = 12 -;; @0021 istore8 notrap aligned little v4, v34 ; v4 = 0 +;; @0021 istore8 user2 little v4, v34 ; v4 = 0 ;; v36 = iconst.i64 16 ;; @0021 v35 = iadd v27, v36 ; v36 = 16 -;; @0021 store notrap aligned little v4, v35 ; v4 = 0 +;; @0021 store user2 little v4, v35 ; v4 = 0 ;; @0024 jump block1 ;; ;; block3 cold: diff --git a/tests/disas/gc/null/struct-new.wat b/tests/disas/gc/null/struct-new.wat index 1be9f6b72db2..1e3ca85a8177 100644 --- a/tests/disas/gc/null/struct-new.wat +++ b/tests/disas/gc/null/struct-new.wat @@ -27,14 +27,14 @@ ;; block0(v0: i64, v1: i64, v2: f32, v3: i32, v4: i32): ;; v45 = stack_addr.i64 ss0 ;; store notrap v4, v45 -;; @002a v11 = load.i64 notrap aligned readonly v0+32 -;; @002a v12 = load.i32 notrap aligned v11 +;; @002a v11 = load.i64 user2 v0+32 +;; @002a v12 = load.i32 user2 v11 ;; v52 = iconst.i32 7 -;; @002a v15 = uadd_overflow_trap v12, v52, user17 ; v52 = 7 +;; @002a v15 = uadd_overflow_trap v12, v52, user18 ; v52 = 7 ;; v58 = iconst.i32 -8 ;; @002a v17 = band v15, v58 ; v58 = -8 ;; @002a v6 = iconst.i32 24 -;; @002a v18 = uadd_overflow_trap v17, v6, user17 ; v6 = 24 +;; @002a v18 = uadd_overflow_trap v17, v6, user18 ; v6 = 24 ;; @002a v43 = load.i64 notrap aligned readonly can_move v0+8 ;; @002a v20 = load.i64 notrap aligned v43+40 ;; @002a v19 = uextend.i64 v18 @@ -47,21 +47,21 @@ ;; v65 = band.i32 v15, v58 ; v58 = -8 ;; v66 = uextend.i64 v65 ;; @002a v27 = iadd v25, v66 -;; @002a store notrap aligned v59, v27 ; v59 = -1342177256 +;; @002a store user2 v59, v27 ; v59 = -1342177256 ;; @002a v31 = load.i64 notrap aligned readonly can_move v0+40 ;; @002a v32 = load.i32 notrap aligned readonly can_move v31 -;; @002a store notrap aligned v32, v27+4 -;; @002a store.i32 notrap aligned v18, v11 +;; @002a store user2 v32, v27+4 +;; @002a store.i32 user2 v18, v11 ;; v40 = iconst.i64 8 ;; @002a v33 = iadd v27, v40 ; v40 = 8 -;; @002a store.f32 notrap aligned little v2, v33 +;; @002a store.f32 user2 little v2, v33 ;; v39 = iconst.i64 12 ;; @002a v34 = iadd v27, v39 ; v39 = 12 -;; @002a istore8.i32 notrap aligned little v3, v34 +;; @002a istore8.i32 user2 little v3, v34 ;; v36 = load.i32 notrap v45 ;; v38 = iconst.i64 16 ;; @002a v35 = iadd v27, v38 ; v38 = 16 -;; @002a store notrap aligned little v36, v35 +;; @002a store user2 little v36, v35 ;; @002d jump block1 ;; ;; block3 cold: diff --git a/tests/disas/gc/null/struct-set.wat b/tests/disas/gc/null/struct-set.wat index 30e88dedfe75..97f431ef92c1 100644 --- a/tests/disas/gc/null/struct-set.wat +++ b/tests/disas/gc/null/struct-set.wat @@ -30,14 +30,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: f32): -;; @0034 trapz v2, user15 +;; @0034 trapz v2, user16 ;; @0034 v9 = load.i64 notrap aligned readonly can_move v0+8 ;; @0034 v5 = load.i64 notrap aligned readonly can_move v9+32 ;; @0034 v4 = uextend.i64 v2 ;; @0034 v6 = iadd v5, v4 ;; @0034 v7 = iconst.i64 8 ;; @0034 v8 = iadd v6, v7 ; v7 = 8 -;; @0034 store notrap aligned little v3, v8 +;; @0034 store user2 little v3, v8 ;; @0038 jump block1 ;; ;; block1: @@ -55,14 +55,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32): -;; @003f trapz v2, user15 +;; @003f trapz v2, user16 ;; @003f v9 = load.i64 notrap aligned readonly can_move v0+8 ;; @003f v5 = load.i64 notrap aligned readonly can_move v9+32 ;; @003f v4 = uextend.i64 v2 ;; @003f v6 = iadd v5, v4 ;; @003f v7 = iconst.i64 12 ;; @003f v8 = iadd v6, v7 ; v7 = 12 -;; @003f istore8 notrap aligned little v3, v8 +;; @003f istore8 user2 little v3, v8 ;; @0043 jump block1 ;; ;; block1: @@ -80,14 +80,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32): -;; @004a trapz v2, user15 +;; @004a trapz v2, user16 ;; @004a v9 = load.i64 notrap aligned readonly can_move v0+8 ;; @004a v5 = load.i64 notrap aligned readonly can_move v9+32 ;; @004a v4 = uextend.i64 v2 ;; @004a v6 = iadd v5, v4 ;; @004a v7 = iconst.i64 16 ;; @004a v8 = iadd v6, v7 ; v7 = 16 -;; @004a store notrap aligned little v3, v8 +;; @004a store user2 little v3, v8 ;; @004e jump block1 ;; ;; block1: diff --git a/tests/disas/gc/null/v128-fields.wat b/tests/disas/gc/null/v128-fields.wat index 76350405b5d8..5ebc53e6fdfb 100644 --- a/tests/disas/gc/null/v128-fields.wat +++ b/tests/disas/gc/null/v128-fields.wat @@ -22,14 +22,14 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @0022 trapz v2, user15 +;; @0022 trapz v2, user16 ;; @0022 v19 = load.i64 notrap aligned readonly can_move v0+8 ;; @0022 v5 = load.i64 notrap aligned readonly can_move v19+32 ;; @0022 v4 = uextend.i64 v2 ;; @0022 v6 = iadd v5, v4 ;; @0022 v7 = iconst.i64 16 ;; @0022 v8 = iadd v6, v7 ; v7 = 16 -;; @0022 v9 = load.i8x16 notrap aligned little v8 +;; @0022 v9 = load.i8x16 user2 little v8 ;; @002e jump block1 ;; ;; block1: diff --git a/tests/disas/gc/struct-new-default.wat b/tests/disas/gc/struct-new-default.wat index e9c504a88529..ad479f10147c 100644 --- a/tests/disas/gc/struct-new-default.wat +++ b/tests/disas/gc/struct-new-default.wat @@ -39,32 +39,32 @@ ;; @0023 v17 = iadd v15, v16 ;; v48 = iconst.i64 24 ;; @0023 v18 = iadd v17, v48 ; v48 = 24 -;; @0023 store notrap aligned little v3, v18 ; v3 = 0.0 +;; @0023 store user2 little v3, v18 ; v3 = 0.0 ;; @0023 v4 = iconst.i32 0 ;; v47 = iconst.i64 28 ;; @0023 v19 = iadd v17, v47 ; v47 = 28 -;; @0023 istore8 notrap aligned little v4, v19 ; v4 = 0 +;; @0023 istore8 user2 little v4, v19 ; v4 = 0 ;; v45 = iconst.i32 1 ;; @0023 brif v45, block3, block2 ; v45 = 1 ;; ;; block2: ;; @0023 v28 = iconst.i64 8 ;; @0023 v29 = iadd.i64 v15, v28 ; v28 = 8 -;; @0023 v30 = load.i64 notrap aligned v29 +;; @0023 v30 = load.i64 user2 v29 ;; v41 = iconst.i64 1 ;; @0023 v31 = iadd v30, v41 ; v41 = 1 -;; @0023 store notrap aligned v31, v29 +;; @0023 store user2 v31, v29 ;; @0023 jump block3 ;; ;; block3: ;; v68 = iconst.i32 0 ;; v46 = iconst.i64 32 ;; @0023 v20 = iadd.i64 v17, v46 ; v46 = 32 -;; @0023 store notrap aligned little v68, v20 ; v68 = 0 +;; @0023 store user2 little v68, v20 ; v68 = 0 ;; @0023 v6 = vconst.i8x16 const0 ;; v38 = iconst.i64 48 ;; @0023 v37 = iadd.i64 v17, v38 ; v38 = 48 -;; @0023 store notrap aligned little v6, v37 ; v6 = const0 +;; @0023 store user2 little v6, v37 ; v6 = const0 ;; @0026 jump block1 ;; ;; block1: diff --git a/tests/disas/gc/struct-new.wat b/tests/disas/gc/struct-new.wat index 8777f9a196e9..3997852121d2 100644 --- a/tests/disas/gc/struct-new.wat +++ b/tests/disas/gc/struct-new.wat @@ -39,10 +39,10 @@ ;; @002a v16 = iadd v14, v15 ;; v55 = iconst.i64 24 ;; @002a v17 = iadd v16, v55 ; v55 = 24 -;; @002a store notrap aligned little v2, v17 +;; @002a store user2 little v2, v17 ;; v54 = iconst.i64 28 ;; @002a v18 = iadd v16, v54 ; v54 = 28 -;; @002a istore8 notrap aligned little v3, v18 +;; @002a istore8 user2 little v3, v18 ;; v40 = load.i32 notrap v58 ;; v51 = iconst.i32 1 ;; @002a v20 = band v40, v51 ; v51 = 1 @@ -57,17 +57,17 @@ ;; @002a v26 = iadd.i64 v14, v24 ;; @002a v27 = iconst.i64 8 ;; @002a v28 = iadd v26, v27 ; v27 = 8 -;; @002a v29 = load.i64 notrap aligned v28 +;; @002a v29 = load.i64 user2 v28 ;; v45 = iconst.i64 1 ;; @002a v30 = iadd v29, v45 ; v45 = 1 -;; @002a store notrap aligned v30, v28 +;; @002a store user2 v30, v28 ;; @002a jump block3 ;; ;; block3: ;; v36 = load.i32 notrap v58 ;; v53 = iconst.i64 32 ;; @002a v19 = iadd.i64 v16, v53 ; v53 = 32 -;; @002a store notrap aligned little v36, v19 +;; @002a store user2 little v36, v19 ;; @002d jump block1 ;; ;; block1: diff --git a/tests/disas/icall-loop.wat b/tests/disas/icall-loop.wat index 0ee9a15350e2..3918c542953f 100644 --- a/tests/disas/icall-loop.wat +++ b/tests/disas/icall-loop.wat @@ -50,7 +50,7 @@ ;; @0027 jump block2 ;; ;; block2: -;; @002b v12 = load.i64 user5 aligned table v11 +;; @002b v12 = load.i64 user6 aligned table v11 ;; v31 = iconst.i64 -2 ;; v32 = band v12, v31 ; v31 = -2 ;; @002b brif v12, block5(v32), block4 @@ -61,9 +61,9 @@ ;; @002b jump block5(v18) ;; ;; block5(v14: i64): -;; @002b v22 = load.i32 user6 aligned readonly v14+16 +;; @002b v22 = load.i32 user7 aligned readonly v14+16 ;; @002b v23 = icmp eq v22, v21 -;; @002b trapz v23, user7 +;; @002b trapz v23, user8 ;; @002b v24 = load.i64 notrap aligned readonly v14+8 ;; @002b v25 = load.i64 notrap aligned readonly v14+24 ;; @002b v26 = call_indirect sig0, v24(v25, v0) @@ -94,7 +94,7 @@ ;; ;; block2: ;; v37 = iadd.i64 v6, v36 ; v36 = 8 -;; @0038 v11 = load.i64 user5 aligned table v37 +;; @0038 v11 = load.i64 user6 aligned table v37 ;; v38 = iconst.i64 -2 ;; v39 = band v11, v38 ; v38 = -2 ;; @0038 brif v11, block5(v39), block4 @@ -106,9 +106,9 @@ ;; @0038 jump block5(v17) ;; ;; block5(v13: i64): -;; @0038 v21 = load.i32 user6 aligned readonly v13+16 +;; @0038 v21 = load.i32 user7 aligned readonly v13+16 ;; @0038 v22 = icmp eq v21, v20 -;; @0038 trapz v22, user7 +;; @0038 trapz v22, user8 ;; @0038 v23 = load.i64 notrap aligned readonly v13+8 ;; @0038 v24 = load.i64 notrap aligned readonly v13+24 ;; @0038 v25 = call_indirect sig0, v23(v24, v0) diff --git a/tests/disas/icall-simd.wat b/tests/disas/icall-simd.wat index 9066a3e34007..749c30e8708b 100644 --- a/tests/disas/icall-simd.wat +++ b/tests/disas/icall-simd.wat @@ -29,7 +29,7 @@ ;; @0033 v10 = iadd v8, v9 ;; @0033 v11 = iconst.i64 0 ;; @0033 v12 = select_spectre_guard v6, v11, v10 ; v11 = 0 -;; @0033 v13 = load.i64 user5 aligned table v12 +;; @0033 v13 = load.i64 user6 aligned table v12 ;; v28 = iconst.i64 -2 ;; @0033 v14 = band v13, v28 ; v28 = -2 ;; @0033 brif v13, block3(v14), block2 @@ -43,9 +43,9 @@ ;; block3(v15: i64): ;; @0033 v21 = load.i64 notrap aligned readonly can_move v0+40 ;; @0033 v22 = load.i32 notrap aligned readonly can_move v21 -;; @0033 v23 = load.i32 user6 aligned readonly v15+16 +;; @0033 v23 = load.i32 user7 aligned readonly v15+16 ;; @0033 v24 = icmp eq v23, v22 -;; @0033 trapz v24, user7 +;; @0033 trapz v24, user8 ;; @0033 v25 = load.i64 notrap aligned readonly v15+8 ;; @0033 v26 = load.i64 notrap aligned readonly v15+24 ;; @0033 v27 = call_indirect sig0, v25(v26, v0, v3) diff --git a/tests/disas/icall.wat b/tests/disas/icall.wat index c02c3c457f2e..d84d2b7c727a 100644 --- a/tests/disas/icall.wat +++ b/tests/disas/icall.wat @@ -29,7 +29,7 @@ ;; @0033 v10 = iadd v8, v9 ;; @0033 v11 = iconst.i64 0 ;; @0033 v12 = select_spectre_guard v6, v11, v10 ; v11 = 0 -;; @0033 v13 = load.i64 user5 aligned table v12 +;; @0033 v13 = load.i64 user6 aligned table v12 ;; v28 = iconst.i64 -2 ;; @0033 v14 = band v13, v28 ; v28 = -2 ;; @0033 brif v13, block3(v14), block2 @@ -43,9 +43,9 @@ ;; block3(v15: i64): ;; @0033 v21 = load.i64 notrap aligned readonly can_move v0+40 ;; @0033 v22 = load.i32 notrap aligned readonly can_move v21 -;; @0033 v23 = load.i32 user6 aligned readonly v15+16 +;; @0033 v23 = load.i32 user7 aligned readonly v15+16 ;; @0033 v24 = icmp eq v23, v22 -;; @0033 trapz v24, user7 +;; @0033 trapz v24, user8 ;; @0033 v25 = load.i64 notrap aligned readonly v15+8 ;; @0033 v26 = load.i64 notrap aligned readonly v15+24 ;; @0033 v27 = call_indirect sig0, v25(v26, v0, v3) diff --git a/tests/disas/if-reachability-translation-0.wat b/tests/disas/if-reachability-translation-0.wat index 7172d9788bd4..7b944957d49d 100644 --- a/tests/disas/if-reachability-translation-0.wat +++ b/tests/disas/if-reachability-translation-0.wat @@ -20,5 +20,5 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @0019 trap user11 +;; @0019 trap user12 ;; } diff --git a/tests/disas/if-reachability-translation-2.wat b/tests/disas/if-reachability-translation-2.wat index 208fca857edd..c413a0ac1772 100644 --- a/tests/disas/if-reachability-translation-2.wat +++ b/tests/disas/if-reachability-translation-2.wat @@ -20,7 +20,7 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @001d trapnz v2, user11 +;; @001d trapnz v2, user12 ;; @001b jump block4 ;; ;; block4: diff --git a/tests/disas/if-reachability-translation-3.wat b/tests/disas/if-reachability-translation-3.wat index 5c046bb4b420..c6233d977e83 100644 --- a/tests/disas/if-reachability-translation-3.wat +++ b/tests/disas/if-reachability-translation-3.wat @@ -20,7 +20,7 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @001f trapz v2, user11 +;; @001f trapz v2, user12 ;; @001b jump block2 ;; ;; block2: diff --git a/tests/disas/if-reachability-translation-4.wat b/tests/disas/if-reachability-translation-4.wat index 8fbfb6447bfc..213af8036608 100644 --- a/tests/disas/if-reachability-translation-4.wat +++ b/tests/disas/if-reachability-translation-4.wat @@ -20,9 +20,9 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32): -;; @001d trapnz v2, user11 +;; @001d trapnz v2, user12 ;; @001b jump block4 ;; ;; block4: -;; @001f trap user11 +;; @001f trap user12 ;; } diff --git a/tests/disas/if-reachability-translation-5.wat b/tests/disas/if-reachability-translation-5.wat index 380fe8cdf46f..e9c6eb67d51f 100644 --- a/tests/disas/if-reachability-translation-5.wat +++ b/tests/disas/if-reachability-translation-5.wat @@ -22,11 +22,11 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32): -;; @0024 trapz v2, user11 +;; @0024 trapz v2, user12 ;; @001c jump block2 ;; ;; block2: -;; @0022 trapz.i32 v3, user11 +;; @0022 trapz.i32 v3, user12 ;; @0020 jump block3 ;; ;; block3: diff --git a/tests/disas/if-reachability-translation-6.wat b/tests/disas/if-reachability-translation-6.wat index 285e03749b01..ba3a7e97e92e 100644 --- a/tests/disas/if-reachability-translation-6.wat +++ b/tests/disas/if-reachability-translation-6.wat @@ -22,11 +22,11 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32): -;; @001e trapnz v2, user11 +;; @001e trapnz v2, user12 ;; @001c jump block4 ;; ;; block4: -;; @0024 trapz.i32 v3, user11 +;; @0024 trapz.i32 v3, user12 ;; @0022 jump block3 ;; ;; block3: diff --git a/tests/disas/if-unreachable-else-params-2.wat b/tests/disas/if-unreachable-else-params-2.wat index 407a59765c99..36299c334ce5 100644 --- a/tests/disas/if-unreachable-else-params-2.wat +++ b/tests/disas/if-unreachable-else-params-2.wat @@ -30,7 +30,7 @@ ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32): ;; @0049 v5 = f64const 0x1.0000000000000p0 -;; @005d trapz v3, user11 +;; @005d trapz v3, user12 ;; @0056 jump block2 ;; ;; block2: diff --git a/tests/disas/if-unreachable-else-params.wat b/tests/disas/if-unreachable-else-params.wat index 970876e6ea73..21d1e89b4faf 100644 --- a/tests/disas/if-unreachable-else-params.wat +++ b/tests/disas/if-unreachable-else-params.wat @@ -63,7 +63,7 @@ ;; @004b v8 = load.i64 notrap aligned readonly can_move v0+56 ;; @004b v9 = iadd v8, v7 ;; @004b v10 = sload16.i64 little heap v9 -;; @004e trap user11 +;; @004e trap user12 ;; ;; block6: ;; @005d v11 = popcnt.i32 v3 ; v3 = 35 diff --git a/tests/disas/indirect-call-no-caching.wat b/tests/disas/indirect-call-no-caching.wat index ca2a591dd909..3f7e14f6a1f1 100644 --- a/tests/disas/indirect-call-no-caching.wat +++ b/tests/disas/indirect-call-no-caching.wat @@ -83,7 +83,7 @@ ;; @0050 v9 = iadd v7, v8 ;; @0050 v10 = iconst.i64 0 ;; @0050 v11 = select_spectre_guard v5, v10, v9 ; v10 = 0 -;; @0050 v12 = load.i64 user5 aligned table v11 +;; @0050 v12 = load.i64 user6 aligned table v11 ;; v27 = iconst.i64 -2 ;; @0050 v13 = band v12, v27 ; v27 = -2 ;; @0050 brif v12, block3(v13), block2 @@ -97,9 +97,9 @@ ;; block3(v14: i64): ;; @0050 v20 = load.i64 notrap aligned readonly can_move v0+40 ;; @0050 v21 = load.i32 notrap aligned readonly can_move v20 -;; @0050 v22 = load.i32 user6 aligned readonly v14+16 +;; @0050 v22 = load.i32 user7 aligned readonly v14+16 ;; @0050 v23 = icmp eq v22, v21 -;; @0050 trapz v23, user7 +;; @0050 trapz v23, user8 ;; @0050 v24 = load.i64 notrap aligned readonly v14+8 ;; @0050 v25 = load.i64 notrap aligned readonly v14+24 ;; @0050 v26 = call_indirect sig0, v24(v25, v0) diff --git a/tests/disas/metadata-for-internal-asserts.wat b/tests/disas/metadata-for-internal-asserts.wat new file mode 100644 index 000000000000..1a8312d70e17 --- /dev/null +++ b/tests/disas/metadata-for-internal-asserts.wat @@ -0,0 +1,48 @@ +;;! target = "x86_64" +;;! test = 'compile' +;;! flags = '-Ccranelift-wasmtime_debug_checks=on -Cmetadata-for-internal-asserts' +;;! objdump = '--funcs all' + +(module (func)) + +;; wasm[0]::function[0]: +;; pushq %rbp +;; movq %rsp, %rbp +;; movq %rbp, %rsp +;; popq %rbp +;; retq +;; +;; signatures[0]::wasm_to_array_trampoline: +;; pushq %rbp +;; movq %rsp, %rbp +;; subq $0x10, %rsp +;; movq %rbx, (%rsp) +;; movl (%rsi), %eax +;; cmpl $0x65726f63, %eax +;; jne 0x70 +;; 22: movq 8(%rsi), %rax +;; movq %rbp, %rcx +;; movq %rcx, 0x30(%rax) +;; movq %rbp, %rcx +;; movq 8(%rcx), %rcx +;; movq %rcx, 0x38(%rax) +;; movq 8(%rdi), %r8 +;; leaq (%rsp), %rdx +;; xorq %rcx, %rcx +;; movq %rsi, %rbx +;; callq *%r8 +;; testb %al, %al +;; je 0x5e +;; 51: movq (%rsp), %rbx +;; addq $0x10, %rsp +;; movq %rbp, %rsp +;; popq %rbp +;; retq +;; 5e: movq 0x10(%rbx), %rax +;; 62: movq 0x1a0(%rax), %rax +;; 69: movq %rbx, %rdi +;; 6c: callq *%rax +;; 6e: ud2 +;; ╰─╼ trap: InternalAssert +;; 70: ud2 +;; ╰─╼ trap: InternalAssert diff --git a/tests/disas/pr2559.wat b/tests/disas/pr2559.wat index 5f66e5d7f2cb..d7594df35634 100644 --- a/tests/disas/pr2559.wat +++ b/tests/disas/pr2559.wat @@ -86,7 +86,7 @@ ;; @0044 v22 = iconst.i32 87 ;; @0047 v23 = bitcast.i8x16 little v15 ;; @0047 v24 = select.i8x16 v22, v8, v23 ; v22 = 87 -;; @0048 trap user11 +;; @0048 trap user12 ;; ;; block1(v4: i8x16): ;; @0055 return v5, v8, v4 @@ -126,7 +126,7 @@ ;; @006e v22 = iconst.i32 87 ;; @0071 v23 = bitcast.i8x16 little v15 ;; @0071 v24 = select.i8x16 v22, v8, v23 ; v22 = 87 -;; @0074 trap user11 +;; @0074 trap user12 ;; ;; block1(v4: i8x16): ;; @0081 return v5, v8, v4 diff --git a/tests/disas/readonly-funcrefs.wat b/tests/disas/readonly-funcrefs.wat index 7b48c4631385..8e70e114b19e 100644 --- a/tests/disas/readonly-funcrefs.wat +++ b/tests/disas/readonly-funcrefs.wat @@ -52,7 +52,7 @@ ;; @0031 v7 = ishl v5, v26 ; v26 = 3 ;; @0031 v8 = iadd v6, v7 ;; @0031 v10 = select_spectre_guard v4, v9, v8 ; v9 = 0 -;; @0031 v11 = load.i64 user5 aligned table v10 +;; @0031 v11 = load.i64 user6 aligned table v10 ;; v25 = iconst.i64 -2 ;; @0031 v12 = band v11, v25 ; v25 = -2 ;; @0031 brif v11, block3(v12), block2 @@ -63,11 +63,11 @@ ;; @0031 jump block3(v17) ;; ;; block3(v13: i64): -;; @0031 v21 = load.i32 user6 aligned readonly v13+16 +;; @0031 v21 = load.i32 user7 aligned readonly v13+16 ;; @0031 v19 = load.i64 notrap aligned readonly can_move v0+40 ;; @0031 v20 = load.i32 notrap aligned readonly can_move v19 ;; @0031 v22 = icmp eq v21, v20 -;; @0031 trapz v22, user7 +;; @0031 trapz v22, user8 ;; @0031 v23 = load.i64 notrap aligned readonly v13+8 ;; @0031 v24 = load.i64 notrap aligned readonly v13+24 ;; @0031 call_indirect sig0, v23(v24, v0) diff --git a/tests/disas/ref-func-0.wat b/tests/disas/ref-func-0.wat index 486d5d628b67..a1b3ad296c76 100644 --- a/tests/disas/ref-func-0.wat +++ b/tests/disas/ref-func-0.wat @@ -40,35 +40,35 @@ ;; @008f v109 = load.i64 notrap aligned readonly can_move v0+8 ;; @008f v14 = load.i64 notrap aligned readonly can_move v109+32 ;; @008f v15 = iadd v14, v13 -;; @008f v16 = load.i32 notrap aligned v15 +;; @008f v16 = load.i32 user2 v15 ;; @008f v17 = iconst.i32 2 ;; @008f v18 = band v16, v17 ; v17 = 2 ;; @008f brif v18, block4, block3 ;; ;; block3: -;; @008f v20 = load.i64 notrap aligned readonly v0+32 -;; @008f v21 = load.i32 notrap aligned v20 +;; @008f v20 = load.i64 user2 v0+32 +;; @008f v21 = load.i32 user2 v20 ;; @008f v22 = uextend.i64 v8 ;; @008f v107 = load.i64 notrap aligned readonly can_move v0+8 ;; @008f v23 = load.i64 notrap aligned readonly can_move v107+32 ;; @008f v24 = iadd v23, v22 ;; @008f v25 = iconst.i64 16 ;; @008f v26 = iadd v24, v25 ; v25 = 16 -;; @008f store notrap aligned v21, v26 +;; @008f store user2 v21, v26 ;; @008f v27 = iconst.i32 2 ;; @008f v28 = bor.i32 v16, v27 ; v27 = 2 ;; @008f v29 = uextend.i64 v8 ;; @008f v105 = load.i64 notrap aligned readonly can_move v0+8 ;; @008f v30 = load.i64 notrap aligned readonly can_move v105+32 ;; @008f v31 = iadd v30, v29 -;; @008f store notrap aligned v28, v31 +;; @008f store user2 v28, v31 ;; @008f v32 = uextend.i64 v8 ;; @008f v103 = load.i64 notrap aligned readonly can_move v0+8 ;; @008f v33 = load.i64 notrap aligned readonly can_move v103+32 ;; @008f v34 = iadd v33, v32 ;; @008f v35 = iconst.i64 8 ;; @008f v36 = iadd v34, v35 ; v35 = 8 -;; @008f v37 = load.i64 notrap aligned v36 +;; @008f v37 = load.i64 user2 v36 ;; v102 = iconst.i64 1 ;; @008f v38 = iadd v37, v102 ; v102 = 1 ;; @008f v39 = uextend.i64 v8 @@ -77,8 +77,8 @@ ;; @008f v41 = iadd v40, v39 ;; @008f v42 = iconst.i64 8 ;; @008f v43 = iadd v41, v42 ; v42 = 8 -;; @008f store notrap aligned v38, v43 -;; @008f store.i32 notrap aligned v8, v20 +;; @008f store user2 v38, v43 +;; @008f store.i32 user2 v8, v20 ;; @008f jump block4 ;; ;; block4: @@ -98,35 +98,35 @@ ;; @0091 v95 = load.i64 notrap aligned readonly can_move v0+8 ;; @0091 v52 = load.i64 notrap aligned readonly can_move v95+32 ;; @0091 v53 = iadd v52, v51 -;; @0091 v54 = load.i32 notrap aligned v53 +;; @0091 v54 = load.i32 user2 v53 ;; @0091 v55 = iconst.i32 2 ;; @0091 v56 = band v54, v55 ; v55 = 2 ;; @0091 brif v56, block7, block6 ;; ;; block6: -;; @0091 v58 = load.i64 notrap aligned readonly v0+32 -;; @0091 v59 = load.i32 notrap aligned v58 +;; @0091 v58 = load.i64 user2 v0+32 +;; @0091 v59 = load.i32 user2 v58 ;; @0091 v60 = uextend.i64 v46 ;; @0091 v93 = load.i64 notrap aligned readonly can_move v0+8 ;; @0091 v61 = load.i64 notrap aligned readonly can_move v93+32 ;; @0091 v62 = iadd v61, v60 ;; @0091 v63 = iconst.i64 16 ;; @0091 v64 = iadd v62, v63 ; v63 = 16 -;; @0091 store notrap aligned v59, v64 +;; @0091 store user2 v59, v64 ;; @0091 v65 = iconst.i32 2 ;; @0091 v66 = bor.i32 v54, v65 ; v65 = 2 ;; @0091 v67 = uextend.i64 v46 ;; @0091 v91 = load.i64 notrap aligned readonly can_move v0+8 ;; @0091 v68 = load.i64 notrap aligned readonly can_move v91+32 ;; @0091 v69 = iadd v68, v67 -;; @0091 store notrap aligned v66, v69 +;; @0091 store user2 v66, v69 ;; @0091 v70 = uextend.i64 v46 ;; @0091 v89 = load.i64 notrap aligned readonly can_move v0+8 ;; @0091 v71 = load.i64 notrap aligned readonly can_move v89+32 ;; @0091 v72 = iadd v71, v70 ;; @0091 v73 = iconst.i64 8 ;; @0091 v74 = iadd v72, v73 ; v73 = 8 -;; @0091 v75 = load.i64 notrap aligned v74 +;; @0091 v75 = load.i64 user2 v74 ;; v88 = iconst.i64 1 ;; @0091 v76 = iadd v75, v88 ; v88 = 1 ;; @0091 v77 = uextend.i64 v46 @@ -135,8 +135,8 @@ ;; @0091 v79 = iadd v78, v77 ;; @0091 v80 = iconst.i64 8 ;; @0091 v81 = iadd v79, v80 ; v80 = 8 -;; @0091 store notrap aligned v76, v81 -;; @0091 store.i32 notrap aligned v46, v58 +;; @0091 store user2 v76, v81 +;; @0091 store.i32 user2 v46, v58 ;; @0091 jump block7 ;; ;; block7: diff --git a/tests/disas/riscv64-component-builtins-asm.wat b/tests/disas/riscv64-component-builtins-asm.wat index 5d93705b9a77..52dd6ed23c99 100644 --- a/tests/disas/riscv64-component-builtins-asm.wat +++ b/tests/disas/riscv64-component-builtins-asm.wat @@ -30,7 +30,7 @@ ;; andi a1, a1, 1 ;; bnez a1, 8 ;; .byte 0x00, 0x00, 0x00, 0x00 -;; ╰─╼ trap: CannotLeaveComponent +;; ╰─╼ trap: Normal(CannotLeaveComponent) ;; ld a1, 8(a0) ;; ld a5, 0x10(a1) ;; mv a4, zero diff --git a/tests/disas/riscv64-component-builtins.wat b/tests/disas/riscv64-component-builtins.wat index 67ee547433bb..d202882c5df8 100644 --- a/tests/disas/riscv64-component-builtins.wat +++ b/tests/disas/riscv64-component-builtins.wat @@ -23,7 +23,7 @@ ;; v6 = load.i32 notrap aligned v0+32 ;; v17 = iconst.i32 1 ;; v7 = band v6, v17 ; v17 = 1 -;; trapz v7, user25 +;; trapz v7, user26 ;; v10 = load.i64 notrap aligned readonly v0+8 ;; v11 = load.i64 notrap aligned readonly v10+16 ;; v8 = iconst.i32 0 diff --git a/tests/disas/stack-switching/resume-suspend-data-passing.wat b/tests/disas/stack-switching/resume-suspend-data-passing.wat index 436a9de699ca..e64a97156987 100644 --- a/tests/disas/stack-switching/resume-suspend-data-passing.wat +++ b/tests/disas/stack-switching/resume-suspend-data-passing.wat @@ -68,7 +68,7 @@ ;; block4(v11: i64, v12: i64, v52: i32): ;; v73 = iconst.i64 1 ;; v74 = icmp eq v11, v73 ; v73 = 1 -;; @0044 trapnz v74, user21 +;; @0044 trapnz v74, user22 ;; @0044 jump block5 ;; ;; block5: @@ -159,7 +159,7 @@ ;; block0(v0: i64, v1: i64): ;; @0056 v2 = iconst.i32 0 ;; @0056 v4 = call fn0(v0, v2) ; v2 = 0 -;; @0058 trapz v4, user15 +;; @0058 trapz v4, user16 ;; @0058 v8 = call fn1(v0, v4, v2, v2) ; v2 = 0, v2 = 0 ;; @0058 v9 = load.i64 notrap aligned v8+72 ;; @0058 v11 = uextend.i128 v9 @@ -188,13 +188,13 @@ ;; ;; block5: ;; @0062 v18 = ireduce.i64 v16 -;; @0062 trapz v18, user15 +;; @0062 trapz v18, user16 ;; @0062 v21 = load.i64 notrap aligned v18+72 ;; v128 = iconst.i64 64 ;; v129 = ushr.i128 v16, v128 ; v128 = 64 ;; @0062 v20 = ireduce.i64 v129 ;; @0062 v22 = icmp eq v21, v20 -;; @0062 trapz v22, user22 +;; @0062 trapz v22, user23 ;; v130 = iconst.i64 1 ;; v131 = iadd v21, v130 ; v130 = 1 ;; @0062 store notrap aligned v131, v18+72 @@ -267,7 +267,7 @@ ;; @0062 jump block8 ;; ;; block9 cold: -;; @0062 trap user11 +;; @0062 trap user12 ;; ;; block10: ;; v98 = iconst.i64 120 diff --git a/tests/disas/stack-switching/resume-suspend.wat b/tests/disas/stack-switching/resume-suspend.wat index 8701a1671065..3505ddb7594a 100644 --- a/tests/disas/stack-switching/resume-suspend.wat +++ b/tests/disas/stack-switching/resume-suspend.wat @@ -41,7 +41,7 @@ ;; block2(v8: i64, v9: i64): ;; v62 = iconst.i64 1 ;; v63 = icmp eq v8, v62 ; v62 = 1 -;; @003b trapnz v63, user21 +;; @003b trapnz v63, user22 ;; @003b jump block3 ;; ;; block3: @@ -120,7 +120,7 @@ ;; block0(v0: i64, v1: i64): ;; @0043 v7 = iconst.i32 0 ;; @0043 v9 = call fn0(v0, v7) ; v7 = 0 -;; @0045 trapz v9, user15 +;; @0045 trapz v9, user16 ;; @0045 v13 = call fn1(v0, v9, v7, v7) ; v7 = 0, v7 = 0 ;; @0045 v14 = load.i64 notrap aligned v13+72 ;; @004e jump block3 @@ -131,14 +131,14 @@ ;; v134 = ishl v16, v130 ; v130 = 64 ;; v136 = ireduce.i64 v134 ;; v138 = bor v136, v13 -;; @004e trapz v138, user15 +;; @004e trapz v138, user16 ;; @004e v24 = load.i64 notrap aligned v138+72 ;; @0045 v15 = uextend.i128 v13 ;; @0045 v18 = bor v134, v15 ;; v140 = ushr v18, v130 ; v130 = 64 ;; @004e v23 = ireduce.i64 v140 ;; @004e v25 = icmp eq v24, v23 -;; @004e trapz v25, user22 +;; @004e trapz v25, user23 ;; v125 = iconst.i64 1 ;; @004e v26 = iadd v24, v125 ; v125 = 1 ;; @004e store notrap aligned v26, v138+72 @@ -213,7 +213,7 @@ ;; @004e jump block6 ;; ;; block7 cold: -;; @004e trap user11 +;; @004e trap user12 ;; ;; block8: ;; v107 = iconst.i64 120 diff --git a/tests/disas/stack-switching/symmetric-switch.wat b/tests/disas/stack-switching/symmetric-switch.wat index dbbcfe0ef21e..faa06ffd06ad 100644 --- a/tests/disas/stack-switching/symmetric-switch.wat +++ b/tests/disas/stack-switching/symmetric-switch.wat @@ -40,7 +40,7 @@ ;; block0(v0: i64, v1: i64): ;; @003a v2 = iconst.i32 1 ;; @003a v4 = call fn0(v0, v2) ; v2 = 1 -;; @003c trapz v4, user15 +;; @003c trapz v4, user16 ;; @003c v5 = iconst.i32 1 ;; @003c v6 = iconst.i32 0 ;; @003c v8 = call fn1(v0, v4, v5, v6) ; v5 = 1, v6 = 0 @@ -56,10 +56,10 @@ ;; v137 = uextend.i128 v136 ; v136 = 64 ;; @003e v16 = ushr v13, v137 ;; @003e v17 = ireduce.i64 v16 -;; @003e trapz v15, user15 +;; @003e trapz v15, user16 ;; @003e v18 = load.i64 notrap aligned v15+72 ;; @003e v19 = icmp eq v18, v17 -;; @003e trapz v19, user22 +;; @003e trapz v19, user23 ;; v135 = iconst.i64 1 ;; @003e v20 = iadd v18, v135 ; v135 = 1 ;; @003e store notrap aligned v20, v15+72 @@ -73,7 +73,7 @@ ;; block2(v26: i64, v27: i64): ;; v133 = iconst.i64 1 ;; @003e v28 = icmp eq v26, v133 ; v133 = 1 -;; @003e trapnz v28, user21 +;; @003e trapnz v28, user22 ;; @003e jump block3 ;; ;; block3: @@ -255,7 +255,7 @@ ;; block0(v0: i64, v1: i64): ;; @0047 v2 = iconst.i32 0 ;; @0047 v4 = call fn0(v0, v2) ; v2 = 0 -;; @0049 trapz v4, user15 +;; @0049 trapz v4, user16 ;; @0049 v5 = iconst.i32 0 ;; @0049 v6 = iconst.i32 0 ;; @0049 v8 = call fn1(v0, v4, v5, v6) ; v5 = 0, v6 = 0 @@ -274,10 +274,10 @@ ;; v110 = uextend.i128 v109 ; v109 = 64 ;; @004b v16 = ushr.i128 v13, v110 ;; @004b v17 = ireduce.i64 v16 -;; @004b trapz v15, user15 +;; @004b trapz v15, user16 ;; @004b v18 = load.i64 notrap aligned v15+72 ;; @004b v19 = icmp eq v18, v17 -;; @004b trapz v19, user22 +;; @004b trapz v19, user23 ;; v108 = iconst.i64 1 ;; @004b v20 = iadd v18, v108 ; v108 = 1 ;; @004b store notrap aligned v20, v15+72 @@ -384,7 +384,7 @@ ;; @004b jump block5 ;; ;; block6 cold: -;; @004b trap user11 +;; @004b trap user12 ;; ;; block5: ;; @004b br_table v70, block6, [] diff --git a/tests/disas/table-get-fixed-size.wat b/tests/disas/table-get-fixed-size.wat index fb858954c48f..48868c488c22 100644 --- a/tests/disas/table-get-fixed-size.wat +++ b/tests/disas/table-get-fixed-size.wat @@ -37,7 +37,7 @@ ;; @0054 v9 = iadd v7, v8 ;; @0054 v10 = iconst.i64 0 ;; @0054 v11 = select_spectre_guard v5, v10, v9 ; v10 = 0 -;; @0054 v12 = load.i32 user5 aligned table v11 +;; @0054 v12 = load.i32 user6 aligned table v11 ;; v60 = iconst.i32 1 ;; @0054 v13 = band v12, v60 ; v60 = 1 ;; v59 = iconst.i32 0 @@ -51,35 +51,35 @@ ;; @0054 v57 = load.i64 notrap aligned readonly can_move v0+8 ;; @0054 v18 = load.i64 notrap aligned readonly can_move v57+32 ;; @0054 v19 = iadd v18, v17 -;; @0054 v20 = load.i32 notrap aligned v19 +;; @0054 v20 = load.i32 user2 v19 ;; @0054 v21 = iconst.i32 2 ;; @0054 v22 = band v20, v21 ; v21 = 2 ;; @0054 brif v22, block4, block3 ;; ;; block3: -;; @0054 v24 = load.i64 notrap aligned readonly v0+32 -;; @0054 v25 = load.i32 notrap aligned v24 +;; @0054 v24 = load.i64 user2 v0+32 +;; @0054 v25 = load.i32 user2 v24 ;; @0054 v26 = uextend.i64 v12 ;; @0054 v55 = load.i64 notrap aligned readonly can_move v0+8 ;; @0054 v27 = load.i64 notrap aligned readonly can_move v55+32 ;; @0054 v28 = iadd v27, v26 ;; @0054 v29 = iconst.i64 16 ;; @0054 v30 = iadd v28, v29 ; v29 = 16 -;; @0054 store notrap aligned v25, v30 +;; @0054 store user2 v25, v30 ;; @0054 v31 = iconst.i32 2 ;; @0054 v32 = bor.i32 v20, v31 ; v31 = 2 ;; @0054 v33 = uextend.i64 v12 ;; @0054 v53 = load.i64 notrap aligned readonly can_move v0+8 ;; @0054 v34 = load.i64 notrap aligned readonly can_move v53+32 ;; @0054 v35 = iadd v34, v33 -;; @0054 store notrap aligned v32, v35 +;; @0054 store user2 v32, v35 ;; @0054 v36 = uextend.i64 v12 ;; @0054 v51 = load.i64 notrap aligned readonly can_move v0+8 ;; @0054 v37 = load.i64 notrap aligned readonly can_move v51+32 ;; @0054 v38 = iadd v37, v36 ;; @0054 v39 = iconst.i64 8 ;; @0054 v40 = iadd v38, v39 ; v39 = 8 -;; @0054 v41 = load.i64 notrap aligned v40 +;; @0054 v41 = load.i64 user2 v40 ;; v50 = iconst.i64 1 ;; @0054 v42 = iadd v41, v50 ; v50 = 1 ;; @0054 v43 = uextend.i64 v12 @@ -88,8 +88,8 @@ ;; @0054 v45 = iadd v44, v43 ;; @0054 v46 = iconst.i64 8 ;; @0054 v47 = iadd v45, v46 ; v46 = 8 -;; @0054 store notrap aligned v42, v47 -;; @0054 store.i32 notrap aligned v12, v24 +;; @0054 store user2 v42, v47 +;; @0054 store.i32 user2 v12, v24 ;; @0054 jump block4 ;; ;; block4: @@ -120,7 +120,7 @@ ;; @005b v9 = iadd v7, v8 ;; @005b v10 = iconst.i64 0 ;; @005b v11 = select_spectre_guard v5, v10, v9 ; v10 = 0 -;; @005b v12 = load.i32 user5 aligned table v11 +;; @005b v12 = load.i32 user6 aligned table v11 ;; v60 = iconst.i32 1 ;; @005b v13 = band v12, v60 ; v60 = 1 ;; v59 = iconst.i32 0 @@ -134,35 +134,35 @@ ;; @005b v57 = load.i64 notrap aligned readonly can_move v0+8 ;; @005b v18 = load.i64 notrap aligned readonly can_move v57+32 ;; @005b v19 = iadd v18, v17 -;; @005b v20 = load.i32 notrap aligned v19 +;; @005b v20 = load.i32 user2 v19 ;; @005b v21 = iconst.i32 2 ;; @005b v22 = band v20, v21 ; v21 = 2 ;; @005b brif v22, block4, block3 ;; ;; block3: -;; @005b v24 = load.i64 notrap aligned readonly v0+32 -;; @005b v25 = load.i32 notrap aligned v24 +;; @005b v24 = load.i64 user2 v0+32 +;; @005b v25 = load.i32 user2 v24 ;; @005b v26 = uextend.i64 v12 ;; @005b v55 = load.i64 notrap aligned readonly can_move v0+8 ;; @005b v27 = load.i64 notrap aligned readonly can_move v55+32 ;; @005b v28 = iadd v27, v26 ;; @005b v29 = iconst.i64 16 ;; @005b v30 = iadd v28, v29 ; v29 = 16 -;; @005b store notrap aligned v25, v30 +;; @005b store user2 v25, v30 ;; @005b v31 = iconst.i32 2 ;; @005b v32 = bor.i32 v20, v31 ; v31 = 2 ;; @005b v33 = uextend.i64 v12 ;; @005b v53 = load.i64 notrap aligned readonly can_move v0+8 ;; @005b v34 = load.i64 notrap aligned readonly can_move v53+32 ;; @005b v35 = iadd v34, v33 -;; @005b store notrap aligned v32, v35 +;; @005b store user2 v32, v35 ;; @005b v36 = uextend.i64 v12 ;; @005b v51 = load.i64 notrap aligned readonly can_move v0+8 ;; @005b v37 = load.i64 notrap aligned readonly can_move v51+32 ;; @005b v38 = iadd v37, v36 ;; @005b v39 = iconst.i64 8 ;; @005b v40 = iadd v38, v39 ; v39 = 8 -;; @005b v41 = load.i64 notrap aligned v40 +;; @005b v41 = load.i64 user2 v40 ;; v50 = iconst.i64 1 ;; @005b v42 = iadd v41, v50 ; v50 = 1 ;; @005b v43 = uextend.i64 v12 @@ -171,8 +171,8 @@ ;; @005b v45 = iadd v44, v43 ;; @005b v46 = iconst.i64 8 ;; @005b v47 = iadd v45, v46 ; v46 = 8 -;; @005b store notrap aligned v42, v47 -;; @005b store.i32 notrap aligned v12, v24 +;; @005b store user2 v42, v47 +;; @005b store.i32 user2 v12, v24 ;; @005b jump block4 ;; ;; block4: diff --git a/tests/disas/table-get.wat b/tests/disas/table-get.wat index 8b807242bee8..3feeabd760e2 100644 --- a/tests/disas/table-get.wat +++ b/tests/disas/table-get.wat @@ -38,7 +38,7 @@ ;; @0053 v10 = iadd v8, v9 ;; @0053 v11 = iconst.i64 0 ;; @0053 v12 = select_spectre_guard v6, v11, v10 ; v11 = 0 -;; @0053 v13 = load.i32 user5 aligned table v12 +;; @0053 v13 = load.i32 user6 aligned table v12 ;; v61 = iconst.i32 1 ;; @0053 v14 = band v13, v61 ; v61 = 1 ;; v60 = iconst.i32 0 @@ -52,35 +52,35 @@ ;; @0053 v58 = load.i64 notrap aligned readonly can_move v0+8 ;; @0053 v19 = load.i64 notrap aligned readonly can_move v58+32 ;; @0053 v20 = iadd v19, v18 -;; @0053 v21 = load.i32 notrap aligned v20 +;; @0053 v21 = load.i32 user2 v20 ;; @0053 v22 = iconst.i32 2 ;; @0053 v23 = band v21, v22 ; v22 = 2 ;; @0053 brif v23, block4, block3 ;; ;; block3: -;; @0053 v25 = load.i64 notrap aligned readonly v0+32 -;; @0053 v26 = load.i32 notrap aligned v25 +;; @0053 v25 = load.i64 user2 v0+32 +;; @0053 v26 = load.i32 user2 v25 ;; @0053 v27 = uextend.i64 v13 ;; @0053 v56 = load.i64 notrap aligned readonly can_move v0+8 ;; @0053 v28 = load.i64 notrap aligned readonly can_move v56+32 ;; @0053 v29 = iadd v28, v27 ;; @0053 v30 = iconst.i64 16 ;; @0053 v31 = iadd v29, v30 ; v30 = 16 -;; @0053 store notrap aligned v26, v31 +;; @0053 store user2 v26, v31 ;; @0053 v32 = iconst.i32 2 ;; @0053 v33 = bor.i32 v21, v32 ; v32 = 2 ;; @0053 v34 = uextend.i64 v13 ;; @0053 v54 = load.i64 notrap aligned readonly can_move v0+8 ;; @0053 v35 = load.i64 notrap aligned readonly can_move v54+32 ;; @0053 v36 = iadd v35, v34 -;; @0053 store notrap aligned v33, v36 +;; @0053 store user2 v33, v36 ;; @0053 v37 = uextend.i64 v13 ;; @0053 v52 = load.i64 notrap aligned readonly can_move v0+8 ;; @0053 v38 = load.i64 notrap aligned readonly can_move v52+32 ;; @0053 v39 = iadd v38, v37 ;; @0053 v40 = iconst.i64 8 ;; @0053 v41 = iadd v39, v40 ; v40 = 8 -;; @0053 v42 = load.i64 notrap aligned v41 +;; @0053 v42 = load.i64 user2 v41 ;; v51 = iconst.i64 1 ;; @0053 v43 = iadd v42, v51 ; v51 = 1 ;; @0053 v44 = uextend.i64 v13 @@ -89,8 +89,8 @@ ;; @0053 v46 = iadd v45, v44 ;; @0053 v47 = iconst.i64 8 ;; @0053 v48 = iadd v46, v47 ; v47 = 8 -;; @0053 store notrap aligned v43, v48 -;; @0053 store.i32 notrap aligned v13, v25 +;; @0053 store user2 v43, v48 +;; @0053 store.i32 user2 v13, v25 ;; @0053 jump block4 ;; ;; block4: @@ -123,7 +123,7 @@ ;; @005a v10 = iadd v8, v9 ;; @005a v11 = iconst.i64 0 ;; @005a v12 = select_spectre_guard v6, v11, v10 ; v11 = 0 -;; @005a v13 = load.i32 user5 aligned table v12 +;; @005a v13 = load.i32 user6 aligned table v12 ;; v61 = iconst.i32 1 ;; @005a v14 = band v13, v61 ; v61 = 1 ;; v60 = iconst.i32 0 @@ -137,35 +137,35 @@ ;; @005a v58 = load.i64 notrap aligned readonly can_move v0+8 ;; @005a v19 = load.i64 notrap aligned readonly can_move v58+32 ;; @005a v20 = iadd v19, v18 -;; @005a v21 = load.i32 notrap aligned v20 +;; @005a v21 = load.i32 user2 v20 ;; @005a v22 = iconst.i32 2 ;; @005a v23 = band v21, v22 ; v22 = 2 ;; @005a brif v23, block4, block3 ;; ;; block3: -;; @005a v25 = load.i64 notrap aligned readonly v0+32 -;; @005a v26 = load.i32 notrap aligned v25 +;; @005a v25 = load.i64 user2 v0+32 +;; @005a v26 = load.i32 user2 v25 ;; @005a v27 = uextend.i64 v13 ;; @005a v56 = load.i64 notrap aligned readonly can_move v0+8 ;; @005a v28 = load.i64 notrap aligned readonly can_move v56+32 ;; @005a v29 = iadd v28, v27 ;; @005a v30 = iconst.i64 16 ;; @005a v31 = iadd v29, v30 ; v30 = 16 -;; @005a store notrap aligned v26, v31 +;; @005a store user2 v26, v31 ;; @005a v32 = iconst.i32 2 ;; @005a v33 = bor.i32 v21, v32 ; v32 = 2 ;; @005a v34 = uextend.i64 v13 ;; @005a v54 = load.i64 notrap aligned readonly can_move v0+8 ;; @005a v35 = load.i64 notrap aligned readonly can_move v54+32 ;; @005a v36 = iadd v35, v34 -;; @005a store notrap aligned v33, v36 +;; @005a store user2 v33, v36 ;; @005a v37 = uextend.i64 v13 ;; @005a v52 = load.i64 notrap aligned readonly can_move v0+8 ;; @005a v38 = load.i64 notrap aligned readonly can_move v52+32 ;; @005a v39 = iadd v38, v37 ;; @005a v40 = iconst.i64 8 ;; @005a v41 = iadd v39, v40 ; v40 = 8 -;; @005a v42 = load.i64 notrap aligned v41 +;; @005a v42 = load.i64 user2 v41 ;; v51 = iconst.i64 1 ;; @005a v43 = iadd v42, v51 ; v51 = 1 ;; @005a v44 = uextend.i64 v13 @@ -174,8 +174,8 @@ ;; @005a v46 = iadd v45, v44 ;; @005a v47 = iconst.i64 8 ;; @005a v48 = iadd v46, v47 ; v47 = 8 -;; @005a store notrap aligned v43, v48 -;; @005a store.i32 notrap aligned v13, v25 +;; @005a store user2 v43, v48 +;; @005a store.i32 user2 v13, v25 ;; @005a jump block4 ;; ;; block4: diff --git a/tests/disas/table-set-fixed-size.wat b/tests/disas/table-set-fixed-size.wat index 2123283c5fce..15af7f10f691 100644 --- a/tests/disas/table-set-fixed-size.wat +++ b/tests/disas/table-set-fixed-size.wat @@ -40,7 +40,7 @@ ;; @0056 v9 = iadd v7, v8 ;; @0056 v10 = iconst.i64 0 ;; @0056 v11 = select_spectre_guard v5, v10, v9 ; v10 = 0 -;; @0056 v12 = load.i32 user5 aligned table v11 +;; @0056 v12 = load.i32 user6 aligned table v11 ;; v61 = iconst.i32 1 ;; @0056 v13 = band v2, v61 ; v61 = 1 ;; v60 = iconst.i32 0 @@ -56,7 +56,7 @@ ;; @0056 v19 = iadd v18, v17 ;; @0056 v20 = iconst.i64 8 ;; @0056 v21 = iadd v19, v20 ; v20 = 8 -;; @0056 v22 = load.i64 notrap aligned v21 +;; @0056 v22 = load.i64 user2 v21 ;; v57 = iconst.i64 1 ;; @0056 v23 = iadd v22, v57 ; v57 = 1 ;; @0056 v24 = uextend.i64 v2 @@ -65,11 +65,11 @@ ;; @0056 v26 = iadd v25, v24 ;; @0056 v27 = iconst.i64 8 ;; @0056 v28 = iadd v26, v27 ; v27 = 8 -;; @0056 store notrap aligned v23, v28 +;; @0056 store user2 v23, v28 ;; @0056 jump block3 ;; ;; block3: -;; @0056 store.i32 user5 aligned table v2, v11 +;; @0056 store.i32 user6 aligned table v2, v11 ;; v54 = iconst.i32 1 ;; @0056 v29 = band.i32 v12, v54 ; v54 = 1 ;; v53 = iconst.i32 0 @@ -85,7 +85,7 @@ ;; @0056 v35 = iadd v34, v33 ;; @0056 v36 = iconst.i64 8 ;; @0056 v37 = iadd v35, v36 ; v36 = 8 -;; @0056 v38 = load.i64 notrap aligned v37 +;; @0056 v38 = load.i64 user2 v37 ;; v50 = iconst.i64 -1 ;; @0056 v39 = iadd v38, v50 ; v50 = -1 ;; v49 = iconst.i64 0 @@ -103,7 +103,7 @@ ;; @0056 v44 = iadd v43, v42 ;; @0056 v45 = iconst.i64 8 ;; @0056 v46 = iadd v44, v45 ; v45 = 8 -;; @0056 store.i64 notrap aligned v39, v46 +;; @0056 store.i64 user2 v39, v46 ;; @0056 jump block7 ;; ;; block7: @@ -136,7 +136,7 @@ ;; @005f v9 = iadd v7, v8 ;; @005f v10 = iconst.i64 0 ;; @005f v11 = select_spectre_guard v5, v10, v9 ; v10 = 0 -;; @005f v12 = load.i32 user5 aligned table v11 +;; @005f v12 = load.i32 user6 aligned table v11 ;; v61 = iconst.i32 1 ;; @005f v13 = band v3, v61 ; v61 = 1 ;; v60 = iconst.i32 0 @@ -152,7 +152,7 @@ ;; @005f v19 = iadd v18, v17 ;; @005f v20 = iconst.i64 8 ;; @005f v21 = iadd v19, v20 ; v20 = 8 -;; @005f v22 = load.i64 notrap aligned v21 +;; @005f v22 = load.i64 user2 v21 ;; v57 = iconst.i64 1 ;; @005f v23 = iadd v22, v57 ; v57 = 1 ;; @005f v24 = uextend.i64 v3 @@ -161,11 +161,11 @@ ;; @005f v26 = iadd v25, v24 ;; @005f v27 = iconst.i64 8 ;; @005f v28 = iadd v26, v27 ; v27 = 8 -;; @005f store notrap aligned v23, v28 +;; @005f store user2 v23, v28 ;; @005f jump block3 ;; ;; block3: -;; @005f store.i32 user5 aligned table v3, v11 +;; @005f store.i32 user6 aligned table v3, v11 ;; v54 = iconst.i32 1 ;; @005f v29 = band.i32 v12, v54 ; v54 = 1 ;; v53 = iconst.i32 0 @@ -181,7 +181,7 @@ ;; @005f v35 = iadd v34, v33 ;; @005f v36 = iconst.i64 8 ;; @005f v37 = iadd v35, v36 ; v36 = 8 -;; @005f v38 = load.i64 notrap aligned v37 +;; @005f v38 = load.i64 user2 v37 ;; v50 = iconst.i64 -1 ;; @005f v39 = iadd v38, v50 ; v50 = -1 ;; v49 = iconst.i64 0 @@ -199,7 +199,7 @@ ;; @005f v44 = iadd v43, v42 ;; @005f v45 = iconst.i64 8 ;; @005f v46 = iadd v44, v45 ; v45 = 8 -;; @005f store.i64 notrap aligned v39, v46 +;; @005f store.i64 user2 v39, v46 ;; @005f jump block7 ;; ;; block7: diff --git a/tests/disas/table-set.wat b/tests/disas/table-set.wat index fd50e7853426..9b2b4b4a707e 100644 --- a/tests/disas/table-set.wat +++ b/tests/disas/table-set.wat @@ -42,7 +42,7 @@ ;; @0055 v10 = iadd v8, v9 ;; @0055 v11 = iconst.i64 0 ;; @0055 v12 = select_spectre_guard v6, v11, v10 ; v11 = 0 -;; @0055 v13 = load.i32 user5 aligned table v12 +;; @0055 v13 = load.i32 user6 aligned table v12 ;; v62 = iconst.i32 1 ;; @0055 v14 = band v2, v62 ; v62 = 1 ;; v61 = iconst.i32 0 @@ -58,7 +58,7 @@ ;; @0055 v20 = iadd v19, v18 ;; @0055 v21 = iconst.i64 8 ;; @0055 v22 = iadd v20, v21 ; v21 = 8 -;; @0055 v23 = load.i64 notrap aligned v22 +;; @0055 v23 = load.i64 user2 v22 ;; v58 = iconst.i64 1 ;; @0055 v24 = iadd v23, v58 ; v58 = 1 ;; @0055 v25 = uextend.i64 v2 @@ -67,11 +67,11 @@ ;; @0055 v27 = iadd v26, v25 ;; @0055 v28 = iconst.i64 8 ;; @0055 v29 = iadd v27, v28 ; v28 = 8 -;; @0055 store notrap aligned v24, v29 +;; @0055 store user2 v24, v29 ;; @0055 jump block3 ;; ;; block3: -;; @0055 store.i32 user5 aligned table v2, v12 +;; @0055 store.i32 user6 aligned table v2, v12 ;; v55 = iconst.i32 1 ;; @0055 v30 = band.i32 v13, v55 ; v55 = 1 ;; v54 = iconst.i32 0 @@ -87,7 +87,7 @@ ;; @0055 v36 = iadd v35, v34 ;; @0055 v37 = iconst.i64 8 ;; @0055 v38 = iadd v36, v37 ; v37 = 8 -;; @0055 v39 = load.i64 notrap aligned v38 +;; @0055 v39 = load.i64 user2 v38 ;; v51 = iconst.i64 -1 ;; @0055 v40 = iadd v39, v51 ; v51 = -1 ;; v50 = iconst.i64 0 @@ -105,7 +105,7 @@ ;; @0055 v45 = iadd v44, v43 ;; @0055 v46 = iconst.i64 8 ;; @0055 v47 = iadd v45, v46 ; v46 = 8 -;; @0055 store.i64 notrap aligned v40, v47 +;; @0055 store.i64 user2 v40, v47 ;; @0055 jump block7 ;; ;; block7: @@ -140,7 +140,7 @@ ;; @005e v10 = iadd v8, v9 ;; @005e v11 = iconst.i64 0 ;; @005e v12 = select_spectre_guard v6, v11, v10 ; v11 = 0 -;; @005e v13 = load.i32 user5 aligned table v12 +;; @005e v13 = load.i32 user6 aligned table v12 ;; v62 = iconst.i32 1 ;; @005e v14 = band v3, v62 ; v62 = 1 ;; v61 = iconst.i32 0 @@ -156,7 +156,7 @@ ;; @005e v20 = iadd v19, v18 ;; @005e v21 = iconst.i64 8 ;; @005e v22 = iadd v20, v21 ; v21 = 8 -;; @005e v23 = load.i64 notrap aligned v22 +;; @005e v23 = load.i64 user2 v22 ;; v58 = iconst.i64 1 ;; @005e v24 = iadd v23, v58 ; v58 = 1 ;; @005e v25 = uextend.i64 v3 @@ -165,11 +165,11 @@ ;; @005e v27 = iadd v26, v25 ;; @005e v28 = iconst.i64 8 ;; @005e v29 = iadd v27, v28 ; v28 = 8 -;; @005e store notrap aligned v24, v29 +;; @005e store user2 v24, v29 ;; @005e jump block3 ;; ;; block3: -;; @005e store.i32 user5 aligned table v3, v12 +;; @005e store.i32 user6 aligned table v3, v12 ;; v55 = iconst.i32 1 ;; @005e v30 = band.i32 v13, v55 ; v55 = 1 ;; v54 = iconst.i32 0 @@ -185,7 +185,7 @@ ;; @005e v36 = iadd v35, v34 ;; @005e v37 = iconst.i64 8 ;; @005e v38 = iadd v36, v37 ; v37 = 8 -;; @005e v39 = load.i64 notrap aligned v38 +;; @005e v39 = load.i64 user2 v38 ;; v51 = iconst.i64 -1 ;; @005e v40 = iadd v39, v51 ; v51 = -1 ;; v50 = iconst.i64 0 @@ -203,7 +203,7 @@ ;; @005e v45 = iadd v44, v43 ;; @005e v46 = iconst.i64 8 ;; @005e v47 = iadd v45, v46 ; v46 = 8 -;; @005e store.i64 notrap aligned v40, v47 +;; @005e store.i64 user2 v40, v47 ;; @005e jump block7 ;; ;; block7: diff --git a/tests/disas/typed-funcrefs-eager-init.wat b/tests/disas/typed-funcrefs-eager-init.wat index 9afe8cf19577..bd688a24cf77 100644 --- a/tests/disas/typed-funcrefs-eager-init.wat +++ b/tests/disas/typed-funcrefs-eager-init.wat @@ -139,14 +139,14 @@ ;; @0048 v12 = load.i64 notrap aligned readonly can_move v0+48 ;; v47 = iconst.i64 8 ;; @0048 v14 = iadd v12, v47 ; v47 = 8 -;; @0048 v17 = load.i64 user5 aligned table v14 -;; @004a v18 = load.i64 user15 aligned readonly v17+8 +;; @0048 v17 = load.i64 user6 aligned table v14 +;; @004a v18 = load.i64 user16 aligned readonly v17+8 ;; @004a v19 = load.i64 notrap aligned readonly v17+24 ;; @004a v20 = call_indirect sig0, v18(v19, v0, v2, v3, v4, v5) ;; v54 = iconst.i64 16 ;; @005b v28 = iadd v12, v54 ; v54 = 16 -;; @005b v31 = load.i64 user5 aligned table v28 -;; @005d v32 = load.i64 user15 aligned readonly v31+8 +;; @005b v31 = load.i64 user6 aligned table v28 +;; @005d v32 = load.i64 user16 aligned readonly v31+8 ;; @005d v33 = load.i64 notrap aligned readonly v31+24 ;; @005d v34 = call_indirect sig0, v32(v33, v0, v2, v3, v4, v5) ;; @0066 jump block1 @@ -169,14 +169,14 @@ ;; @0075 v12 = load.i64 notrap aligned readonly can_move v0+48 ;; v47 = iconst.i64 8 ;; @0075 v14 = iadd v12, v47 ; v47 = 8 -;; @0075 v17 = load.i64 user5 aligned table v14 -;; @0075 v18 = load.i64 user6 aligned readonly v17+8 +;; @0075 v17 = load.i64 user6 aligned table v14 +;; @0075 v18 = load.i64 user7 aligned readonly v17+8 ;; @0075 v19 = load.i64 notrap aligned readonly v17+24 ;; @0075 v20 = call_indirect sig0, v18(v19, v0, v2, v3, v4, v5) ;; v54 = iconst.i64 16 ;; @0087 v28 = iadd v12, v54 ; v54 = 16 -;; @0087 v31 = load.i64 user5 aligned table v28 -;; @0087 v32 = load.i64 user6 aligned readonly v31+8 +;; @0087 v31 = load.i64 user6 aligned table v28 +;; @0087 v32 = load.i64 user7 aligned readonly v31+8 ;; @0087 v33 = load.i64 notrap aligned readonly v31+24 ;; @0087 v34 = call_indirect sig0, v32(v33, v0, v2, v3, v4, v5) ;; @0091 jump block1 @@ -196,11 +196,11 @@ ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32, v5: i32): ;; @009e v9 = load.i64 notrap aligned table v0+64 -;; @00a0 v10 = load.i64 user15 aligned readonly v9+8 +;; @00a0 v10 = load.i64 user16 aligned readonly v9+8 ;; @00a0 v11 = load.i64 notrap aligned readonly v9+24 ;; @00a0 v12 = call_indirect sig0, v10(v11, v0, v2, v3, v4, v5) ;; @00af v15 = load.i64 notrap aligned table v0+80 -;; @00b1 v16 = load.i64 user15 aligned readonly v15+8 +;; @00b1 v16 = load.i64 user16 aligned readonly v15+8 ;; @00b1 v17 = load.i64 notrap aligned readonly v15+24 ;; @00b1 v18 = call_indirect sig0, v16(v17, v0, v2, v3, v4, v5) ;; @00ba jump block1 diff --git a/tests/disas/typed-funcrefs.wat b/tests/disas/typed-funcrefs.wat index da8c43224d73..0adf87debc5d 100644 --- a/tests/disas/typed-funcrefs.wat +++ b/tests/disas/typed-funcrefs.wat @@ -141,7 +141,7 @@ ;; @0048 v12 = load.i64 notrap aligned readonly can_move v0+48 ;; v67 = iconst.i64 8 ;; @0048 v14 = iadd v12, v67 ; v67 = 8 -;; @0048 v17 = load.i64 user5 aligned table v14 +;; @0048 v17 = load.i64 user6 aligned table v14 ;; v57 = iconst.i64 -2 ;; @0048 v18 = band v17, v57 ; v57 = -2 ;; @0048 brif v17, block3(v18), block2 @@ -153,12 +153,12 @@ ;; @0048 jump block3(v23) ;; ;; block3(v19: i64): -;; @004a v24 = load.i64 user15 aligned readonly v19+8 +;; @004a v24 = load.i64 user16 aligned readonly v19+8 ;; @004a v25 = load.i64 notrap aligned readonly v19+24 ;; @004a v26 = call_indirect sig1, v24(v25, v0, v2, v3, v4, v5) ;; v74 = iconst.i64 16 ;; @005b v39 = iadd.i64 v12, v74 ; v74 = 16 -;; @005b v42 = load.i64 user5 aligned table v39 +;; @005b v42 = load.i64 user6 aligned table v39 ;; v75 = iconst.i64 -2 ;; v76 = band v42, v75 ; v75 = -2 ;; @005b brif v42, block5(v76), block4 @@ -170,7 +170,7 @@ ;; @005b jump block5(v48) ;; ;; block5(v44: i64): -;; @005d v49 = load.i64 user15 aligned readonly v44+8 +;; @005d v49 = load.i64 user16 aligned readonly v44+8 ;; @005d v50 = load.i64 notrap aligned readonly v44+24 ;; @005d v51 = call_indirect sig1, v49(v50, v0, v2, v3, v4, v5) ;; @0066 jump block1 @@ -195,7 +195,7 @@ ;; @0075 v12 = load.i64 notrap aligned readonly can_move v0+48 ;; v67 = iconst.i64 8 ;; @0075 v14 = iadd v12, v67 ; v67 = 8 -;; @0075 v17 = load.i64 user5 aligned table v14 +;; @0075 v17 = load.i64 user6 aligned table v14 ;; v57 = iconst.i64 -2 ;; @0075 v18 = band v17, v57 ; v57 = -2 ;; @0075 brif v17, block3(v18), block2 @@ -207,12 +207,12 @@ ;; @0075 jump block3(v23) ;; ;; block3(v19: i64): -;; @0075 v24 = load.i64 user6 aligned readonly v19+8 +;; @0075 v24 = load.i64 user7 aligned readonly v19+8 ;; @0075 v25 = load.i64 notrap aligned readonly v19+24 ;; @0075 v26 = call_indirect sig0, v24(v25, v0, v2, v3, v4, v5) ;; v74 = iconst.i64 16 ;; @0087 v39 = iadd.i64 v12, v74 ; v74 = 16 -;; @0087 v42 = load.i64 user5 aligned table v39 +;; @0087 v42 = load.i64 user6 aligned table v39 ;; v75 = iconst.i64 -2 ;; v76 = band v42, v75 ; v75 = -2 ;; @0087 brif v42, block5(v76), block4 @@ -224,7 +224,7 @@ ;; @0087 jump block5(v48) ;; ;; block5(v44: i64): -;; @0087 v49 = load.i64 user6 aligned readonly v44+8 +;; @0087 v49 = load.i64 user7 aligned readonly v44+8 ;; @0087 v50 = load.i64 notrap aligned readonly v44+24 ;; @0087 v51 = call_indirect sig0, v49(v50, v0, v2, v3, v4, v5) ;; @0091 jump block1 @@ -244,11 +244,11 @@ ;; ;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32, v5: i32): ;; @009e v9 = load.i64 notrap aligned table v0+64 -;; @00a0 v10 = load.i64 user15 aligned readonly v9+8 +;; @00a0 v10 = load.i64 user16 aligned readonly v9+8 ;; @00a0 v11 = load.i64 notrap aligned readonly v9+24 ;; @00a0 v12 = call_indirect sig0, v10(v11, v0, v2, v3, v4, v5) ;; @00af v15 = load.i64 notrap aligned table v0+80 -;; @00b1 v16 = load.i64 user15 aligned readonly v15+8 +;; @00b1 v16 = load.i64 user16 aligned readonly v15+8 ;; @00b1 v17 = load.i64 notrap aligned readonly v15+24 ;; @00b1 v18 = call_indirect sig0, v16(v17, v0, v2, v3, v4, v5) ;; @00ba jump block1 diff --git a/tests/disas/unreachable_code.wat b/tests/disas/unreachable_code.wat index fe6e365c72e1..01a609efac16 100644 --- a/tests/disas/unreachable_code.wat +++ b/tests/disas/unreachable_code.wat @@ -85,7 +85,7 @@ ;; stack_limit = gv2 ;; ;; block0(v0: i64, v1: i64): -;; @0043 trap user11 +;; @0043 trap user12 ;; } ;; ;; function u0:1(i64 vmctx, i64) -> i32 tail { @@ -98,7 +98,7 @@ ;; @004c jump block2 ;; ;; block2: -;; @004e trap user11 +;; @004e trap user12 ;; } ;; ;; function u0:2(i64 vmctx, i64) -> i32 tail { @@ -115,7 +115,7 @@ ;; @006a jump block9 ;; ;; block9: -;; @0074 trap user11 +;; @0074 trap user12 ;; ;; block13: ;; @0087 jump block7 @@ -130,7 +130,7 @@ ;; @008b jump block3 ;; ;; block3: -;; @008c trap user11 +;; @008c trap user12 ;; } ;; ;; function u0:3(i64 vmctx, i64) tail { diff --git a/tests/disas/x64-simple-load.wat b/tests/disas/x64-simple-load.wat index fdea5f178952..6e4cdb812a2d 100644 --- a/tests/disas/x64-simple-load.wat +++ b/tests/disas/x64-simple-load.wat @@ -17,10 +17,10 @@ ;; ╰─╼ addrmap: 0x21 ;; movl %edx, %edi ;; movzbq (%rsi, %rdi), %rax -;; ╰─╼ trap: MemoryOutOfBounds +;; ╰─╼ trap: Normal(MemoryOutOfBounds) ;; movzbq 4(%rsi, %rdi), %rcx ;; ├─╼ addrmap: 0x26 -;; ╰─╼ trap: MemoryOutOfBounds +;; ╰─╼ trap: Normal(MemoryOutOfBounds) ;; movq %rbp, %rsp ;; ╰─╼ addrmap: 0x29 ;; popq %rbp From c084e97a5d5ce5a2664c71f10ec53e6363966f9e Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 8 May 2026 09:45:07 -0700 Subject: [PATCH 2/2] Implement custom trapping loads/stores for Pulley Implement this for both little and big-endian loads. --- .../codegen/src/isa/pulley_shared/inst.isle | 10 +- .../src/isa/pulley_shared/inst/args.rs | 21 ++- .../codegen/src/isa/pulley_shared/lower.isle | 153 +++++++++------ .../src/isa/pulley_shared/lower/isle.rs | 4 + .../filetests/isa/pulley32/load.clif | 8 +- .../filetests/isa/pulley32/store.clif | 8 +- .../filetests/isa/pulley64/load.clif | 175 ++++++++++++++---- .../filetests/isa/pulley64/store.clif | 113 ++++++++++- crates/wasmtime/src/runtime/vm/interpreter.rs | 17 +- pulley/src/decode.rs | 7 +- pulley/src/encode.rs | 7 +- pulley/src/interp.rs | 100 +++++++++- pulley/src/lib.rs | 29 ++- pulley/src/regs.rs | 21 +++ 14 files changed, 553 insertions(+), 120 deletions(-) diff --git a/cranelift/codegen/src/isa/pulley_shared/inst.isle b/cranelift/codegen/src/isa/pulley_shared/inst.isle index ba96439db1d7..4b089005efab 100644 --- a/cranelift/codegen/src/isa/pulley_shared/inst.isle +++ b/cranelift/codegen/src/isa/pulley_shared/inst.isle @@ -219,13 +219,14 @@ (enum (Base (addr XReg) + (trap_code TrapCode) (offset i32)))) ;; Constructor for the `AddrZ` type used in `*_z` loads/stores -(decl addrz (Value Offset32) AddrZ) -(rule (addrz addr offset) +(decl addrz (Value TrapCode Offset32) AddrZ) +(rule (addrz addr code offset) (if-let (ValueOffset.Both reg off32) (amode_base addr offset)) - (AddrZ.Base reg off32)) + (AddrZ.Base reg code off32)) ;;; ISLE representation of the `AddrG32` ("*_g32") addressing mode in Pulley. (type AddrG32 @@ -298,6 +299,9 @@ (decl pure memflags_nontrapping (MemFlags) bool) (extern constructor memflags_nontrapping memflags_nontrapping) +(decl pure partial memflags_trapping (MemFlags) TrapCode) +(extern constructor memflags_trapping memflags_trapping) + (decl pure memflags_is_wasm (MemFlags) bool) (extern constructor memflags_is_wasm memflags_is_wasm) diff --git a/cranelift/codegen/src/isa/pulley_shared/inst/args.rs b/cranelift/codegen/src/isa/pulley_shared/inst/args.rs index e97e3303ef99..aa69e5fc19d5 100644 --- a/cranelift/codegen/src/isa/pulley_shared/inst/args.rs +++ b/cranelift/codegen/src/isa/pulley_shared/inst/args.rs @@ -622,7 +622,11 @@ impl AddrZ { /// Implementation of regalloc for this addressing mode. pub fn collect_operands(&mut self, collector: &mut impl OperandVisitor) { match self { - AddrZ::Base { addr, offset: _ } => { + AddrZ::Base { + addr, + trap_code: _, + offset: _, + } => { collector.reg_use(addr); } } @@ -632,8 +636,13 @@ impl AddrZ { impl From for pulley_interpreter::AddrZ { fn from(addr: AddrZ) -> Self { match addr { - AddrZ::Base { addr, offset } => Self { + AddrZ::Base { + addr, + trap_code, + offset, + } => Self { addr: addr.into(), + trap_code: trap_code.as_raw().get(), offset, }, } @@ -643,9 +652,13 @@ impl From for pulley_interpreter::AddrZ { impl fmt::Display for AddrZ { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - AddrZ::Base { addr, offset } => { + AddrZ::Base { + addr, + trap_code, + offset, + } => { let addr = reg_name(**addr); - write!(f, "{addr}, {offset}") + write!(f, "{addr}, {offset} ; trap={trap_code}") } } } diff --git a/cranelift/codegen/src/isa/pulley_shared/lower.isle b/cranelift/codegen/src/isa/pulley_shared/lower.isle index d6df01f9df7d..33cbdcc30292 100644 --- a/cranelift/codegen/src/isa/pulley_shared/lower.isle +++ b/cranelift/codegen/src/isa/pulley_shared/lower.isle @@ -1069,29 +1069,48 @@ (rule (emit_addro32_xload addr $I32 (ExtKind.Zero64)) (pulley_zext32 (pulley_xload32le_o32 addr))) (rule (emit_addro32_xload addr $I64 _ext) (pulley_xload64le_o32 addr)) -;; Special case: wasm loads/stores that map trap use the `*_z` addressing modes -;; which generates a trap for load-from-null. +;; Special case: trapping loads/stores that map trap use the `*_z` addressing +;; modes which generates a trap for load-from-null. (rule 1 (gen_xload addr offset flags ty ext) - (if-let true (memflags_is_wasm flags)) - (emit_addrz_xload (addrz addr offset) ty ext)) - -(decl emit_addrz_xload (AddrZ Type ExtKind) XReg) -(rule (emit_addrz_xload addr $I8 (ExtKind.None)) (pulley_xload8_u32_z addr)) -(rule (emit_addrz_xload addr $I8 (ExtKind.Sign32)) (pulley_xload8_s32_z addr)) -(rule (emit_addrz_xload addr $I8 (ExtKind.Zero32)) (pulley_xload8_u32_z addr)) -(rule (emit_addrz_xload addr $I8 (ExtKind.Sign64)) (pulley_sext32 (pulley_xload8_s32_z addr))) -(rule (emit_addrz_xload addr $I8 (ExtKind.Zero64)) (pulley_zext32 (pulley_xload8_u32_z addr))) -(rule (emit_addrz_xload addr $I16 (ExtKind.None)) (pulley_xload16le_u32_z addr)) -(rule (emit_addrz_xload addr $I16 (ExtKind.Sign32)) (pulley_xload16le_s32_z addr)) -(rule (emit_addrz_xload addr $I16 (ExtKind.Zero32)) (pulley_xload16le_u32_z addr)) -(rule (emit_addrz_xload addr $I16 (ExtKind.Sign64)) (pulley_sext32 (pulley_xload16le_s32_z addr))) -(rule (emit_addrz_xload addr $I16 (ExtKind.Zero64)) (pulley_zext32 (pulley_xload16le_u32_z addr))) -(rule (emit_addrz_xload addr $I32 (ExtKind.None)) (pulley_xload32le_z addr)) -(rule (emit_addrz_xload addr $I32 (ExtKind.Sign32)) (pulley_xload32le_z addr)) -(rule (emit_addrz_xload addr $I32 (ExtKind.Zero32)) (pulley_xload32le_z addr)) -(rule (emit_addrz_xload addr $I32 (ExtKind.Sign64)) (pulley_sext32 (pulley_xload32le_z addr))) -(rule (emit_addrz_xload addr $I32 (ExtKind.Zero64)) (pulley_zext32 (pulley_xload32le_z addr))) -(rule (emit_addrz_xload addr $I64 _ext) (pulley_xload64le_z addr)) + (if-let trap (memflags_trapping flags)) + (if-let (Endianness.Little) (endianness flags)) + (emit_addrz_xload_le (addrz addr trap offset) ty ext)) +(rule 1 (gen_xload addr offset flags ty ext) + (if-let trap (memflags_trapping flags)) + (if-let (Endianness.Big) (endianness flags)) + (emit_addrz_xload_be (addrz addr trap offset) ty ext)) + +(decl emit_addrz_xload_le (AddrZ Type ExtKind) XReg) +(rule (emit_addrz_xload_le addr $I8 (ExtKind.None)) (pulley_xload8_u32_z addr)) +(rule (emit_addrz_xload_le addr $I8 (ExtKind.Sign32)) (pulley_xload8_s32_z addr)) +(rule (emit_addrz_xload_le addr $I8 (ExtKind.Zero32)) (pulley_xload8_u32_z addr)) +(rule (emit_addrz_xload_le addr $I8 (ExtKind.Sign64)) (pulley_sext32 (pulley_xload8_s32_z addr))) +(rule (emit_addrz_xload_le addr $I8 (ExtKind.Zero64)) (pulley_zext32 (pulley_xload8_u32_z addr))) +(rule (emit_addrz_xload_le addr $I16 (ExtKind.None)) (pulley_xload16le_u32_z addr)) +(rule (emit_addrz_xload_le addr $I16 (ExtKind.Sign32)) (pulley_xload16le_s32_z addr)) +(rule (emit_addrz_xload_le addr $I16 (ExtKind.Zero32)) (pulley_xload16le_u32_z addr)) +(rule (emit_addrz_xload_le addr $I16 (ExtKind.Sign64)) (pulley_sext32 (pulley_xload16le_s32_z addr))) +(rule (emit_addrz_xload_le addr $I16 (ExtKind.Zero64)) (pulley_zext32 (pulley_xload16le_u32_z addr))) +(rule (emit_addrz_xload_le addr $I32 (ExtKind.None)) (pulley_xload32le_z addr)) +(rule (emit_addrz_xload_le addr $I32 (ExtKind.Sign32)) (pulley_xload32le_z addr)) +(rule (emit_addrz_xload_le addr $I32 (ExtKind.Zero32)) (pulley_xload32le_z addr)) +(rule (emit_addrz_xload_le addr $I32 (ExtKind.Sign64)) (pulley_sext32 (pulley_xload32le_z addr))) +(rule (emit_addrz_xload_le addr $I32 (ExtKind.Zero64)) (pulley_zext32 (pulley_xload32le_z addr))) +(rule (emit_addrz_xload_le addr $I64 _ext) (pulley_xload64le_z addr)) + +(decl emit_addrz_xload_be (AddrZ Type ExtKind) XReg) +(rule (emit_addrz_xload_be addr $I8 e) (emit_addrz_xload_le addr $I8 e)) +(rule (emit_addrz_xload_be addr $I16 (ExtKind.None)) (pulley_xload16be_u32_z addr)) +(rule (emit_addrz_xload_be addr $I16 (ExtKind.Sign32)) (pulley_xload16be_s32_z addr)) +(rule (emit_addrz_xload_be addr $I16 (ExtKind.Zero32)) (pulley_xload16be_u32_z addr)) +(rule (emit_addrz_xload_be addr $I16 (ExtKind.Sign64)) (pulley_sext32 (pulley_xload16be_s32_z addr))) +(rule (emit_addrz_xload_be addr $I16 (ExtKind.Zero64)) (pulley_zext32 (pulley_xload16be_u32_z addr))) +(rule (emit_addrz_xload_be addr $I32 (ExtKind.None)) (pulley_xload32be_z addr)) +(rule (emit_addrz_xload_be addr $I32 (ExtKind.Sign32)) (pulley_xload32be_z addr)) +(rule (emit_addrz_xload_be addr $I32 (ExtKind.Zero32)) (pulley_xload32be_z addr)) +(rule (emit_addrz_xload_be addr $I32 (ExtKind.Sign64)) (pulley_sext32 (pulley_xload32be_z addr))) +(rule (emit_addrz_xload_be addr $I32 (ExtKind.Zero64)) (pulley_zext32 (pulley_xload32be_z addr))) +(rule (emit_addrz_xload_be addr $I64 _ext) (pulley_xload64be_z addr)) ;; Special case: wasm loads/stores that may trap use the `*_g32` addressing ;; modes. This is a superset of the `*_z` modes above and requires extracting @@ -1155,14 +1174,22 @@ (pulley_fload (amode addr offset) ty flags)) ;; Base case: use trapping loads stores with the `*_z` addressing mode for -;; wasm-looking loads/stores. +;; loads/stores. (rule 1 (gen_fload addr offset flags ty) - (if-let true (memflags_is_wasm flags)) - (emit_addrz_fload (addrz addr offset) ty)) + (if-let code (memflags_trapping flags)) + (if-let (Endianness.Little) (endianness flags)) + (emit_addrz_fload_le (addrz addr code offset) ty)) +(rule 1 (gen_fload addr offset flags ty) + (if-let code (memflags_trapping flags)) + (if-let (Endianness.Big) (endianness flags)) + (emit_addrz_fload_be (addrz addr code offset) ty)) -(decl emit_addrz_fload (AddrZ Type) FReg) -(rule (emit_addrz_fload addr $F32) (pulley_fload32le_z addr)) -(rule (emit_addrz_fload addr $F64) (pulley_fload64le_z addr)) +(decl emit_addrz_fload_le (AddrZ Type) FReg) +(rule (emit_addrz_fload_le addr $F32) (pulley_fload32le_z addr)) +(rule (emit_addrz_fload_le addr $F64) (pulley_fload64le_z addr)) +(decl emit_addrz_fload_be (AddrZ Type) FReg) +(rule (emit_addrz_fload_be addr $F32) (pulley_fload32be_z addr)) +(rule (emit_addrz_fload_be addr $F64) (pulley_fload64be_z addr)) ;; Special case: use `*_g32` addressing when the bounds-check can be ;; pattern-matched. @@ -1184,19 +1211,27 @@ (if-let true (memflags_nontrapping flags)) (pulley_vload (amode addr offset) ty flags)) -;; Base case: wasm loads/stores using the `*_z` addressing mode. +;; Base case: trapping loads/stores using the `*_z` addressing mode. +(rule 1 (gen_vload addr offset flags ty ext) + (if-let code (memflags_trapping flags)) + (if-let (Endianness.Little) (endianness flags)) + (emit_addrz_vload_le (addrz addr code offset) ty ext)) (rule 1 (gen_vload addr offset flags ty ext) - (if-let true (memflags_is_wasm flags)) - (emit_addrz_vload (addrz addr offset) ty ext)) - -(decl emit_addrz_vload (AddrZ Type VExtKind) VReg) -(rule (emit_addrz_vload addr (ty_vec128 _) (VExtKind.None)) (pulley_vload128le_z addr)) -(rule (emit_addrz_vload addr (ty_vec128 _) (VExtKind.S8x8)) (pulley_vload8x8_s_z addr)) -(rule (emit_addrz_vload addr (ty_vec128 _) (VExtKind.U8x8)) (pulley_vload8x8_u_z addr)) -(rule (emit_addrz_vload addr (ty_vec128 _) (VExtKind.S16x4)) (pulley_vload16x4le_s_z addr)) -(rule (emit_addrz_vload addr (ty_vec128 _) (VExtKind.U16x4)) (pulley_vload16x4le_u_z addr)) -(rule (emit_addrz_vload addr (ty_vec128 _) (VExtKind.S32x2)) (pulley_vload32x2le_s_z addr)) -(rule (emit_addrz_vload addr (ty_vec128 _) (VExtKind.U32x2)) (pulley_vload32x2le_u_z addr)) + (if-let code (memflags_trapping flags)) + (if-let (Endianness.Big) (endianness flags)) + (emit_addrz_vload_be (addrz addr code offset) ty ext)) + +(decl emit_addrz_vload_le (AddrZ Type VExtKind) VReg) +(rule (emit_addrz_vload_le addr (ty_vec128 _) (VExtKind.None)) (pulley_vload128le_z addr)) +(rule (emit_addrz_vload_le addr (ty_vec128 _) (VExtKind.S8x8)) (pulley_vload8x8_s_z addr)) +(rule (emit_addrz_vload_le addr (ty_vec128 _) (VExtKind.U8x8)) (pulley_vload8x8_u_z addr)) +(rule (emit_addrz_vload_le addr (ty_vec128 _) (VExtKind.S16x4)) (pulley_vload16x4le_s_z addr)) +(rule (emit_addrz_vload_le addr (ty_vec128 _) (VExtKind.U16x4)) (pulley_vload16x4le_u_z addr)) +(rule (emit_addrz_vload_le addr (ty_vec128 _) (VExtKind.S32x2)) (pulley_vload32x2le_s_z addr)) +(rule (emit_addrz_vload_le addr (ty_vec128 _) (VExtKind.U32x2)) (pulley_vload32x2le_u_z addr)) + +(decl emit_addrz_vload_be (AddrZ Type VExtKind) VReg) +(rule (emit_addrz_vload_be addr (ty_vec128 _) (VExtKind.None)) (pulley_vload128be_z addr)) ;; Special case: use `*_g32` addressing when the bounds-check can be ;; pattern-matched. @@ -1263,19 +1298,33 @@ (if-let true (memflags_nontrapping flags)) (pulley_vstore (amode addr offset) src ty flags)) -;; Base case: wasm stores +;; Base case: trapping stores (rule 3 (gen_store src addr offset flags ty) - (if-let true (memflags_is_wasm flags)) - (emit_addrz_store (addrz addr offset) src ty)) - -(decl emit_addrz_store (AddrZ Value Type) SideEffectNoResult) -(rule (emit_addrz_store addr val $I8) (pulley_xstore8_z addr val)) -(rule (emit_addrz_store addr val $I16) (pulley_xstore16le_z addr val)) -(rule (emit_addrz_store addr val $I32) (pulley_xstore32le_z addr val)) -(rule (emit_addrz_store addr val $I64) (pulley_xstore64le_z addr val)) -(rule (emit_addrz_store addr val $F32) (pulley_fstore32le_z addr val)) -(rule (emit_addrz_store addr val $F64) (pulley_fstore64le_z addr val)) -(rule 1 (emit_addrz_store addr val (ty_vec128 _)) (pulley_vstore128le_z addr val)) + (if-let code (memflags_trapping flags)) + (if-let (Endianness.Little) (endianness flags)) + (emit_addrz_store_le (addrz addr code offset) src ty)) +(rule 3 (gen_store src addr offset flags ty) + (if-let code (memflags_trapping flags)) + (if-let (Endianness.Big) (endianness flags)) + (emit_addrz_store_be (addrz addr code offset) src ty)) + +(decl emit_addrz_store_le (AddrZ Value Type) SideEffectNoResult) +(rule (emit_addrz_store_le addr val $I8) (pulley_xstore8_z addr val)) +(rule (emit_addrz_store_le addr val $I16) (pulley_xstore16le_z addr val)) +(rule (emit_addrz_store_le addr val $I32) (pulley_xstore32le_z addr val)) +(rule (emit_addrz_store_le addr val $I64) (pulley_xstore64le_z addr val)) +(rule (emit_addrz_store_le addr val $F32) (pulley_fstore32le_z addr val)) +(rule (emit_addrz_store_le addr val $F64) (pulley_fstore64le_z addr val)) +(rule 1 (emit_addrz_store_le addr val (ty_vec128 _)) (pulley_vstore128le_z addr val)) + +(decl emit_addrz_store_be (AddrZ Value Type) SideEffectNoResult) +(rule (emit_addrz_store_be addr val $I8) (pulley_xstore8_z addr val)) +(rule (emit_addrz_store_be addr val $I16) (pulley_xstore16be_z addr val)) +(rule (emit_addrz_store_be addr val $I32) (pulley_xstore32be_z addr val)) +(rule (emit_addrz_store_be addr val $I64) (pulley_xstore64be_z addr val)) +(rule (emit_addrz_store_be addr val $F32) (pulley_fstore32be_z addr val)) +(rule (emit_addrz_store_be addr val $F64) (pulley_fstore64be_z addr val)) +(rule 1 (emit_addrz_store_be addr val (ty_vec128 _)) (pulley_vstore128be_z addr val)) ;; special case: wasm stores with a folded bounds check (rule 4 (gen_store src addr offset flags ty) diff --git a/cranelift/codegen/src/isa/pulley_shared/lower/isle.rs b/cranelift/codegen/src/isa/pulley_shared/lower/isle.rs index d72b6a023789..af900f72fa4f 100644 --- a/cranelift/codegen/src/isa/pulley_shared/lower/isle.rs +++ b/cranelift/codegen/src/isa/pulley_shared/lower/isle.rs @@ -276,6 +276,10 @@ where flags.trap_code().is_none() } + fn memflags_trapping(&mut self, flags: MemFlags) -> Option { + flags.trap_code() + } + fn memflags_is_wasm(&mut self, flags: MemFlags) -> bool { flags.trap_code() == Some(TrapCode::HEAP_OUT_OF_BOUNDS) && self.endianness(flags) == Endianness::Little diff --git a/cranelift/filetests/filetests/isa/pulley32/load.clif b/cranelift/filetests/filetests/isa/pulley32/load.clif index fc0b6156d458..85579b4e9768 100644 --- a/cranelift/filetests/filetests/isa/pulley32/load.clif +++ b/cranelift/filetests/filetests/isa/pulley32/load.clif @@ -9,7 +9,7 @@ block0(v0: i32): ; VCode: ; block0: -; xload32le_z x0, x0, 0 +; xload32le_z x0, x0, 0 ; trap=heap_oob ; ret ; ; Disassembled: @@ -24,7 +24,7 @@ block0(v0: i32): ; VCode: ; block0: -; xload64le_z x0, x0, 0 +; xload64le_z x0, x0, 0 ; trap=heap_oob ; ret ; ; Disassembled: @@ -39,7 +39,7 @@ block0(v0: i32): ; VCode: ; block0: -; xload32le_z x0, x0, 4 +; xload32le_z x0, x0, 4 ; trap=heap_oob ; ret ; ; Disassembled: @@ -54,7 +54,7 @@ block0(v0: i32): ; VCode: ; block0: -; xload64le_z x0, x0, 8 +; xload64le_z x0, x0, 8 ; trap=heap_oob ; ret ; ; Disassembled: diff --git a/cranelift/filetests/filetests/isa/pulley32/store.clif b/cranelift/filetests/filetests/isa/pulley32/store.clif index 7e4217f580d4..e221c79b0020 100644 --- a/cranelift/filetests/filetests/isa/pulley32/store.clif +++ b/cranelift/filetests/filetests/isa/pulley32/store.clif @@ -9,7 +9,7 @@ block0(v0: i32, v1: i32): ; VCode: ; block0: -; xstore32le_z x1, 0, x0 +; xstore32le_z x1, 0 ; trap=heap_oob, x0 ; ret ; ; Disassembled: @@ -24,7 +24,7 @@ block0(v0: i64, v1: i32): ; VCode: ; block0: -; xstore64le_z x1, 0, x0 +; xstore64le_z x1, 0 ; trap=heap_oob, x0 ; ret ; ; Disassembled: @@ -39,7 +39,7 @@ block0(v0: i32, v1: i32): ; VCode: ; block0: -; xstore32le_z x1, 4, x0 +; xstore32le_z x1, 4 ; trap=heap_oob, x0 ; ret ; ; Disassembled: @@ -54,7 +54,7 @@ block0(v0: i64, v1: i32): ; VCode: ; block0: -; xstore64le_z x1, 8, x0 +; xstore64le_z x1, 8 ; trap=heap_oob, x0 ; ret ; ; Disassembled: diff --git a/cranelift/filetests/filetests/isa/pulley64/load.clif b/cranelift/filetests/filetests/isa/pulley64/load.clif index a8ad2b01f9e9..d511c7711f2b 100644 --- a/cranelift/filetests/filetests/isa/pulley64/load.clif +++ b/cranelift/filetests/filetests/isa/pulley64/load.clif @@ -9,7 +9,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload8_u32_z x0, x0, 0 +; xload8_u32_z x0, x0, 0 ; trap=heap_oob ; ret ; ; Disassembled: @@ -24,7 +24,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload8_s32_z x0, x0, 0 +; xload8_s32_z x0, x0, 0 ; trap=heap_oob ; ret ; ; Disassembled: @@ -39,7 +39,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload8_u32_z x0, x0, 0 +; xload8_u32_z x0, x0, 0 ; trap=heap_oob ; ret ; ; Disassembled: @@ -54,7 +54,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload16le_u32_z x0, x0, 0 +; xload16le_u32_z x0, x0, 0 ; trap=heap_oob ; ret ; ; Disassembled: @@ -69,7 +69,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload16le_s32_z x0, x0, 0 +; xload16le_s32_z x0, x0, 0 ; trap=heap_oob ; ret ; ; Disassembled: @@ -84,7 +84,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload16le_u32_z x0, x0, 0 +; xload16le_u32_z x0, x0, 0 ; trap=heap_oob ; ret ; ; Disassembled: @@ -99,7 +99,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload32le_z x0, x0, 0 +; xload32le_z x0, x0, 0 ; trap=heap_oob ; ret ; ; Disassembled: @@ -114,7 +114,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload32le_z x2, x0, 0 +; xload32le_z x2, x0, 0 ; trap=heap_oob ; sext32 x0, x2 ; ret ; @@ -131,7 +131,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload32le_z x2, x0, 0 +; xload32le_z x2, x0, 0 ; trap=heap_oob ; zext32 x0, x2 ; ret ; @@ -148,7 +148,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload64le_z x0, x0, 0 +; xload64le_z x0, x0, 0 ; trap=heap_oob ; ret ; ; Disassembled: @@ -163,7 +163,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload8_u32_z x0, x0, 4 +; xload8_u32_z x0, x0, 4 ; trap=heap_oob ; ret ; ; Disassembled: @@ -178,7 +178,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload8_s32_z x0, x0, 4 +; xload8_s32_z x0, x0, 4 ; trap=heap_oob ; ret ; ; Disassembled: @@ -193,7 +193,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload8_u32_z x0, x0, 4 +; xload8_u32_z x0, x0, 4 ; trap=heap_oob ; ret ; ; Disassembled: @@ -208,7 +208,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload16le_u32_z x0, x0, 4 +; xload16le_u32_z x0, x0, 4 ; trap=heap_oob ; ret ; ; Disassembled: @@ -223,7 +223,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload16le_s32_z x0, x0, 4 +; xload16le_s32_z x0, x0, 4 ; trap=heap_oob ; ret ; ; Disassembled: @@ -238,7 +238,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload16le_u32_z x0, x0, 4 +; xload16le_u32_z x0, x0, 4 ; trap=heap_oob ; ret ; ; Disassembled: @@ -253,7 +253,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload32le_z x0, x0, 4 +; xload32le_z x0, x0, 4 ; trap=heap_oob ; ret ; ; Disassembled: @@ -268,7 +268,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload32le_z x2, x0, 4 +; xload32le_z x2, x0, 4 ; trap=heap_oob ; sext32 x0, x2 ; ret ; @@ -285,7 +285,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload32le_z x2, x0, 4 +; xload32le_z x2, x0, 4 ; trap=heap_oob ; zext32 x0, x2 ; ret ; @@ -302,7 +302,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload64le_z x0, x0, 65536 +; xload64le_z x0, x0, 65536 ; trap=heap_oob ; ret ; ; Disassembled: @@ -317,7 +317,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload8_u32_z x0, x0, 65536 +; xload8_u32_z x0, x0, 65536 ; trap=heap_oob ; ret ; ; Disassembled: @@ -332,7 +332,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload8_s32_z x0, x0, 65536 +; xload8_s32_z x0, x0, 65536 ; trap=heap_oob ; ret ; ; Disassembled: @@ -347,7 +347,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload8_u32_z x0, x0, 65536 +; xload8_u32_z x0, x0, 65536 ; trap=heap_oob ; ret ; ; Disassembled: @@ -362,7 +362,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload16le_u32_z x0, x0, 65536 +; xload16le_u32_z x0, x0, 65536 ; trap=heap_oob ; ret ; ; Disassembled: @@ -377,7 +377,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload16le_s32_z x0, x0, 65536 +; xload16le_s32_z x0, x0, 65536 ; trap=heap_oob ; ret ; ; Disassembled: @@ -392,7 +392,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload16le_u32_z x0, x0, 65536 +; xload16le_u32_z x0, x0, 65536 ; trap=heap_oob ; ret ; ; Disassembled: @@ -407,7 +407,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload32le_z x0, x0, 65536 +; xload32le_z x0, x0, 65536 ; trap=heap_oob ; ret ; ; Disassembled: @@ -422,7 +422,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload32le_z x2, x0, 65536 +; xload32le_z x2, x0, 65536 ; trap=heap_oob ; sext32 x0, x2 ; ret ; @@ -439,7 +439,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload32le_z x2, x0, 65536 +; xload32le_z x2, x0, 65536 ; trap=heap_oob ; zext32 x0, x2 ; ret ; @@ -456,7 +456,7 @@ block0(v0: i64): ; VCode: ; block0: -; xload64le_z x0, x0, 65536 +; xload64le_z x0, x0, 65536 ; trap=heap_oob ; ret ; ; Disassembled: @@ -472,10 +472,123 @@ block0(v0: i64): ; VCode: ; block0: -; xload64le_z x0, x0, 18 +; xload64le_z x0, x0, 18 ; trap=heap_oob ; ret ; ; Disassembled: ; xload64le_z x0, x0, 18 ; ret +function %load_i8_be_custom_trap(i64) -> i8 { +block0(v0: i64): + v1 = iadd_imm v0, 10 + v2 = load.i8 big user12 v1+8 + return v2 +} + +; VCode: +; block0: +; xload8_u32_z x0, x0, 18 ; trap=user12 +; ret +; +; Disassembled: +; xload8_u32_z x0, x0, 18 +; ret + +function %load_i16_be_custom_trap(i64) -> i16 { +block0(v0: i64): + v1 = iadd_imm v0, 10 + v2 = load.i16 big user12 v1+8 + return v2 +} + +; VCode: +; block0: +; xload16be_u32_z x0, x0, 18 ; trap=user12 +; ret +; +; Disassembled: +; xload16be_u32_z x0, x0, 18 +; ret + +function %load_i32_be_custom_trap(i64) -> i32 { +block0(v0: i64): + v1 = iadd_imm v0, 10 + v2 = load.i32 big user12 v1+8 + return v2 +} + +; VCode: +; block0: +; xload32be_z x0, x0, 18 ; trap=user12 +; ret +; +; Disassembled: +; xload32be_z x0, x0, 18 +; ret + +function %load_i64_be_custom_trap(i64) -> i64 { +block0(v0: i64): + v1 = iadd_imm v0, 10 + v2 = load.i64 big user12 v1+8 + return v2 +} + +; VCode: +; block0: +; xload64be_z x0, x0, 18 ; trap=user12 +; ret +; +; Disassembled: +; xload64be_z x0, x0, 18 +; ret + + +function %load_f32_be_custom_trap(i64) -> f32 { +block0(v0: i64): + v1 = iadd_imm v0, 10 + v2 = load.f32 big user12 v1+8 + return v2 +} + +; VCode: +; block0: +; fload32be_z f0, x0, 18 ; trap=user12 +; ret +; +; Disassembled: +; fload32be_z f0, x0, 18 +; ret + +function %load_f64_be_custom_trap(i64) -> f64 { +block0(v0: i64): + v1 = iadd_imm v0, 10 + v2 = load.f64 big user12 v1+8 + return v2 +} + +; VCode: +; block0: +; fload64be_z f0, x0, 18 ; trap=user12 +; ret +; +; Disassembled: +; fload64be_z f0, x0, 18 +; ret + +function %load_i64x2_be_custom_trap(i64) -> i64x2 { +block0(v0: i64): + v1 = iadd_imm v0, 10 + v2 = load.i64x2 big user12 v1+8 + return v2 +} + +; VCode: +; block0: +; vload128be_z v0, x0, 18 ; trap=user12 +; ret +; +; Disassembled: +; vload128be_z v0, x0, 18 +; ret + diff --git a/cranelift/filetests/filetests/isa/pulley64/store.clif b/cranelift/filetests/filetests/isa/pulley64/store.clif index 7f3c8813194c..ad1c63969ac9 100644 --- a/cranelift/filetests/filetests/isa/pulley64/store.clif +++ b/cranelift/filetests/filetests/isa/pulley64/store.clif @@ -9,7 +9,7 @@ block0(v0: i32, v1: i64): ; VCode: ; block0: -; xstore32le_z x1, 0, x0 +; xstore32le_z x1, 0 ; trap=heap_oob, x0 ; ret ; ; Disassembled: @@ -24,7 +24,7 @@ block0(v0: i64, v1: i64): ; VCode: ; block0: -; xstore64le_z x1, 0, x0 +; xstore64le_z x1, 0 ; trap=heap_oob, x0 ; ret ; ; Disassembled: @@ -39,7 +39,7 @@ block0(v0: i32, v1: i64): ; VCode: ; block0: -; xstore32le_z x1, 4, x0 +; xstore32le_z x1, 4 ; trap=heap_oob, x0 ; ret ; ; Disassembled: @@ -54,10 +54,115 @@ block0(v0: i64, v1: i64): ; VCode: ; block0: -; xstore64le_z x1, 8, x0 +; xstore64le_z x1, 8 ; trap=heap_oob, x0 ; ret ; ; Disassembled: ; xstore64le_z x1, 8, x0 ; ret +function %store_i8_be_custom(i8, i64) { +block0(v0: i8, v1: i64): + store big user13 v0, v1 + return +} + +; VCode: +; block0: +; xstore8_z x1, 0 ; trap=user13, x0 +; ret +; +; Disassembled: +; xstore8_z x1, 0, x0 +; ret + +function %store_i16_be_custom(i16, i64) { +block0(v0: i16, v1: i64): + store big user13 v0, v1 + return +} + +; VCode: +; block0: +; xstore16be_z x1, 0 ; trap=user13, x0 +; ret +; +; Disassembled: +; xstore16be_z x1, 0, x0 +; ret + +function %store_i32_be_custom(i32, i64) { +block0(v0: i32, v1: i64): + store big user13 v0, v1 + return +} + +; VCode: +; block0: +; xstore32be_z x1, 0 ; trap=user13, x0 +; ret +; +; Disassembled: +; xstore32be_z x1, 0, x0 +; ret + +function %store_i64_be_custom(i64, i64) { +block0(v0: i64, v1: i64): + store big user13 v0, v1 + return +} + +; VCode: +; block0: +; xstore64be_z x1, 0 ; trap=user13, x0 +; ret +; +; Disassembled: +; xstore64be_z x1, 0, x0 +; ret + +function %store_f32_be_custom(f32, i64) { +block0(v0: f32, v1: i64): + store big user13 v0, v1 + return +} + +; VCode: +; block0: +; fstore32be_z x0, 0 ; trap=user13, f0 +; ret +; +; Disassembled: +; fstore32be_z x0, 0, f0 +; ret + +function %store_f64_be_custom(f64, i64) { +block0(v0: f64, v1: i64): + store big user13 v0, v1 + return +} + +; VCode: +; block0: +; fstore64be_z x0, 0 ; trap=user13, f0 +; ret +; +; Disassembled: +; fstore64be_z x0, 0, f0 +; ret + +function %store_i64x2_be_custom(i64x2, i64) { +block0(v0: i64x2, v1: i64): + store big user13 v0, v1 + return +} + +; VCode: +; block0: +; vstore128be_z x0, 0 ; trap=user13, v0 +; ret +; +; Disassembled: +; vstore128be_z x0, 0, v0 +; ret + diff --git a/crates/wasmtime/src/runtime/vm/interpreter.rs b/crates/wasmtime/src/runtime/vm/interpreter.rs index 71f4ecdb6df3..fa454b5ce1c6 100644 --- a/crates/wasmtime/src/runtime/vm/interpreter.rs +++ b/crates/wasmtime/src/runtime/vm/interpreter.rs @@ -8,7 +8,7 @@ use core::marker; use core::ptr::NonNull; use pulley_interpreter::interp::{DoneReason, RegType, TrapKind, Val, Vm, XRegVal}; use pulley_interpreter::{Reg, XReg}; -use wasmtime_environ::{BuiltinFunctionIndex, HostCall, Trap}; +use wasmtime_environ::{BuiltinFunctionIndex, CompiledTrap, HostCall, Trap}; use wasmtime_unwinder::Handler; use wasmtime_unwinder::Unwind; @@ -464,14 +464,15 @@ impl InterpreterRef<'_> { match kind { Some(kind) => { let trap = match kind { - TrapKind::IntegerOverflow => Trap::IntegerOverflow, - TrapKind::DivideByZero => Trap::IntegerDivisionByZero, - TrapKind::BadConversionToInteger => Trap::BadConversionToInteger, - TrapKind::MemoryOutOfBounds => Trap::MemoryOutOfBounds, - TrapKind::DisabledOpcode => Trap::DisabledOpcode, - TrapKind::StackOverflow => Trap::StackOverflow, + TrapKind::IntegerOverflow => Trap::IntegerOverflow.into(), + TrapKind::DivideByZero => Trap::IntegerDivisionByZero.into(), + TrapKind::BadConversionToInteger => Trap::BadConversionToInteger.into(), + TrapKind::MemoryOutOfBounds => Trap::MemoryOutOfBounds.into(), + TrapKind::DisabledOpcode => Trap::DisabledOpcode.into(), + TrapKind::StackOverflow => Trap::StackOverflow.into(), + TrapKind::Code(n) => CompiledTrap::from_u8(n).unwrap(), }; - s.set_jit_trap(regs, None, trap.into()); + s.set_jit_trap(regs, None, trap); s.entry_trap_handler() } None => { diff --git a/pulley/src/decode.rs b/pulley/src/decode.rs index 6c567a71dd1c..575f5e9e2160 100644 --- a/pulley/src/decode.rs +++ b/pulley/src/decode.rs @@ -470,10 +470,9 @@ impl Decode for AddrZ { where T: BytecodeStream, { - Ok(AddrZ { - addr: XReg::decode(bytecode)?, - offset: i32::decode(bytecode)?, - }) + let a = u16::decode(bytecode)?; + let b = i32::decode(bytecode)?; + Ok(AddrZ::from_parts(a, b)) } } diff --git a/pulley/src/encode.rs b/pulley/src/encode.rs index 2815d892bcb1..be35b05c0690 100644 --- a/pulley/src/encode.rs +++ b/pulley/src/encode.rs @@ -215,14 +215,15 @@ impl Encode for AddrO32 { } impl Encode for AddrZ { - const WIDTH: u8 = 5; + const WIDTH: u8 = 6; fn encode(&self, sink: &mut E) where E: Extend, { - self.addr.encode(sink); - self.offset.encode(sink); + let (a, b) = self.to_parts(); + a.encode(sink); + b.encode(sink); } } diff --git a/pulley/src/interp.rs b/pulley/src/interp.rs index 940d35237b79..7a423ce9bef3 100644 --- a/pulley/src/interp.rs +++ b/pulley/src/interp.rs @@ -954,6 +954,7 @@ mod done { MemoryOutOfBounds, DisabledOpcode, StackOverflow, + Code(u8), } impl MachineState { @@ -1231,7 +1232,7 @@ impl AddressingMode for AddrZ { // a trap, but all other addresses are allowed. let host_addr = i.state[self.addr].get_ptr::(); if host_addr.is_null() { - i.done_trap_kind::(Some(TrapKind::MemoryOutOfBounds))?; + i.done_trap_kind::(Some(TrapKind::Code(self.trap_code)))?; unreachable!(); } unsafe { @@ -3111,7 +3112,7 @@ impl ExtendedOpVisitor for Interpreter<'_> { #[interp_disable_if_cfg(pulley_disable_interp_simd)] fn vload128le_z(&mut self, dst: VReg, addr: AddrZ) -> ControlFlow { - let val = unsafe { self.load_ne::(addr)? }; + let val = unsafe { self.load_ne::(addr)? }; self.state[dst].set_u128(u128::from_le(val)); ControlFlow::Continue(()) } @@ -5627,4 +5628,99 @@ impl ExtendedOpVisitor for Interpreter<'_> { self.set_i128(dst_lo, dst_hi, result as i128); ControlFlow::Continue(()) } + + // ========================================================================= + // z addressing modes (big endian) + + fn xload16be_u32_z(&mut self, dst: XReg, addr: AddrZ) -> ControlFlow { + let result = unsafe { self.load_ne::(addr)? }; + self.state[dst].set_u32(u16::from_be(result).into()); + ControlFlow::Continue(()) + } + + fn xload16be_s32_z(&mut self, dst: XReg, addr: AddrZ) -> ControlFlow { + let result = unsafe { self.load_ne::(addr)? }; + self.state[dst].set_i32(i16::from_be(result).into()); + ControlFlow::Continue(()) + } + + fn xload32be_z(&mut self, dst: XReg, addr: AddrZ) -> ControlFlow { + let result = unsafe { self.load_ne::(addr)? }; + self.state[dst].set_i32(i32::from_be(result)); + ControlFlow::Continue(()) + } + + fn xload64be_z(&mut self, dst: XReg, addr: AddrZ) -> ControlFlow { + let result = unsafe { self.load_ne::(addr)? }; + self.state[dst].set_i64(i64::from_be(result)); + ControlFlow::Continue(()) + } + + fn xstore16be_z(&mut self, addr: AddrZ, val: XReg) -> ControlFlow { + let val = self.state[val].get_u32() as u16; + unsafe { + self.store_ne::(addr, val.to_be())?; + } + ControlFlow::Continue(()) + } + + fn xstore32be_z(&mut self, addr: AddrZ, val: XReg) -> ControlFlow { + let val = self.state[val].get_u32(); + unsafe { + self.store_ne::(addr, val.to_be())?; + } + ControlFlow::Continue(()) + } + + fn xstore64be_z(&mut self, addr: AddrZ, val: XReg) -> ControlFlow { + let val = self.state[val].get_u64(); + unsafe { + self.store_ne::(addr, val.to_be())?; + } + ControlFlow::Continue(()) + } + + fn fload32be_z(&mut self, dst: FReg, addr: AddrZ) -> ControlFlow { + let val = unsafe { self.load_ne::(addr)? }; + self.state[dst].set_f32(f32::from_bits(u32::from_be(val))); + ControlFlow::Continue(()) + } + + fn fload64be_z(&mut self, dst: FReg, addr: AddrZ) -> ControlFlow { + let val = unsafe { self.load_ne::(addr)? }; + self.state[dst].set_f64(f64::from_bits(u64::from_be(val))); + ControlFlow::Continue(()) + } + + fn fstore32be_z(&mut self, addr: AddrZ, src: FReg) -> ControlFlow { + let val = self.state[src].get_f32(); + unsafe { + self.store_ne::(addr, val.to_bits().to_be())?; + } + ControlFlow::Continue(()) + } + + fn fstore64be_z(&mut self, addr: AddrZ, src: FReg) -> ControlFlow { + let val = self.state[src].get_f64(); + unsafe { + self.store_ne::(addr, val.to_bits().to_be())?; + } + ControlFlow::Continue(()) + } + + #[interp_disable_if_cfg(pulley_disable_interp_simd)] + fn vload128be_z(&mut self, dst: VReg, addr: AddrZ) -> ControlFlow { + let val = unsafe { self.load_ne::(addr)? }; + self.state[dst].set_u128(u128::from_be(val)); + ControlFlow::Continue(()) + } + + #[interp_disable_if_cfg(pulley_disable_interp_simd)] + fn vstore128be_z(&mut self, addr: AddrZ, src: VReg) -> ControlFlow { + let val = self.state[src].get_u128(); + unsafe { + self.store_ne::(addr, val.to_be())?; + } + ControlFlow::Continue(()) + } } diff --git a/pulley/src/lib.rs b/pulley/src/lib.rs index dba201017df1..36a09cb13a34 100644 --- a/pulley/src/lib.rs +++ b/pulley/src/lib.rs @@ -746,7 +746,7 @@ macro_rules! for_each_extended_op { /// `*addr = src` vstore128le_o32 = Vstore128LeO32 { addr: AddrO32, src: VReg }; /// `dst = *(ptr + offset)` - vload128le_z = VLoad128Z { dst: VReg, addr: AddrZ }; + vload128le_z = VLoad128LeZ { dst: VReg, addr: AddrZ }; /// `*(ptr + offset) = src` vstore128le_z = Vstore128LeZ { addr: AddrZ, src: VReg }; /// `dst = *(ptr + offset)` @@ -1380,6 +1380,33 @@ macro_rules! for_each_extended_op { lhs: XReg, rhs: XReg }; + + /// `low32(dst) = zext_16_32(*addr)` + xload16be_u32_z = XLoad16BeU32Z { dst: XReg, addr: AddrZ }; + /// `low32(dst) = sext_16_32(*addr)` + xload16be_s32_z = XLoad16BeS32Z { dst: XReg, addr: AddrZ }; + /// `low32(dst) = *addr` + xload32be_z = XLoad32BeZ { dst: XReg, addr: AddrZ }; + /// `dst = *addr` + xload64be_z = XLoad64BeZ { dst: XReg, addr: AddrZ }; + /// `*addr = low16(src)` + xstore16be_z = XStore16BeZ { addr: AddrZ, src: XReg }; + /// `*addr = low32(src)` + xstore32be_z = XStore32BeZ { addr: AddrZ, src: XReg }; + /// `*addr = src` + xstore64be_z = XStore64BeZ { addr: AddrZ, src: XReg }; + /// `low32(dst) = zext(*addr)` + fload32be_z = Fload32BeZ { dst: FReg, addr: AddrZ }; + /// `dst = *addr` + fload64be_z = Fload64BeZ { dst: FReg, addr: AddrZ }; + /// `*addr = low32(src)` + fstore32be_z = Fstore32BeZ { addr: AddrZ, src: FReg }; + /// `*addr = src` + fstore64be_z = Fstore64BeZ { addr: AddrZ, src: FReg }; + /// `dst = *(ptr + offset)` + vload128be_z = VLoad128BeZ { dst: VReg, addr: AddrZ }; + /// `*(ptr + offset) = src` + vstore128be_z = Vstore128BeZ { addr: AddrZ, src: VReg }; } }; } diff --git a/pulley/src/regs.rs b/pulley/src/regs.rs index f9bad41a2b1d..339a13d5fd6f 100644 --- a/pulley/src/regs.rs +++ b/pulley/src/regs.rs @@ -359,10 +359,31 @@ pub struct AddrO32 { pub struct AddrZ { /// The base address of memory, or NULL. pub addr: XReg, + /// The trap code to use when the address being loaded is NULL. + pub trap_code: u8, /// A byte offset from `addr`. pub offset: i32, } +impl AddrZ { + /// Decodes this immediate from its constituent parts. + pub fn from_parts(a: u16, b: i32) -> AddrZ { + let addr = XReg::new((a & 0b11111) as u8).unwrap(); + let trap_code = (a >> 5) as u8; + AddrZ { + addr, + trap_code, + offset: b, + } + } + + /// Encodes this immediate into its constituent parts. + pub fn to_parts(&self) -> (u16, i32) { + let a = (u16::from(self.trap_code) << 5) | u16::from(self.addr.to_u8()); + (a, self.offset) + } +} + /// Immediate used for the "g32" addressing mode. /// /// This addressing mode represents the computation of a WebAssembly address for