A lightweight WebAssembly runtime that is fast, secure, and standards-compliant
Define alias regions for GC header fields and array length (#14353)
Nick Fitzgerald71cb012f128f
diff --git a/crates/cranelift/src/alias_region.rs b/crates/cranelift/src/alias_region.rsindex d2fd475902..a6022b2c36 100644--- a/crates/cranelift/src/alias_region.rs+++ b/crates/cranelift/src/alias_region.rs@@ -82,6 +82,9 @@ enum VmType {HostValRaw,VMPayloads,VMRawContObj,+ VMGcHeader,+ VMDrcHeader,+ VMCopyingHeader,}/// A key that uniquely identifies an alias region across an entire compilation.@@ -135,9 +138,8 @@ enum AliasRegionKey {index: DefinedGlobalIndex,},- /// A GC heap access that is not of a struct field or of array elements:- /// headers, array lengths, reference counts, etc...- GcHeap,+ /// An access of a GC array's `length` word.+ GcArrayLength,/// An access of a GC struct's field.GcStructField {@@ -181,6 +183,12 @@ enum AliasRegionKey {/// An access of the bytes inside a data segment.DataSegment,++ /// An access of an exception object's tag-instance word.+ GcExnTagInstance,++ /// An access of an exception object's tag-defined word.+ GcExnTagDefined,}impl AliasRegionKey {@@ -308,8 +316,29 @@ pub enum GcAccess {field: u32,},- /// An access of non-payload bytes: a header, length, ref count, or tag.- Header,+ /// An access of `VMGcHeader::kind` or the reserved bits packed into it.+ HeaderKind,++ /// An access of `VMGcHeader::ty`.+ HeaderTypeIndex,++ /// An access of `VMDrcHeader::ref_count`.+ DrcRefCount,++ /// An access of `VMDrcHeader::next_over_approximated_stack_root`.+ DrcNextOverApproximatedStackRoot,++ /// An access of `VMCopyingHeader::object_size`.+ CopyingObjectSize,++ /// An access of an array's `length` word.+ ArrayLength,++ /// An access of an exception object's tag-instance word.+ ExnTagInstance,++ /// An access of an exception object's tag-defined word.+ ExnTagDefined,}/// Alias region bookkeeping and load/store helper type.@@ -1173,15 +1202,6 @@ whereself.offsets.get_ptr_size()}- /// Get the alias region for GC heap accesses of non-payload bytes:- /// headers, lengths, reference counts, etc...- ///- /// Use `gc_access_region` for struct fields, exception payloads, and array- /// elements.- pub fn gc_heap_region(&mut self, func: &mut ir::Function) -> ir::AliasRegion {- self.region(func, AliasRegionKey::GcHeap)- }-/// Get the alias region for the given GC object access.pub fn gc_access_region(&mut self,@@ -1190,7 +1210,23 @@ whereaccess: GcAccess,) -> ir::AliasRegion {let key = match access {- GcAccess::Header => AliasRegionKey::GcHeap,+ GcAccess::HeaderKind => return self.vm_gc_header().kind().region(func),+ GcAccess::HeaderTypeIndex => return self.vm_gc_header().ty().region(func),+ GcAccess::DrcRefCount => return self.vm_drc_header().ref_count().region(func),+ GcAccess::DrcNextOverApproximatedStackRoot => {+ return self+ .vm_drc_header()+ .next_over_approximated_stack_root()+ .region(func);+ }+ GcAccess::CopyingObjectSize => {+ return self.vm_copying_header().object_size().region(func);+ }++ GcAccess::ArrayLength => AliasRegionKey::GcArrayLength,+ GcAccess::ExnTagInstance => AliasRegionKey::GcExnTagInstance,+ GcAccess::ExnTagDefined => AliasRegionKey::GcExnTagDefined,+GcAccess::StructField { ty, field } => AliasRegionKey::GcStructField {ty: self.gc_introducer(types, ty, field),field,@@ -1607,7 +1643,31 @@ mod tests {fn gc_keys_do_not_collide() {let ty = ModuleInternedTypeIndex::from_u32;- let mut keys = vec![AliasRegionKey::GcHeap];+ let mut keys = vec![+ AliasRegionKey::GcArrayLength,+ AliasRegionKey::GcExnTagInstance,+ AliasRegionKey::GcExnTagDefined,+ AliasRegionKey::Vm {+ ty: VmType::VMGcHeader,+ offset: 0,+ },+ AliasRegionKey::Vm {+ ty: VmType::VMGcHeader,+ offset: 4,+ },+ AliasRegionKey::Vm {+ ty: VmType::VMDrcHeader,+ offset: 8,+ },+ AliasRegionKey::Vm {+ ty: VmType::VMDrcHeader,+ offset: 16,+ },+ AliasRegionKey::Vm {+ ty: VmType::VMCopyingHeader,+ offset: 8,+ },+ ];for t in 0..3 {for field in 0..2 {keys.push(AliasRegionKey::GcStructField { ty: ty(t), field });diff --git a/crates/cranelift/src/func_environ/gc.rs b/crates/cranelift/src/func_environ/gc.rsindex 85fad8e47b..96cbbf89fd 100644--- a/crates/cranelift/src/func_environ/gc.rs+++ b/crates/cranelift/src/func_environ/gc.rs@@ -291,7 +291,7 @@ fn emit_gc_kind_assert(},);let flags = func_env- .gc_header_memflags(&mut builder.func)+ .gc_memflags(&mut builder.func, GcAccess::HeaderKind).with_readonly();let kind_and_reserved_bits = builder.ins().load(ir::types::I32, flags, kind_addr, 0);let kind_mask = builder@@ -331,7 +331,7 @@ pub fn read_field_at_addr(// Data inside GC objects is always little endian.let flags = func_env- .gc_memflags_for(&mut builder.func, access)+ .gc_memflags(&mut builder.func, access).with_endianness(ir::Endianness::Little);let value = match ty {@@ -558,7 +558,7 @@ pub fn write_field_at_addr() -> WasmResult<()> {// Data inside GC objects is always little endian.let flags = func_env- .gc_memflags_for(&mut builder.func, access)+ .gc_memflags(&mut builder.func, access).with_endianness(ir::Endianness::Little);match field_ty {@@ -1043,7 +1043,7 @@ pub fn translate_array_len(},);let flags = func_env- .gc_header_memflags(&mut builder.func)+ .gc_memflags(&mut builder.func, GcAccess::ArrayLength).with_readonly();let result = builder.ins().load(ir::types::I32, flags, len_field, 0);log::trace!("translate_array_len(..) -> {result:?}");@@ -1374,11 +1374,10 @@ pub fn translate_ref_test(object_size: wasmtime_environ::VM_GC_HEADER_SIZE,},);- let gc_memflags = func_env.gc_header_memflags(&mut builder.func);- let actual_kind =- builder- .ins()- .load(ir::types::I32, gc_memflags.with_readonly(), kind_addr, 0);+ let kind_flags = func_env+ .gc_memflags(&mut builder.func, GcAccess::HeaderKind)+ .with_readonly();+ let actual_kind = builder.ins().load(ir::types::I32, kind_flags, kind_addr, 0);let expected_kind = builder.ins().iconst(ir::types::I32, i64::from(expected_kind.as_u32()));@@ -1456,11 +1455,10 @@ pub fn translate_ref_test(access_size: func_env.offsets.size_of_vmshared_type_index(),},);- let gc_memflags = func_env.gc_header_memflags(&mut builder.func);- let actual_shared_ty =- builder- .ins()- .load(ir::types::I32, gc_memflags.with_readonly(), ty_addr, 0);+ let ty_flags = func_env+ .gc_memflags(&mut builder.func, GcAccess::HeaderTypeIndex)+ .with_readonly();+ let actual_shared_ty = builder.ins().load(ir::types::I32, ty_flags, ty_addr, 0);func_env.is_subtype(builder,@@ -1631,20 +1629,13 @@ fn initialize_struct_fields(}impl FuncEnvironment<'_> {- /// Flags to use for GC loads/stores of non-field/element bytes;- /// fields/elements use `gc_memflags_for`.+ /// Flags to use for a memory access of the given part of a GC object.///- /// This is used for accesses to the GC heap which aren't expected to trap, but- /// retain internal assertion metadata to report if such a trap happens. This- /// is here to ensure that in the face of heap corruption that there's no- /// possible UB within Cranelift and/or the runtime.- fn gc_header_memflags(&mut self, func: &mut ir::Function) -> ir::MemFlagsData {- self.gc_memflags_for(func, GcAccess::Header)- }-- /// Like `gc_memflags`, but for an access of the given part of a GC object,- /// which gets its own alias region.- fn gc_memflags_for(&mut self, func: &mut ir::Function, access: GcAccess) -> ir::MemFlagsData {+ /// These accesses aren't expected to trap, but retain internal assertion+ /// metadata to report if such a trap happens. This is here to ensure that+ /// in the face of GC heap corruption that there's no possible UB within+ /// Cranelift and/or the runtime.+ fn gc_memflags(&mut self, func: &mut ir::Function, access: GcAccess) -> ir::MemFlagsData {let region = self.alias_regions.gc_access_region(func, self.types, access);diff --git a/crates/cranelift/src/func_environ/gc/copying.rs b/crates/cranelift/src/func_environ/gc/copying.rsindex a58aa30c8f..c6bd02ce21 100644--- a/crates/cranelift/src/func_environ/gc/copying.rs+++ b/crates/cranelift/src/func_environ/gc/copying.rs@@ -170,33 +170,32 @@ impl CopyingCompiler {let heap_offset = uextend_i32_to_pointer_type(builder, pointer_type, gc_ref);let obj_ptr = builder.ins().iadd(base, heap_offset);- // These header writes target the GC heap, so tag them with the- // GC-heap region (like the null collector does).- let header_flags = func_env.gc_header_memflags(&mut builder.func);-// Write `VMGcHeader::kind` with inline trace info bits included.+ let kind_flags = func_env.gc_memflags(&mut builder.func, GcAccess::HeaderKind);let kind_val = builder.ins().iconst(ir::types::I32, i64::from(kind.as_u32() | reserved_bits));builder.ins().store(- header_flags,+ kind_flags,kind_val,obj_ptr,i32::try_from(wasmtime_environ::VM_GC_HEADER_KIND_OFFSET).unwrap(),);// Write `VMGcHeader::type_index`.+ let ty_flags = func_env.gc_memflags(&mut builder.func, GcAccess::HeaderTypeIndex);let shared_ty = func_env.module_interned_to_shared_ty(&mut builder.cursor(), ty);builder.ins().store(- header_flags,+ ty_flags,shared_ty,obj_ptr,i32::try_from(wasmtime_environ::VM_GC_HEADER_TYPE_INDEX_OFFSET).unwrap(),);// Write `VMCopyingHeader::object_size`.+ let size_flags = func_env.gc_memflags(&mut builder.func, GcAccess::CopyingObjectSize);builder.ins().istore32(- header_flags,+ size_flags,aligned_size_64,obj_ptr,i32::try_from(wasmtime_environ::VM_GC_HEADER_SIZE).unwrap(),@@ -255,7 +254,7 @@ impl GcCompiler for CopyingCompiler {reserved_bits,)?;let len_addr = builder.ins().iadd_imm_s(object_addr, i64::from(len_offset));- let flags = func_env.gc_header_memflags(&mut builder.func);+ let flags = func_env.gc_memflags(&mut builder.func, GcAccess::ArrayLength);builder.ins().store(flags, len, len_addr, 0);Ok(array_ref)@@ -344,7 +343,7 @@ impl GcCompiler for CopyingCompiler {builder,WasmStorageType::Val(WasmValType::I32),instance_id_addr,- GcAccess::Header,+ GcAccess::ExnTagInstance,instance_id,)?;let tag_addr = builder@@ -355,7 +354,7 @@ impl GcCompiler for CopyingCompiler {builder,WasmStorageType::Val(WasmValType::I32),tag_addr,- GcAccess::Header,+ GcAccess::ExnTagDefined,tag,)?;@@ -434,7 +433,7 @@ impl GcCompiler for CopyingCompiler {) -> WasmResult<()> {// Data inside GC objects is always little endian.let flags = func_env- .gc_memflags_for(&mut builder.func, access)+ .gc_memflags(&mut builder.func, access).with_endianness(ir::Endianness::Little);match ty {diff --git a/crates/cranelift/src/func_environ/gc/drc.rs b/crates/cranelift/src/func_environ/gc/drc.rsindex 9061c24b2a..8a74ea2d40 100644--- a/crates/cranelift/src/func_environ/gc/drc.rs+++ b/crates/cranelift/src/func_environ/gc/drc.rs@@ -11,8 +11,8 @@ use cranelift_frontend::FunctionBuilder;use smallvec::SmallVec;use wasmtime_environ::drc::{EXCEPTION_TAG_DEFINED_OFFSET, EXCEPTION_TAG_INSTANCE_OFFSET};use wasmtime_environ::{- GcTypeLayouts, TypeIndex, VMGcKind, WasmHeapType, WasmRefType, WasmResult, WasmStorageType,- WasmValType, drc::DrcTypeLayouts,+ GcTypeLayouts, PtrSize, TypeIndex, VMGcKind, WasmHeapType, WasmRefType, WasmResult,+ WasmStorageType, WasmValType, drc::DrcTypeLayouts,};#[derive(Default)]@@ -30,7 +30,7 @@ impl DrcCompiler {builder: &mut FunctionBuilder,gc_ref: ir::Value,) -> ir::Value {- let offset = func_env.offsets.vm_drc_header_ref_count();+ let offset = u32::from(func_env.offsets.ptr.vm_drc_header().ref_count());let pointer = func_env.prepare_gc_ref_access(builder,gc_ref,@@ -39,7 +39,7 @@ impl DrcCompiler {access_size: u8::try_from(ir::types::I64.bytes()).unwrap(),},);- let flags = func_env.gc_header_memflags(&mut builder.func);+ let flags = func_env.gc_memflags(&mut builder.func, GcAccess::DrcRefCount);builder.ins().load(ir::types::I64, flags, pointer, 0)}@@ -54,7 +54,7 @@ impl DrcCompiler {gc_ref: ir::Value,new_ref_count: ir::Value,) {- let offset = func_env.offsets.vm_drc_header_ref_count();+ let offset = u32::from(func_env.offsets.ptr.vm_drc_header().ref_count());let pointer = func_env.prepare_gc_ref_access(builder,gc_ref,@@ -63,7 +63,7 @@ impl DrcCompiler {access_size: u8::try_from(ir::types::I64.bytes()).unwrap(),},);- let flags = func_env.gc_header_memflags(&mut builder.func);+ let flags = func_env.gc_memflags(&mut builder.func, GcAccess::DrcRefCount);builder.ins().store(flags, new_ref_count, pointer, 0);}@@ -225,13 +225,20 @@ impl DrcCompiler {builder,gc_ref,BoundsCheck::StaticOffset {- offset: func_env- .offsets- .vm_drc_header_next_over_approximated_stack_root(),+ offset: u32::from(+ func_env+ .offsets+ .ptr+ .vm_drc_header()+ .next_over_approximated_stack_root(),+ ),access_size: u8::try_from(ir::types::I32.bytes()).unwrap(),},);- let flags = func_env.gc_header_memflags(&mut builder.func);+ let flags = func_env.gc_memflags(+ &mut builder.func,+ GcAccess::DrcNextOverApproximatedStackRoot,+ );builder.ins().store(flags, next, ptr, 0);}@@ -264,11 +271,11 @@ impl DrcCompiler {builder,gc_ref,BoundsCheck::StaticOffset {- offset: func_env.offsets.vm_gc_header_reserved_bits(),+ offset: u32::from(func_env.offsets.ptr.vm_gc_header().kind()),access_size: u8::try_from(ir::types::I32.bytes()).unwrap(),},);- let flags = func_env.gc_header_memflags(&mut builder.func);+ let flags = func_env.gc_memflags(&mut builder.func, GcAccess::HeaderKind);builder.ins().store(flags, new_reserved, ptr, 0);}}@@ -321,7 +328,7 @@ impl GcCompiler for DrcCompiler {uextend_i32_to_pointer_type(builder, func_env.pointer_type(), array_ref);let object_addr = builder.ins().iadd(base, extended_array_ref);let len_addr = builder.ins().iadd_imm_s(object_addr, i64::from(len_offset));- let flags = func_env.gc_header_memflags(&mut builder.func);+ let flags = func_env.gc_memflags(&mut builder.func, GcAccess::ArrayLength);builder.ins().store(flags, len, len_addr, 0);Ok(array_ref)}@@ -432,7 +439,7 @@ impl GcCompiler for DrcCompiler {builder,WasmStorageType::Val(WasmValType::I32),instance_id_addr,- GcAccess::Header,+ GcAccess::ExnTagInstance,instance_id,)?;let tag_addr = builder@@ -443,7 +450,7 @@ impl GcCompiler for DrcCompiler {builder,WasmStorageType::Val(WasmValType::I32),tag_addr,- GcAccess::Header,+ GcAccess::ExnTagDefined,tag,)?;@@ -569,11 +576,11 @@ impl GcCompiler for DrcCompiler {builder,gc_ref,BoundsCheck::StaticOffset {- offset: func_env.offsets.vm_gc_header_reserved_bits(),+ offset: u32::from(func_env.offsets.ptr.vm_gc_header().kind()),access_size: u8::try_from(ir::types::I32.bytes()).unwrap(),},);- let flags = func_env.gc_header_memflags(&mut builder.func);+ let flags = func_env.gc_memflags(&mut builder.func, GcAccess::HeaderKind);let reserved = builder.ins().load(ir::types::I32, flags, ptr, 0);let in_set_bit = builder.ins().iconst(ir::types::I32,@@ -919,7 +926,7 @@ impl GcCompiler for DrcCompiler {{// Data inside GC objects is always little endian.let flags = func_env- .gc_memflags_for(&mut builder.func, access)+ .gc_memflags(&mut builder.func, access).with_endianness(ir::Endianness::Little);return self.translate_init_gc_reference(func_env, builder, r, field_addr, val, flags);}diff --git a/crates/cranelift/src/func_environ/gc/null.rs b/crates/cranelift/src/func_environ/gc/null.rsindex 42cf8922da..94089a2c02 100644--- a/crates/cranelift/src/func_environ/gc/null.rs+++ b/crates/cranelift/src/func_environ/gc/null.rs@@ -157,15 +157,16 @@ impl NullCompiler {i64::from(VMSharedTypeIndex::reserved_value().as_bits()),),};- let flags = func_env.gc_header_memflags(&mut builder.func);+ let kind_flags = func_env.gc_memflags(&mut builder.func, GcAccess::HeaderKind);builder.ins().store(- flags,+ kind_flags,kind_and_size,ptr_to_object,i32::try_from(wasmtime_environ::VM_GC_HEADER_KIND_OFFSET).unwrap(),);+ let ty_flags = func_env.gc_memflags(&mut builder.func, GcAccess::HeaderTypeIndex);builder.ins().store(- flags,+ ty_flags,ty,ptr_to_object,i32::try_from(wasmtime_environ::VM_GC_HEADER_TYPE_INDEX_OFFSET).unwrap(),@@ -228,7 +229,7 @@ impl GcCompiler for NullCompiler {let len_addr = builder.ins().iadd_imm_s(ptr_to_object, i64::from(len_offset));- let flags = func_env.gc_header_memflags(&mut builder.func);+ let flags = func_env.gc_memflags(&mut builder.func, GcAccess::ArrayLength);builder.ins().store(flags, len, len_addr, 0);Ok(gc_ref)@@ -337,7 +338,7 @@ impl GcCompiler for NullCompiler {builder,WasmStorageType::Val(WasmValType::I32),instance_id_addr,- GcAccess::Header,+ GcAccess::ExnTagInstance,instance_id,)?;let tag_addr = builder@@ -348,7 +349,7 @@ impl GcCompiler for NullCompiler {builder,WasmStorageType::Val(WasmValType::I32),tag_addr,- GcAccess::Header,+ GcAccess::ExnTagDefined,tag,)?;diff --git a/crates/environ/src/vmoffsets.rs b/crates/environ/src/vmoffsets.rsindex 741bf7e23d..4c8dca3135 100644--- a/crates/environ/src/vmoffsets.rs+++ b/crates/environ/src/vmoffsets.rs@@ -75,6 +75,7 @@ macro_rules! define_vm_type_offsets {(@size ($p:expr) VMCommonStackInformation) => {u32::from(($p).vm_common_stack_information().size())};+ (@size ($p:expr) VMGcHeader) => { u32::from(($p).vm_gc_header().size()) };// `VMStackChain` is a `repr(usize, C)` enum, and is not itself defined by// `for_each_vm_type!`.(@size ($p:expr) VMStackChain) => { u32::from(($p).size_of_vmstack_chain()) };@@ -121,6 +122,7 @@ macro_rules! define_vm_type_offsets {(@align ($p:expr) VMCommonStackInformation) => {u32::from(($p).vm_common_stack_information().align())};+ (@align ($p:expr) VMGcHeader) => { u32::from(($p).vm_gc_header().align()) };(@align ($p:expr) VMStackChain) => { u32::from($p) };(@align ($p:expr) VMStackState) => { 4u32 };(@align ($p:expr) VMContinuationStack) => { u32::from($p) };@@ -886,45 +888,6 @@ macro_rules! define_vmoffsets_dynamic_offsets {}for_each_vmctx_type!(define_vmoffsets_dynamic_offsets);-/// Offsets for `VMGcHeader`.-impl<P: PtrSize> VMOffsets<P> {- /// Return the offset for the `VMGcHeader::kind` field.- #[inline]- pub fn vm_gc_header_kind(&self) -> u32 {- 0- }-- /// Return the offset for the `VMGcHeader`'s reserved bits.- #[inline]- pub fn vm_gc_header_reserved_bits(&self) -> u32 {- // NB: The reserved bits are the unused `VMGcKind` bits.- self.vm_gc_header_kind()- }-- /// Return the offset for the `VMGcHeader::ty` field.- #[inline]- pub fn vm_gc_header_ty(&self) -> u32 {- self.vm_gc_header_kind() + 4- }-}--/// Offsets for `VMDrcHeader`.-///-/// Should only be used when the DRC collector is enabled.-impl<P: PtrSize> VMOffsets<P> {- /// Return the offset for `VMDrcHeader::ref_count`.- #[inline]- pub fn vm_drc_header_ref_count(&self) -> u32 {- 8- }-- /// Return the offset for `VMDrcHeader::next_over_approximated_stack_root`.- #[inline]- pub fn vm_drc_header_next_over_approximated_stack_root(&self) -> u32 {- self.vm_drc_header_ref_count() + 8- }-}-/// Magic value for core Wasm VM contexts.////// This is stored at the start of all `VMContext` structures.diff --git a/crates/environ/src/vmtypes.rs b/crates/environ/src/vmtypes.rsindex ab7ac0675b..1321291e72 100644--- a/crates/environ/src/vmtypes.rs+++ b/crates/environ/src/vmtypes.rs@@ -753,6 +753,86 @@ macro_rules! for_each_vm_type {/// The bump-allocation finger, an index into the GC heap.pub next: NonZeroU32,}++ /// The common header for all objects allocated in a GC heap.+ ///+ /// This header is shared across all collectors, although particular+ /// collectors may always add their own trailing fields to this+ /// header for all of their own GC objects.+ ///+ /// This is a bit-packed structure that logically has the following+ /// fields:+ ///+ /// ```ignore+ /// struct VMGcHeader {+ /// // Highest 5 bits.+ /// kind: VMGcKind,+ ///+ /// // 27 bits available for the `GcRuntime` to make use of+ /// // however it sees fit.+ /// reserved: u27,+ ///+ /// // The `VMSharedTypeIndex` for this GC object, if it isn't an+ /// // `externref` (or an `externref` re-wrapped as an+ /// // `anyref`). `None` is represented with+ /// // `VMSharedTypeIndex::reserved_value()`.+ /// ty: Option<VMSharedTypeIndex>,+ /// }+ /// ```+ ///+ /// NB: the `kind` and `reserved` fields share one word, and+ /// therefore one alias region: splitting them would let Cranelift+ /// forward a stale kind across a reserved-bits store.+ #[derive(Debug, Clone, Copy)]+ #[repr(C, align(8))]+ #[snake_name = vm_gc_header]+ pub struct VMGcHeader {+ /// The object's `VMGcKind` and 27 bits of space reserved for+ /// however the GC sees fit to use it.+ pub(crate) kind: u32,++ /// The object's type index.+ pub(crate) ty: VMSharedTypeIndex,+ }++ /// The common header for all objects in the DRC collector.+ ///+ /// This adds a ref count and over-approximated-stack-roots list+ /// link on top of the collector-agnostic [`VMGcHeader`].+ #[cfg(feature = "gc-drc")]+ #[repr(C)]+ #[snake_name = vm_drc_header]+ pub(crate) struct VMDrcHeader {+ /// The collector-agnostic header.+ #[aggregate]+ pub(crate) header: VMGcHeader,++ /// This object's reference count.+ pub(crate) ref_count: u64,++ /// The next object in the over-approximated-stack-roots list,+ /// if this object is in that list.+ pub(crate) next_over_approximated_stack_root: Option<VMGcRef>,++ /// The size of this object in the GC heap.+ ///+ /// Written by the runtime at allocation time; compiled Wasm+ /// never accesses it.+ pub(crate) object_size: u32,+ }++ /// The common header for all objects in the copying collector.+ #[cfg(feature = "gc-copying")]+ #[repr(C)]+ #[snake_name = vm_copying_header]+ pub(crate) struct VMCopyingHeader {+ /// The collector-agnostic header.+ #[aggregate]+ pub(crate) header: VMGcHeader,++ /// The size of this object in the GC heap.+ pub(crate) object_size: u32,+ }}};}diff --git a/crates/wasmtime/src/runtime/vm.rs b/crates/wasmtime/src/runtime/vm.rsindex 10526a1499..e3a3606d12 100644--- a/crates/wasmtime/src/runtime/vm.rs+++ b/crates/wasmtime/src/runtime/vm.rs@@ -127,8 +127,12 @@ pub use crate::runtime::vm::traphandlers::*;#[cfg(feature = "component-model")]pub use crate::runtime::vm::vmcontext::VMArrayCallFunction;#[cfg(feature = "gc-copying")]+pub(crate) use crate::runtime::vm::vmcontext::VMCopyingHeader;+#[cfg(feature = "gc-copying")]pub use crate::runtime::vm::vmcontext::VMCopyingHeapData;#[cfg(feature = "gc-drc")]+pub(crate) use crate::runtime::vm::vmcontext::VMDrcHeader;+#[cfg(feature = "gc-drc")]pub use crate::runtime::vm::vmcontext::VMDrcHeapData;#[cfg(feature = "component-model-async")]pub use crate::runtime::vm::vmcontext::VMLazyThread;diff --git a/crates/wasmtime/src/runtime/vm/gc/enabled/copying.rs b/crates/wasmtime/src/runtime/vm/gc/enabled/copying.rsindex cafb4d0bc8..e8746623cb 100644--- a/crates/wasmtime/src/runtime/vm/gc/enabled/copying.rs+++ b/crates/wasmtime/src/runtime/vm/gc/enabled/copying.rs@@ -14,8 +14,8 @@ use super::VMArrayRef;use super::trace_infos::TraceInfos;use crate::runtime::vm::{ExternRefHostDataId, GarbageCollection, GcHeap, GcHeapObject, GcProgress, GcRootsIter,- GcRuntime, GcStoreTraceState, SendSyncUnsafeCell, TraceInfo, TypedGcRef, VMCopyingHeapData,- VMExternRef, VMGcHeader, VMGcRef, VMMemoryDefinition,+ GcRuntime, GcStoreTraceState, SendSyncUnsafeCell, TraceInfo, TypedGcRef, VMCopyingHeader,+ VMCopyingHeapData, VMExternRef, VMGcHeader, VMGcRef, VMMemoryDefinition,};use crate::{Engine, bail_bug, prelude::*};use core::{@@ -48,13 +48,6 @@ unsafe impl GcRuntime for CopyingCollector {}}-/// The common header for all objects in the copying collector.-#[repr(C)]-struct VMCopyingHeader {- header: VMGcHeader,- object_size: u32,-}-// Safety: All copying collector objects have a `VMCopyingHeader`.unsafe impl GcHeapObject for VMCopyingHeader {#[inline]diff --git a/crates/wasmtime/src/runtime/vm/gc/enabled/drc.rs b/crates/wasmtime/src/runtime/vm/gc/enabled/drc.rsindex 0252fd36c6..996d8dc5e8 100644--- a/crates/wasmtime/src/runtime/vm/gc/enabled/drc.rs+++ b/crates/wasmtime/src/runtime/vm/gc/enabled/drc.rs@@ -53,7 +53,7 @@ use crate::runtime::vm::{GcRuntime, GcStoreTraceState, SendSyncUnsafeCell, TraceInfo, TypedGcRef, VMExternRef,VMGcHeader, VMGcObjectData, VMGcRef,};-use crate::vm::{VMDrcHeapData, VMMemoryDefinition};+use crate::vm::{VMDrcHeader, VMDrcHeapData, VMMemoryDefinition};use crate::{Engine, Trap, bail_bug, prelude::*};use core::sync::atomic::AtomicUsize;use core::{@@ -727,19 +727,6 @@ fn externref_to_drc(externref: &VMExternRef) -> &TypedGcRef<VMDrcExternRef> {gc_ref.as_typed_unchecked()}-/// The common header for all objects in the DRC collector.-///-/// This adds a ref count on top collector-agnostic `VMGcHeader`.-///-/// This is accessed by JIT code.-#[repr(C)]-struct VMDrcHeader {- header: VMGcHeader,- ref_count: u64,- next_over_approximated_stack_root: Option<VMGcRef>,- object_size: u32,-}-unsafe impl GcHeapObject for VMDrcHeader {#[inline]fn is(_header: &VMGcHeader) -> bool {@@ -1324,19 +1311,6 @@ impl<T> DerefMut for DebugOnly<T> {#[cfg(test)]mod tests {use super::*;- use wasmtime_environ::HostPtr;-- #[test]- fn vm_drc_header_size_align() {- assert_eq!(- (wasmtime_environ::drc::HEADER_SIZE as usize),- core::mem::size_of::<VMDrcHeader>()- );- assert_eq!(- (wasmtime_environ::drc::HEADER_ALIGN as usize),- core::mem::align_of::<VMDrcHeader>()- );- }#[test]fn vm_drc_array_header_length_offset() {@@ -1345,41 +1319,4 @@ mod tests {u32::try_from(core::mem::offset_of!(VMDrcArrayHeader, length)).unwrap(),);}-- #[test]- fn ref_count_is_at_correct_offset() {- let extern_data = VMDrcHeader {- header: VMGcHeader::externref(),- ref_count: 0,- next_over_approximated_stack_root: None,- object_size: 0,- };-- let extern_data_ptr = &extern_data as *const _;- let ref_count_ptr = &extern_data.ref_count as *const _;-- let actual_offset = (ref_count_ptr as usize) - (extern_data_ptr as usize);-- let offsets = wasmtime_environ::VMOffsets::from(wasmtime_environ::VMOffsetsFields {- ptr: HostPtr,- num_imported_functions: 0,- num_imported_tables: 0,- num_imported_memories: 0,- num_imported_globals: 0,- num_imported_tags: 0,- num_defined_tables: 0,- num_defined_memories: 0,- num_owned_memories: 0,- num_defined_globals: 0,- num_defined_tags: 0,- num_escaped_funcs: 0,- num_runtime_data: 0,- has_startup_func: false,- });-- assert_eq!(- offsets.vm_drc_header_ref_count(),- u32::try_from(actual_offset).unwrap(),- );- }}diff --git a/crates/wasmtime/src/runtime/vm/gc/gc_ref.rs b/crates/wasmtime/src/runtime/vm/gc/gc_ref.rsindex d351e26787..17f9d5bcce 100644--- a/crates/wasmtime/src/runtime/vm/gc/gc_ref.rs+++ b/crates/wasmtime/src/runtime/vm/gc/gc_ref.rs@@ -10,38 +10,7 @@ use wasmtime_core::truncate::{truncate_i32_to_i8, truncate_i32_to_i16};use wasmtime_environ::packed_option::ReservedValue;use wasmtime_environ::{VMGcKind, VMSharedTypeIndex};-/// The common header for all objects allocated in a GC heap.-///-/// This header is shared across all collectors, although particular collectors-/// may always add their own trailing fields to this header for all of their own-/// GC objects.-///-/// This is a bit-packed structure that logically has the following fields:-///-/// ```ignore-/// struct VMGcHeader {-/// // Highest 5 bits.-/// kind: VMGcKind,-///-/// // 27 bits available for the `GcRuntime` to make use of however it sees fit.-/// reserved: u27,-///-/// // The `VMSharedTypeIndex` for this GC object, if it isn't an-/// // `externref` (or an `externref` re-wrapped as an `anyref`). `None` is-/// // represented with `VMSharedTypeIndex::reserved_value()`.-/// ty: Option<VMSharedTypeIndex>,-/// }-/// ```-#[repr(C, align(8))]-#[derive(Debug, Clone, Copy)]-pub struct VMGcHeader {- /// The object's `VMGcKind` and 27 bits of space reserved for however the GC- /// sees fit to use it.- kind: u32,-- /// The object's type index.- ty: VMSharedTypeIndex,-}+pub use crate::runtime::vm::vmcontext::VMGcHeader;unsafe impl GcHeapObject for VMGcHeader {#[inline]diff --git a/tests/disas/gc/alias-region-exn-payload.wat b/tests/disas/gc/alias-region-exn-payload.watindex b930e9ca6e..cc6ed40c92 100644--- a/tests/disas/gc/alias-region-exn-payload.wat+++ b/tests/disas/gc/alias-region-exn-payload.wat@@ -33,9 +33,12 @@;; region5 = 196 "";; region6 = 130 "";; region7 = 26 ""-;; region8 = 108 ""-;; region9 = 110 ""-;; region10 = 142 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 110 ""+;; region11 = 142 ""+;; region12 = 229 ""+;; region13 = 96 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -72,21 +75,21 @@;; @003a store user2 region8 v52, v27 ; v52 = 0x0400_0020;; @003a v30 = load.i64 notrap aligned readonly can_move region6 v0+40;; @003a v31 = load.i32 notrap aligned readonly can_move region7 v30+12-;; @003a store user2 region8 v31, v27+4+;; @003a store user2 region9 v31, v27+4;; @003a store.i32 notrap aligned region3 v17, v10;; @003a v32 = iconst.i64 16;; @003a v33 = iadd v27, v32 ; v32 = 16-;; @003a store.i32 user2 little region9 v2, v33+;; @003a store.i32 user2 little region10 v2, v33;; @003a v34 = iconst.i64 24;; @003a v35 = iadd v27, v34 ; v34 = 24-;; @003a store.i64 user2 little region10 v3, v35+;; @003a store.i64 user2 little region11 v3, v35;; @003a v36 = iconst.i64 8;; @003a v37 = iadd v27, v36 ; v36 = 8-;; @003a store.i32 user2 little region8 v4, v37+;; @003a store.i32 user2 little region12 v4, v37;; @003a v5 = iconst.i32 0;; @003a v38 = iconst.i64 12;; @003a v39 = iadd v27, v38 ; v38 = 12-;; @003a store user2 little region8 v5, v39 ; v5 = 0+;; @003a store user2 little region13 v5, v39 ; v5 = 0;; @003a try_call fn2(v0, v58), sig2, block4, [ context v0 ];;;; block4:diff --git a/tests/disas/gc/array-new-data.wat b/tests/disas/gc/array-new-data.watindex 72f0bca22f..c9d7d794eb 100644--- a/tests/disas/gc/array-new-data.wat+++ b/tests/disas/gc/array-new-data.wat@@ -87,9 +87,11 @@;; region7 = 130 "";; region8 = 6 "";; region9 = 196 ""-;; region10 = 108 ""-;; region11 = 206 ""-;; region12 = 135 ""+;; region10 = 239 ""+;; region11 = 134 ""+;; region12 = 108 ""+;; region13 = 206 ""+;; region14 = 135 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -141,9 +143,9 @@;; @0025 store user2 region10 v141, v48 ; v141 = -1476395002;; v144 = load.i64 notrap aligned readonly can_move region7 v0+40;; v145 = load.i32 notrap aligned readonly can_move region8 v144-;; @0025 store user2 region10 v145, v48+4+;; @0025 store user2 region11 v145, v48+4;; v146 = band.i64 v29, v28 ; v28 = -16-;; @0025 istore32 user2 region10 v146, v48+8+;; @0025 istore32 user2 region2 v146, v48+8;; @0025 jump block4(v24, v48);;;; block3 cold:@@ -160,17 +162,17 @@;;;; block4(v52: i32, v53: i64):;; v112 = stack_addr.i64 ss0-;; store notrap aligned region12 v52, v112+;; store notrap aligned region14 v52, v112;; @0025 v54 = iconst.i64 16;; @0025 v55 = iadd v53, v54 ; v54 = 16-;; @0025 store.i32 user2 region10 v3, v55+;; @0025 store.i32 user2 region12 v3, v55;; @0025 trapz v52, user16;; v147 = load.i64 notrap aligned readonly can_move region0 v0+8;; v148 = load.i64 notrap aligned readonly can_move region9 v147+32;; @0025 v57 = uextend.i64 v52;; @0025 v60 = iadd v148, v57;; @0025 v62 = iadd v60, v54 ; v54 = 16-;; @0025 v63 = load.i32 user2 readonly region10 v62+;; @0025 v63 = load.i32 user2 readonly region12 v62;; @0025 v64 = uextend.i64 v63;; @0025 v70 = icmp.i64 ugt v7, v64;; @0025 trapnz v70, user17@@ -179,7 +181,7 @@;; @0025 v88 = icmp.i64 ugt v10, v82;; @0025 trapnz v88, heap_oob;; @0025 v89 = load.i64 notrap aligned region3 v0+48-;; @0025 v100 = load.i64 notrap aligned region11 v147+40+;; @0025 v100 = load.i64 notrap aligned region13 v147+40;; @0025 v75 = iconst.i64 20;; @0025 v76 = iadd v60, v75 ; v75 = 20;; @0025 v102 = uadd_overflow_trap v76, v7, user2@@ -191,6 +193,6 @@;; @0029 jump block1;;;; block1:-;; v105 = load.i32 notrap aligned region12 v112+;; v105 = load.i32 notrap aligned region14 v112;; @0029 return v105;; }diff --git a/tests/disas/gc/array-new-default-anyref.wat b/tests/disas/gc/array-new-default-anyref.watindex c6765a2424..2a611ada79 100644--- a/tests/disas/gc/array-new-default-anyref.wat+++ b/tests/disas/gc/array-new-default-anyref.wat@@ -18,9 +18,12 @@;; region5 = 130 "";; region6 = 6 "";; region7 = 196 ""-;; region8 = 108 ""-;; region9 = 206 ""-;; region10 = 5 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 90 ""+;; region11 = 108 ""+;; region12 = 206 ""+;; region13 = 5 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -67,9 +70,9 @@;; @001f store user2 region8 v126, v36 ; v126 = -1476394994;; v129 = load.i64 notrap aligned readonly can_move region5 v0+40;; v130 = load.i32 notrap aligned readonly can_move region6 v129-;; @001f store user2 region8 v130, v36+4+;; @001f store user2 region9 v130, v36+4;; v131 = band.i64 v17, v16 ; v16 = -16-;; @001f istore32 user2 region8 v131, v36+8+;; @001f istore32 user2 region10 v131, v36+8;; @001f jump block4(v12, v36);;;; block3 cold:@@ -87,18 +90,18 @@;; block4(v40: i32, v41: i64):;; @001f v42 = iconst.i64 16;; @001f v43 = iadd v41, v42 ; v42 = 16-;; @001f store.i32 user2 region8 v2, v43+;; @001f store.i32 user2 region11 v2, v43;; @001f trapz v40, user16;; v132 = load.i64 notrap aligned readonly can_move region0 v0+8;; v133 = load.i64 notrap aligned readonly can_move region7 v132+32;; @001f v46 = uextend.i64 v40;; @001f v49 = iadd v133, v46;; @001f v51 = iadd v49, v42 ; v42 = 16-;; @001f v52 = load.i32 user2 readonly region8 v51+;; @001f v52 = load.i32 user2 readonly region11 v51;; @001f v53 = uextend.i64 v52;; @001f v59 = icmp.i64 ugt v4, v53;; @001f trapnz v59, user17-;; @001f v76 = load.i64 notrap aligned region9 v132+40+;; @001f v76 = load.i64 notrap aligned region12 v132+40;; @001f v64 = iconst.i64 20;; @001f v65 = iadd v49, v64 ; v64 = 20;; @001f v78 = uadd_overflow_trap v65, v88, user2@@ -114,7 +117,7 @@;;;; block5(v83: i64):;; v134 = iconst.i32 0-;; @001f store user2 little region10 v134, v83 ; v134 = 0+;; @001f store user2 little region13 v134, v83 ; v134 = 0;; v135 = iconst.i64 4;; v136 = iadd v83, v135 ; v135 = 4;; @001f v86 = icmp eq v136, v80diff --git a/tests/disas/gc/array-new-default-exnref.wat b/tests/disas/gc/array-new-default-exnref.watindex cb4fdd557b..dc6af66f99 100644--- a/tests/disas/gc/array-new-default-exnref.wat+++ b/tests/disas/gc/array-new-default-exnref.wat@@ -18,9 +18,12 @@;; region5 = 130 "";; region6 = 6 "";; region7 = 196 ""-;; region8 = 108 ""-;; region9 = 206 ""-;; region10 = 5 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 90 ""+;; region11 = 108 ""+;; region12 = 206 ""+;; region13 = 5 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -67,9 +70,9 @@;; @001f store user2 region8 v126, v36 ; v126 = -1476394994;; v129 = load.i64 notrap aligned readonly can_move region5 v0+40;; v130 = load.i32 notrap aligned readonly can_move region6 v129-;; @001f store user2 region8 v130, v36+4+;; @001f store user2 region9 v130, v36+4;; v131 = band.i64 v17, v16 ; v16 = -16-;; @001f istore32 user2 region8 v131, v36+8+;; @001f istore32 user2 region10 v131, v36+8;; @001f jump block4(v12, v36);;;; block3 cold:@@ -87,18 +90,18 @@;; block4(v40: i32, v41: i64):;; @001f v42 = iconst.i64 16;; @001f v43 = iadd v41, v42 ; v42 = 16-;; @001f store.i32 user2 region8 v2, v43+;; @001f store.i32 user2 region11 v2, v43;; @001f trapz v40, user16;; v132 = load.i64 notrap aligned readonly can_move region0 v0+8;; v133 = load.i64 notrap aligned readonly can_move region7 v132+32;; @001f v46 = uextend.i64 v40;; @001f v49 = iadd v133, v46;; @001f v51 = iadd v49, v42 ; v42 = 16-;; @001f v52 = load.i32 user2 readonly region8 v51+;; @001f v52 = load.i32 user2 readonly region11 v51;; @001f v53 = uextend.i64 v52;; @001f v59 = icmp.i64 ugt v4, v53;; @001f trapnz v59, user17-;; @001f v76 = load.i64 notrap aligned region9 v132+40+;; @001f v76 = load.i64 notrap aligned region12 v132+40;; @001f v64 = iconst.i64 20;; @001f v65 = iadd v49, v64 ; v64 = 20;; @001f v78 = uadd_overflow_trap v65, v88, user2@@ -114,7 +117,7 @@;;;; block5(v83: i64):;; v134 = iconst.i32 0-;; @001f store user2 little region10 v134, v83 ; v134 = 0+;; @001f store user2 little region13 v134, v83 ; v134 = 0;; v135 = iconst.i64 4;; v136 = iadd v83, v135 ; v135 = 4;; @001f v86 = icmp eq v136, v80diff --git a/tests/disas/gc/array-new-default-externref.wat b/tests/disas/gc/array-new-default-externref.watindex 08b5864ad5..fbf83a0c1f 100644--- a/tests/disas/gc/array-new-default-externref.wat+++ b/tests/disas/gc/array-new-default-externref.wat@@ -18,9 +18,12 @@;; region5 = 130 "";; region6 = 6 "";; region7 = 196 ""-;; region8 = 108 ""-;; region9 = 206 ""-;; region10 = 5 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 90 ""+;; region11 = 108 ""+;; region12 = 206 ""+;; region13 = 5 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -67,9 +70,9 @@;; @001f store user2 region8 v126, v36 ; v126 = -1476394994;; v129 = load.i64 notrap aligned readonly can_move region5 v0+40;; v130 = load.i32 notrap aligned readonly can_move region6 v129-;; @001f store user2 region8 v130, v36+4+;; @001f store user2 region9 v130, v36+4;; v131 = band.i64 v17, v16 ; v16 = -16-;; @001f istore32 user2 region8 v131, v36+8+;; @001f istore32 user2 region10 v131, v36+8;; @001f jump block4(v12, v36);;;; block3 cold:@@ -87,18 +90,18 @@;; block4(v40: i32, v41: i64):;; @001f v42 = iconst.i64 16;; @001f v43 = iadd v41, v42 ; v42 = 16-;; @001f store.i32 user2 region8 v2, v43+;; @001f store.i32 user2 region11 v2, v43;; @001f trapz v40, user16;; v132 = load.i64 notrap aligned readonly can_move region0 v0+8;; v133 = load.i64 notrap aligned readonly can_move region7 v132+32;; @001f v46 = uextend.i64 v40;; @001f v49 = iadd v133, v46;; @001f v51 = iadd v49, v42 ; v42 = 16-;; @001f v52 = load.i32 user2 readonly region8 v51+;; @001f v52 = load.i32 user2 readonly region11 v51;; @001f v53 = uextend.i64 v52;; @001f v59 = icmp.i64 ugt v4, v53;; @001f trapnz v59, user17-;; @001f v76 = load.i64 notrap aligned region9 v132+40+;; @001f v76 = load.i64 notrap aligned region12 v132+40;; @001f v64 = iconst.i64 20;; @001f v65 = iadd v49, v64 ; v64 = 20;; @001f v78 = uadd_overflow_trap v65, v88, user2@@ -114,7 +117,7 @@;;;; block5(v83: i64):;; v134 = iconst.i32 0-;; @001f store user2 little region10 v134, v83 ; v134 = 0+;; @001f store user2 little region13 v134, v83 ; v134 = 0;; v135 = iconst.i64 4;; v136 = iadd v83, v135 ; v135 = 4;; @001f v86 = icmp eq v136, v80diff --git a/tests/disas/gc/array-new-default-f32.wat b/tests/disas/gc/array-new-default-f32.watindex 3d2fc82fb6..ac6fcafb43 100644--- a/tests/disas/gc/array-new-default-f32.wat+++ b/tests/disas/gc/array-new-default-f32.wat@@ -19,9 +19,12 @@;; region5 = 130 "";; region6 = 6 "";; region7 = 196 ""-;; region8 = 108 ""-;; region9 = 206 ""-;; region10 = 135 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 90 ""+;; region11 = 108 ""+;; region12 = 206 ""+;; region13 = 135 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -70,9 +73,9 @@;; @001f store user2 region8 v129, v36 ; v129 = -1476395002;; v132 = load.i64 notrap aligned readonly can_move region5 v0+40;; v133 = load.i32 notrap aligned readonly can_move region6 v132-;; @001f store user2 region8 v133, v36+4+;; @001f store user2 region9 v133, v36+4;; v134 = band.i64 v17, v16 ; v16 = -16-;; @001f istore32 user2 region8 v134, v36+8+;; @001f istore32 user2 region10 v134, v36+8;; @001f jump block4(v12, v36);;;; block3 cold:@@ -89,21 +92,21 @@;;;; block4(v40: i32, v41: i64):;; v89 = stack_addr.i64 ss0-;; store notrap aligned region10 v40, v89+;; store notrap aligned region13 v40, v89;; @001f v42 = iconst.i64 16;; @001f v43 = iadd v41, v42 ; v42 = 16-;; @001f store.i32 user2 region8 v2, v43+;; @001f store.i32 user2 region11 v2, v43;; @001f trapz v40, user16;; v135 = load.i64 notrap aligned readonly can_move region0 v0+8;; v136 = load.i64 notrap aligned readonly can_move region7 v135+32;; @001f v46 = uextend.i64 v40;; @001f v49 = iadd v136, v46;; @001f v51 = iadd v49, v42 ; v42 = 16-;; @001f v52 = load.i32 user2 readonly region8 v51+;; @001f v52 = load.i32 user2 readonly region11 v51;; @001f v53 = uextend.i64 v52;; @001f v59 = icmp.i64 ugt v4, v53;; @001f trapnz v59, user17-;; @001f v76 = load.i64 notrap aligned region9 v135+40+;; @001f v76 = load.i64 notrap aligned region12 v135+40;; @001f v64 = iconst.i64 20;; @001f v65 = iadd v49, v64 ; v64 = 20;; @001f v78 = uadd_overflow_trap v65, v91, user2@@ -115,6 +118,6 @@;; @0022 jump block1;;;; block1:-;; v82 = load.i32 notrap aligned region10 v89+;; v82 = load.i32 notrap aligned region13 v89;; @0022 return v82;; }diff --git a/tests/disas/gc/array-new-default-f64.wat b/tests/disas/gc/array-new-default-f64.watindex b32760d579..4ac51b43b0 100644--- a/tests/disas/gc/array-new-default-f64.wat+++ b/tests/disas/gc/array-new-default-f64.wat@@ -19,9 +19,12 @@;; region5 = 130 "";; region6 = 6 "";; region7 = 196 ""-;; region8 = 108 ""-;; region9 = 206 ""-;; region10 = 135 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 90 ""+;; region11 = 108 ""+;; region12 = 206 ""+;; region13 = 135 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -70,9 +73,9 @@;; @001f store user2 region8 v129, v36 ; v129 = -1476395002;; v132 = load.i64 notrap aligned readonly can_move region5 v0+40;; v133 = load.i32 notrap aligned readonly can_move region6 v132-;; @001f store user2 region8 v133, v36+4+;; @001f store user2 region9 v133, v36+4;; v134 = band.i64 v17, v16 ; v16 = -16-;; @001f istore32 user2 region8 v134, v36+8+;; @001f istore32 user2 region10 v134, v36+8;; @001f jump block4(v12, v36);;;; block3 cold:@@ -89,21 +92,21 @@;;;; block4(v40: i32, v41: i64):;; v89 = stack_addr.i64 ss0-;; store notrap aligned region10 v40, v89+;; store notrap aligned region13 v40, v89;; @001f v42 = iconst.i64 16;; @001f v43 = iadd v41, v42 ; v42 = 16-;; @001f store.i32 user2 region8 v2, v43+;; @001f store.i32 user2 region11 v2, v43;; @001f trapz v40, user16;; v135 = load.i64 notrap aligned readonly can_move region0 v0+8;; v136 = load.i64 notrap aligned readonly can_move region7 v135+32;; @001f v46 = uextend.i64 v40;; @001f v49 = iadd v136, v46;; @001f v51 = iadd v49, v42 ; v42 = 16-;; @001f v52 = load.i32 user2 readonly region8 v51+;; @001f v52 = load.i32 user2 readonly region11 v51;; @001f v53 = uextend.i64 v52;; @001f v59 = icmp.i64 ugt v4, v53;; @001f trapnz v59, user17-;; @001f v76 = load.i64 notrap aligned region9 v135+40+;; @001f v76 = load.i64 notrap aligned region12 v135+40;; @001f v64 = iconst.i64 24;; @001f v65 = iadd v49, v64 ; v64 = 24;; @001f v78 = uadd_overflow_trap v65, v91, user2@@ -115,6 +118,6 @@;; @0022 jump block1;;;; block1:-;; v82 = load.i32 notrap aligned region10 v89+;; v82 = load.i32 notrap aligned region13 v89;; @0022 return v82;; }diff --git a/tests/disas/gc/array-new-default-funcref.wat b/tests/disas/gc/array-new-default-funcref.watindex 418b68dc24..c5af3a044f 100644--- a/tests/disas/gc/array-new-default-funcref.wat+++ b/tests/disas/gc/array-new-default-funcref.wat@@ -19,10 +19,13 @@;; region5 = 130 "";; region6 = 6 "";; region7 = 196 ""-;; region8 = 108 ""-;; region9 = 206 ""-;; region10 = 5 ""-;; region11 = 135 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 90 ""+;; region11 = 108 ""+;; region12 = 206 ""+;; region13 = 5 ""+;; region14 = 135 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -71,9 +74,9 @@;; @001f store user2 region8 v136, v36 ; v136 = -1476395002;; v139 = load.i64 notrap aligned readonly can_move region5 v0+40;; v140 = load.i32 notrap aligned readonly can_move region6 v139-;; @001f store user2 region8 v140, v36+4+;; @001f store user2 region9 v140, v36+4;; v141 = band.i64 v17, v16 ; v16 = -16-;; @001f istore32 user2 region8 v141, v36+8+;; @001f istore32 user2 region10 v141, v36+8;; @001f jump block4(v12, v36);;;; block3 cold:@@ -90,21 +93,21 @@;;;; block4(v40: i32, v41: i64):;; v97 = stack_addr.i64 ss0-;; store notrap aligned region11 v40, v97+;; store notrap aligned region14 v40, v97;; @001f v42 = iconst.i64 16;; @001f v43 = iadd v41, v42 ; v42 = 16-;; @001f store.i32 user2 region8 v2, v43+;; @001f store.i32 user2 region11 v2, v43;; @001f trapz v40, user16;; v142 = load.i64 notrap aligned readonly can_move region0 v0+8;; v143 = load.i64 notrap aligned readonly can_move region7 v142+32;; @001f v46 = uextend.i64 v40;; @001f v49 = iadd v143, v46;; @001f v51 = iadd v49, v42 ; v42 = 16-;; @001f v52 = load.i32 user2 readonly region8 v51+;; @001f v52 = load.i32 user2 readonly region11 v51;; @001f v53 = uextend.i64 v52;; @001f v59 = icmp.i64 ugt v4, v53;; @001f trapnz v59, user17-;; @001f v76 = load.i64 notrap aligned region9 v142+40+;; @001f v76 = load.i64 notrap aligned region12 v142+40;; @001f v64 = iconst.i64 20;; @001f v65 = iadd v49, v64 ; v64 = 20;; @001f v78 = uadd_overflow_trap v65, v99, user2@@ -120,7 +123,7 @@;; @001f brif v84, block6, block5(v65);;;; block5(v85: i64):-;; @001f store.i32 notrap aligned little region10 v81, v85+;; @001f store.i32 notrap aligned little region13 v81, v85;; v144 = iconst.i64 4;; v145 = iadd v85, v144 ; v144 = 4;; @001f v88 = icmp eq v145, v82@@ -130,6 +133,6 @@;; @0022 jump block1;;;; block1:-;; v90 = load.i32 notrap aligned region11 v97+;; v90 = load.i32 notrap aligned region14 v97;; @0022 return v90;; }diff --git a/tests/disas/gc/array-new-default-i16.wat b/tests/disas/gc/array-new-default-i16.watindex 49f4299e12..f2caa8e7f0 100644--- a/tests/disas/gc/array-new-default-i16.wat+++ b/tests/disas/gc/array-new-default-i16.wat@@ -19,9 +19,12 @@;; region5 = 130 "";; region6 = 6 "";; region7 = 196 ""-;; region8 = 108 ""-;; region9 = 206 ""-;; region10 = 135 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 90 ""+;; region11 = 108 ""+;; region12 = 206 ""+;; region13 = 135 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -69,9 +72,9 @@;; @001f store user2 region8 v139, v36 ; v139 = -1476395002;; v142 = load.i64 notrap aligned readonly can_move region5 v0+40;; v143 = load.i32 notrap aligned readonly can_move region6 v142-;; @001f store user2 region8 v143, v36+4+;; @001f store user2 region9 v143, v36+4;; v144 = band.i64 v17, v16 ; v16 = -16-;; @001f istore32 user2 region8 v144, v36+8+;; @001f istore32 user2 region10 v144, v36+8;; @001f jump block4(v12, v36);;;; block3 cold:@@ -88,21 +91,21 @@;;;; block4(v40: i32, v41: i64):;; v89 = stack_addr.i64 ss0-;; store notrap aligned region10 v40, v89+;; store notrap aligned region13 v40, v89;; @001f v42 = iconst.i64 16;; @001f v43 = iadd v41, v42 ; v42 = 16-;; @001f store.i32 user2 region8 v2, v43+;; @001f store.i32 user2 region11 v2, v43;; @001f trapz v40, user16;; v145 = load.i64 notrap aligned readonly can_move region0 v0+8;; v146 = load.i64 notrap aligned readonly can_move region7 v145+32;; @001f v46 = uextend.i64 v40;; @001f v49 = iadd v146, v46;; @001f v51 = iadd v49, v42 ; v42 = 16-;; @001f v52 = load.i32 user2 readonly region8 v51+;; @001f v52 = load.i32 user2 readonly region11 v51;; @001f v53 = uextend.i64 v52;; @001f v59 = icmp.i64 ugt v4, v53;; @001f trapnz v59, user17-;; @001f v76 = load.i64 notrap aligned region9 v145+40+;; @001f v76 = load.i64 notrap aligned region12 v145+40;; @001f v64 = iconst.i64 20;; @001f v65 = iadd v49, v64 ; v64 = 20;; @001f v78 = uadd_overflow_trap v65, v92, user2@@ -114,6 +117,6 @@;; @0022 jump block1;;;; block1:-;; v82 = load.i32 notrap aligned region10 v89+;; v82 = load.i32 notrap aligned region13 v89;; @0022 return v82;; }diff --git a/tests/disas/gc/array-new-default-i32.wat b/tests/disas/gc/array-new-default-i32.watindex b9d949384b..ee4f0f0001 100644--- a/tests/disas/gc/array-new-default-i32.wat+++ b/tests/disas/gc/array-new-default-i32.wat@@ -19,9 +19,12 @@;; region5 = 130 "";; region6 = 6 "";; region7 = 196 ""-;; region8 = 108 ""-;; region9 = 206 ""-;; region10 = 135 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 90 ""+;; region11 = 108 ""+;; region12 = 206 ""+;; region13 = 135 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -70,9 +73,9 @@;; @001f store user2 region8 v129, v36 ; v129 = -1476395002;; v132 = load.i64 notrap aligned readonly can_move region5 v0+40;; v133 = load.i32 notrap aligned readonly can_move region6 v132-;; @001f store user2 region8 v133, v36+4+;; @001f store user2 region9 v133, v36+4;; v134 = band.i64 v17, v16 ; v16 = -16-;; @001f istore32 user2 region8 v134, v36+8+;; @001f istore32 user2 region10 v134, v36+8;; @001f jump block4(v12, v36);;;; block3 cold:@@ -89,21 +92,21 @@;;;; block4(v40: i32, v41: i64):;; v89 = stack_addr.i64 ss0-;; store notrap aligned region10 v40, v89+;; store notrap aligned region13 v40, v89;; @001f v42 = iconst.i64 16;; @001f v43 = iadd v41, v42 ; v42 = 16-;; @001f store.i32 user2 region8 v2, v43+;; @001f store.i32 user2 region11 v2, v43;; @001f trapz v40, user16;; v135 = load.i64 notrap aligned readonly can_move region0 v0+8;; v136 = load.i64 notrap aligned readonly can_move region7 v135+32;; @001f v46 = uextend.i64 v40;; @001f v49 = iadd v136, v46;; @001f v51 = iadd v49, v42 ; v42 = 16-;; @001f v52 = load.i32 user2 readonly region8 v51+;; @001f v52 = load.i32 user2 readonly region11 v51;; @001f v53 = uextend.i64 v52;; @001f v59 = icmp.i64 ugt v4, v53;; @001f trapnz v59, user17-;; @001f v76 = load.i64 notrap aligned region9 v135+40+;; @001f v76 = load.i64 notrap aligned region12 v135+40;; @001f v64 = iconst.i64 20;; @001f v65 = iadd v49, v64 ; v64 = 20;; @001f v78 = uadd_overflow_trap v65, v91, user2@@ -115,6 +118,6 @@;; @0022 jump block1;;;; block1:-;; v82 = load.i32 notrap aligned region10 v89+;; v82 = load.i32 notrap aligned region13 v89;; @0022 return v82;; }diff --git a/tests/disas/gc/array-new-default-i64.wat b/tests/disas/gc/array-new-default-i64.watindex a6c2921355..49318743df 100644--- a/tests/disas/gc/array-new-default-i64.wat+++ b/tests/disas/gc/array-new-default-i64.wat@@ -19,9 +19,12 @@;; region5 = 130 "";; region6 = 6 "";; region7 = 196 ""-;; region8 = 108 ""-;; region9 = 206 ""-;; region10 = 135 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 90 ""+;; region11 = 108 ""+;; region12 = 206 ""+;; region13 = 135 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -70,9 +73,9 @@;; @001f store user2 region8 v128, v36 ; v128 = -1476395002;; v131 = load.i64 notrap aligned readonly can_move region5 v0+40;; v132 = load.i32 notrap aligned readonly can_move region6 v131-;; @001f store user2 region8 v132, v36+4+;; @001f store user2 region9 v132, v36+4;; v133 = band.i64 v17, v16 ; v16 = -16-;; @001f istore32 user2 region8 v133, v36+8+;; @001f istore32 user2 region10 v133, v36+8;; @001f jump block4(v12, v36);;;; block3 cold:@@ -89,21 +92,21 @@;;;; block4(v40: i32, v41: i64):;; v89 = stack_addr.i64 ss0-;; store notrap aligned region10 v40, v89+;; store notrap aligned region13 v40, v89;; @001f v42 = iconst.i64 16;; @001f v43 = iadd v41, v42 ; v42 = 16-;; @001f store.i32 user2 region8 v2, v43+;; @001f store.i32 user2 region11 v2, v43;; @001f trapz v40, user16;; v134 = load.i64 notrap aligned readonly can_move region0 v0+8;; v135 = load.i64 notrap aligned readonly can_move region7 v134+32;; @001f v46 = uextend.i64 v40;; @001f v49 = iadd v135, v46;; @001f v51 = iadd v49, v42 ; v42 = 16-;; @001f v52 = load.i32 user2 readonly region8 v51+;; @001f v52 = load.i32 user2 readonly region11 v51;; @001f v53 = uextend.i64 v52;; @001f v59 = icmp.i64 ugt v4, v53;; @001f trapnz v59, user17-;; @001f v76 = load.i64 notrap aligned region9 v134+40+;; @001f v76 = load.i64 notrap aligned region12 v134+40;; @001f v64 = iconst.i64 24;; @001f v65 = iadd v49, v64 ; v64 = 24;; @001f v78 = uadd_overflow_trap v65, v91, user2@@ -115,6 +118,6 @@;; @0022 jump block1;;;; block1:-;; v82 = load.i32 notrap aligned region10 v89+;; v82 = load.i32 notrap aligned region13 v89;; @0022 return v82;; }diff --git a/tests/disas/gc/array-new-default-i8.wat b/tests/disas/gc/array-new-default-i8.watindex a0d90c0a1d..d22672c071 100644--- a/tests/disas/gc/array-new-default-i8.wat+++ b/tests/disas/gc/array-new-default-i8.wat@@ -19,9 +19,12 @@;; region5 = 130 "";; region6 = 6 "";; region7 = 196 ""-;; region8 = 108 ""-;; region9 = 206 ""-;; region10 = 135 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 90 ""+;; region11 = 108 ""+;; region12 = 206 ""+;; region13 = 135 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -66,9 +69,9 @@;; @001f store user2 region8 v117, v36 ; v117 = -1476395002;; v120 = load.i64 notrap aligned readonly can_move region5 v0+40;; v121 = load.i32 notrap aligned readonly can_move region6 v120-;; @001f store user2 region8 v121, v36+4+;; @001f store user2 region9 v121, v36+4;; v122 = band.i64 v17, v16 ; v16 = -16-;; @001f istore32 user2 region8 v122, v36+8+;; @001f istore32 user2 region10 v122, v36+8;; @001f jump block4(v12, v36);;;; block3 cold:@@ -85,21 +88,21 @@;;;; block4(v40: i32, v41: i64):;; v88 = stack_addr.i64 ss0-;; store notrap aligned region10 v40, v88+;; store notrap aligned region13 v40, v88;; @001f v42 = iconst.i64 16;; @001f v43 = iadd v41, v42 ; v42 = 16-;; @001f store.i32 user2 region8 v2, v43+;; @001f store.i32 user2 region11 v2, v43;; @001f trapz v40, user16;; v123 = load.i64 notrap aligned readonly can_move region0 v0+8;; v124 = load.i64 notrap aligned readonly can_move region7 v123+32;; @001f v46 = uextend.i64 v40;; @001f v49 = iadd v124, v46;; @001f v51 = iadd v49, v42 ; v42 = 16-;; @001f v52 = load.i32 user2 readonly region8 v51+;; @001f v52 = load.i32 user2 readonly region11 v51;; @001f v53 = uextend.i64 v52;; @001f v59 = icmp.i64 ugt v4, v53;; @001f trapnz v59, user17-;; @001f v76 = load.i64 notrap aligned region9 v123+40+;; @001f v76 = load.i64 notrap aligned region12 v123+40;; @001f v64 = iconst.i64 20;; @001f v65 = iadd v49, v64 ; v64 = 20;; @001f v78 = uadd_overflow_trap v65, v4, user2@@ -111,6 +114,6 @@;; @0022 jump block1;;;; block1:-;; v81 = load.i32 notrap aligned region10 v88+;; v81 = load.i32 notrap aligned region13 v88;; @0022 return v81;; }diff --git a/tests/disas/gc/copying/alias-region-header.wat b/tests/disas/gc/copying/alias-region-header.watnew file mode 100644index 0000000000..fdc49b0d64--- /dev/null+++ b/tests/disas/gc/copying/alias-region-header.wat@@ -0,0 +1,95 @@+;;! target = "x86_64"+;;! test = "optimize"+;;! flags = "-W function-references,gc -C collector=copying"++;; The copying collector's `VMCopyingHeader::object_size` gets its own alias+;; region.++(module+ (type $s (struct (field (mut i32))))+ (type $a (array (mut i32)))++ (func (export "f") (param $a (ref $a)) (param $x anyref) (result i32)+ ;; Writes the kind word, the type-index word, the object size, and the+ ;; field.+ (struct.get $s 0 (struct.new $s (i32.const 1)))+ )+)+;; function u0:0(i64 vmctx, i64, i32, i32) -> i32 tail {+;; region0 = 123 ""+;; region1 = 160 ""+;; region2 = 65 ""+;; region3 = 177 ""+;; region4 = 98 ""+;; region5 = 130 ""+;; region6 = 6 ""+;; region7 = 196 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 90 ""+;; region11 = 147 ""+;; region12 = 206 ""+;; gv0 = vmctx+;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8+;; gv2 = load.i64 notrap aligned region1 gv1+24+;; sig0 = (i64 vmctx, i32, i32, i32, i32) -> i32 tail+;; fn0 = colocated u805306368:24 sig0+;; stack_limit = gv2+;;+;; block0(v0: i64, v1: i64, v2: i32, v3: i32):+;; @002b v6 = load.i64 notrap aligned readonly can_move region2 v0+32+;; @002b v7 = load.i32 notrap aligned region3 v6+;; @002b v8 = load.i32 notrap aligned region4 v6+4+;; @002b v14 = uextend.i64 v7+;; v46 = iconst.i64 32+;; @002b v15 = iadd v14, v46 ; v46 = 32+;; @002b v16 = uextend.i64 v8+;; @002b v17 = icmp ule v15, v16+;; @002b brif v17, block2, block3+;;+;; block2:+;; v62 = iconst.i32 32+;; v60 = iadd.i32 v7, v62 ; v62 = 32+;; @002b store notrap aligned region3 v60, v6+;; v63 = iconst.i32 -1342177278+;; v64 = load.i64 notrap aligned readonly can_move region0 v0+8+;; v65 = load.i64 notrap aligned readonly can_move region7 v64+32+;; @002b v31 = iadd v65, v14+;; @002b store user2 region8 v63, v31 ; v63 = -1342177278+;; v66 = load.i64 notrap aligned readonly can_move region5 v0+40+;; v67 = load.i32 notrap aligned readonly can_move region6 v66+;; @002b store user2 region9 v67, v31+4+;; v68 = iconst.i64 32+;; @002b istore32 user2 region10 v68, v31+8 ; v68 = 32+;; @002b jump block4(v7, v31)+;;+;; block3 cold:+;; @002b v18 = iconst.i32 -1342177278+;; @002b v19 = load.i64 notrap aligned readonly can_move region5 v0+40+;; @002b v20 = load.i32 notrap aligned readonly can_move region6 v19+;; @002b v5 = iconst.i32 32+;; @002b v21 = iconst.i32 16+;; @002b v22 = call fn0(v0, v18, v20, v5, v21) ; v18 = -1342177278, v5 = 32, v21 = 16+;; @002b v23 = load.i64 notrap aligned readonly can_move region0 v0+8+;; @002b v24 = load.i64 notrap aligned readonly can_move region7 v23+32+;; @002b v25 = uextend.i64 v22+;; @002b v26 = iadd v24, v25+;; @002b jump block4(v22, v26)+;;+;; block4(v35: i32, v36: i64):+;; @0029 v4 = iconst.i32 1+;; @002b v37 = iconst.i64 16+;; @002b v38 = iadd v36, v37 ; v37 = 16+;; @002b store user2 little region11 v4, v38 ; v4 = 1+;; @002e trapz v35, user16+;; v69 = load.i64 notrap aligned readonly can_move region0 v0+8+;; v70 = load.i64 notrap aligned readonly can_move region7 v69+32+;; @002e v39 = uextend.i64 v35+;; @002e v42 = iadd v70, v39+;; @002e v44 = iadd v42, v37 ; v37 = 16+;; @002e v45 = load.i32 user2 little region11 v44+;; @0032 jump block1+;;+;; block1:+;; @0032 return v45+;; }diff --git a/tests/disas/gc/copying/array-new-fixed-of-gc-refs.wat b/tests/disas/gc/copying/array-new-fixed-of-gc-refs.watindex 90a0702533..fc510584ff 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@@ -20,12 +20,15 @@;; region5 = 130 "";; region6 = 6 "";; region7 = 196 ""-;; region8 = 108 ""-;; region9 = 206 ""-;; region10 = 5 ""-;; region11 = 135 ""-;; region12 = 187 ""-;; region13 = 26 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 90 ""+;; region11 = 108 ""+;; region12 = 206 ""+;; region13 = 5 ""+;; region14 = 135 ""+;; region15 = 187 ""+;; region16 = 26 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -35,11 +38,11 @@;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32):;; v137 = stack_addr.i64 ss2-;; store notrap aligned region13 v2, v137+;; store notrap aligned region16 v2, v137;; v138 = stack_addr.i64 ss1-;; store notrap aligned region12 v3, v138+;; store notrap aligned region15 v3, v138;; v139 = stack_addr.i64 ss0-;; store notrap aligned region11 v4, v139+;; store notrap aligned region14 v4, v139;; @0025 v14 = load.i64 notrap aligned readonly can_move region2 v0+32;; @0025 v15 = load.i32 notrap aligned region3 v14;; @0025 v16 = load.i32 notrap aligned region4 v14+4@@ -61,9 +64,9 @@;; @0025 store user2 region8 v232, v39 ; v232 = -1476394994;; v235 = load.i64 notrap aligned readonly can_move region5 v0+40;; v236 = load.i32 notrap aligned readonly can_move region6 v235-;; @0025 store user2 region8 v236, v39+4+;; @0025 store user2 region9 v236, v39+4;; v237 = iconst.i64 32-;; @0025 istore32 user2 region8 v237, v39+8 ; v237 = 32+;; @0025 istore32 user2 region10 v237, v39+8 ; v237 = 32;; @0025 jump block4(v15, v39);;;; block3 cold:@@ -83,14 +86,14 @@;; @0025 v5 = iconst.i32 3;; @0025 v45 = iconst.i64 16;; @0025 v46 = iadd v44, v45 ; v45 = 16-;; @0025 store user2 region8 v5, v46 ; v5 = 3+;; @0025 store user2 region11 v5, v46 ; v5 = 3;; @0025 trapz v43, user16;; v238 = load.i64 notrap aligned readonly can_move region0 v0+8;; v239 = load.i64 notrap aligned readonly can_move region7 v238+32;; @0025 v48 = uextend.i64 v43;; @0025 v51 = iadd v239, v48;; @0025 v53 = iadd v51, v45 ; v45 = 16-;; @0025 v54 = load.i32 user2 readonly region8 v53+;; @0025 v54 = load.i32 user2 readonly region11 v53;; @0025 trapz v54, user17;; @0025 v57 = uextend.i64 v54;; v142 = iconst.i64 2@@ -103,30 +106,30 @@;; @0025 v6 = iconst.i32 20;; @0025 v63 = uadd_overflow_trap v180, v6, user2 ; v6 = 20;; @0025 v67 = uadd_overflow_trap v43, v63, user2-;; v136 = load.i32 notrap aligned region13 v137+;; v136 = load.i32 notrap aligned region16 v137;; @0025 v68 = uextend.i64 v67;; @0025 v71 = iadd v239, v68;; @0025 v72 = isub v63, v6 ; v6 = 20;; @0025 v73 = uextend.i64 v72;; @0025 v74 = isub v71, v73-;; @0025 store user2 little region10 v136, v74+;; @0025 store user2 little region13 v136, v74;; @0025 v75 = iconst.i32 1;; v196 = icmp ugt v54, v75 ; v75 = 1;; @0025 trapz v196, user17-;; v134 = load.i32 notrap aligned region12 v138+;; v134 = load.i32 notrap aligned region15 v138;; v205 = iconst.i32 24;; @0025 v100 = isub v63, v205 ; v205 = 24;; @0025 v101 = uextend.i64 v100;; @0025 v102 = isub v71, v101-;; @0025 store user2 little region10 v134, v102+;; @0025 store user2 little region13 v134, v102;; v211 = icmp ugt v54, v179 ; v179 = 2;; @0025 trapz v211, user17-;; v132 = load.i32 notrap aligned region11 v139+;; v132 = load.i32 notrap aligned region14 v139;; v225 = iconst.i32 28;; @0025 v128 = isub v63, v225 ; v225 = 28;; @0025 v129 = uextend.i64 v128;; @0025 v130 = isub v71, v129-;; @0025 store user2 little region10 v132, v130+;; @0025 store user2 little region13 v132, v130;; @0029 jump block1;;;; block1:diff --git a/tests/disas/gc/copying/array-new-fixed.wat b/tests/disas/gc/copying/array-new-fixed.watindex 00dfee036d..6d13d52651 100644--- a/tests/disas/gc/copying/array-new-fixed.wat+++ b/tests/disas/gc/copying/array-new-fixed.wat@@ -17,9 +17,12 @@;; region5 = 130 "";; region6 = 6 "";; region7 = 196 ""-;; region8 = 108 ""-;; region9 = 206 ""-;; region10 = 5 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 90 ""+;; region11 = 108 ""+;; region12 = 206 ""+;; region13 = 5 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -49,9 +52,9 @@;; @0025 store user2 region8 v220, v39 ; v220 = -1476395002;; v223 = load.i64 notrap aligned readonly can_move region5 v0+40;; v224 = load.i32 notrap aligned readonly can_move region6 v223-;; @0025 store user2 region8 v224, v39+4+;; @0025 store user2 region9 v224, v39+4;; v225 = iconst.i64 48-;; @0025 istore32 user2 region8 v225, v39+8 ; v225 = 48+;; @0025 istore32 user2 region10 v225, v39+8 ; v225 = 48;; @0025 jump block4(v15, v39);;;; block3 cold:@@ -71,14 +74,14 @@;; @0025 v5 = iconst.i32 3;; @0025 v45 = iconst.i64 16;; @0025 v46 = iadd v44, v45 ; v45 = 16-;; @0025 store user2 region8 v5, v46 ; v5 = 3+;; @0025 store user2 region11 v5, v46 ; v5 = 3;; @0025 trapz v43, user16;; v226 = load.i64 notrap aligned readonly can_move region0 v0+8;; v227 = load.i64 notrap aligned readonly can_move region7 v226+32;; @0025 v48 = uextend.i64 v43;; @0025 v51 = iadd v227, v48;; @0025 v53 = iadd v51, v45 ; v45 = 16-;; @0025 v54 = load.i32 user2 readonly region8 v53+;; @0025 v54 = load.i32 user2 readonly region11 v53;; @0025 trapz v54, user17;; @0025 v57 = uextend.i64 v54;; v131 = iconst.i64 3@@ -95,7 +98,7 @@;; @0025 v72 = isub v63, v6 ; v6 = 24;; @0025 v73 = uextend.i64 v72;; @0025 v74 = isub v71, v73-;; @0025 store.i64 user2 little region10 v2, v74+;; @0025 store.i64 user2 little region13 v2, v74;; @0025 v75 = iconst.i32 1;; v185 = icmp ugt v54, v75 ; v75 = 1;; @0025 trapz v185, user17@@ -103,7 +106,7 @@;; @0025 v100 = isub v63, v194 ; v194 = 32;; @0025 v101 = uextend.i64 v100;; @0025 v102 = isub v71, v101-;; @0025 store.i64 user2 little region10 v3, v102+;; @0025 store.i64 user2 little region13 v3, v102;; @0025 v103 = iconst.i32 2;; v200 = icmp ugt v54, v103 ; v103 = 2;; @0025 trapz v200, user17@@ -111,7 +114,7 @@;; @0025 v128 = isub v63, v213 ; v213 = 40;; @0025 v129 = uextend.i64 v128;; @0025 v130 = isub v71, v129-;; @0025 store.i64 user2 little region10 v4, v130+;; @0025 store.i64 user2 little region13 v4, v130;; @0029 jump block1;;;; block1:diff --git a/tests/disas/gc/copying/array-new.wat b/tests/disas/gc/copying/array-new.watindex 9a7736d55a..afa85aa7f8 100644--- a/tests/disas/gc/copying/array-new.wat+++ b/tests/disas/gc/copying/array-new.wat@@ -17,9 +17,12 @@;; region5 = 130 "";; region6 = 6 "";; region7 = 196 ""-;; region8 = 108 ""-;; region9 = 206 ""-;; region10 = 5 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 90 ""+;; region11 = 108 ""+;; region12 = 206 ""+;; region13 = 5 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -66,9 +69,9 @@;; @0022 store user2 region8 v126, v37 ; v126 = -1476395002;; v129 = load.i64 notrap aligned readonly can_move region5 v0+40;; v130 = load.i32 notrap aligned readonly can_move region6 v129-;; @0022 store user2 region8 v130, v37+4+;; @0022 store user2 region9 v130, v37+4;; v131 = band.i64 v18, v17 ; v17 = -16-;; @0022 istore32 user2 region8 v131, v37+8+;; @0022 istore32 user2 region10 v131, v37+8;; @0022 jump block4(v13, v37);;;; block3 cold:@@ -86,18 +89,18 @@;; block4(v41: i32, v42: i64):;; @0022 v43 = iconst.i64 16;; @0022 v44 = iadd v42, v43 ; v43 = 16-;; @0022 store.i32 user2 region8 v3, v44+;; @0022 store.i32 user2 region11 v3, v44;; @0022 trapz v41, user16;; v132 = load.i64 notrap aligned readonly can_move region0 v0+8;; v133 = load.i64 notrap aligned readonly can_move region7 v132+32;; @0022 v46 = uextend.i64 v41;; @0022 v49 = iadd v133, v46;; @0022 v51 = iadd v49, v43 ; v43 = 16-;; @0022 v52 = load.i32 user2 readonly region8 v51+;; @0022 v52 = load.i32 user2 readonly region11 v51;; @0022 v53 = uextend.i64 v52;; @0022 v59 = icmp.i64 ugt v5, v53;; @0022 trapnz v59, user17-;; @0022 v76 = load.i64 notrap aligned region9 v132+40+;; @0022 v76 = load.i64 notrap aligned region12 v132+40;; @0022 v64 = iconst.i64 24;; @0022 v65 = iadd v49, v64 ; v64 = 24;; @0022 v78 = uadd_overflow_trap v65, v88, user2@@ -111,7 +114,7 @@;; @0022 brif v82, block6, block5(v65);;;; block5(v83: i64):-;; @0022 store.i64 user2 little region10 v2, v83+;; @0022 store.i64 user2 little region13 v2, v83;; v134 = iconst.i64 8;; v135 = iadd v83, v134 ; v134 = 8;; @0022 v86 = icmp eq v135, v80diff --git a/tests/disas/gc/copying/br-on-cast-fail.wat b/tests/disas/gc/copying/br-on-cast-fail.watindex b3633f8d6e..f5fdd113a4 100644--- a/tests/disas/gc/copying/br-on-cast-fail.wat+++ b/tests/disas/gc/copying/br-on-cast-fail.wat@@ -20,11 +20,12 @@;; region1 = 160 "";; region2 = 196 "";; region3 = 206 ""-;; region4 = 108 ""+;; region4 = 239 "";; region5 = 130 "";; region6 = 6 ""-;; region7 = 25 ""-;; region8 = 68 ""+;; region7 = 134 ""+;; region8 = 25 ""+;; region9 = 68 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -57,7 +58,7 @@;; block6:;; @002e v28 = iconst.i64 4;; @002e v29 = iadd.i64 v13, v28 ; v28 = 4-;; @002e v30 = load.i32 user2 readonly region4 v29+;; @002e v30 = load.i32 user2 readonly region7 v29;; @002e v22 = load.i64 notrap aligned readonly can_move region5 v0+40;; @002e v23 = load.i32 notrap aligned readonly can_move region6 v22;; @002e v31 = icmp eq v30, v23@@ -68,14 +69,14 @@;; @002e brif v33, block7, block2;;;; block7:-;; @0034 v35 = load.i64 notrap aligned readonly can_move region8 v0+56-;; @0034 v34 = load.i64 notrap aligned readonly can_move region7 v0+72+;; @0034 v35 = load.i64 notrap aligned readonly can_move region9 v0+56+;; @0034 v34 = load.i64 notrap aligned readonly can_move region8 v0+72;; @0034 call_indirect sig0, v35(v34, v0);; @0036 return;;;; block2:-;; @0038 v37 = load.i64 notrap aligned readonly can_move region8 v0+88-;; @0038 v36 = load.i64 notrap aligned readonly can_move region7 v0+104+;; @0038 v37 = load.i64 notrap aligned readonly can_move region9 v0+88+;; @0038 v36 = load.i64 notrap aligned readonly can_move region8 v0+104;; @0038 call_indirect sig0, v37(v36, v0);; @003a return;; }diff --git a/tests/disas/gc/copying/br-on-cast.wat b/tests/disas/gc/copying/br-on-cast.watindex e4b2914cc3..3215bced8f 100644--- a/tests/disas/gc/copying/br-on-cast.wat+++ b/tests/disas/gc/copying/br-on-cast.wat@@ -20,11 +20,12 @@;; region1 = 160 "";; region2 = 196 "";; region3 = 206 ""-;; region4 = 108 ""+;; region4 = 239 "";; region5 = 130 "";; region6 = 6 ""-;; region7 = 25 ""-;; region8 = 68 ""+;; region7 = 134 ""+;; region8 = 25 ""+;; region9 = 68 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -57,7 +58,7 @@;; block6:;; @002f v28 = iconst.i64 4;; @002f v29 = iadd.i64 v13, v28 ; v28 = 4-;; @002f v30 = load.i32 user2 readonly region4 v29+;; @002f v30 = load.i32 user2 readonly region7 v29;; @002f v22 = load.i64 notrap aligned readonly can_move region5 v0+40;; @002f v23 = load.i32 notrap aligned readonly can_move region6 v22;; @002f v31 = icmp eq v30, v23@@ -68,14 +69,14 @@;; @002f brif v33, block2, block7;;;; block7:-;; @0035 v35 = load.i64 notrap aligned readonly can_move region8 v0+56-;; @0035 v34 = load.i64 notrap aligned readonly can_move region7 v0+72+;; @0035 v35 = load.i64 notrap aligned readonly can_move region9 v0+56+;; @0035 v34 = load.i64 notrap aligned readonly can_move region8 v0+72;; @0035 call_indirect sig0, v35(v34, v0);; @0037 return;;;; block2:-;; @0039 v37 = load.i64 notrap aligned readonly can_move region8 v0+88-;; @0039 v36 = load.i64 notrap aligned readonly can_move region7 v0+104+;; @0039 v37 = load.i64 notrap aligned readonly can_move region9 v0+88+;; @0039 v36 = load.i64 notrap aligned readonly can_move region8 v0+104;; @0039 call_indirect sig0, v37(v36, v0);; @003b return;; }diff --git a/tests/disas/gc/copying/funcref-in-gc-heap-new.wat b/tests/disas/gc/copying/funcref-in-gc-heap-new.watindex 6e3e981b87..e79c987728 100644--- a/tests/disas/gc/copying/funcref-in-gc-heap-new.wat+++ b/tests/disas/gc/copying/funcref-in-gc-heap-new.wat@@ -18,9 +18,11 @@;; region5 = 130 "";; region6 = 6 "";; region7 = 196 ""-;; region8 = 108 ""-;; region9 = 147 ""-;; region10 = 135 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 90 ""+;; region11 = 147 ""+;; region12 = 135 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -52,9 +54,9 @@;; @0020 store user2 region8 v59, v29 ; v59 = -1342177278;; v62 = load.i64 notrap aligned readonly can_move region5 v0+40;; v63 = load.i32 notrap aligned readonly can_move region6 v62-;; @0020 store user2 region8 v63, v29+4+;; @0020 store user2 region9 v63, v29+4;; v64 = iconst.i64 32-;; @0020 istore32 user2 region8 v64, v29+8 ; v64 = 32+;; @0020 istore32 user2 region10 v64, v29+8 ; v64 = 32;; @0020 jump block4(v5, v29);;;; block3 cold:@@ -72,15 +74,15 @@;;;; block4(v33: i32, v34: i64):;; v41 = stack_addr.i64 ss0-;; store notrap aligned region10 v33, v41+;; store notrap aligned region12 v33, v41;; @0020 v37 = call fn1(v0, v2), stack_map=[i32 @ ss0+0];; @0020 v38 = ireduce.i32 v37;; @0020 v35 = iconst.i64 16;; @0020 v36 = iadd v34, v35 ; v35 = 16-;; @0020 store user2 little region9 v38, v36+;; @0020 store user2 little region11 v38, v36;; @0023 jump block1;;;; block1:-;; v40 = load.i32 notrap aligned region10 v41+;; v40 = load.i32 notrap aligned region12 v41;; @0023 return v40;; }diff --git a/tests/disas/gc/copying/ref-cast.wat b/tests/disas/gc/copying/ref-cast.watindex 8da49db706..9da28af169 100644--- a/tests/disas/gc/copying/ref-cast.wat+++ b/tests/disas/gc/copying/ref-cast.wat@@ -12,9 +12,10 @@;; region1 = 160 "";; region2 = 196 "";; region3 = 206 ""-;; region4 = 108 ""+;; region4 = 239 "";; region5 = 130 "";; region6 = 6 ""+;; region7 = 134 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -46,7 +47,7 @@;; block5:;; @001e v28 = iconst.i64 4;; @001e v29 = iadd.i64 v13, v28 ; v28 = 4-;; @001e v30 = load.i32 user2 readonly region4 v29+;; @001e v30 = load.i32 user2 readonly region7 v29;; @001e v22 = load.i64 notrap aligned readonly can_move region5 v0+40;; @001e v23 = load.i32 notrap aligned readonly can_move region6 v22;; @001e v31 = icmp eq v30, v23diff --git a/tests/disas/gc/copying/ref-test-array.wat b/tests/disas/gc/copying/ref-test-array.watindex ff53f363b6..1d6e9ee53b 100644--- a/tests/disas/gc/copying/ref-test-array.wat+++ b/tests/disas/gc/copying/ref-test-array.wat@@ -11,7 +11,7 @@;; region1 = 160 "";; region2 = 196 "";; region3 = 206 ""-;; region4 = 108 ""+;; region4 = 239 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24diff --git a/tests/disas/gc/copying/ref-test-concrete-type.wat b/tests/disas/gc/copying/ref-test-concrete-type.watindex aefc7b3695..8da6058c4a 100644--- a/tests/disas/gc/copying/ref-test-concrete-type.wat+++ b/tests/disas/gc/copying/ref-test-concrete-type.wat@@ -12,9 +12,10 @@;; region1 = 160 "";; region2 = 196 "";; region3 = 206 ""-;; region4 = 108 ""+;; region4 = 239 "";; region5 = 130 "";; region6 = 6 ""+;; region7 = 134 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -46,7 +47,7 @@;; block5:;; @001d v28 = iconst.i64 4;; @001d v29 = iadd.i64 v13, v28 ; v28 = 4-;; @001d v30 = load.i32 user2 readonly region4 v29+;; @001d v30 = load.i32 user2 readonly region7 v29;; @001d v22 = load.i64 notrap aligned readonly can_move region5 v0+40;; @001d v23 = load.i32 notrap aligned readonly can_move region6 v22;; @001d v31 = icmp eq v30, v23diff --git a/tests/disas/gc/copying/ref-test-eq.wat b/tests/disas/gc/copying/ref-test-eq.watindex ec727df48f..870a619b4a 100644--- a/tests/disas/gc/copying/ref-test-eq.wat+++ b/tests/disas/gc/copying/ref-test-eq.wat@@ -11,7 +11,7 @@;; region1 = 160 "";; region2 = 196 "";; region3 = 206 ""-;; region4 = 108 ""+;; region4 = 239 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24diff --git a/tests/disas/gc/copying/ref-test-struct.wat b/tests/disas/gc/copying/ref-test-struct.watindex 4cb4fb57c8..af5a2fe2a0 100644--- a/tests/disas/gc/copying/ref-test-struct.wat+++ b/tests/disas/gc/copying/ref-test-struct.wat@@ -11,7 +11,7 @@;; region1 = 160 "";; region2 = 196 "";; region3 = 206 ""-;; region4 = 108 ""+;; region4 = 239 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24diff --git a/tests/disas/gc/copying/struct-new-default.wat b/tests/disas/gc/copying/struct-new-default.watindex 0f1bbb796d..ba4b02e281 100644--- a/tests/disas/gc/copying/struct-new-default.wat+++ b/tests/disas/gc/copying/struct-new-default.wat@@ -19,10 +19,12 @@;; region5 = 130 "";; region6 = 6 "";; region7 = 196 ""-;; region8 = 108 ""-;; region9 = 147 ""-;; region10 = 225 ""-;; region11 = 152 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 90 ""+;; region11 = 147 ""+;; region12 = 225 ""+;; region13 = 152 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -52,9 +54,9 @@;; @0021 store user2 region8 v60, v31 ; v60 = -1342177246;; v63 = load.i64 notrap aligned readonly can_move region5 v0+40;; v64 = load.i32 notrap aligned readonly can_move region6 v63-;; @0021 store user2 region8 v64, v31+4+;; @0021 store user2 region9 v64, v31+4;; v65 = iconst.i64 32-;; @0021 istore32 user2 region8 v65, v31+8 ; v65 = 32+;; @0021 istore32 user2 region10 v65, v31+8 ; v65 = 32;; @0021 jump block4(v7, v31);;;; block3 cold:@@ -74,14 +76,14 @@;; @0021 v2 = f32const 0.0;; @0021 v37 = iconst.i64 16;; @0021 v38 = iadd v36, v37 ; v37 = 16-;; @0021 store user2 little region9 v2, v38 ; v2 = 0.0+;; @0021 store user2 little region11 v2, v38 ; v2 = 0.0;; @0021 v3 = iconst.i32 0;; @0021 v39 = iconst.i64 20;; @0021 v40 = iadd v36, v39 ; v39 = 20-;; @0021 istore8 user2 little region10 v3, v40 ; v3 = 0+;; @0021 istore8 user2 little region12 v3, v40 ; v3 = 0;; @0021 v41 = iconst.i64 24;; @0021 v42 = iadd v36, v41 ; v41 = 24-;; @0021 store user2 little region11 v3, v42 ; v3 = 0+;; @0021 store user2 little region13 v3, v42 ; v3 = 0;; @0024 jump block1;;;; block1:diff --git a/tests/disas/gc/copying/struct-new.wat b/tests/disas/gc/copying/struct-new.watindex a2a3646466..85a663467c 100644--- a/tests/disas/gc/copying/struct-new.wat+++ b/tests/disas/gc/copying/struct-new.wat@@ -20,11 +20,13 @@;; region5 = 130 "";; region6 = 6 "";; region7 = 196 ""-;; region8 = 108 ""-;; region9 = 147 ""-;; region10 = 225 ""-;; region11 = 152 ""-;; region12 = 135 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 90 ""+;; region11 = 147 ""+;; region12 = 225 ""+;; region13 = 152 ""+;; region14 = 135 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -34,7 +36,7 @@;;;; block0(v0: i64, v1: i64, v2: f32, v3: i32, v4: i32):;; v45 = stack_addr.i64 ss0-;; store notrap aligned region12 v4, v45+;; store notrap aligned region14 v4, v45;; @002a v6 = load.i64 notrap aligned readonly can_move region2 v0+32;; @002a v7 = load.i32 notrap aligned region3 v6;; @002a v8 = load.i32 notrap aligned region4 v6+4@@ -56,9 +58,9 @@;; @002a store user2 region8 v63, v31 ; v63 = -1342177246;; v66 = load.i64 notrap aligned readonly can_move region5 v0+40;; v67 = load.i32 notrap aligned readonly can_move region6 v66-;; @002a store user2 region8 v67, v31+4+;; @002a store user2 region9 v67, v31+4;; v68 = iconst.i64 32-;; @002a istore32 user2 region8 v68, v31+8 ; v68 = 32+;; @002a istore32 user2 region10 v68, v31+8 ; v68 = 32;; @002a jump block4(v7, v31);;;; block3 cold:@@ -77,14 +79,14 @@;; block4(v35: i32, v36: i64):;; @002a v37 = iconst.i64 16;; @002a v38 = iadd v36, v37 ; v37 = 16-;; @002a store.f32 user2 little region9 v2, v38+;; @002a store.f32 user2 little region11 v2, v38;; @002a v39 = iconst.i64 20;; @002a v40 = iadd v36, v39 ; v39 = 20-;; @002a istore8.i32 user2 little region10 v3, v40-;; v44 = load.i32 notrap aligned region12 v45+;; @002a istore8.i32 user2 little region12 v3, v40+;; v44 = load.i32 notrap aligned region14 v45;; @002a v41 = iconst.i64 24;; @002a v42 = iadd v36, v41 ; v41 = 24-;; @002a store user2 little region11 v44, v42+;; @002a store user2 little region13 v44, v42;; @002d jump block1;;;; block1:diff --git a/tests/disas/gc/drc/alias-region-header.wat b/tests/disas/gc/drc/alias-region-header.watnew file mode 100644index 0000000000..5c26e0bcfd--- /dev/null+++ b/tests/disas/gc/drc/alias-region-header.wat@@ -0,0 +1,173 @@+;;! target = "x86_64"+;;! test = "optimize"+;;! flags = "-W function-references,gc -C collector=drc"++;; The DRC collector's `VMDrcHeader::ref_count` and+;; `next_over_approximated_stack_root` each get their own alias region.++(module+ (type $s (struct (field (mut anyref))))+ (type $a (array (mut i32)))++ (func (export "f") (param $s (ref $s)) (param $a (ref $a)) (param $x anyref) (result anyref)+ ;; A GC-ref store emits DRC write barriers, which touch the ref counts of+ ;; both the old and the new value.+ (struct.set $s 0 (local.get $s) (local.get $x))++ ;; A GC-ref load emits a DRC read barrier, which touches the ref count, the+ ;; kind word's reserved bits, and the over-approximated-stack-roots link.+ (struct.get $s 0 (local.get $s))+ )+)+;; function u0:0(i64 vmctx, i64, i32, i32, i32) -> i32 tail {+;; ss0 = explicit_slot 4, align = 4+;; region0 = 123 ""+;; region1 = 160 ""+;; region2 = 196 ""+;; region3 = 206 ""+;; region4 = 147 ""+;; region5 = 175 ""+;; region6 = 239 ""+;; region7 = 65 ""+;; region8 = 210 ""+;; region9 = 121 ""+;; region10 = 115 ""+;; region11 = 137 ""+;; region12 = 135 ""+;; gv0 = vmctx+;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8+;; gv2 = load.i64 notrap aligned region1 gv1+24+;; sig0 = (i64 vmctx, i32) tail+;; sig1 = (i64 vmctx) -> i8 tail+;; fn0 = colocated u805306368:22 sig0+;; fn1 = colocated u805306368:45 sig1+;; stack_limit = gv2+;;+;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32):+;; v145 = stack_addr.i64 ss0+;; store notrap aligned region12 v2, v145+;; @002f trapz v2, user16+;; @002f v6 = load.i64 notrap aligned readonly can_move region0 v0+8+;; @002f v7 = load.i64 notrap aligned readonly can_move region2 v6+32+;; @002f v5 = uextend.i64 v2+;; @002f v8 = iadd v7, v5+;; @002f v9 = iconst.i64 24+;; @002f v10 = iadd v8, v9 ; v9 = 24+;; @002f v11 = load.i32 user2 little region4 v10+;; @002f v12 = iconst.i32 1+;; @002f v13 = band v4, v12 ; v12 = 1+;; @002f v14 = iconst.i32 0+;; @002f v15 = icmp eq v4, v14 ; v14 = 0+;; @002f v16 = uextend.i32 v15+;; @002f v17 = bor v13, v16+;; @002f brif v17, block3, block2+;;+;; block2:+;; @002f v18 = uextend.i64 v4+;; @002f v21 = iadd.i64 v7, v18+;; @002f v22 = iconst.i64 8+;; @002f v23 = iadd v21, v22 ; v22 = 8+;; @002f v24 = load.i64 user2 region5 v23+;; @002f v25 = iconst.i64 1+;; @002f v26 = iadd v24, v25 ; v25 = 1+;; @002f store user2 region5 v26, v23+;; @002f jump block3+;;+;; block3:+;; v159 = iadd.i64 v8, v9 ; v9 = 24+;; @002f store.i32 user2 little region4 v4, v159+;; v160 = iconst.i32 1+;; v161 = band.i32 v11, v160 ; v160 = 1+;; v162 = iconst.i32 0+;; v163 = icmp.i32 eq v11, v162 ; v162 = 0+;; @002f v37 = uextend.i32 v163+;; @002f v38 = bor v161, v37+;; @002f brif v38, block7, block4+;;+;; block4:+;; @002f v39 = uextend.i64 v11+;; @002f v42 = iadd.i64 v7, v39+;; v164 = iconst.i64 8+;; @002f v44 = iadd v42, v164 ; v164 = 8+;; @002f v45 = load.i64 user2 region5 v44+;; v165 = iconst.i64 1+;; v157 = icmp eq v45, v165 ; v165 = 1+;; @002f brif v157, block5, block6+;;+;; block5 cold:+;; @002f call fn0(v0, v11), stack_map=[i32 @ ss0+0]+;; @002f jump block7+;;+;; block6:+;; @002f v46 = iconst.i64 -1+;; @002f v47 = iadd.i64 v45, v46 ; v46 = -1+;; v166 = iadd.i64 v42, v164 ; v164 = 8+;; @002f store user2 region5 v47, v166+;; @002f jump block7+;;+;; block7:+;; v140 = load.i32 notrap aligned region12 v145+;; @0035 trapz v140, user16+;; @0035 v58 = uextend.i64 v140+;; @0035 v61 = iadd.i64 v7, v58+;; v167 = iconst.i64 24+;; v168 = iadd v61, v167 ; v167 = 24+;; @0035 v64 = load.i32 user2 little region4 v168+;; store notrap aligned region12 v64, v145+;; v169 = iconst.i32 1+;; v170 = band v64, v169 ; v169 = 1+;; v171 = iconst.i32 0+;; v172 = icmp eq v64, v171 ; v171 = 0+;; @0035 v69 = uextend.i32 v172+;; @0035 v70 = bor v170, v69+;; @0035 brif v70, block10, block8+;;+;; block8:+;; @0035 v71 = uextend.i64 v64+;; @0035 v74 = iadd.i64 v7, v71+;; @0035 v75 = load.i32 user2 region6 v74+;; @0035 v76 = iconst.i32 2+;; @0035 v77 = band v75, v76 ; v76 = 2+;; @0035 brif v77, block10, block9+;;+;; block9:+;; @0035 v78 = load.i64 notrap aligned readonly can_move region7 v0+32+;; @0035 v79 = load.i32 notrap aligned region8 v78+;; @0035 v84 = iconst.i64 16+;; @0035 v85 = iadd.i64 v74, v84 ; v84 = 16+;; @0035 store user2 region9 v79, v85+;; v173 = iconst.i32 2+;; v174 = bor.i32 v75, v173 ; v173 = 2+;; @0035 store user2 region6 v174, v74+;; v175 = iconst.i64 8+;; @0035 v97 = iadd.i64 v74, v175 ; v175 = 8+;; @0035 v98 = load.i64 user2 region5 v97+;; v176 = iconst.i64 1+;; @0035 v100 = iadd v98, v176 ; v176 = 1+;; @0035 store user2 region5 v100, v97+;; @0035 store.i32 notrap aligned region8 v64, v78+;; @0035 v107 = load.i32 notrap aligned region10 v78+4+;; v177 = iconst.i32 1+;; v178 = iadd v107, v177 ; v177 = 1+;; @0035 store notrap aligned region10 v178, v78+4+;; @0035 v112 = load.i32 notrap aligned region11 v78+8+;; @0035 v113 = iadd v112, v112+;; @0035 v114 = iconst.i32 1024+;; @0035 v115 = umax v113, v114 ; v114 = 1024+;; @0035 v116 = icmp uge v178, v115+;; @0035 brif v116, block11, block12+;;+;; block11 cold:+;; @0035 v117 = call fn1(v0), stack_map=[i32 @ ss0+0]+;; @0035 jump block12+;;+;; block12:+;; @0035 jump block10+;;+;; block10:+;; @0039 jump block1+;;+;; block1:+;; v119 = load.i32 notrap aligned region12 v145+;; @0039 return v119+;; }diff --git a/tests/disas/gc/drc/array-new-fixed-of-gc-refs.wat b/tests/disas/gc/drc/array-new-fixed-of-gc-refs.watindex 7e413bf27e..09eae95242 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@@ -21,9 +21,10 @@;; region5 = 108 "";; region6 = 206 "";; region7 = 5 ""-;; region8 = 135 ""-;; region9 = 187 ""-;; region10 = 26 ""+;; region8 = 175 ""+;; region9 = 135 ""+;; region10 = 187 ""+;; region11 = 26 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -33,11 +34,11 @@;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32):;; v202 = stack_addr.i64 ss2-;; store notrap aligned region10 v2, v202+;; store notrap aligned region11 v2, v202;; v203 = stack_addr.i64 ss1-;; store notrap aligned region9 v3, v203+;; store notrap aligned region10 v3, v203;; v204 = stack_addr.i64 ss0-;; store notrap aligned region8 v4, v204+;; store notrap aligned region9 v4, v204;; @0025 v14 = iconst.i32 -1476395008;; @0025 v15 = load.i64 notrap aligned readonly can_move region2 v0+40;; @0025 v16 = load.i32 notrap aligned readonly can_move region3 v15@@ -54,7 +55,7 @@;; @0025 store user2 region5 v5, v24 ; v5 = 3;; @0025 trapz v18, user16;; @0025 v45 = uadd_overflow_trap v18, v216, user2 ; v216 = 40-;; v201 = load.i32 notrap aligned region10 v202+;; v201 = load.i32 notrap aligned region11 v202;; @0025 v53 = iconst.i32 1;; @0025 v54 = band v201, v53 ; v53 = 1;; @0025 v25 = iconst.i32 0@@ -68,10 +69,10 @@;; @0025 v62 = iadd.i64 v20, v59;; @0025 v63 = iconst.i64 8;; @0025 v64 = iadd v62, v63 ; v63 = 8-;; @0025 v65 = load.i64 user2 region5 v64+;; @0025 v65 = load.i64 user2 region8 v64;; @0025 v66 = iconst.i64 1;; @0025 v67 = iadd v65, v66 ; v66 = 1-;; @0025 store user2 region5 v67, v64+;; @0025 store user2 region8 v67, v64;; @0025 jump block3;;;; block3:@@ -80,24 +81,9 @@;; v206 = iconst.i64 12;; @0025 v52 = isub v49, v206 ; v206 = 12;; @0025 store.i32 user2 little region7 v201, v52-;; v305 = iadd.i64 v22, v23 ; v23 = 24-;; @0025 v81 = load.i32 user2 readonly region5 v305-;; v306 = iconst.i32 1-;; v307 = icmp ugt v81, v306 ; v306 = 1-;; @0025 trapz v307, user17-;; @0025 v84 = uextend.i64 v81-;; v207 = iconst.i64 2-;; v252 = ishl v84, v207 ; v207 = 2-;; @0025 v10 = iconst.i64 32-;; @0025 v87 = ushr v252, v10 ; v10 = 32-;; @0025 trapnz v87, user2-;; v228 = iconst.i32 2-;; v257 = ishl v81, v228 ; v228 = 2-;; @0025 v6 = iconst.i32 28-;; @0025 v90 = uadd_overflow_trap v257, v6, user2 ; v6 = 28-;; @0025 v94 = uadd_overflow_trap.i32 v18, v90, user2-;; v191 = load.i32 notrap aligned region9 v203-;; v308 = band v191, v306 ; v306 = 1+;; v191 = load.i32 notrap aligned region10 v203+;; v307 = iconst.i32 1+;; v308 = band v191, v307 ; v307 = 1;; v309 = iconst.i32 0;; v310 = icmp eq v191, v309 ; v309 = 0;; @0025 v106 = uextend.i32 v310@@ -109,62 +95,38 @@;; @0025 v111 = iadd.i64 v20, v108;; v311 = iconst.i64 8;; @0025 v113 = iadd v111, v311 ; v311 = 8-;; @0025 v114 = load.i64 user2 region5 v113+;; @0025 v114 = load.i64 user2 region8 v113;; v312 = iconst.i64 1;; @0025 v116 = iadd v114, v312 ; v312 = 1-;; @0025 store user2 region5 v116, v113+;; @0025 store user2 region8 v116, v113;; @0025 jump block5;;;; block5:-;; @0025 v95 = uextend.i64 v94-;; @0025 v98 = iadd.i64 v20, v95-;; v269 = iconst.i32 32-;; @0025 v99 = isub.i32 v90, v269 ; v269 = 32-;; @0025 v100 = uextend.i64 v99-;; @0025 v101 = isub v98, v100+;; v313 = iconst.i64 8+;; @0025 v101 = isub.i64 v49, v313 ; v313 = 8;; @0025 store.i32 user2 little region7 v191, v101-;; v313 = iadd.i64 v22, v23 ; v23 = 24-;; @0025 v130 = load.i32 user2 readonly region5 v313-;; v314 = iconst.i32 2-;; v315 = icmp ugt v130, v314 ; v314 = 2-;; @0025 trapz v315, user17-;; @0025 v133 = uextend.i64 v130-;; v316 = iconst.i64 2-;; v317 = ishl v133, v316 ; v316 = 2-;; v318 = iconst.i64 32-;; v319 = ushr v317, v318 ; v318 = 32-;; @0025 trapnz v319, user2-;; v320 = ishl v130, v314 ; v314 = 2-;; v321 = iconst.i32 28-;; @0025 v139 = uadd_overflow_trap v320, v321, user2 ; v321 = 28-;; @0025 v143 = uadd_overflow_trap.i32 v18, v139, user2-;; v181 = load.i32 notrap aligned region8 v204-;; v322 = iconst.i32 1-;; v323 = band v181, v322 ; v322 = 1-;; v324 = iconst.i32 0-;; v325 = icmp eq v181, v324 ; v324 = 0-;; @0025 v155 = uextend.i32 v325-;; @0025 v156 = bor v323, v155+;; v181 = load.i32 notrap aligned region9 v204+;; v314 = iconst.i32 1+;; v315 = band v181, v314 ; v314 = 1+;; v316 = iconst.i32 0+;; v317 = icmp eq v181, v316 ; v316 = 0+;; @0025 v155 = uextend.i32 v317+;; @0025 v156 = bor v315, v155;; @0025 brif v156, block7, block6;;;; block6:;; @0025 v157 = uextend.i64 v181;; @0025 v160 = iadd.i64 v20, v157-;; v326 = iconst.i64 8-;; @0025 v162 = iadd v160, v326 ; v326 = 8-;; @0025 v163 = load.i64 user2 region5 v162-;; v327 = iconst.i64 1-;; @0025 v165 = iadd v163, v327 ; v327 = 1-;; @0025 store user2 region5 v165, v162+;; @0025 v162 = iadd v160, v313 ; v313 = 8+;; @0025 v163 = load.i64 user2 region8 v162+;; v318 = iconst.i64 1+;; @0025 v165 = iadd v163, v318 ; v318 = 1+;; @0025 store user2 region8 v165, v162;; @0025 jump block7;;;; block7:-;; @0025 v144 = uextend.i64 v143-;; @0025 v147 = iadd.i64 v20, v144-;; v299 = iconst.i32 36-;; @0025 v148 = isub.i32 v139, v299 ; v299 = 36-;; @0025 v149 = uextend.i64 v148-;; @0025 v150 = isub v147, v149+;; @0025 v8 = iconst.i64 4+;; @0025 v150 = isub.i64 v49, v8 ; v8 = 4;; @0025 store.i32 user2 little region7 v181, v150;; @0029 jump block1;;diff --git a/tests/disas/gc/drc/br-on-cast-fail.wat b/tests/disas/gc/drc/br-on-cast-fail.watindex 9cab33157b..ec7e544b02 100644--- a/tests/disas/gc/drc/br-on-cast-fail.wat+++ b/tests/disas/gc/drc/br-on-cast-fail.wat@@ -21,11 +21,12 @@;; region1 = 160 "";; region2 = 196 "";; region3 = 206 ""-;; region4 = 108 ""+;; region4 = 239 "";; region5 = 130 "";; region6 = 6 ""-;; region7 = 25 ""-;; region8 = 68 ""+;; region7 = 134 ""+;; region8 = 25 ""+;; region9 = 68 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -58,7 +59,7 @@;; block6:;; @002e v28 = iconst.i64 4;; @002e v29 = iadd.i64 v13, v28 ; v28 = 4-;; @002e v30 = load.i32 user2 readonly region4 v29+;; @002e v30 = load.i32 user2 readonly region7 v29;; @002e v22 = load.i64 notrap aligned readonly can_move region5 v0+40;; @002e v23 = load.i32 notrap aligned readonly can_move region6 v22;; @002e v31 = icmp eq v30, v23@@ -69,14 +70,14 @@;; @002e brif v33, block7, block2;;;; block7:-;; @0034 v35 = load.i64 notrap aligned readonly can_move region8 v0+56-;; @0034 v34 = load.i64 notrap aligned readonly can_move region7 v0+72+;; @0034 v35 = load.i64 notrap aligned readonly can_move region9 v0+56+;; @0034 v34 = load.i64 notrap aligned readonly can_move region8 v0+72;; @0034 call_indirect sig0, v35(v34, v0);; @0036 return;;;; block2:-;; @0038 v37 = load.i64 notrap aligned readonly can_move region8 v0+88-;; @0038 v36 = load.i64 notrap aligned readonly can_move region7 v0+104+;; @0038 v37 = load.i64 notrap aligned readonly can_move region9 v0+88+;; @0038 v36 = load.i64 notrap aligned readonly can_move region8 v0+104;; @0038 call_indirect sig0, v37(v36, v0);; @003a return;; }diff --git a/tests/disas/gc/drc/br-on-cast.wat b/tests/disas/gc/drc/br-on-cast.watindex 193d6b2245..4223ce0c6e 100644--- a/tests/disas/gc/drc/br-on-cast.wat+++ b/tests/disas/gc/drc/br-on-cast.wat@@ -21,11 +21,12 @@;; region1 = 160 "";; region2 = 196 "";; region3 = 206 ""-;; region4 = 108 ""+;; region4 = 239 "";; region5 = 130 "";; region6 = 6 ""-;; region7 = 25 ""-;; region8 = 68 ""+;; region7 = 134 ""+;; region8 = 25 ""+;; region9 = 68 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -58,7 +59,7 @@;; block6:;; @002f v28 = iconst.i64 4;; @002f v29 = iadd.i64 v13, v28 ; v28 = 4-;; @002f v30 = load.i32 user2 readonly region4 v29+;; @002f v30 = load.i32 user2 readonly region7 v29;; @002f v22 = load.i64 notrap aligned readonly can_move region5 v0+40;; @002f v23 = load.i32 notrap aligned readonly can_move region6 v22;; @002f v31 = icmp eq v30, v23@@ -69,14 +70,14 @@;; @002f brif v33, block2, block7;;;; block7:-;; @0035 v35 = load.i64 notrap aligned readonly can_move region8 v0+56-;; @0035 v34 = load.i64 notrap aligned readonly can_move region7 v0+72+;; @0035 v35 = load.i64 notrap aligned readonly can_move region9 v0+56+;; @0035 v34 = load.i64 notrap aligned readonly can_move region8 v0+72;; @0035 call_indirect sig0, v35(v34, v0);; @0037 return;;;; block2:-;; @0039 v37 = load.i64 notrap aligned readonly can_move region8 v0+88-;; @0039 v36 = load.i64 notrap aligned readonly can_move region7 v0+104+;; @0039 v37 = load.i64 notrap aligned readonly can_move region9 v0+88+;; @0039 v36 = load.i64 notrap aligned readonly can_move region8 v0+104;; @0039 call_indirect sig0, v37(v36, v0);; @003b return;; }diff --git a/tests/disas/gc/drc/externref-globals.wat b/tests/disas/gc/drc/externref-globals.watindex a4708eed04..3fee836528 100644--- a/tests/disas/gc/drc/externref-globals.wat+++ b/tests/disas/gc/drc/externref-globals.wat@@ -19,12 +19,14 @@;; region2 = 250 "";; region3 = 196 "";; region4 = 206 ""-;; region5 = 108 ""+;; region5 = 239 "";; region6 = 65 "";; region7 = 210 ""-;; region8 = 115 ""-;; region9 = 137 ""-;; region10 = 135 ""+;; region8 = 121 ""+;; region9 = 175 ""+;; region10 = 115 ""+;; region11 = 137 ""+;; region12 = 135 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -37,7 +39,7 @@;; @0034 v3 = iadd v0, v2 ; v2 = 48;; @0034 v4 = load.i32 notrap aligned region2 v3;; v76 = stack_addr.i64 ss0-;; store notrap aligned region10 v4, v76+;; store notrap aligned region12 v4, v76;; @0034 v5 = iconst.i32 1;; @0034 v6 = band v4, v5 ; v5 = 1;; @0034 v7 = iconst.i32 0@@ -61,22 +63,22 @@;; @0034 v19 = load.i32 notrap aligned region7 v18;; @0034 v24 = iconst.i64 16;; @0034 v25 = iadd.i64 v14, v24 ; v24 = 16-;; @0034 store user2 region5 v19, v25+;; @0034 store user2 region8 v19, v25;; v77 = iconst.i32 2;; v78 = bor.i32 v15, v77 ; v77 = 2;; @0034 store user2 region5 v78, v14;; @0034 v36 = iconst.i64 8;; @0034 v37 = iadd.i64 v14, v36 ; v36 = 8-;; @0034 v38 = load.i64 user2 region5 v37+;; @0034 v38 = load.i64 user2 region9 v37;; @0034 v39 = iconst.i64 1;; @0034 v40 = iadd v38, v39 ; v39 = 1-;; @0034 store user2 region5 v40, v37+;; @0034 store user2 region9 v40, v37;; @0034 store.i32 notrap aligned region7 v4, v18-;; @0034 v47 = load.i32 notrap aligned region8 v18+4+;; @0034 v47 = load.i32 notrap aligned region10 v18+4;; v79 = iconst.i32 1;; v80 = iadd v47, v79 ; v79 = 1-;; @0034 store notrap aligned region8 v80, v18+4-;; @0034 v52 = load.i32 notrap aligned region9 v18+8+;; @0034 store notrap aligned region10 v80, v18+4+;; @0034 v52 = load.i32 notrap aligned region11 v18+8;; @0034 v53 = iadd v52, v52;; @0034 v54 = iconst.i32 1024;; @0034 v55 = umax v53, v54 ; v54 = 1024@@ -94,7 +96,7 @@;; @0036 jump block1;;;; block1:-;; v59 = load.i32 notrap aligned region10 v76+;; v59 = load.i32 notrap aligned region12 v76;; @0036 return v59;; };;@@ -104,7 +106,7 @@;; region2 = 250 "";; region3 = 196 "";; region4 = 206 ""-;; region5 = 108 ""+;; region5 = 175 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24diff --git a/tests/disas/gc/drc/ref-cast.wat b/tests/disas/gc/drc/ref-cast.watindex 2db09d89bf..d5c239dba3 100644--- a/tests/disas/gc/drc/ref-cast.wat+++ b/tests/disas/gc/drc/ref-cast.wat@@ -13,9 +13,10 @@;; region1 = 160 "";; region2 = 196 "";; region3 = 206 ""-;; region4 = 108 ""+;; region4 = 239 "";; region5 = 130 "";; region6 = 6 ""+;; region7 = 134 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -47,7 +48,7 @@;; block5:;; @001e v28 = iconst.i64 4;; @001e v29 = iadd.i64 v13, v28 ; v28 = 4-;; @001e v30 = load.i32 user2 readonly region4 v29+;; @001e v30 = load.i32 user2 readonly region7 v29;; @001e v22 = load.i64 notrap aligned readonly can_move region5 v0+40;; @001e v23 = load.i32 notrap aligned readonly can_move region6 v22;; @001e v31 = icmp eq v30, v23diff --git a/tests/disas/gc/drc/ref-test-array.wat b/tests/disas/gc/drc/ref-test-array.watindex 521b1061bb..48125ed28c 100644--- a/tests/disas/gc/drc/ref-test-array.wat+++ b/tests/disas/gc/drc/ref-test-array.wat@@ -12,7 +12,7 @@;; region1 = 160 "";; region2 = 196 "";; region3 = 206 ""-;; region4 = 108 ""+;; region4 = 239 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24diff --git a/tests/disas/gc/drc/ref-test-concrete-type.wat b/tests/disas/gc/drc/ref-test-concrete-type.watindex 2b38383073..3e615dfeb3 100644--- a/tests/disas/gc/drc/ref-test-concrete-type.wat+++ b/tests/disas/gc/drc/ref-test-concrete-type.wat@@ -13,9 +13,10 @@;; region1 = 160 "";; region2 = 196 "";; region3 = 206 ""-;; region4 = 108 ""+;; region4 = 239 "";; region5 = 130 "";; region6 = 6 ""+;; region7 = 134 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -47,7 +48,7 @@;; block5:;; @001d v28 = iconst.i64 4;; @001d v29 = iadd.i64 v13, v28 ; v28 = 4-;; @001d v30 = load.i32 user2 readonly region4 v29+;; @001d v30 = load.i32 user2 readonly region7 v29;; @001d v22 = load.i64 notrap aligned readonly can_move region5 v0+40;; @001d v23 = load.i32 notrap aligned readonly can_move region6 v22;; @001d v31 = icmp eq v30, v23diff --git a/tests/disas/gc/drc/ref-test-eq.wat b/tests/disas/gc/drc/ref-test-eq.watindex 28c36da5b5..35963553fd 100644--- a/tests/disas/gc/drc/ref-test-eq.wat+++ b/tests/disas/gc/drc/ref-test-eq.wat@@ -12,7 +12,7 @@;; region1 = 160 "";; region2 = 196 "";; region3 = 206 ""-;; region4 = 108 ""+;; region4 = 239 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24diff --git a/tests/disas/gc/drc/ref-test-struct.wat b/tests/disas/gc/drc/ref-test-struct.watindex f8050ee939..ba776ec0b6 100644--- a/tests/disas/gc/drc/ref-test-struct.wat+++ b/tests/disas/gc/drc/ref-test-struct.wat@@ -12,7 +12,7 @@;; region1 = 160 "";; region2 = 196 "";; region3 = 206 ""-;; region4 = 108 ""+;; region4 = 239 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24diff --git a/tests/disas/gc/drc/struct-get.wat b/tests/disas/gc/drc/struct-get.watindex 4e9e230a9f..0b45f332a8 100644--- a/tests/disas/gc/drc/struct-get.wat+++ b/tests/disas/gc/drc/struct-get.wat@@ -110,12 +110,14 @@;; region2 = 196 "";; region3 = 206 "";; region4 = 152 ""-;; region5 = 108 ""+;; region5 = 239 "";; region6 = 65 "";; region7 = 210 ""-;; region8 = 115 ""-;; region9 = 137 ""-;; region10 = 135 ""+;; region8 = 121 ""+;; region9 = 175 ""+;; region10 = 115 ""+;; region11 = 137 ""+;; region12 = 135 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -133,7 +135,7 @@;; @004e v8 = iadd v6, v7 ; v7 = 32;; @004e v9 = load.i32 user2 little region4 v8;; v81 = stack_addr.i64 ss0-;; store notrap aligned region10 v9, v81+;; store notrap aligned region12 v9, v81;; @004e v10 = iconst.i32 1;; @004e v11 = band v9, v10 ; v10 = 1;; @004e v12 = iconst.i32 0@@ -155,22 +157,22 @@;; @004e v24 = load.i32 notrap aligned region7 v23;; @004e v29 = iconst.i64 16;; @004e v30 = iadd.i64 v19, v29 ; v29 = 16-;; @004e store user2 region5 v24, v30+;; @004e store user2 region8 v24, v30;; v82 = iconst.i32 2;; v83 = bor.i32 v20, v82 ; v82 = 2;; @004e store user2 region5 v83, v19;; @004e v41 = iconst.i64 8;; @004e v42 = iadd.i64 v19, v41 ; v41 = 8-;; @004e v43 = load.i64 user2 region5 v42+;; @004e v43 = load.i64 user2 region9 v42;; @004e v44 = iconst.i64 1;; @004e v45 = iadd v43, v44 ; v44 = 1-;; @004e store user2 region5 v45, v42+;; @004e store user2 region9 v45, v42;; @004e store.i32 notrap aligned region7 v9, v23-;; @004e v52 = load.i32 notrap aligned region8 v23+4+;; @004e v52 = load.i32 notrap aligned region10 v23+4;; v84 = iconst.i32 1;; v85 = iadd v52, v84 ; v84 = 1-;; @004e store notrap aligned region8 v85, v23+4-;; @004e v57 = load.i32 notrap aligned region9 v23+8+;; @004e store notrap aligned region10 v85, v23+4+;; @004e v57 = load.i32 notrap aligned region11 v23+8;; @004e v58 = iadd v57, v57;; @004e v59 = iconst.i32 1024;; @004e v60 = umax v58, v59 ; v59 = 1024@@ -188,6 +190,6 @@;; @0052 jump block1;;;; block1:-;; v64 = load.i32 notrap aligned region10 v81+;; v64 = load.i32 notrap aligned region12 v81;; @0052 return v64;; }diff --git a/tests/disas/gc/drc/struct-new-default.wat b/tests/disas/gc/drc/struct-new-default.watindex a3b0f352cc..2f86137248 100644--- a/tests/disas/gc/drc/struct-new-default.wat+++ b/tests/disas/gc/drc/struct-new-default.wat@@ -21,7 +21,7 @@;; region6 = 225 "";; region7 = 152 "";; region8 = 206 ""-;; region9 = 108 ""+;; region9 = 175 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24diff --git a/tests/disas/gc/drc/struct-new.wat b/tests/disas/gc/drc/struct-new.watindex 09b244415f..53e0ef4ded 100644--- a/tests/disas/gc/drc/struct-new.wat+++ b/tests/disas/gc/drc/struct-new.wat@@ -22,7 +22,7 @@;; region6 = 225 "";; region7 = 152 "";; region8 = 206 ""-;; region9 = 108 ""+;; region9 = 175 "";; region10 = 135 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8diff --git a/tests/disas/gc/drc/struct-set.wat b/tests/disas/gc/drc/struct-set.watindex 44ab8fdab7..7b86c75889 100644--- a/tests/disas/gc/drc/struct-set.wat+++ b/tests/disas/gc/drc/struct-set.wat@@ -77,7 +77,7 @@;; region2 = 196 "";; region3 = 206 "";; region4 = 152 ""-;; region5 = 108 ""+;; region5 = 175 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24diff --git a/tests/disas/gc/null/alias-region-header.wat b/tests/disas/gc/null/alias-region-header.watnew file mode 100644index 0000000000..5d8562cb28--- /dev/null+++ b/tests/disas/gc/null/alias-region-header.wat@@ -0,0 +1,129 @@+;;! target = "x86_64"+;;! test = "optimize"+;;! flags = "-W function-references,gc -C collector=null"++;; Every word of a GC object's header gets its own alias region: the kind word,+;; the type-index word, an array's length, and a struct field should all be+;; different regions here.++(module+ (type $s (struct (field (mut i32))))+ (type $a (array (mut i32)))++ (func (export "f") (param $a (ref $a)) (param $x anyref) (result i32 i32 i32)+ ;; Writes the kind word, the type-index word, and the field.+ (struct.get $s 0 (struct.new $s (i32.const 1)))++ ;; Reads the length word.+ (array.len (local.get $a))++ ;; Reads the kind word and the type-index word.+ (ref.test (ref $s) (local.get $x))+ )+)+;; function u0:0(i64 vmctx, i64, i32, i32) -> i32, i32, i32 tail {+;; ss0 = explicit_slot 4, align = 4+;; ss1 = explicit_slot 4, align = 4+;; region0 = 123 ""+;; region1 = 160 ""+;; region2 = 65 ""+;; region3 = 237 ""+;; region4 = 206 ""+;; region5 = 196 ""+;; region6 = 130 ""+;; region7 = 6 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 147 ""+;; region11 = 108 ""+;; region12 = 135 ""+;; region13 = 187 ""+;; gv0 = vmctx+;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8+;; gv2 = load.i64 notrap aligned region1 gv1+24+;; sig0 = (i64 vmctx, i64) -> i8 tail+;; fn0 = colocated u805306368:23 sig0+;; stack_limit = gv2+;;+;; block0(v0: i64, v1: i64, v2: i32, v3: i32):+;; v92 = stack_addr.i64 ss1+;; store notrap aligned region13 v2, v92+;; v93 = stack_addr.i64 ss0+;; store notrap aligned region12 v3, v93+;; @002d v9 = load.i64 notrap aligned readonly can_move region2 v0+32+;; @002d v10 = load.i32 notrap aligned region3 v9+;; v100 = iconst.i32 7+;; @002d v13 = uadd_overflow_trap v10, v100, user18 ; v100 = 7+;; v106 = iconst.i32 -8+;; @002d v15 = band v13, v106 ; v106 = -8+;; @002d v5 = iconst.i32 16+;; @002d v16 = uadd_overflow_trap v15, v5, user18 ; v5 = 16+;; @002d v18 = load.i64 notrap aligned readonly can_move region0 v0+8+;; @002d v19 = load.i64 notrap aligned region4 v18+40+;; @002d v17 = uextend.i64 v16+;; @002d v20 = icmp ule v17, v19+;; @002d brif v20, block2, block3+;;+;; block2:+;; v107 = iconst.i32 -1342177264+;; @002d v24 = load.i64 notrap aligned readonly can_move region5 v18+32+;; v113 = band.i32 v13, v106 ; v106 = -8+;; v114 = uextend.i64 v113+;; @002d v26 = iadd v24, v114+;; @002d store user2 region8 v107, v26 ; v107 = -1342177264+;; @002d v29 = load.i64 notrap aligned readonly can_move region6 v0+40+;; @002d v30 = load.i32 notrap aligned readonly can_move region7 v29+;; @002d store user2 region9 v30, v26+4+;; @002d store.i32 notrap aligned region3 v16, v9+;; @002b v4 = iconst.i32 1+;; @002d v31 = iconst.i64 8+;; @002d v32 = iadd v26, v31 ; v31 = 8+;; @002d store user2 little region10 v4, v32 ; v4 = 1+;; @0030 trapz v113, user16+;; v91 = load.i32 notrap aligned region13 v92+;; @0036 trapz v91, user16+;; @0036 v41 = uextend.i64 v91+;; @0036 v44 = iadd v24, v41+;; @0036 v46 = iadd v44, v31 ; v31 = 8+;; @0036 v47 = load.i32 user2 readonly region11 v46+;; v87 = load.i32 notrap aligned region12 v93+;; v94 = iconst.i32 0+;; @003a v50 = icmp eq v87, v94 ; v94 = 0+;; @003a brif v50, block6(v94), block4 ; v94 = 0+;;+;; block3 cold:+;; @002d v21 = isub.i64 v17, v19+;; @002d v22 = call fn0(v0, v21), stack_map=[i32 @ ss1+0, i32 @ ss0+0]+;; @002d jump block2+;;+;; block4:+;; v115 = iconst.i32 1+;; v116 = band.i32 v87, v115 ; v115 = 1+;; v117 = iconst.i32 0+;; @003a brif v116, block6(v117), block5 ; v117 = 0+;;+;; block5:+;; @003a v56 = uextend.i64 v87+;; @003a v59 = iadd.i64 v24, v56+;; @003a v62 = load.i32 user2 readonly region8 v59+;; @002d v27 = iconst.i32 -1342177280+;; @003a v64 = band v62, v27 ; v27 = -1342177280+;; @003a v65 = icmp eq v64, v27 ; v27 = -1342177280+;; v118 = iconst.i32 0+;; @003a brif v65, block7, block6(v118) ; v118 = 0+;;+;; block7:+;; @003a v74 = iconst.i64 4+;; @003a v75 = iadd.i64 v59, v74 ; v74 = 4+;; @003a v76 = load.i32 user2 readonly region9 v75+;; @003a v77 = icmp eq v76, v30+;; @003a v78 = uextend.i32 v77+;; @003a jump block6(v78)+;;+;; block6(v79: i32):+;; @003d jump block1+;;+;; block1:+;; v119 = iconst.i32 1+;; @003d return v119, v47, v79 ; v119 = 1+;; }diff --git a/tests/disas/gc/null/array-new-fixed-of-gc-refs.wat b/tests/disas/gc/null/array-new-fixed-of-gc-refs.watindex 05a73a33aa..e83c0df2d7 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@@ -21,11 +21,13 @@;; region5 = 196 "";; region6 = 130 "";; region7 = 6 ""-;; region8 = 108 ""-;; region9 = 5 ""-;; region10 = 135 ""-;; region11 = 187 ""-;; region12 = 26 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 108 ""+;; region11 = 5 ""+;; region12 = 135 ""+;; region13 = 187 ""+;; region14 = 26 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -35,11 +37,11 @@;;;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32):;; v131 = stack_addr.i64 ss2-;; store notrap aligned region12 v2, v131+;; store notrap aligned region14 v2, v131;; v132 = stack_addr.i64 ss1-;; store notrap aligned region11 v3, v132+;; store notrap aligned region13 v3, v132;; v133 = stack_addr.i64 ss0-;; store notrap aligned region10 v4, v133+;; store notrap aligned region12 v4, v133;; @0025 v17 = load.i64 notrap aligned readonly can_move region2 v0+32;; @0025 v18 = load.i32 notrap aligned region3 v17;; v151 = iconst.i32 7@@ -63,28 +65,28 @@;; @0025 store user2 region8 v158, v34 ; v158 = -1476394984;; @0025 v37 = load.i64 notrap aligned readonly can_move region6 v0+40;; @0025 v38 = load.i32 notrap aligned readonly can_move region7 v37-;; @0025 store user2 region8 v38, v34+4+;; @0025 store user2 region9 v38, v34+4;; @0025 store.i32 notrap aligned region3 v24, v17;; @0025 v5 = iconst.i32 3;; @0025 v39 = iconst.i64 8;; @0025 v40 = iadd v34, v39 ; v39 = 8-;; @0025 store user2 region8 v5, v40 ; v5 = 3+;; @0025 store user2 region10 v5, v40 ; v5 = 3;; @0025 trapz v253, user16;; v255 = iconst.i32 24;; @0025 v61 = uadd_overflow_trap v253, v255, user2 ; v255 = 24-;; v130 = load.i32 notrap aligned region12 v131+;; v130 = load.i32 notrap aligned region14 v131;; @0025 v62 = uextend.i64 v61;; @0025 v65 = iadd v32, v62;; v135 = iconst.i64 12;; @0025 v68 = isub v65, v135 ; v135 = 12-;; @0025 store user2 little region9 v130, v68-;; v128 = load.i32 notrap aligned region11 v132+;; @0025 store user2 little region11 v130, v68+;; v128 = load.i32 notrap aligned region13 v132;; @0025 v96 = isub v65, v39 ; v39 = 8-;; @0025 store user2 little region9 v128, v96-;; v126 = load.i32 notrap aligned region10 v133+;; @0025 store user2 little region11 v128, v96+;; v126 = load.i32 notrap aligned region12 v133;; @0025 v8 = iconst.i64 4;; @0025 v124 = isub v65, v8 ; v8 = 4-;; @0025 store user2 little region9 v126, v124+;; @0025 store user2 little region11 v126, v124;; @0029 jump block1;;;; block3 cold:diff --git a/tests/disas/gc/null/array-new-fixed.wat b/tests/disas/gc/null/array-new-fixed.watindex 93d9fa174f..f186f1bf3a 100644--- a/tests/disas/gc/null/array-new-fixed.wat+++ b/tests/disas/gc/null/array-new-fixed.wat@@ -18,8 +18,10 @@;; region5 = 196 "";; region6 = 130 "";; region7 = 6 ""-;; region8 = 108 ""-;; region9 = 5 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 108 ""+;; region11 = 5 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -51,12 +53,12 @@;; @0025 store user2 region8 v149, v34 ; v149 = -1476394968;; @0025 v37 = load.i64 notrap aligned readonly can_move region6 v0+40;; @0025 v38 = load.i32 notrap aligned readonly can_move region7 v37-;; @0025 store user2 region8 v38, v34+4+;; @0025 store user2 region9 v38, v34+4;; @0025 store.i32 notrap aligned region3 v24, v17;; @0025 v5 = iconst.i32 3;; @0025 v8 = iconst.i64 8;; @0025 v40 = iadd v34, v8 ; v8 = 8-;; @0025 store user2 region8 v5, v40 ; v5 = 3+;; @0025 store user2 region10 v5, v40 ; v5 = 3;; @0025 trapz v242, user16;; v244 = iconst.i32 40;; @0025 v61 = uadd_overflow_trap v242, v244, user2 ; v244 = 40@@ -64,12 +66,12 @@;; @0025 v65 = iadd v32, v62;; v126 = iconst.i64 24;; @0025 v68 = isub v65, v126 ; v126 = 24-;; @0025 store.i64 user2 little region9 v2, v68+;; @0025 store.i64 user2 little region11 v2, v68;; v211 = iconst.i64 16;; @0025 v96 = isub v65, v211 ; v211 = 16-;; @0025 store.i64 user2 little region9 v3, v96+;; @0025 store.i64 user2 little region11 v3, v96;; @0025 v124 = isub v65, v8 ; v8 = 8-;; @0025 store.i64 user2 little region9 v4, v124+;; @0025 store.i64 user2 little region11 v4, v124;; @0029 jump block1;;;; block3 cold:diff --git a/tests/disas/gc/null/array-new.wat b/tests/disas/gc/null/array-new.watindex 691cdefbd6..78ad05dce6 100644--- a/tests/disas/gc/null/array-new.wat+++ b/tests/disas/gc/null/array-new.wat@@ -18,8 +18,10 @@;; region5 = 196 "";; region6 = 130 "";; region7 = 6 ""-;; region8 = 108 ""-;; region9 = 5 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 108 ""+;; region11 = 5 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -64,11 +66,11 @@;; @0022 store user2 region8 v99, v32;; @0022 v35 = load.i64 notrap aligned readonly can_move region6 v0+40;; @0022 v36 = load.i32 notrap aligned readonly can_move region7 v35-;; @0022 store user2 region8 v36, v32+4+;; @0022 store user2 region9 v36, v32+4;; @0022 store.i32 notrap aligned region3 v22, v15;; @0022 v6 = iconst.i64 8;; @0022 v38 = iadd v32, v6 ; v6 = 8-;; @0022 store.i32 user2 region8 v3, v38+;; @0022 store.i32 user2 region10 v3, v38;; @0022 trapz v116, user16;; @0022 v70 = load.i64 notrap aligned region4 v24+40;; @0022 v58 = iconst.i64 16@@ -83,7 +85,7 @@;; @0022 brif v76, block5, block4(v59);;;; block4(v77: i64):-;; @0022 store.i64 user2 little region9 v2, v77+;; @0022 store.i64 user2 little region11 v2, v77;; v118 = iconst.i64 8;; v119 = iadd v77, v118 ; v118 = 8;; @0022 v80 = icmp eq v119, v74diff --git a/tests/disas/gc/null/br-on-cast-fail.wat b/tests/disas/gc/null/br-on-cast-fail.watindex 36cea4f296..7446c9533a 100644--- a/tests/disas/gc/null/br-on-cast-fail.wat+++ b/tests/disas/gc/null/br-on-cast-fail.wat@@ -21,11 +21,12 @@;; region1 = 160 "";; region2 = 196 "";; region3 = 206 ""-;; region4 = 108 ""+;; region4 = 239 "";; region5 = 130 "";; region6 = 6 ""-;; region7 = 25 ""-;; region8 = 68 ""+;; region7 = 134 ""+;; region8 = 25 ""+;; region9 = 68 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -58,7 +59,7 @@;; block6:;; @002e v28 = iconst.i64 4;; @002e v29 = iadd.i64 v13, v28 ; v28 = 4-;; @002e v30 = load.i32 user2 readonly region4 v29+;; @002e v30 = load.i32 user2 readonly region7 v29;; @002e v22 = load.i64 notrap aligned readonly can_move region5 v0+40;; @002e v23 = load.i32 notrap aligned readonly can_move region6 v22;; @002e v31 = icmp eq v30, v23@@ -69,14 +70,14 @@;; @002e brif v33, block7, block2;;;; block7:-;; @0034 v35 = load.i64 notrap aligned readonly can_move region8 v0+56-;; @0034 v34 = load.i64 notrap aligned readonly can_move region7 v0+72+;; @0034 v35 = load.i64 notrap aligned readonly can_move region9 v0+56+;; @0034 v34 = load.i64 notrap aligned readonly can_move region8 v0+72;; @0034 call_indirect sig0, v35(v34, v0);; @0036 return;;;; block2:-;; @0038 v37 = load.i64 notrap aligned readonly can_move region8 v0+88-;; @0038 v36 = load.i64 notrap aligned readonly can_move region7 v0+104+;; @0038 v37 = load.i64 notrap aligned readonly can_move region9 v0+88+;; @0038 v36 = load.i64 notrap aligned readonly can_move region8 v0+104;; @0038 call_indirect sig0, v37(v36, v0);; @003a return;; }diff --git a/tests/disas/gc/null/br-on-cast.wat b/tests/disas/gc/null/br-on-cast.watindex 3b7a209999..e950dc64e4 100644--- a/tests/disas/gc/null/br-on-cast.wat+++ b/tests/disas/gc/null/br-on-cast.wat@@ -21,11 +21,12 @@;; region1 = 160 "";; region2 = 196 "";; region3 = 206 ""-;; region4 = 108 ""+;; region4 = 239 "";; region5 = 130 "";; region6 = 6 ""-;; region7 = 25 ""-;; region8 = 68 ""+;; region7 = 134 ""+;; region8 = 25 ""+;; region9 = 68 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -58,7 +59,7 @@;; block6:;; @002f v28 = iconst.i64 4;; @002f v29 = iadd.i64 v13, v28 ; v28 = 4-;; @002f v30 = load.i32 user2 readonly region4 v29+;; @002f v30 = load.i32 user2 readonly region7 v29;; @002f v22 = load.i64 notrap aligned readonly can_move region5 v0+40;; @002f v23 = load.i32 notrap aligned readonly can_move region6 v22;; @002f v31 = icmp eq v30, v23@@ -69,14 +70,14 @@;; @002f brif v33, block2, block7;;;; block7:-;; @0035 v35 = load.i64 notrap aligned readonly can_move region8 v0+56-;; @0035 v34 = load.i64 notrap aligned readonly can_move region7 v0+72+;; @0035 v35 = load.i64 notrap aligned readonly can_move region9 v0+56+;; @0035 v34 = load.i64 notrap aligned readonly can_move region8 v0+72;; @0035 call_indirect sig0, v35(v34, v0);; @0037 return;;;; block2:-;; @0039 v37 = load.i64 notrap aligned readonly can_move region8 v0+88-;; @0039 v36 = load.i64 notrap aligned readonly can_move region7 v0+104+;; @0039 v37 = load.i64 notrap aligned readonly can_move region9 v0+88+;; @0039 v36 = load.i64 notrap aligned readonly can_move region8 v0+104;; @0039 call_indirect sig0, v37(v36, v0);; @003b return;; }diff --git a/tests/disas/gc/null/funcref-in-gc-heap-new.wat b/tests/disas/gc/null/funcref-in-gc-heap-new.watindex 85ec3bfd18..9bf4a91c1c 100644--- a/tests/disas/gc/null/funcref-in-gc-heap-new.wat+++ b/tests/disas/gc/null/funcref-in-gc-heap-new.wat@@ -18,8 +18,9 @@;; region5 = 196 "";; region6 = 130 "";; region7 = 6 ""-;; region8 = 108 ""-;; region9 = 147 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 147 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -53,13 +54,13 @@;; @0020 store user2 region8 v46, v24 ; v46 = -1342177264;; @0020 v27 = load.i64 notrap aligned readonly can_move region6 v0+40;; @0020 v28 = load.i32 notrap aligned readonly can_move region7 v27-;; @0020 store user2 region8 v28, v24+4+;; @0020 store user2 region9 v28, v24+4;; @0020 store.i32 notrap aligned region3 v14, v7;; @0020 v31 = call fn1(v0, v2);; @0020 v32 = ireduce.i32 v31;; @0020 v29 = iconst.i64 8;; @0020 v30 = iadd v24, v29 ; v29 = 8-;; @0020 store user2 little region9 v32, v30+;; @0020 store user2 little region10 v32, v30;; @0023 jump block1;;;; block3 cold:diff --git a/tests/disas/gc/null/ref-cast.wat b/tests/disas/gc/null/ref-cast.watindex 54cc325950..be12caff53 100644--- a/tests/disas/gc/null/ref-cast.wat+++ b/tests/disas/gc/null/ref-cast.wat@@ -13,9 +13,10 @@;; region1 = 160 "";; region2 = 196 "";; region3 = 206 ""-;; region4 = 108 ""+;; region4 = 239 "";; region5 = 130 "";; region6 = 6 ""+;; region7 = 134 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -47,7 +48,7 @@;; block5:;; @001e v28 = iconst.i64 4;; @001e v29 = iadd.i64 v13, v28 ; v28 = 4-;; @001e v30 = load.i32 user2 readonly region4 v29+;; @001e v30 = load.i32 user2 readonly region7 v29;; @001e v22 = load.i64 notrap aligned readonly can_move region5 v0+40;; @001e v23 = load.i32 notrap aligned readonly can_move region6 v22;; @001e v31 = icmp eq v30, v23diff --git a/tests/disas/gc/null/ref-test-array.wat b/tests/disas/gc/null/ref-test-array.watindex 8027edb31e..51a1a1bf51 100644--- a/tests/disas/gc/null/ref-test-array.wat+++ b/tests/disas/gc/null/ref-test-array.wat@@ -12,7 +12,7 @@;; region1 = 160 "";; region2 = 196 "";; region3 = 206 ""-;; region4 = 108 ""+;; region4 = 239 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24diff --git a/tests/disas/gc/null/ref-test-concrete-type.wat b/tests/disas/gc/null/ref-test-concrete-type.watindex 0d0578115b..81ff1790d7 100644--- a/tests/disas/gc/null/ref-test-concrete-type.wat+++ b/tests/disas/gc/null/ref-test-concrete-type.wat@@ -13,9 +13,10 @@;; region1 = 160 "";; region2 = 196 "";; region3 = 206 ""-;; region4 = 108 ""+;; region4 = 239 "";; region5 = 130 "";; region6 = 6 ""+;; region7 = 134 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -47,7 +48,7 @@;; block5:;; @001d v28 = iconst.i64 4;; @001d v29 = iadd.i64 v13, v28 ; v28 = 4-;; @001d v30 = load.i32 user2 readonly region4 v29+;; @001d v30 = load.i32 user2 readonly region7 v29;; @001d v22 = load.i64 notrap aligned readonly can_move region5 v0+40;; @001d v23 = load.i32 notrap aligned readonly can_move region6 v22;; @001d v31 = icmp eq v30, v23diff --git a/tests/disas/gc/null/ref-test-eq.wat b/tests/disas/gc/null/ref-test-eq.watindex 3d24222cd6..1b818b436a 100644--- a/tests/disas/gc/null/ref-test-eq.wat+++ b/tests/disas/gc/null/ref-test-eq.wat@@ -12,7 +12,7 @@;; region1 = 160 "";; region2 = 196 "";; region3 = 206 ""-;; region4 = 108 ""+;; region4 = 239 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24diff --git a/tests/disas/gc/null/ref-test-struct.wat b/tests/disas/gc/null/ref-test-struct.watindex a5c6e00e0b..1c7c872898 100644--- a/tests/disas/gc/null/ref-test-struct.wat+++ b/tests/disas/gc/null/ref-test-struct.wat@@ -12,7 +12,7 @@;; region1 = 160 "";; region2 = 196 "";; region3 = 206 ""-;; region4 = 108 ""+;; region4 = 239 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24diff --git a/tests/disas/gc/null/struct-new-default.wat b/tests/disas/gc/null/struct-new-default.watindex 6a3838177b..bf8ff3fc69 100644--- a/tests/disas/gc/null/struct-new-default.wat+++ b/tests/disas/gc/null/struct-new-default.wat@@ -20,10 +20,11 @@;; region5 = 196 "";; region6 = 130 "";; region7 = 6 ""-;; region8 = 108 ""-;; region9 = 147 ""-;; region10 = 225 ""-;; region11 = 152 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 147 ""+;; region11 = 225 ""+;; region12 = 152 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -55,19 +56,19 @@;; @0021 store user2 region8 v49, v26 ; v49 = -1342177256;; @0021 v29 = load.i64 notrap aligned readonly can_move region6 v0+40;; @0021 v30 = load.i32 notrap aligned readonly can_move region7 v29-;; @0021 store user2 region8 v30, v26+4+;; @0021 store user2 region9 v30, v26+4;; @0021 store.i32 notrap aligned region3 v16, v9;; @0021 v2 = f32const 0.0;; @0021 v31 = iconst.i64 8;; @0021 v32 = iadd v26, v31 ; v31 = 8-;; @0021 store user2 little region9 v2, v32 ; v2 = 0.0+;; @0021 store user2 little region10 v2, v32 ; v2 = 0.0;; @0021 v3 = iconst.i32 0;; @0021 v33 = iconst.i64 12;; @0021 v34 = iadd v26, v33 ; v33 = 12-;; @0021 istore8 user2 little region10 v3, v34 ; v3 = 0+;; @0021 istore8 user2 little region11 v3, v34 ; v3 = 0;; @0021 v35 = iconst.i64 16;; @0021 v36 = iadd v26, v35 ; v35 = 16-;; @0021 store user2 little region11 v3, v36 ; v3 = 0+;; @0021 store user2 little region12 v3, v36 ; v3 = 0;; @0024 jump block1;;;; block3 cold:diff --git a/tests/disas/gc/null/struct-new.wat b/tests/disas/gc/null/struct-new.watindex 97a71a597c..5a482f134d 100644--- a/tests/disas/gc/null/struct-new.wat+++ b/tests/disas/gc/null/struct-new.wat@@ -21,11 +21,12 @@;; region5 = 196 "";; region6 = 130 "";; region7 = 6 ""-;; region8 = 108 ""-;; region9 = 147 ""-;; region10 = 225 ""-;; region11 = 152 ""-;; region12 = 135 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 147 ""+;; region11 = 225 ""+;; region12 = 152 ""+;; region13 = 135 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -35,7 +36,7 @@;;;; block0(v0: i64, v1: i64, v2: f32, v3: i32, v4: i32):;; v39 = stack_addr.i64 ss0-;; store notrap aligned region12 v4, v39+;; store notrap aligned region13 v4, v39;; @002a v9 = load.i64 notrap aligned readonly can_move region2 v0+32;; @002a v10 = load.i32 notrap aligned region3 v9;; v46 = iconst.i32 7@@ -59,18 +60,18 @@;; @002a store user2 region8 v53, v26 ; v53 = -1342177256;; @002a v29 = load.i64 notrap aligned readonly can_move region6 v0+40;; @002a v30 = load.i32 notrap aligned readonly can_move region7 v29-;; @002a store user2 region8 v30, v26+4+;; @002a store user2 region9 v30, v26+4;; @002a store.i32 notrap aligned region3 v16, v9;; @002a v31 = iconst.i64 8;; @002a v32 = iadd v26, v31 ; v31 = 8-;; @002a store.f32 user2 little region9 v2, v32+;; @002a store.f32 user2 little region10 v2, v32;; @002a v33 = iconst.i64 12;; @002a v34 = iadd v26, v33 ; v33 = 12-;; @002a istore8.i32 user2 little region10 v3, v34-;; v38 = load.i32 notrap aligned region12 v39+;; @002a istore8.i32 user2 little region11 v3, v34+;; v38 = load.i32 notrap aligned region13 v39;; @002a v35 = iconst.i64 16;; @002a v36 = iadd v26, v35 ; v35 = 16-;; @002a store user2 little region11 v38, v36+;; @002a store user2 little region12 v38, v36;; @002d jump block1;;;; block3 cold:diff --git a/tests/disas/gc/ref-test-cast-final-type.wat b/tests/disas/gc/ref-test-cast-final-type.watindex 163cfc3899..1d85da7a1c 100644--- a/tests/disas/gc/ref-test-cast-final-type.wat+++ b/tests/disas/gc/ref-test-cast-final-type.wat@@ -19,9 +19,10 @@;; region1 = 160 "";; region2 = 196 "";; region3 = 206 ""-;; region4 = 108 ""+;; region4 = 239 "";; region5 = 130 "";; region6 = 6 ""+;; region7 = 134 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -53,7 +54,7 @@;; block5:;; @0024 v28 = iconst.i64 4;; @0024 v29 = iadd.i64 v13, v28 ; v28 = 4-;; @0024 v30 = load.i32 user2 readonly region4 v29+;; @0024 v30 = load.i32 user2 readonly region7 v29;; @0024 v22 = load.i64 notrap aligned readonly can_move region5 v0+40;; @0024 v23 = load.i32 notrap aligned readonly can_move region6 v22;; @0024 v31 = icmp eq v30, v23@@ -72,9 +73,10 @@;; region1 = 160 "";; region2 = 196 "";; region3 = 206 ""-;; region4 = 108 ""+;; region4 = 239 "";; region5 = 130 "";; region6 = 6 ""+;; region7 = 134 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -106,7 +108,7 @@;; block5:;; @002c v28 = iconst.i64 4;; @002c v29 = iadd.i64 v13, v28 ; v28 = 4-;; @002c v30 = load.i32 user2 readonly region4 v29+;; @002c v30 = load.i32 user2 readonly region7 v29;; @002c v22 = load.i64 notrap aligned readonly can_move region5 v0+40;; @002c v23 = load.i32 notrap aligned readonly can_move region6 v22;; @002c v31 = icmp eq v30, v23diff --git a/tests/disas/gc/struct-new-default.wat b/tests/disas/gc/struct-new-default.watindex b56bf7dcde..fa16643557 100644--- a/tests/disas/gc/struct-new-default.wat+++ b/tests/disas/gc/struct-new-default.wat@@ -21,11 +21,13 @@;; region5 = 130 "";; region6 = 6 "";; region7 = 196 ""-;; region8 = 108 ""-;; region9 = 147 ""-;; region10 = 225 ""-;; region11 = 152 ""-;; region12 = 245 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 90 ""+;; region11 = 147 ""+;; region12 = 225 ""+;; region13 = 152 ""+;; region14 = 245 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -56,9 +58,9 @@;; @0023 store user2 region8 v63, v32 ; v63 = -1342177246;; v66 = load.i64 notrap aligned readonly can_move region5 v0+40;; v67 = load.i32 notrap aligned readonly can_move region6 v66-;; @0023 store user2 region8 v67, v32+4+;; @0023 store user2 region9 v67, v32+4;; v68 = iconst.i64 48-;; @0023 istore32 user2 region8 v68, v32+8 ; v68 = 48+;; @0023 istore32 user2 region10 v68, v32+8 ; v68 = 48;; @0023 jump block4(v8, v32);;;; block3 cold:@@ -78,18 +80,18 @@;; @0023 v2 = f32const 0.0;; @0023 v38 = iconst.i64 16;; @0023 v39 = iadd v37, v38 ; v38 = 16-;; @0023 store user2 little region9 v2, v39 ; v2 = 0.0+;; @0023 store user2 little region11 v2, v39 ; v2 = 0.0;; @0023 v3 = iconst.i32 0;; @0023 v40 = iconst.i64 20;; @0023 v41 = iadd v37, v40 ; v40 = 20-;; @0023 istore8 user2 little region10 v3, v41 ; v3 = 0+;; @0023 istore8 user2 little region12 v3, v41 ; v3 = 0;; @0023 v42 = iconst.i64 24;; @0023 v43 = iadd v37, v42 ; v42 = 24-;; @0023 store user2 little region11 v3, v43 ; v3 = 0+;; @0023 store user2 little region13 v3, v43 ; v3 = 0;; @0023 v5 = vconst.i8x16 const0;; @0023 v44 = iconst.i64 32;; @0023 v45 = iadd v37, v44 ; v44 = 32-;; @0023 store user2 little region12 v5, v45 ; v5 = const0+;; @0023 store user2 little region14 v5, v45 ; v5 = const0;; @0026 jump block1;;;; block1:diff --git a/tests/disas/gc/struct-new.wat b/tests/disas/gc/struct-new.watindex 5d1e77c63a..4de40ebf07 100644--- a/tests/disas/gc/struct-new.wat+++ b/tests/disas/gc/struct-new.wat@@ -21,11 +21,13 @@;; region5 = 130 "";; region6 = 6 "";; region7 = 196 ""-;; region8 = 108 ""-;; region9 = 147 ""-;; region10 = 225 ""-;; region11 = 152 ""-;; region12 = 135 ""+;; region8 = 239 ""+;; region9 = 134 ""+;; region10 = 90 ""+;; region11 = 147 ""+;; region12 = 225 ""+;; region13 = 152 ""+;; region14 = 135 "";; gv0 = vmctx;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8;; gv2 = load.i64 notrap aligned region1 gv1+24@@ -35,7 +37,7 @@;;;; block0(v0: i64, v1: i64, v2: f32, v3: i32, v4: i32):;; v45 = stack_addr.i64 ss0-;; store notrap aligned region12 v4, v45+;; store notrap aligned region14 v4, v45;; @002a v6 = load.i64 notrap aligned readonly can_move region2 v0+32;; @002a v7 = load.i32 notrap aligned region3 v6;; @002a v8 = load.i32 notrap aligned region4 v6+4@@ -57,9 +59,9 @@;; @002a store user2 region8 v63, v31 ; v63 = -1342177246;; v66 = load.i64 notrap aligned readonly can_move region5 v0+40;; v67 = load.i32 notrap aligned readonly can_move region6 v66-;; @002a store user2 region8 v67, v31+4+;; @002a store user2 region9 v67, v31+4;; v68 = iconst.i64 32-;; @002a istore32 user2 region8 v68, v31+8 ; v68 = 32+;; @002a istore32 user2 region10 v68, v31+8 ; v68 = 32;; @002a jump block4(v7, v31);;;; block3 cold:@@ -78,14 +80,14 @@;; block4(v35: i32, v36: i64):;; @002a v37 = iconst.i64 16;; @002a v38 = iadd v36, v37 ; v37 = 16-;; @002a store.f32 user2 little region9 v2, v38+;; @002a store.f32 user2 little region11 v2, v38;; @002a v39 = iconst.i64 20;; @002a v40 = iadd v36, v39 ; v39 = 20-;; @002a istore8.i32 user2 little region10 v3, v40-;; v44 = load.i32 notrap aligned region12 v45+;; @002a istore8.i32 user2 little region12 v3, v40+;; v44 = load.i32 notrap aligned region14 v45;; @002a v41 = iconst.i64 24;; @002a v42 = iadd v36, v41 ; v41 = 24-;; @002a store user2 little region11 v44, v42+;; @002a store user2 little region13 v44, v42;; @002d jump block1;;;; block1:diff --git a/tests/misc_testsuite/gc/alias-region-exn-tag.wast b/tests/misc_testsuite/gc/alias-region-exn-tag.wastnew file mode 100644index 0000000000..3ff1ead1af--- /dev/null+++ b/tests/misc_testsuite/gc/alias-region-exn-tag.wast@@ -0,0 +1,82 @@+;;! gc = true+;;! exceptions = true++;; An exception object's two tag words each get their own alias region, which+;; must be distinct from each other and from every payload's region.++(component+ (core module $A+ ;; Two tags with identical payload signatures, so telling them apart at+ ;; the catch site depends entirely on the tag words.+ (tag $t0 (export "t0") (param i32 i64))+ (tag $t1 (export "t1") (param i32 i64))++ (func (export "throw0") (param i32 i64)+ (throw $t0 (local.get 0) (local.get 1)))+ (func (export "throw1") (param i32 i64)+ (throw $t1 (local.get 0) (local.get 1)))+ )++ (core instance $a (instantiate $A))++ (core module $B+ ;; Shift this module's type index space relative to $A's.+ (type $unused0 (struct (field f64)))+ (type $unused1 (array (mut i64)))++ (import "" "t0" (tag $t0 (param i32 i64)))+ (import "" "t1" (tag $t1 (param i32 i64)))+ (import "" "throw0" (func $throw0 (param i32 i64)))+ (import "" "throw1" (func $throw1 (param i32 i64)))++ (func $catch (param $throw-t1 i32) (param $p1-expected i64) (result i32)+ (local $which i32)+ (local $p0 i32)+ (local $p1 i64)+ (block $done+ (block $as-t0 (result i32 i64)+ (block $as-t1 (result i32 i64)+ (try_table (catch $t0 $as-t0) (catch $t1 $as-t1)+ (if (local.get $throw-t1)+ (then (call $throw1 (i32.const 0x22) (local.get $p1-expected)))+ (else (call $throw0 (i32.const 0x11) (local.get $p1-expected)))))+ (return (i32.const 0)))++ ;; Caught as `$t1`.+ (local.set $p1)+ (local.set $p0)+ (local.set $which (i32.const 2))+ (br $done))++ ;; Caught as `$t0`.+ (local.set $p1)+ (local.set $p0)+ (local.set $which (i32.const 1)))++ (if (i64.ne (local.get $p1) (local.get $p1-expected))+ (then (return (i32.const 0))))+ (i32.add (i32.mul (local.get $which) (i32.const 0x1000))+ (local.get $p0)))++ (func (export "catch-0") (result i32)+ (call $catch (i32.const 0) (i64.const 0x2222_3333_4444_5555)))++ (func (export "catch-1") (result i32)+ (call $catch (i32.const 1) (i64.const 0x6666_7777_8888_9999)))+ )++ (core instance $b (instantiate $B+ (with "" (instance+ (export "t0" (tag $a "t0"))+ (export "t1" (tag $a "t1"))+ (export "throw0" (func $a "throw0"))+ (export "throw1" (func $a "throw1"))))))++ (func (export "catch-0") (result u32)+ (canon lift (core func $b "catch-0")))+ (func (export "catch-1") (result u32)+ (canon lift (core func $b "catch-1")))+)++(assert_return (invoke "catch-0") (u32.const 0x1011))+(assert_return (invoke "catch-1") (u32.const 0x2022))diff --git a/winch/codegen/src/codegen/drc.rs b/winch/codegen/src/codegen/drc.rsindex 8f3a1b45a3..4f2cc81fee 100644--- a/winch/codegen/src/codegen/drc.rs+++ b/winch/codegen/src/codegen/drc.rs@@ -90,7 +90,9 @@ wherelet header_extent = i64::from(self.env.vmoffsets- .vm_drc_header_next_over_approximated_stack_root(),+ .ptr+ .vm_drc_header()+ .next_over_approximated_stack_root(),) + 4;self.emit_gc_ref_bounds_check(ref_reg, bound_reg, header_extent)?;@@ -139,7 +141,7 @@ wherelet old_reg = self.context.any_gpr(self.masm)?;self.masm.load(addr, writable!(old_reg), OperandSize::S32)?;- let ref_count_offset = self.env.vmoffsets.vm_drc_header_ref_count();+ let ref_count_offset = u32::from(self.env.vmoffsets.ptr.vm_drc_header().ref_count());let header_extent = i64::from(ref_count_offset + DRC_REF_COUNT_SIZE);// Retain the new heap reference before publishing it. This ordering@@ -202,7 +204,7 @@ whereobject_addr: Reg,skip: MachLabel,) -> Result<()> {- let reserved_offset = self.env.vmoffsets.vm_gc_header_reserved_bits();+ let reserved_offset = u32::from(self.env.vmoffsets.ptr.vm_gc_header().kind());self.masm.with_scratch::<IntScratch, _>(|masm, scratch| {masm.load(masm.address_at_reg(object_addr, reserved_offset)?,@@ -253,11 +255,14 @@ where.vm_drc_heap_data().current_over_approximated_stack_roots_len(),);- let next_offset = self- .env- .vmoffsets- .vm_drc_header_next_over_approximated_stack_root();- let reserved_offset = self.env.vmoffsets.vm_gc_header_reserved_bits();+ let next_offset = u32::from(+ self.env+ .vmoffsets+ .ptr+ .vm_drc_header()+ .next_over_approximated_stack_root(),+ );+ let reserved_offset = u32::from(self.env.vmoffsets.ptr.vm_gc_header().kind());let heap_data_reg = self.context.any_gpr(self.masm)?;self.masm.load_ptr(@@ -401,7 +406,7 @@ whereheap_base: Reg,heap_bound: Reg,) -> Result<()> {- let ref_count_offset = self.env.vmoffsets.vm_drc_header_ref_count();+ let ref_count_offset = u32::from(self.env.vmoffsets.ptr.vm_drc_header().ref_count());let header_extent = i64::from(ref_count_offset + DRC_REF_COUNT_SIZE);self.emit_gc_ref_bounds_check(gc_ref, heap_bound, header_extent)?;@@ -431,7 +436,7 @@ whereobject_addr: Reg,mutation: RefCountMutation,) -> Result<Reg> {- let ref_count_offset = self.env.vmoffsets.vm_drc_header_ref_count();+ let ref_count_offset = u32::from(self.env.vmoffsets.ptr.vm_drc_header().ref_count());let count = self.context.any_gpr(self.masm)?;self.masm.load(self.masm.address_at_reg(object_addr, ref_count_offset)?,@@ -452,7 +457,7 @@ where}fn emit_store_ref_count(&mut self, object_addr: Reg, count: Reg) -> Result<()> {- let ref_count_offset = self.env.vmoffsets.vm_drc_header_ref_count();+ let ref_count_offset = u32::from(self.env.vmoffsets.ptr.vm_drc_header().ref_count());self.masm.store(count.into(),self.masm.address_at_reg(object_addr, ref_count_offset)?,