Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Give each GC struct field and array element its own alias region (#14351)

Nick Fitzgerald6f3af146c388
diff --git a/crates/cranelift/src/alias_region.rs b/crates/cranelift/src/alias_region.rs
index bcab270214..d2fd475902 100644
--- a/crates/cranelift/src/alias_region.rs
+++ b/crates/cranelift/src/alias_region.rs
@@ -19,16 +19,16 @@
//! We strive to avoid adding new hand-written methods as much as possible.
use crate::translate::Load;
-use core::fmt;
use cranelift_codegen::{
cursor::FuncCursor,
ir::{self, InstBuilder as _},
};
+use std::collections::HashMap;
use std::hash::{Hash as _, Hasher};
use wasmtime_environ::{
BuiltinFunctionIndex, DefinedGlobalIndex, DefinedMemoryIndex, DefinedTableIndex, GetPtrSize,
- ModuleInternedTypeIndex, NUM_COMPONENT_CONTEXT_SLOTS, PtrSize as _, RuntimeDataIndex,
- StaticModuleIndex, VMOffsets, VmctxArrayIndex as _,
+ ModuleInternedTypeIndex, ModuleTypesBuilder, NUM_COMPONENT_CONTEXT_SLOTS, PtrSize as _,
+ RuntimeDataIndex, StaticModuleIndex, VMOffsets, VmctxArrayIndex as _, WasmCompositeInnerType,
component::{
ComponentBuiltinFunctionIndex, LoweredIndex, ResourceIndex, RuntimeCallbackIndex,
RuntimeComponentInstanceIndex, RuntimeMemoryIndex, RuntimePostReturnIndex,
@@ -88,7 +88,7 @@ enum VmType {
///
/// This is used to assign stable `user_id`s to `AliasRegionData` entries so
/// that alias regions can be deduplicated during inlining.
-#[derive(Clone, Copy, PartialEq, Eq, Hash)]
+#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
enum AliasRegionKey {
/// An access of a field within a VM data structure of type `ty`.
Vm {
@@ -135,9 +135,32 @@ enum AliasRegionKey {
index: DefinedGlobalIndex,
},
- /// A GC heap access.
+ /// 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 struct's field.
+ GcStructField {
+ /// The first supertype that introduced this field.
+ ty: ModuleInternedTypeIndex,
+ /// The index of the field being accessed.
+ field: u32,
+ },
+
+ /// An access of a GC array's elements, which all share one region.
+ GcArrayElements {
+ /// The first supertype that introduced these elements.
+ ty: ModuleInternedTypeIndex,
+ },
+
+ /// An access of an exception object's payload field.
+ GcExnPayload {
+ /// The exception type.
+ exn_ty: ModuleInternedTypeIndex,
+ /// The payload field being accessed.
+ field: u32,
+ },
+
/// A stack slot access.
Stack {
/// The stack slot being accessed.
@@ -267,29 +290,26 @@ impl AliasRegionKey {
}
}
-impl fmt::Debug for AliasRegionKey {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- match self {
- AliasRegionKey::Vm { ty, offset } => write!(f, "{ty:?}+{offset:#x}"),
- AliasRegionKey::PublicMemory => write!(f, "PublicMemory"),
- AliasRegionKey::DefinedMemory { module, index } => {
- write!(f, "DefinedMemory({module:?}, {index:?})")
- }
- AliasRegionKey::PublicTable => write!(f, "PublicTable"),
- AliasRegionKey::DefinedTable { module, index } => {
- write!(f, "DefinedTable({module:?}, {index:?})")
- }
- AliasRegionKey::PublicGlobal => write!(f, "PublicGlobal"),
- AliasRegionKey::DefinedGlobal { module, index } => {
- write!(f, "DefinedGlobal({module:?}, {index:?})")
- }
- AliasRegionKey::GcHeap => write!(f, "GcHeap"),
- AliasRegionKey::Stack { slot } => write!(f, "Stack({slot:?})"),
- AliasRegionKey::UnsafeIntrinsicMemory => write!(f, "UnsafeIntrinsicMemory"),
- AliasRegionKey::ElementSegment => write!(f, "ElementSegment"),
- AliasRegionKey::DataSegment => write!(f, "DataSegment"),
- }
- }
+/// Which logical part of a GC object an access targets.
+#[derive(Clone, Copy, Debug)]
+pub enum GcAccess {
+ /// An access of a struct's field, by the type at the access site.
+ StructField {
+ ty: ModuleInternedTypeIndex,
+ field: u32,
+ },
+
+ /// An access of one of an array's elements, by the type at the access site.
+ ArrayElements { ty: ModuleInternedTypeIndex },
+
+ /// An access of an exception object's payload field.
+ ExnPayload {
+ exn_ty: ModuleInternedTypeIndex,
+ field: u32,
+ },
+
+ /// An access of non-payload bytes: a header, length, ref count, or tag.
+ Header,
}
/// Alias region bookkeeping and load/store helper type.
@@ -300,6 +320,10 @@ impl fmt::Debug for AliasRegionKey {
pub struct AliasRegions<Offsets> {
pointer_type: ir::Type,
offsets: Offsets,
+
+ /// Cache for `Self::gc_introducer`, keyed on the access site's type and the
+ /// field index, if any.
+ gc_introducer_cache: HashMap<(ModuleInternedTypeIndex, u32), ModuleInternedTypeIndex>,
}
impl<Offsets> AliasRegions<Offsets> {
@@ -1134,6 +1158,7 @@ where
pointer_type: ir::Type::int_with_byte_size(offsets.get_ptr_size().size().into())
.unwrap(),
offsets,
+ gc_introducer_cache: HashMap::new(),
}
}
@@ -1148,11 +1173,81 @@ where
self.offsets.get_ptr_size()
}
- /// Get the alias region for accesses into the GC heap.
+ /// 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,
+ func: &mut ir::Function,
+ types: &ModuleTypesBuilder,
+ access: GcAccess,
+ ) -> ir::AliasRegion {
+ let key = match access {
+ GcAccess::Header => AliasRegionKey::GcHeap,
+ GcAccess::StructField { ty, field } => AliasRegionKey::GcStructField {
+ ty: self.gc_introducer(types, ty, field),
+ field,
+ },
+ GcAccess::ArrayElements { ty } => AliasRegionKey::GcArrayElements {
+ ty: self.gc_introducer(types, ty, 0),
+ },
+ GcAccess::ExnPayload { exn_ty, field } => {
+ AliasRegionKey::GcExnPayload { exn_ty, field }
+ }
+ };
+ self.region(func, key)
+ }
+
+ /// Find the type that introduced the given field (or, for arrays, the
+ /// elements) into `ty`'s subtyping hierarchy, memoizing the answer.
+ fn gc_introducer(
+ &mut self,
+ types: &ModuleTypesBuilder,
+ ty: ModuleInternedTypeIndex,
+ field: u32,
+ ) -> ModuleInternedTypeIndex {
+ if let Some(introducer) = self.gc_introducer_cache.get(&(ty, field)) {
+ return *introducer;
+ }
+
+ let mut introducer = ty;
+ while let Some(supertype) = types[introducer].supertype {
+ let supertype = supertype.unwrap_module_type_index();
+
+ let supertype_declares_field = match &types[supertype].composite_type.inner {
+ // Subtyping a struct can only append new fields, so we need
+ // only look at the field length.
+ WasmCompositeInnerType::Struct(s) => field < u32::try_from(s.fields.len()).unwrap(),
+
+ // Array elements are always introduced by the first type
+ // without a supertype.
+ WasmCompositeInnerType::Array(_) => true,
+
+ inner @ WasmCompositeInnerType::Func(_)
+ | inner @ WasmCompositeInnerType::Cont(_)
+ | inner @ WasmCompositeInnerType::Exn(_) => {
+ unreachable!("not a GC type with subtyping: {inner:?}")
+ }
+ };
+
+ if supertype_declares_field {
+ introducer = supertype;
+ } else {
+ break;
+ }
+ }
+
+ self.gc_introducer_cache.insert((ty, field), introducer);
+ introducer
+ }
+
/// Get the alias region shared by all memories that cross a module boundary
/// and whose definition we do not statically know.
pub fn public_memory_region(&mut self, func: &mut ir::Function) -> ir::AliasRegion {
@@ -1498,3 +1593,38 @@ pub(crate) fn debug_assert_all_mem_insts_have_alias_regions(func: &ir::Function)
}
}
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ /// Collisions are sound and only cost an optimization, so this is not a
+ /// correctness test: it exists so that anything reshuffling the key hashes
+ /// says so here rather than as `tests/disas` diffs where two regions have
+ /// quietly merged. If it fires, find a new `SEED` as described on
+ /// `into_raw`, additionally covering the keys below.
+ #[test]
+ fn gc_keys_do_not_collide() {
+ let ty = ModuleInternedTypeIndex::from_u32;
+
+ let mut keys = vec![AliasRegionKey::GcHeap];
+ for t in 0..3 {
+ for field in 0..2 {
+ keys.push(AliasRegionKey::GcStructField { ty: ty(t), field });
+ }
+ keys.push(AliasRegionKey::GcArrayElements { ty: ty(t) });
+ }
+
+ for (i, a) in keys.iter().enumerate() {
+ for b in &keys[i + 1..] {
+ assert_ne!(
+ a.into_raw(),
+ b.into_raw(),
+ "alias region keys {a:?} and {b:?} collide on \
+ user_id {}; a new `SEED` is needed",
+ a.into_raw(),
+ );
+ }
+ }
+ }
+}
diff --git a/crates/cranelift/src/func_environ.rs b/crates/cranelift/src/func_environ.rs
index 6da9845a9e..91eb2fcadc 100644
--- a/crates/cranelift/src/func_environ.rs
+++ b/crates/cranelift/src/func_environ.rs
@@ -1,7 +1,7 @@
mod gc;
pub(crate) mod stack_switching;
-use crate::alias_region::AliasRegions;
+use crate::alias_region::{AliasRegions, GcAccess};
use crate::compiler::Compiler;
use crate::translate::{
FuncTranslationStacks, Heap, HeapData, MemoryKind, StructFieldsVec, TableData, TableSize,
@@ -498,7 +498,11 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
match entity {
CheckedEntity::Memory(index) => self.memory_alias_region(func, index),
CheckedEntity::Table { table, .. } => self.table_alias_region(func, table),
- CheckedEntity::Array { .. } => self.alias_regions.gc_heap_region(func),
+ CheckedEntity::Array { ty, .. } => self.alias_regions.gc_access_region(
+ func,
+ self.types,
+ GcAccess::ArrayElements { ty },
+ ),
CheckedEntity::Elem(_) => self.alias_regions.element_segment_region(func),
CheckedEntity::Data { .. } | CheckedEntity::RuntimeData(_) => {
self.alias_regions.data_segment_region(func)
@@ -3960,9 +3964,14 @@ impl FuncEnvironment<'_> {
initialized,
)?
}
- CheckedEntity::Array { initialized, .. } => {
+ CheckedEntity::Array {
+ initialized, ty, ..
+ } => {
+ let access = GcAccess::ArrayElements { ty };
if is_pre_interned_funcref {
- let region = self.alias_regions.gc_heap_region(builder.func);
+ let region =
+ self.alias_regions
+ .gc_access_region(builder.func, self.types, access);
builder.ins().store(
ir::MemFlagsData::trusted()
.with_endianness(Endianness::Little)
@@ -3972,9 +3981,9 @@ impl FuncEnvironment<'_> {
0,
);
} else if initialized {
- gc::write_field_at_addr(self, builder, elem_ty, elem_addr, value)?
+ gc::write_field_at_addr(self, builder, elem_ty, elem_addr, access, value)?
} else {
- gc::init_field_at_addr(self, builder, elem_ty, elem_addr, value)?
+ gc::init_field_at_addr(self, builder, elem_ty, elem_addr, access, value)?
}
}
_ => unreachable!(),
@@ -4594,10 +4603,19 @@ impl FuncEnvironment<'_> {
assert!(initialized);
this.translate_table_get(builder, table, src_index)?
}
- CheckedEntity::Array { initialized, .. } => {
+ CheckedEntity::Array {
+ initialized, ty, ..
+ } => {
assert!(initialized);
let read_ty = src_entity.storage_type(this);
- gc::read_field_at_addr(this, builder, read_ty, src, None)?
+ gc::read_field_at_addr(
+ this,
+ builder,
+ read_ty,
+ src,
+ GcAccess::ArrayElements { ty },
+ None,
+ )?
}
CheckedEntity::Elem(_) => {
let WasmStorageType::Val(WasmValType::Ref(ty)) = write_ty else {
@@ -4636,11 +4654,14 @@ impl FuncEnvironment<'_> {
initialized,
)?;
}
- CheckedEntity::Array { initialized, .. } => {
+ CheckedEntity::Array {
+ initialized, ty, ..
+ } => {
+ let access = GcAccess::ArrayElements { ty };
if initialized {
- gc::write_field_at_addr(this, builder, write_ty, dst, val)?
+ gc::write_field_at_addr(this, builder, write_ty, dst, access, val)?
} else {
- gc::init_field_at_addr(this, builder, write_ty, dst, val)?
+ gc::init_field_at_addr(this, builder, write_ty, dst, access, val)?
}
}
CheckedEntity::Memory(_)
diff --git a/crates/cranelift/src/func_environ/gc.rs b/crates/cranelift/src/func_environ/gc.rs
index 8603eca2a8..85fad8e47b 100644
--- a/crates/cranelift/src/func_environ/gc.rs
+++ b/crates/cranelift/src/func_environ/gc.rs
@@ -1,6 +1,7 @@
//! Interface to compiling GC-related things.
use crate::TRAP_ARRAY_OUT_OF_BOUNDS;
+use crate::alias_region::GcAccess;
use crate::bounds_checks::BoundsCheck;
use crate::func_environ::{CheckedEntity, Extension, FuncEnvironment, stack_switching::fatpointer};
use crate::translate::{
@@ -179,6 +180,7 @@ pub trait GcCompiler {
builder: &mut FunctionBuilder,
ty: WasmStorageType,
addr: ir::Value,
+ access: GcAccess,
val: ir::Value,
) -> WasmResult<()>;
}
@@ -288,7 +290,9 @@ fn emit_gc_kind_assert(
object_size: wasmtime_environ::VM_GC_HEADER_SIZE,
},
);
- let flags = func_env.gc_memflags(&mut builder.func).with_readonly();
+ let flags = func_env
+ .gc_header_memflags(&mut builder.func)
+ .with_readonly();
let kind_and_reserved_bits = builder.ins().load(ir::types::I32, flags, kind_addr, 0);
let kind_mask = builder
.ins()
@@ -316,6 +320,7 @@ pub fn read_field_at_addr(
builder: &mut FunctionBuilder<'_>,
ty: WasmStorageType,
addr: ir::Value,
+ access: GcAccess,
extension: Option<Extension>,
) -> WasmResult<ir::Value> {
assert_eq!(extension.is_none(), matches!(ty, WasmStorageType::Val(_)));
@@ -326,7 +331,7 @@ pub fn read_field_at_addr(
// Data inside GC objects is always little endian.
let flags = func_env
- .gc_memflags(&mut builder.func)
+ .gc_memflags_for(&mut builder.func, access)
.with_endianness(ir::Endianness::Little);
let value = match ty {
@@ -537,9 +542,10 @@ pub fn init_field_at_addr(
builder: &mut FunctionBuilder<'_>,
field_ty: WasmStorageType,
field_addr: ir::Value,
+ access: GcAccess,
new_val: ir::Value,
) -> WasmResult<()> {
- gc_compiler(func_env)?.init_field(func_env, builder, field_ty, field_addr, new_val)
+ gc_compiler(func_env)?.init_field(func_env, builder, field_ty, field_addr, access, new_val)
}
pub fn write_field_at_addr(
@@ -547,11 +553,12 @@ pub fn write_field_at_addr(
builder: &mut FunctionBuilder<'_>,
field_ty: WasmStorageType,
field_addr: ir::Value,
+ access: GcAccess,
new_val: ir::Value,
) -> WasmResult<()> {
// Data inside GC objects is always little endian.
let flags = func_env
- .gc_memflags(&mut builder.func)
+ .gc_memflags_for(&mut builder.func, access)
.with_endianness(ir::Endianness::Little);
match field_ty {
@@ -687,6 +694,10 @@ pub fn translate_struct_get(
builder,
field_ty.element_type,
field_addr,
+ GcAccess::StructField {
+ ty: interned_type_index,
+ field: u32::try_from(field_index).unwrap(),
+ },
extension,
);
log::trace!("translate_struct_get(..) -> {result:?}");
@@ -736,6 +747,10 @@ pub fn translate_struct_set(
builder,
field_ty.element_type,
field_addr,
+ GcAccess::StructField {
+ ty: interned_type_index,
+ field: u32::try_from(field_index).unwrap(),
+ },
new_val,
)?;
@@ -768,12 +783,21 @@ pub fn translate_exn_unbox(
// `func_env`, which we later mutate below via
// `prepare_gc_ref_access()`.
let mut accesses: SmallVec<[_; 4]> = smallvec![];
- for (field_ty, field_layout) in exception_ty.fields.iter().zip(exn_layout.fields.iter()) {
- accesses.push((field_layout.offset, field_ty.element_type));
+ for (i, (field_ty, field_layout)) in exception_ty
+ .fields
+ .iter()
+ .zip(exn_layout.fields.iter())
+ .enumerate()
+ {
+ accesses.push((
+ u32::try_from(i).unwrap(),
+ field_layout.offset,
+ field_ty.element_type,
+ ));
}
let mut result = smallvec![];
- for (field_offset, field_ty) in accesses {
+ for (field_index, field_offset, field_ty) in accesses {
let field_size = wasmtime_environ::byte_size_of_wasm_ty_in_gc_heap(&field_ty);
assert!(field_offset + field_size <= exn_size);
let field_addr = func_env.prepare_gc_ref_access(
@@ -786,7 +810,17 @@ pub fn translate_exn_unbox(
},
);
- let value = read_field_at_addr(func_env, builder, field_ty, field_addr, None)?;
+ let value = read_field_at_addr(
+ func_env,
+ builder,
+ field_ty,
+ field_addr,
+ GcAccess::ExnPayload {
+ exn_ty: exception_ty_idx,
+ field: field_index,
+ },
+ None,
+ )?;
result.push(value);
}
@@ -981,6 +1015,7 @@ pub fn translate_array_new_fixed(
builder,
array_ty.0.element_type,
addr,
+ GcAccess::ArrayElements { ty },
*elem,
)?;
}
@@ -1007,7 +1042,9 @@ pub fn translate_array_len(
access_size: u8::try_from(ir::types::I32.bytes()).unwrap(),
},
);
- let flags = func_env.gc_memflags(&mut builder.func).with_readonly();
+ let flags = func_env
+ .gc_header_memflags(&mut builder.func)
+ .with_readonly();
let result = builder.ins().load(ir::types::I32, flags, len_field, 0);
log::trace!("translate_array_len(..) -> {result:?}");
Ok(result)
@@ -1157,7 +1194,16 @@ pub fn translate_array_get(
let array_ty = func_env.types.unwrap_array(array_type_index)?;
let elem_ty = array_ty.0.element_type;
- let result = read_field_at_addr(func_env, builder, elem_ty, elem_addr, extension)?;
+ let result = read_field_at_addr(
+ func_env,
+ builder,
+ elem_ty,
+ elem_addr,
+ GcAccess::ArrayElements {
+ ty: array_type_index,
+ },
+ extension,
+ )?;
log::trace!("translate_array_get(..) -> {result:?}");
Ok(result)
}
@@ -1180,7 +1226,16 @@ pub fn translate_array_set(
let array_ty = func_env.types.unwrap_array(array_type_index)?;
let elem_ty = array_ty.0.element_type;
- write_field_at_addr(func_env, builder, elem_ty, elem_addr, value)?;
+ write_field_at_addr(
+ func_env,
+ builder,
+ elem_ty,
+ elem_addr,
+ GcAccess::ArrayElements {
+ ty: array_type_index,
+ },
+ value,
+ )?;
log::trace!("translate_array_set: finished");
Ok(())
@@ -1319,7 +1374,7 @@ pub fn translate_ref_test(
object_size: wasmtime_environ::VM_GC_HEADER_SIZE,
},
);
- let gc_memflags = func_env.gc_memflags(&mut builder.func);
+ let gc_memflags = func_env.gc_header_memflags(&mut builder.func);
let actual_kind =
builder
.ins()
@@ -1401,7 +1456,7 @@ pub fn translate_ref_test(
access_size: func_env.offsets.size_of_vmshared_type_index(),
},
);
- let gc_memflags = func_env.gc_memflags(&mut builder.func);
+ let gc_memflags = func_env.gc_header_memflags(&mut builder.func);
let actual_shared_ty =
builder
.ins()
@@ -1529,36 +1584,70 @@ fn initialize_struct_fields(
assert_eq!(field_offsets.len(), field_values.len());
assert!(!func_env.types[struct_ty].composite_type.shared);
- let fields = match &func_env.types[struct_ty].composite_type.inner {
- WasmCompositeInnerType::Struct(s) => &s.fields,
- WasmCompositeInnerType::Exn(e) => &e.fields,
+ // Struct and exception payloads use different alias region keys.
+ let (fields, is_exn) = match &func_env.types[struct_ty].composite_type.inner {
+ WasmCompositeInnerType::Struct(s) => (&s.fields, false),
+ WasmCompositeInnerType::Exn(e) => (&e.fields, true),
_ => panic!("Not a struct or exception type"),
};
let field_types: SmallVec<[_; 8]> = fields.iter().cloned().collect();
assert_eq!(field_types.len(), field_values.len());
- for ((ty, val), offset) in field_types.into_iter().zip(field_values).zip(field_offsets) {
+ for (i, ((ty, val), offset)) in field_types
+ .into_iter()
+ .zip(field_values)
+ .zip(field_offsets)
+ .enumerate()
+ {
let size_of_access = wasmtime_environ::byte_size_of_wasm_ty_in_gc_heap(&ty.element_type);
assert!(offset + size_of_access <= struct_size);
let field_addr = builder
.ins()
.iadd_imm_s(raw_ptr_to_struct, i64::from(offset));
- gc_compiler(func_env)?.init_field(func_env, builder, ty.element_type, field_addr, *val)?;
+ let field = u32::try_from(i).unwrap();
+ let access = if is_exn {
+ GcAccess::ExnPayload {
+ exn_ty: struct_ty,
+ field,
+ }
+ } else {
+ GcAccess::StructField {
+ ty: struct_ty,
+ field,
+ }
+ };
+ gc_compiler(func_env)?.init_field(
+ func_env,
+ builder,
+ ty.element_type,
+ field_addr,
+ access,
+ *val,
+ )?;
}
Ok(())
}
impl FuncEnvironment<'_> {
- /// Flags to use for general-purpose GC loads/stores.
+ /// Flags to use for GC loads/stores of non-field/element bytes;
+ /// fields/elements use `gc_memflags_for`.
///
/// 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_memflags(&mut self, func: &mut ir::Function) -> ir::MemFlagsData {
- let region = self.alias_regions.gc_heap_region(func);
+ 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 {
+ let region = self
+ .alias_regions
+ .gc_access_region(func, self.types, access);
ir::MemFlagsData::new()
.with_trap_code(Some(crate::TRAP_GC_HEAP_CORRUPT))
.with_alias_region(Some(region))
diff --git a/crates/cranelift/src/func_environ/gc/copying.rs b/crates/cranelift/src/func_environ/gc/copying.rs
index ec9b47a9e8..a58aa30c8f 100644
--- a/crates/cranelift/src/func_environ/gc/copying.rs
+++ b/crates/cranelift/src/func_environ/gc/copying.rs
@@ -172,7 +172,7 @@ impl CopyingCompiler {
// 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_memflags(&mut builder.func);
+ let header_flags = func_env.gc_header_memflags(&mut builder.func);
// Write `VMGcHeader::kind` with inline trace info bits included.
let kind_val = builder
@@ -255,7 +255,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_memflags(&mut builder.func);
+ let flags = func_env.gc_header_memflags(&mut builder.func);
builder.ins().store(flags, len, len_addr, 0);
Ok(array_ref)
@@ -344,6 +344,7 @@ impl GcCompiler for CopyingCompiler {
builder,
WasmStorageType::Val(WasmValType::I32),
instance_id_addr,
+ GcAccess::Header,
instance_id,
)?;
let tag_addr = builder
@@ -354,6 +355,7 @@ impl GcCompiler for CopyingCompiler {
builder,
WasmStorageType::Val(WasmValType::I32),
tag_addr,
+ GcAccess::Header,
tag,
)?;
@@ -427,11 +429,12 @@ impl GcCompiler for CopyingCompiler {
builder: &mut FunctionBuilder<'_>,
ty: WasmStorageType,
field_addr: ir::Value,
+ access: GcAccess,
val: ir::Value,
) -> WasmResult<()> {
// Data inside GC objects is always little endian.
let flags = func_env
- .gc_memflags(&mut builder.func)
+ .gc_memflags_for(&mut builder.func, access)
.with_endianness(ir::Endianness::Little);
match ty {
@@ -445,7 +448,7 @@ impl GcCompiler for CopyingCompiler {
unbarriered_store_gc_ref(builder, r.heap_type, field_addr, val, flags)?;
}
WasmHeapTopType::Cont => {
- write_field_at_addr(func_env, builder, ty, field_addr, val)?
+ write_field_at_addr(func_env, builder, ty, field_addr, access, val)?
}
},
WasmStorageType::I8 => {
diff --git a/crates/cranelift/src/func_environ/gc/drc.rs b/crates/cranelift/src/func_environ/gc/drc.rs
index 50a453fd1f..9061c24b2a 100644
--- a/crates/cranelift/src/func_environ/gc/drc.rs
+++ b/crates/cranelift/src/func_environ/gc/drc.rs
@@ -39,7 +39,7 @@ impl DrcCompiler {
access_size: u8::try_from(ir::types::I64.bytes()).unwrap(),
},
);
- let flags = func_env.gc_memflags(&mut builder.func);
+ let flags = func_env.gc_header_memflags(&mut builder.func);
builder.ins().load(ir::types::I64, flags, pointer, 0)
}
@@ -63,7 +63,7 @@ impl DrcCompiler {
access_size: u8::try_from(ir::types::I64.bytes()).unwrap(),
},
);
- let flags = func_env.gc_memflags(&mut builder.func);
+ let flags = func_env.gc_header_memflags(&mut builder.func);
builder.ins().store(flags, new_ref_count, pointer, 0);
}
@@ -231,7 +231,7 @@ impl DrcCompiler {
access_size: u8::try_from(ir::types::I32.bytes()).unwrap(),
},
);
- let flags = func_env.gc_memflags(&mut builder.func);
+ let flags = func_env.gc_header_memflags(&mut builder.func);
builder.ins().store(flags, next, ptr, 0);
}
@@ -268,7 +268,7 @@ impl DrcCompiler {
access_size: u8::try_from(ir::types::I32.bytes()).unwrap(),
},
);
- let flags = func_env.gc_memflags(&mut builder.func);
+ let flags = func_env.gc_header_memflags(&mut builder.func);
builder.ins().store(flags, new_reserved, ptr, 0);
}
}
@@ -321,7 +321,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_memflags(&mut builder.func);
+ let flags = func_env.gc_header_memflags(&mut builder.func);
builder.ins().store(flags, len, len_addr, 0);
Ok(array_ref)
}
@@ -432,6 +432,7 @@ impl GcCompiler for DrcCompiler {
builder,
WasmStorageType::Val(WasmValType::I32),
instance_id_addr,
+ GcAccess::Header,
instance_id,
)?;
let tag_addr = builder
@@ -442,6 +443,7 @@ impl GcCompiler for DrcCompiler {
builder,
WasmStorageType::Val(WasmValType::I32),
tag_addr,
+ GcAccess::Header,
tag,
)?;
@@ -571,7 +573,7 @@ impl GcCompiler for DrcCompiler {
access_size: u8::try_from(ir::types::I32.bytes()).unwrap(),
},
);
- let flags = func_env.gc_memflags(&mut builder.func);
+ let flags = func_env.gc_header_memflags(&mut builder.func);
let reserved = builder.ins().load(ir::types::I32, flags, ptr, 0);
let in_set_bit = builder.ins().iconst(
ir::types::I32,
@@ -909,6 +911,7 @@ impl GcCompiler for DrcCompiler {
builder: &mut FunctionBuilder<'_>,
ty: WasmStorageType,
field_addr: ir::Value,
+ access: GcAccess,
val: ir::Value,
) -> WasmResult<()> {
if let WasmStorageType::Val(WasmValType::Ref(r)) = ty
@@ -916,12 +919,12 @@ impl GcCompiler for DrcCompiler {
{
// Data inside GC objects is always little endian.
let flags = func_env
- .gc_memflags(&mut builder.func)
+ .gc_memflags_for(&mut builder.func, access)
.with_endianness(ir::Endianness::Little);
return self.translate_init_gc_reference(func_env, builder, r, field_addr, val, flags);
}
- write_field_at_addr(func_env, builder, ty, field_addr, val)?;
+ write_field_at_addr(func_env, builder, ty, field_addr, access, val)?;
Ok(())
}
diff --git a/crates/cranelift/src/func_environ/gc/null.rs b/crates/cranelift/src/func_environ/gc/null.rs
index 479a9b6fd0..42cf8922da 100644
--- a/crates/cranelift/src/func_environ/gc/null.rs
+++ b/crates/cranelift/src/func_environ/gc/null.rs
@@ -157,7 +157,7 @@ impl NullCompiler {
i64::from(VMSharedTypeIndex::reserved_value().as_bits()),
),
};
- let flags = func_env.gc_memflags(&mut builder.func);
+ let flags = func_env.gc_header_memflags(&mut builder.func);
builder.ins().store(
flags,
kind_and_size,
@@ -228,7 +228,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_memflags(&mut builder.func);
+ let flags = func_env.gc_header_memflags(&mut builder.func);
builder.ins().store(flags, len, len_addr, 0);
Ok(gc_ref)
@@ -337,6 +337,7 @@ impl GcCompiler for NullCompiler {
builder,
WasmStorageType::Val(WasmValType::I32),
instance_id_addr,
+ GcAccess::Header,
instance_id,
)?;
let tag_addr = builder
@@ -347,6 +348,7 @@ impl GcCompiler for NullCompiler {
builder,
WasmStorageType::Val(WasmValType::I32),
tag_addr,
+ GcAccess::Header,
tag,
)?;
@@ -396,8 +398,9 @@ impl GcCompiler for NullCompiler {
builder: &mut FunctionBuilder<'_>,
ty: WasmStorageType,
field_addr: ir::Value,
+ access: GcAccess,
val: ir::Value,
) -> WasmResult<()> {
- write_field_at_addr(func_env, builder, ty, field_addr, val)
+ write_field_at_addr(func_env, builder, ty, field_addr, access, val)
}
}
diff --git a/tests/disas/array-copy-anyref.wat b/tests/disas/array-copy-anyref.wat
index 374ecefc82..becaa19855 100644
--- a/tests/disas/array-copy-anyref.wat
+++ b/tests/disas/array-copy-anyref.wat
@@ -15,6 +15,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -74,8 +75,8 @@
;; @002b brif v74, block3(v30, v54, v5), block4(v79, v80, v82)
;;
;; block3(v83: i64, v84: i64, v85: i32):
-;; @002b v88 = load.i32 user2 little region4 v84
-;; @002b store user2 little region4 v88, v83
+;; @002b v88 = load.i32 user2 little region5 v84
+;; @002b store user2 little region5 v88, v83
;; v123 = iconst.i64 4
;; v124 = iadd v84, v123 ; v123 = 4
;; @002b v95 = icmp eq v124, v80
@@ -87,9 +88,9 @@
;; block4(v96: i64, v97: i64, v98: i32):
;; v118 = iconst.i64 4
;; v119 = isub v97, v118 ; v118 = 4
-;; @002b v107 = load.i32 user2 little region4 v119
+;; @002b v107 = load.i32 user2 little region5 v119
;; v120 = isub v96, v118 ; v118 = 4
-;; @002b store user2 little region4 v107, v120
+;; @002b store user2 little region5 v107, v120
;; @002b v108 = icmp eq v119, v54
;; v121 = iconst.i32 1
;; v122 = isub v98, v121 ; v121 = 1
diff --git a/tests/disas/array-copy-inline.wat b/tests/disas/array-copy-inline.wat
index be4dcc7a53..3a61851c35 100644
--- a/tests/disas/array-copy-inline.wat
+++ b/tests/disas/array-copy-inline.wat
@@ -21,6 +21,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -68,12 +69,12 @@
;; @002a v72 = uadd_overflow_trap v54, v90, user2 ; v90 = 28
;; @002a v73 = icmp ugt v72, v64
;; @002a trapnz v73, user2
-;; @002a v74 = load.i8x16 notrap aligned little region4 v54
-;; @002a v75 = load.i64 notrap aligned little region4 v54+16
-;; @002a v76 = load.i32 notrap aligned little region4 v54+24
-;; @002a store notrap aligned little region4 v74, v30
-;; @002a store notrap aligned little region4 v75, v30+16
-;; @002a store notrap aligned little region4 v76, v30+24
+;; @002a v74 = load.i8x16 notrap aligned little region5 v54
+;; @002a v75 = load.i64 notrap aligned little region5 v54+16
+;; @002a v76 = load.i32 notrap aligned little region5 v54+24
+;; @002a store notrap aligned little region5 v74, v30
+;; @002a store notrap aligned little region5 v75, v30+16
+;; @002a store notrap aligned little region5 v76, v30+24
;; @002e jump block1
;;
;; block1:
diff --git a/tests/disas/array-fill-anyref.wat b/tests/disas/array-fill-anyref.wat
index eb98ec7eee..f600b9b90a 100644
--- a/tests/disas/array-fill-anyref.wat
+++ b/tests/disas/array-fill-anyref.wat
@@ -23,6 +23,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -61,7 +62,7 @@
;; @0030 brif v42, block3, block2(v29)
;;
;; block2(v43: i64):
-;; @0030 store.i32 user2 little region4 v4, v43
+;; @0030 store.i32 user2 little region5 v4, v43
;; v54 = iconst.i64 4
;; v55 = iadd v43, v54 ; v54 = 4
;; @0030 v46 = icmp eq v55, v40
@@ -80,6 +81,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -120,7 +122,7 @@
;;
;; block2(v43: i64):
;; v54 = iconst.i32 0
-;; @003e store user2 little region4 v54, v43 ; v54 = 0
+;; @003e store user2 little region5 v54, v43 ; v54 = 0
;; v55 = iconst.i64 4
;; v56 = iadd v43, v55 ; v55 = 4
;; @003e v46 = icmp eq v56, v40
@@ -139,6 +141,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -179,7 +182,7 @@
;;
;; block2(v47: i64):
;; v64 = iconst.i32 -1
-;; @004e store user2 little region4 v64, v47 ; v64 = -1
+;; @004e store user2 little region5 v64, v47 ; v64 = -1
;; v65 = iconst.i64 4
;; v66 = iadd v47, v65 ; v65 = 4
;; @004e v50 = icmp eq v66, v44
diff --git a/tests/disas/array-fill-externref.wat b/tests/disas/array-fill-externref.wat
index 4c0f714072..bdcc60d398 100644
--- a/tests/disas/array-fill-externref.wat
+++ b/tests/disas/array-fill-externref.wat
@@ -19,6 +19,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; 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 @@
;; @002f brif v42, block3, block2(v29)
;;
;; block2(v43: i64):
-;; @002f store.i32 user2 little region4 v4, v43
+;; @002f store.i32 user2 little region5 v4, v43
;; v54 = iconst.i64 4
;; v55 = iadd v43, v54 ; v54 = 4
;; @002f v46 = icmp eq v55, v40
@@ -76,6 +77,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -116,7 +118,7 @@
;;
;; block2(v43: i64):
;; v54 = iconst.i32 0
-;; @003d store user2 little region4 v54, v43 ; v54 = 0
+;; @003d store user2 little region5 v54, v43 ; v54 = 0
;; v55 = iconst.i64 4
;; v56 = iadd v43, v55 ; v55 = 4
;; @003d v46 = icmp eq v56, v40
diff --git a/tests/disas/array-fill-f32.wat b/tests/disas/array-fill-f32.wat
index a971cbbc20..cbdaa1951f 100644
--- a/tests/disas/array-fill-f32.wat
+++ b/tests/disas/array-fill-f32.wat
@@ -23,6 +23,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -61,7 +62,7 @@
;; @0030 brif v42, block3, block2(v29)
;;
;; block2(v43: i64):
-;; @0030 store.f32 user2 little region4 v4, v43
+;; @0030 store.f32 user2 little region5 v4, v43
;; v54 = iconst.i64 4
;; v55 = iadd v43, v54 ; v54 = 4
;; @0030 v46 = icmp eq v55, v40
@@ -127,6 +128,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -167,7 +169,7 @@
;;
;; block2(v43: i64):
;; v54 = f32const 0x1.000000p0
-;; @0052 store user2 little region4 v54, v43 ; v54 = 0x1.000000p0
+;; @0052 store user2 little region5 v54, v43 ; v54 = 0x1.000000p0
;; v55 = iconst.i64 4
;; v56 = iadd v43, v55 ; v55 = 4
;; @0052 v46 = icmp eq v56, v40
diff --git a/tests/disas/array-fill-f64.wat b/tests/disas/array-fill-f64.wat
index a5139ede62..7ce14d7c99 100644
--- a/tests/disas/array-fill-f64.wat
+++ b/tests/disas/array-fill-f64.wat
@@ -23,6 +23,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -61,7 +62,7 @@
;; @0030 brif v42, block3, block2(v29)
;;
;; block2(v43: i64):
-;; @0030 store.f64 user2 little region4 v4, v43
+;; @0030 store.f64 user2 little region5 v4, v43
;; v54 = iconst.i64 8
;; v55 = iadd v43, v54 ; v54 = 8
;; @0030 v46 = icmp eq v55, v40
@@ -127,6 +128,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -167,7 +169,7 @@
;;
;; block2(v43: i64):
;; v54 = f64const 0x1.0000000000000p0
-;; @005a store user2 little region4 v54, v43 ; v54 = 0x1.0000000000000p0
+;; @005a store user2 little region5 v54, v43 ; v54 = 0x1.0000000000000p0
;; v55 = iconst.i64 8
;; v56 = iadd v43, v55 ; v55 = 8
;; @005a v46 = icmp eq v56, v40
diff --git a/tests/disas/array-fill-funcref.wat b/tests/disas/array-fill-funcref.wat
index 8e8151c00e..afa37cde81 100644
--- a/tests/disas/array-fill-funcref.wat
+++ b/tests/disas/array-fill-funcref.wat
@@ -26,6 +26,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -68,7 +69,7 @@
;; @003b brif v44, block3, block2(v29)
;;
;; block2(v45: i64):
-;; @003b store.i32 notrap aligned little region4 v41, v45
+;; @003b store.i32 notrap aligned little region5 v41, v45
;; v56 = iconst.i64 4
;; v57 = iadd v45, v56 ; v56 = 4
;; @003b v48 = icmp eq v57, v42
@@ -87,6 +88,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -129,7 +131,7 @@
;; @0049 brif v44, block3, block2(v29)
;;
;; block2(v45: i64):
-;; @0049 store.i32 notrap aligned little region4 v41, v45
+;; @0049 store.i32 notrap aligned little region5 v41, v45
;; v55 = iconst.i64 4
;; v56 = iadd v45, v55 ; v55 = 4
;; @0049 v48 = icmp eq v56, v42
@@ -149,7 +151,8 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
-;; region5 = 232 ""
+;; region5 = 5 ""
+;; region6 = 135 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -161,10 +164,10 @@
;;
;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32):
;; v56 = stack_addr.i64 ss0
-;; store notrap aligned region5 v2, v56
+;; store notrap aligned region6 v2, v56
;; @0053 v5 = iconst.i32 3
;; @0053 v6 = call fn0(v0, v5), stack_map=[i32 @ ss0+0] ; v5 = 3
-;; v55 = load.i32 notrap aligned region5 v56
+;; v55 = load.i32 notrap aligned region6 v56
;; @0057 trapz v55, user16
;; @0057 v8 = load.i64 notrap aligned readonly can_move region0 v0+8
;; @0057 v9 = load.i64 notrap aligned readonly can_move region2 v8+32
@@ -199,7 +202,7 @@
;; @0057 brif v45, block3, block2(v30)
;;
;; block2(v46: i64):
-;; @0057 store.i32 notrap aligned little region4 v42, v46
+;; @0057 store.i32 notrap aligned little region5 v42, v46
;; v64 = iconst.i64 4
;; v65 = iadd v46, v64 ; v64 = 4
;; @0057 v49 = icmp eq v65, v43
diff --git a/tests/disas/array-fill-i16.wat b/tests/disas/array-fill-i16.wat
index c3ce7f4b39..98840708b3 100644
--- a/tests/disas/array-fill-i16.wat
+++ b/tests/disas/array-fill-i16.wat
@@ -27,6 +27,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -65,7 +66,7 @@
;; @0031 brif v42, block3, block2(v29)
;;
;; block2(v43: i64):
-;; @0031 istore16.i32 user2 little region4 v4, v43
+;; @0031 istore16.i32 user2 little region5 v4, v43
;; v57 = iconst.i64 2
;; v58 = iadd v43, v57 ; v57 = 2
;; @0031 v46 = icmp eq v58, v40
@@ -178,6 +179,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -218,7 +220,7 @@
;;
;; block2(v43: i64):
;; v57 = iconst.i32 0xdead
-;; @005d istore16 user2 little region4 v57, v43 ; v57 = 0xdead
+;; @005d istore16 user2 little region5 v57, v43 ; v57 = 0xdead
;; v58 = iconst.i64 2
;; v59 = iadd v43, v58 ; v58 = 2
;; @005d v46 = icmp eq v59, v40
diff --git a/tests/disas/array-fill-i31ref.wat b/tests/disas/array-fill-i31ref.wat
index a69e7bca64..653f7b4eaf 100644
--- a/tests/disas/array-fill-i31ref.wat
+++ b/tests/disas/array-fill-i31ref.wat
@@ -23,6 +23,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -61,7 +62,7 @@
;; @0030 brif v42, block3, block2(v29)
;;
;; block2(v43: i64):
-;; @0030 store.i32 user2 little region4 v4, v43
+;; @0030 store.i32 user2 little region5 v4, v43
;; v54 = iconst.i64 4
;; v55 = iadd v43, v54 ; v54 = 4
;; @0030 v46 = icmp eq v55, v40
@@ -80,6 +81,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -120,7 +122,7 @@
;;
;; block2(v43: i64):
;; v54 = iconst.i32 0
-;; @003e store user2 little region4 v54, v43 ; v54 = 0
+;; @003e store user2 little region5 v54, v43 ; v54 = 0
;; v55 = iconst.i64 4
;; v56 = iadd v43, v55 ; v55 = 4
;; @003e v46 = icmp eq v56, v40
@@ -139,6 +141,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -179,7 +182,7 @@
;;
;; block2(v47: i64):
;; v64 = iconst.i32 -1
-;; @004e store user2 little region4 v64, v47 ; v64 = -1
+;; @004e store user2 little region5 v64, v47 ; v64 = -1
;; v65 = iconst.i64 4
;; v66 = iadd v47, v65 ; v65 = 4
;; @004e v50 = icmp eq v66, v44
diff --git a/tests/disas/array-fill-i32.wat b/tests/disas/array-fill-i32.wat
index a15eeb2903..ff7b792be2 100644
--- a/tests/disas/array-fill-i32.wat
+++ b/tests/disas/array-fill-i32.wat
@@ -27,6 +27,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -65,7 +66,7 @@
;; @0031 brif v42, block3, block2(v29)
;;
;; block2(v43: i64):
-;; @0031 store.i32 user2 little region4 v4, v43
+;; @0031 store.i32 user2 little region5 v4, v43
;; v54 = iconst.i64 4
;; v55 = iadd v43, v54 ; v54 = 4
;; @0031 v46 = icmp eq v55, v40
@@ -178,6 +179,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -218,7 +220,7 @@
;;
;; block2(v43: i64):
;; v54 = iconst.i32 0xdead
-;; @005d store user2 little region4 v54, v43 ; v54 = 0xdead
+;; @005d store user2 little region5 v54, v43 ; v54 = 0xdead
;; v55 = iconst.i64 4
;; v56 = iadd v43, v55 ; v55 = 4
;; @005d v46 = icmp eq v56, v40
diff --git a/tests/disas/array-fill-i64.wat b/tests/disas/array-fill-i64.wat
index c2e58cf7b7..f7a62abec5 100644
--- a/tests/disas/array-fill-i64.wat
+++ b/tests/disas/array-fill-i64.wat
@@ -27,6 +27,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -65,7 +66,7 @@
;; @0031 brif v42, block3, block2(v29)
;;
;; block2(v43: i64):
-;; @0031 store.i64 user2 little region4 v4, v43
+;; @0031 store.i64 user2 little region5 v4, v43
;; v54 = iconst.i64 8
;; v55 = iadd v43, v54 ; v54 = 8
;; @0031 v46 = icmp eq v55, v40
@@ -178,6 +179,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -218,7 +220,7 @@
;;
;; block2(v43: i64):
;; v54 = iconst.i64 1
-;; @005b store user2 little region4 v54, v43 ; v54 = 1
+;; @005b store user2 little region5 v54, v43 ; v54 = 1
;; v55 = iconst.i64 8
;; v56 = iadd v43, v55 ; v55 = 8
;; @005b v46 = icmp eq v56, v40
diff --git a/tests/disas/component-model/alias-region-gc-cross-module.wat b/tests/disas/component-model/alias-region-gc-cross-module.wat
new file mode 100644
index 0000000000..8f2cb56551
--- /dev/null
+++ b/tests/disas/component-model/alias-region-gc-cross-module.wat
@@ -0,0 +1,79 @@
+;;! target = "x86_64"
+;;! test = "optimize"
+;;! filter = "function"
+;;! flags = "-W function-references,gc -C collector=null -C inlining=n"
+
+;; Core modules in one component are compiled together, so both functions must
+;; declare the same `regionN = <user_id>` for field 0 despite declaring the
+;; type separately. Inlining is off to keep the region tables comparable.
+
+(component
+ (core module $M1
+ (type $ty (struct (field (mut i32))))
+ (func (export "f") (param (ref $ty)) (result i32)
+ (struct.get $ty 0 (local.get 0))
+ )
+ )
+
+ (core module $M2
+ (type $unused (struct (field (mut f64))))
+ (type $ty (struct (field (mut i32))))
+ (func (export "g") (param (ref $ty)) (result i32)
+ (struct.get $ty 0 (local.get 0))
+ )
+ )
+
+ (core instance $m1 (instantiate $M1))
+ (core instance $m2 (instantiate $M2))
+)
+;; function u0:0(i64 vmctx, i64, i32) -> i32 tail {
+;; region0 = 123 ""
+;; region1 = 160 ""
+;; region2 = 196 ""
+;; region3 = 206 ""
+;; region4 = 147 ""
+;; gv0 = vmctx
+;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
+;; gv2 = load.i64 notrap aligned region1 gv1+24
+;; stack_limit = gv2
+;;
+;; block0(v0: i64, v1: i64, v2: i32):
+;; @0031 trapz v2, user16
+;; @0031 v4 = load.i64 notrap aligned readonly can_move region0 v0+8
+;; @0031 v5 = load.i64 notrap aligned readonly can_move region2 v4+32
+;; @0031 v3 = uextend.i64 v2
+;; @0031 v6 = iadd v5, v3
+;; @0031 v7 = iconst.i64 8
+;; @0031 v8 = iadd v6, v7 ; v7 = 8
+;; @0031 v9 = load.i32 user2 little region4 v8
+;; @0035 jump block1
+;;
+;; block1:
+;; @0035 return v9
+;; }
+;;
+;; function u1:0(i64 vmctx, i64, i32) -> i32 tail {
+;; region0 = 123 ""
+;; region1 = 160 ""
+;; region2 = 196 ""
+;; region3 = 206 ""
+;; region4 = 147 ""
+;; gv0 = vmctx
+;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
+;; gv2 = load.i64 notrap aligned region1 gv1+24
+;; stack_limit = gv2
+;;
+;; block0(v0: i64, v1: i64, v2: i32):
+;; @0076 trapz v2, user16
+;; @0076 v4 = load.i64 notrap aligned readonly can_move region0 v0+8
+;; @0076 v5 = load.i64 notrap aligned readonly can_move region2 v4+32
+;; @0076 v3 = uextend.i64 v2
+;; @0076 v6 = iadd v5, v3
+;; @0076 v7 = iconst.i64 8
+;; @0076 v8 = iadd v6, v7 ; v7 = 8
+;; @0076 v9 = load.i32 user2 little region4 v8
+;; @007a jump block1
+;;
+;; block1:
+;; @007a return v9
+;; }
diff --git a/tests/disas/component-model/checked-intrinsics-inlined-no-spectre.wat b/tests/disas/component-model/checked-intrinsics-inlined-no-spectre.wat
index 1d53a7e8a4..274ee906c5 100644
--- a/tests/disas/component-model/checked-intrinsics-inlined-no-spectre.wat
+++ b/tests/disas/component-model/checked-intrinsics-inlined-no-spectre.wat
@@ -52,7 +52,7 @@
;; region1 = 160 ""
;; region2 = 25 ""
;; region3 = 175 ""
-;; region4 = 35 ""
+;; region4 = 113 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/component-model/checked-intrinsics-inlined.wat b/tests/disas/component-model/checked-intrinsics-inlined.wat
index 98f35ac91e..e3e2f6a07c 100644
--- a/tests/disas/component-model/checked-intrinsics-inlined.wat
+++ b/tests/disas/component-model/checked-intrinsics-inlined.wat
@@ -53,7 +53,7 @@
;; region1 = 160 ""
;; region2 = 25 ""
;; region3 = 175 ""
-;; region4 = 35 ""
+;; region4 = 113 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/component-model/checked-intrinsics-trampoline.wat b/tests/disas/component-model/checked-intrinsics-trampoline.wat
index 7f7a1679bd..7d4f6a30fa 100644
--- a/tests/disas/component-model/checked-intrinsics-trampoline.wat
+++ b/tests/disas/component-model/checked-intrinsics-trampoline.wat
@@ -32,7 +32,7 @@
)
)
;; function u0:0(i64 vmctx, i64, i64, i64, i64) -> i32 tail {
-;; region0 = 35 ""
+;; region0 = 113 ""
;;
;; block0(v0: i64, v1: i64, v2: i64, v3: i64, v4: i64):
;; v5 = iconst.i64 4
@@ -48,7 +48,7 @@
;; }
;;
;; function u0:0(i64 vmctx, i64, i64, i64, i64, i32) tail {
-;; region0 = 35 ""
+;; region0 = 113 ""
;;
;; block0(v0: i64, v1: i64, v2: i64, v3: i64, v4: i64, v5: i32):
;; v6 = iconst.i64 4
diff --git a/tests/disas/component-model/inlining-and-unsafe-intrinsics.wat b/tests/disas/component-model/inlining-and-unsafe-intrinsics.wat
index 865925b304..92c822db59 100644
--- a/tests/disas/component-model/inlining-and-unsafe-intrinsics.wat
+++ b/tests/disas/component-model/inlining-and-unsafe-intrinsics.wat
@@ -47,7 +47,7 @@
;; region1 = 160 ""
;; region2 = 25 ""
;; region3 = 175 ""
-;; region4 = 35 ""
+;; region4 = 113 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/component-model/unsafe-intrinsics-used.wat b/tests/disas/component-model/unsafe-intrinsics-used.wat
index c22b40a6f0..e3099527c7 100644
--- a/tests/disas/component-model/unsafe-intrinsics-used.wat
+++ b/tests/disas/component-model/unsafe-intrinsics-used.wat
@@ -45,7 +45,7 @@
;; }
;;
;; function u0:0(i64 vmctx, i64, i64) -> i32 tail {
-;; region0 = 35 ""
+;; region0 = 113 ""
;;
;; block0(v0: i64, v1: i64, v2: i64):
;; v3 = load.i8 notrap aligned region0 v2
diff --git a/tests/disas/elem-segment.wat b/tests/disas/elem-segment.wat
index ecd96076ac..8293127fa4 100644
--- a/tests/disas/elem-segment.wat
+++ b/tests/disas/elem-segment.wat
@@ -44,7 +44,7 @@
;; }
;;
;; function u2415919104:0(i64 vmctx, i64) tail {
-;; region0 = 191 ""
+;; region0 = 116 ""
;; sig0 = (i64 vmctx, i32) -> i64 tail
;; sig1 = (i64 vmctx, i32) -> i64 tail
;; fn0 = colocated u805306368:4 sig0
diff --git a/tests/disas/gc/alias-region-array-types.wat b/tests/disas/gc/alias-region-array-types.wat
new file mode 100644
index 0000000000..14cafaa9e4
--- /dev/null
+++ b/tests/disas/gc/alias-region-array-types.wat
@@ -0,0 +1,109 @@
+;;! target = "x86_64"
+;;! test = "optimize"
+;;! flags = "-W function-references,gc -C collector=null"
+
+;; Unrelated array types get different element regions. These differ only in
+;; element mutability, which defeats rec-group deduplication while leaving the
+;; regions as the only difference below.
+
+(module
+ (type $a (array (mut i32)))
+ (type $b (array i32))
+
+ (func $f (param i32) nop)
+
+ (func (param (ref $a)) (param (ref $b))
+ ;; The calls make it easy to see which load is the element load in the CLIF,
+ ;; so we can check their regions.
+ (call $f (array.get $a (local.get 0) (i32.const 0)))
+ (call $f (array.get $b (local.get 1) (i32.const 0)))
+ )
+)
+;; function u0:0(i64 vmctx, i64, i32) tail {
+;; region0 = 123 ""
+;; region1 = 160 ""
+;; gv0 = vmctx
+;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
+;; gv2 = load.i64 notrap aligned region1 gv1+24
+;; stack_limit = gv2
+;;
+;; block0(v0: i64, v1: i64, v2: i32):
+;; @0027 jump block1
+;;
+;; block1:
+;; @0027 return
+;; }
+;;
+;; function u0:1(i64 vmctx, i64, i32, i32) tail {
+;; ss0 = explicit_slot 4, align = 4
+;; region0 = 123 ""
+;; region1 = 160 ""
+;; region2 = 196 ""
+;; region3 = 206 ""
+;; region4 = 108 ""
+;; region5 = 5 ""
+;; region6 = 214 ""
+;; region7 = 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, i64, i32) tail
+;; fn0 = colocated u0:0 sig0
+;; stack_limit = gv2
+;;
+;; block0(v0: i64, v1: i64, v2: i32, v3: i32):
+;; v68 = stack_addr.i64 ss0
+;; store notrap aligned region7 v3, v68
+;; @002e trapz v2, user16
+;; @002e v6 = load.i64 notrap aligned readonly can_move region0 v0+8
+;; @002e v7 = load.i64 notrap aligned readonly can_move region2 v6+32
+;; @002e v5 = uextend.i64 v2
+;; @002e v8 = iadd v7, v5
+;; @002e v9 = iconst.i64 8
+;; @002e v10 = iadd v8, v9 ; v9 = 8
+;; @002e v11 = load.i32 user2 readonly region4 v10
+;; @002e trapz v11, user17
+;; @002e v14 = uextend.i64 v11
+;; v74 = iconst.i64 2
+;; v75 = ishl v14, v74 ; v74 = 2
+;; @002e v16 = iconst.i64 32
+;; @002e v17 = ushr v75, v16 ; v16 = 32
+;; @002e trapnz v17, user2
+;; v82 = iconst.i32 2
+;; v83 = ishl v11, v82 ; v82 = 2
+;; @002e v19 = iconst.i32 12
+;; @002e v20 = uadd_overflow_trap v83, v19, user2 ; v19 = 12
+;; @002e v24 = uadd_overflow_trap v2, v20, user2
+;; @002e v25 = uextend.i64 v24
+;; @002e v28 = iadd v7, v25
+;; @002e v29 = isub v20, v19 ; v19 = 12
+;; @002e v30 = uextend.i64 v29
+;; @002e v31 = isub v28, v30
+;; @002e v32 = load.i32 user2 little region5 v31
+;; @0031 call fn0(v0, v0, v32), stack_map=[i32 @ ss0+0]
+;; v67 = load.i32 notrap aligned region7 v68
+;; @0037 trapz v67, user16
+;; @0037 v34 = uextend.i64 v67
+;; @0037 v37 = iadd v7, v34
+;; @0037 v39 = iadd v37, v9 ; v9 = 8
+;; @0037 v40 = load.i32 user2 readonly region4 v39
+;; @0037 trapz v40, user17
+;; @0037 v43 = uextend.i64 v40
+;; v104 = ishl v43, v74 ; v74 = 2
+;; @0037 v46 = ushr v104, v16 ; v16 = 32
+;; @0037 trapnz v46, user2
+;; v109 = ishl v40, v82 ; v82 = 2
+;; @0037 v49 = uadd_overflow_trap v109, v19, user2 ; v19 = 12
+;; @0037 v53 = uadd_overflow_trap v67, v49, user2
+;; @0037 v54 = uextend.i64 v53
+;; @0037 v57 = iadd v7, v54
+;; @0037 v58 = isub v49, v19 ; v19 = 12
+;; @0037 v59 = uextend.i64 v58
+;; @0037 v60 = isub v57, v59
+;; @0037 v61 = load.i32 user2 little region6 v60
+;; @003a call fn0(v0, v0, v61)
+;; @003c jump block1
+;;
+;; block1:
+;; @003c return
+;; }
diff --git a/tests/disas/gc/alias-region-exn-payload.wat b/tests/disas/gc/alias-region-exn-payload.wat
new file mode 100644
index 0000000000..b930e9ca6e
--- /dev/null
+++ b/tests/disas/gc/alias-region-exn-payload.wat
@@ -0,0 +1,148 @@
+;;! target = "x86_64"
+;;! test = "optimize"
+;;! flags = "-W exceptions,function-references,gc -C collector=null"
+
+;; Each exception payload field gets its own region, and the throwing and
+;; catching functions must agree on them: `$throw`'s initializing stores and
+;; `$catch`'s unboxing loads are the two halves of one region pair.
+
+(module
+ (tag $e (param i32 i64))
+
+ (func $throw (param i32 i64)
+ (throw $e (local.get 0) (local.get 1))
+ )
+
+ (func $catch (export "catch") (param i32 i64) (result i32 i64)
+ (block $b (result i32 i64)
+ (try_table (result i32 i64) (catch $e $b)
+ (call $throw (local.get 0) (local.get 1))
+ (i32.const 42)
+ (i64.const 100)
+ )
+ )
+ )
+)
+
+;; function u0:0(i64 vmctx, i64, i32, i64) tail {
+;; region0 = 123 ""
+;; region1 = 160 ""
+;; region2 = 65 ""
+;; region3 = 237 ""
+;; region4 = 206 ""
+;; region5 = 196 ""
+;; region6 = 130 ""
+;; region7 = 26 ""
+;; region8 = 108 ""
+;; region9 = 110 ""
+;; region10 = 142 ""
+;; 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, i64) -> i8 tail
+;; sig2 = (i64 vmctx, i32) -> i8 tail
+;; fn0 = colocated u805306368:43 sig0
+;; fn1 = colocated u805306368:23 sig1
+;; fn2 = colocated u805306368:44 sig2
+;; stack_limit = gv2
+;;
+;; block0(v0: i64, v1: i64, v2: i32, v3: i64):
+;; @003a v4 = call fn0(v0)
+;; @003a v10 = load.i64 notrap aligned readonly can_move region2 v0+32
+;; @003a v11 = load.i32 notrap aligned region3 v10
+;; v45 = iconst.i32 7
+;; @003a v14 = uadd_overflow_trap v11, v45, user18 ; v45 = 7
+;; v51 = iconst.i32 -8
+;; @003a v16 = band v14, v51 ; v51 = -8
+;; @003a v6 = iconst.i32 32
+;; @003a v17 = uadd_overflow_trap v16, v6, user18 ; v6 = 32
+;; @003a v19 = load.i64 notrap aligned readonly can_move region0 v0+8
+;; @003a v20 = load.i64 notrap aligned region4 v19+40
+;; @003a v18 = uextend.i64 v17
+;; @003a v21 = icmp ule v18, v20
+;; @003a brif v21, block2, block3
+;;
+;; block2:
+;; v52 = iconst.i32 0x0400_0020
+;; @003a v25 = load.i64 notrap aligned readonly can_move region5 v19+32
+;; v58 = band.i32 v14, v51 ; v51 = -8
+;; v59 = uextend.i64 v58
+;; @003a v27 = iadd v25, v59
+;; @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.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 v34 = iconst.i64 24
+;; @003a v35 = iadd v27, v34 ; v34 = 24
+;; @003a store.i64 user2 little region10 v3, v35
+;; @003a v36 = iconst.i64 8
+;; @003a v37 = iadd v27, v36 ; v36 = 8
+;; @003a store.i32 user2 little region8 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 try_call fn2(v0, v58), sig2, block4, [ context v0 ]
+;;
+;; block4:
+;; @003a trap user12
+;;
+;; block3 cold:
+;; @003a v22 = isub.i64 v18, v20
+;; @003a v23 = call fn1(v0, v22)
+;; @003a jump block2
+;; }
+;;
+;; function u0:1(i64 vmctx, i64, i32, i64) -> i32, i64 tail {
+;; region0 = 123 ""
+;; region1 = 160 ""
+;; region2 = 196 ""
+;; region3 = 206 ""
+;; region4 = 110 ""
+;; region5 = 142 ""
+;; 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, i32, i64) tail
+;; fn0 = colocated u0:0 sig0
+;; stack_limit = gv2
+;;
+;; block0(v0: i64, v1: i64, v2: i32, v3: i64):
+;; @0041 jump block3
+;;
+;; block5(v4: i64):
+;; @0041 v7 = load.i64 notrap aligned readonly can_move region0 v0+8
+;; @0041 v8 = load.i64 notrap aligned readonly can_move region2 v7+32
+;; @0041 v5 = ireduce.i32 v4
+;; @0041 v6 = uextend.i64 v5
+;; @0041 v9 = iadd v8, v6
+;; @0041 v10 = iconst.i64 16
+;; @0041 v11 = iadd v9, v10 ; v10 = 16
+;; @0041 v12 = load.i32 user2 little region4 v11
+;; @0041 v17 = iconst.i64 24
+;; @0041 v18 = iadd v9, v17 ; v17 = 24
+;; @0041 v19 = load.i64 user2 little region5 v18
+;; @0041 jump block2(v12, v19)
+;;
+;; block3:
+;; @004b try_call fn0(v0, v0, v2, v3), sig0, block6, [ context v0, tag0: block5(exn0) ]
+;;
+;; block6:
+;; @0052 jump block4
+;;
+;; block4:
+;; @004d v20 = iconst.i32 42
+;; @004f v21 = iconst.i64 100
+;; @0053 jump block2(v20, v21) ; v20 = 42, v21 = 100
+;;
+;; block2(v22: i32, v23: i64):
+;; @0054 jump block1
+;;
+;; block1:
+;; @0054 return v22, v23
+;; }
diff --git a/tests/disas/gc/alias-region-gc-inlining.wat b/tests/disas/gc/alias-region-gc-inlining.wat
new file mode 100644
index 0000000000..077fe28f9d
--- /dev/null
+++ b/tests/disas/gc/alias-region-gc-inlining.wat
@@ -0,0 +1,90 @@
+;;! target = "x86_64"
+;;! test = "optimize"
+;;! filter = "wasm[0]--function"
+;;! flags = "-W function-references,gc -C collector=null -C inlining=y"
+
+;; The inlined `struct.set` lands in the same region as the caller's
+;; `struct.get` and is forwarded: `$get_after_set` returns `$val` directly.
+
+(module
+ (type $ty (sub (struct (field (mut i32)))))
+
+ (func $set (param (ref $ty)) (param i32)
+ (struct.set $ty 0 (local.get 0) (local.get 1))
+ )
+
+ (func $get_after_set (param $obj (ref $ty)) (param $val i32) (result i32)
+ (call $set (local.get $obj) (local.get $val))
+ (struct.get $ty 0 (local.get $obj))
+ )
+)
+
+;; function u0:0(i64 vmctx, i64, i32, i32) tail {
+;; region0 = 123 ""
+;; region1 = 160 ""
+;; region2 = 196 ""
+;; region3 = 206 ""
+;; region4 = 147 ""
+;; gv0 = vmctx
+;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
+;; gv2 = load.i64 notrap aligned region1 gv1+24
+;; stack_limit = gv2
+;;
+;; block0(v0: i64, v1: i64, v2: i32, v3: i32):
+;; @002c trapz v2, user16
+;; @002c v5 = load.i64 notrap aligned readonly can_move region0 v0+8
+;; @002c v6 = load.i64 notrap aligned readonly can_move region2 v5+32
+;; @002c v4 = uextend.i64 v2
+;; @002c v7 = iadd v6, v4
+;; @002c v8 = iconst.i64 8
+;; @002c v9 = iadd v7, v8 ; v8 = 8
+;; @002c store user2 little region4 v3, v9
+;; @0030 jump block1
+;;
+;; block1:
+;; @0030 return
+;; }
+;;
+;; function u0:1(i64 vmctx, i64, i32, i32) -> i32 tail {
+;; ss0 = explicit_slot 4, align = 4
+;; region0 = 123 ""
+;; region1 = 160 ""
+;; region2 = 196 ""
+;; region3 = 206 ""
+;; region4 = 147 ""
+;; region5 = 135 ""
+;; gv0 = vmctx
+;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
+;; gv2 = load.i64 notrap aligned region1 gv1+24
+;; gv3 = vmctx
+;; gv4 = load.i64 notrap aligned readonly can_move region0 gv3+8
+;; gv5 = load.i64 notrap aligned region1 gv4+24
+;; sig0 = (i64 vmctx, i64, i32, i32) tail
+;; fn0 = colocated u0:0 sig0
+;; stack_limit = gv2
+;;
+;; block0(v0: i64, v1: i64, v2: i32, v3: i32):
+;; v17 = stack_addr.i64 ss0
+;; store notrap aligned region5 v2, v17
+;; @0037 jump block2
+;;
+;; block2:
+;; trapz.i32 v2, user16
+;; v19 = load.i64 notrap aligned readonly can_move region0 v0+8
+;; v20 = load.i64 notrap aligned readonly can_move region2 v19+32
+;; v18 = uextend.i64 v2
+;; v21 = iadd v20, v18
+;; v22 = iconst.i64 8
+;; v23 = iadd v21, v22 ; v22 = 8
+;; store.i32 user2 little region4 v3, v23
+;; jump block3
+;;
+;; block3:
+;; jump block4
+;;
+;; block4:
+;; @003f jump block1
+;;
+;; block1:
+;; @003f return v3
+;; }
diff --git a/tests/disas/gc/alias-region-gc-type-dedup.wat b/tests/disas/gc/alias-region-gc-type-dedup.wat
new file mode 100644
index 0000000000..7db84cd4e3
--- /dev/null
+++ b/tests/disas/gc/alias-region-gc-type-dedup.wat
@@ -0,0 +1,46 @@
+;;! target = "x86_64"
+;;! test = "optimize"
+;;! flags = "-W function-references,gc -C collector=null"
+
+;; Rec-group deduplication collapses the two wasm-level type indices below to
+;; one `ModuleInternedTypeIndex`, so both `struct.get`s share a region.
+
+(module
+ (type $ty1 (struct (field (mut i32))))
+ (type $ty2 (struct (field (mut i32))))
+
+ (func (param (ref $ty1)) (param (ref $ty2)) (result i32 i32)
+ (struct.get $ty1 0 (local.get 0))
+ (struct.get $ty2 0 (local.get 1))
+ )
+)
+;; function u0:0(i64 vmctx, i64, i32, i32) -> i32, i32 tail {
+;; region0 = 123 ""
+;; region1 = 160 ""
+;; region2 = 196 ""
+;; region3 = 206 ""
+;; region4 = 147 ""
+;; gv0 = vmctx
+;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
+;; gv2 = load.i64 notrap aligned region1 gv1+24
+;; stack_limit = gv2
+;;
+;; block0(v0: i64, v1: i64, v2: i32, v3: i32):
+;; @0027 trapz v2, user16
+;; @0027 v5 = load.i64 notrap aligned readonly can_move region0 v0+8
+;; @0027 v6 = load.i64 notrap aligned readonly can_move region2 v5+32
+;; @0027 v4 = uextend.i64 v2
+;; @0027 v7 = iadd v6, v4
+;; @0027 v8 = iconst.i64 8
+;; @0027 v9 = iadd v7, v8 ; v8 = 8
+;; @0027 v10 = load.i32 user2 little region4 v9
+;; @002d trapz v3, user16
+;; @002d v11 = uextend.i64 v3
+;; @002d v14 = iadd v6, v11
+;; @002d v16 = iadd v14, v8 ; v8 = 8
+;; @002d v17 = load.i32 user2 little region4 v16
+;; @0031 jump block1
+;;
+;; block1:
+;; @0031 return v10, v17
+;; }
diff --git a/tests/disas/gc/alias-region-struct-subtype.wat b/tests/disas/gc/alias-region-struct-subtype.wat
new file mode 100644
index 0000000000..f38ad2cd6c
--- /dev/null
+++ b/tests/disas/gc/alias-region-struct-subtype.wat
@@ -0,0 +1,48 @@
+;;! target = "x86_64"
+;;! test = "optimize"
+;;! flags = "-W function-references,gc -C collector=null"
+
+;; A field's region is keyed on the type that introduced it. Field 0 comes from
+;; `$base`, so reaching it through either type gives one region; field 1 comes
+;; from `$derived` and gets another.
+
+(module
+ (type $base (sub (struct (field (mut i32)))))
+ (type $derived (sub $base (struct (field (mut i32))
+ (field (mut i32)))))
+
+ (func (param (ref $derived)) (result i32 i32 i32)
+ (struct.get $derived 0 (local.get 0))
+ (struct.get $base 0 (local.get 0))
+ (struct.get $derived 1 (local.get 0))
+ )
+)
+;; function u0:0(i64 vmctx, i64, i32) -> i32, i32, i32 tail {
+;; region0 = 123 ""
+;; region1 = 160 ""
+;; region2 = 196 ""
+;; region3 = 206 ""
+;; region4 = 147 ""
+;; region5 = 165 ""
+;; gv0 = vmctx
+;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
+;; gv2 = load.i64 notrap aligned region1 gv1+24
+;; stack_limit = gv2
+;;
+;; block0(v0: i64, v1: i64, v2: i32):
+;; @002d trapz v2, user16
+;; @002d v4 = load.i64 notrap aligned readonly can_move region0 v0+8
+;; @002d v5 = load.i64 notrap aligned readonly can_move region2 v4+32
+;; @002d v3 = uextend.i64 v2
+;; @002d v6 = iadd v5, v3
+;; @002d v7 = iconst.i64 8
+;; @002d v8 = iadd v6, v7 ; v7 = 8
+;; @002d v9 = load.i32 user2 little region4 v8
+;; @0039 v21 = iconst.i64 12
+;; @0039 v22 = iadd v6, v21 ; v21 = 12
+;; @0039 v23 = load.i32 user2 little region5 v22
+;; @003d jump block1
+;;
+;; block1:
+;; @003d return v9, v9, v23
+;; }
diff --git a/tests/disas/gc/array-copy-with-fuel.wat b/tests/disas/gc/array-copy-with-fuel.wat
index f787eb77e8..8ebcb4ee0c 100644
--- a/tests/disas/gc/array-copy-with-fuel.wat
+++ b/tests/disas/gc/array-copy-with-fuel.wat
@@ -18,8 +18,9 @@
;; region3 = 196 ""
;; region4 = 206 ""
;; region5 = 108 ""
-;; region6 = 232 ""
-;; region7 = 240 ""
+;; region6 = 5 ""
+;; region7 = 135 ""
+;; region8 = 187 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -29,9 +30,9 @@
;;
;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32, v5: i32, v6: i32):
;; v162 = stack_addr.i64 ss0
-;; store notrap aligned region6 v2, v162
+;; store notrap aligned region7 v2, v162
;; v163 = stack_addr.i64 ss1
-;; store notrap aligned region7 v4, v163
+;; store notrap aligned region8 v4, v163
;; @0020 v7 = load.i64 notrap aligned readonly can_move region0 v0+8
;; @0020 v8 = load.i64 notrap aligned region2 v7
;; @0020 v9 = iconst.i64 1
@@ -48,7 +49,7 @@
;; @0020 jump block3(v16)
;;
;; block3(v125: i64):
-;; v161 = load.i32 notrap aligned region6 v162
+;; v161 = load.i32 notrap aligned region7 v162
;; @002b trapz v161, user16
;; @002b v24 = load.i64 notrap aligned readonly can_move region3 v7+32
;; @002b v22 = uextend.i64 v161
@@ -62,7 +63,7 @@
;; @002b v29 = uextend.i64 v28
;; @002b v35 = icmp ugt v34, v29
;; @002b trapnz v35, user17
-;; v155 = load.i32 notrap aligned region7 v163
+;; v155 = load.i32 notrap aligned region8 v163
;; @002b trapz v155, user16
;; @002b v46 = uextend.i64 v155
;; @002b v49 = iadd v24, v46
@@ -102,8 +103,8 @@
;; @002b brif v89, block5(v45, v69, v5), block6(v94, v95, v97)
;;
;; block5(v98: i64, v99: i64, v100: i32):
-;; @002b v103 = load.i32 user2 little region5 v99
-;; @002b store user2 little region5 v103, v98
+;; @002b v103 = load.i32 user2 little region6 v99
+;; @002b store user2 little region6 v103, v98
;; v178 = iconst.i64 4
;; v179 = iadd v99, v178 ; v178 = 4
;; @002b v110 = icmp eq v179, v95
@@ -115,9 +116,9 @@
;; block6(v111: i64, v112: i64, v113: i32):
;; v173 = iconst.i64 4
;; v174 = isub v112, v173 ; v173 = 4
-;; @002b v122 = load.i32 user2 little region5 v174
+;; @002b v122 = load.i32 user2 little region6 v174
;; v175 = isub v111, v173 ; v173 = 4
-;; @002b store user2 little region5 v122, v175
+;; @002b store user2 little region6 v122, v175
;; @002b v123 = icmp eq v174, v69
;; v176 = iconst.i32 1
;; v177 = isub v113, v176 ; v176 = 1
diff --git a/tests/disas/gc/array-new-data.wat b/tests/disas/gc/array-new-data.wat
index 392836ea2d..72f0bca22f 100644
--- a/tests/disas/gc/array-new-data.wat
+++ b/tests/disas/gc/array-new-data.wat
@@ -89,7 +89,7 @@
;; region9 = 196 ""
;; region10 = 108 ""
;; region11 = 206 ""
-;; region12 = 232 ""
+;; region12 = 135 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/gc/array-new-default-anyref.wat b/tests/disas/gc/array-new-default-anyref.wat
index bcc69bd24f..c6765a2424 100644
--- a/tests/disas/gc/array-new-default-anyref.wat
+++ b/tests/disas/gc/array-new-default-anyref.wat
@@ -20,6 +20,7 @@
;; region7 = 196 ""
;; region8 = 108 ""
;; region9 = 206 ""
+;; region10 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -113,7 +114,7 @@
;;
;; block5(v83: i64):
;; v134 = iconst.i32 0
-;; @001f store user2 little region8 v134, v83 ; v134 = 0
+;; @001f store user2 little region10 v134, v83 ; v134 = 0
;; v135 = iconst.i64 4
;; v136 = iadd v83, v135 ; v135 = 4
;; @001f v86 = icmp eq v136, v80
diff --git a/tests/disas/gc/array-new-default-exnref.wat b/tests/disas/gc/array-new-default-exnref.wat
index 0729defc09..cb4fdd557b 100644
--- a/tests/disas/gc/array-new-default-exnref.wat
+++ b/tests/disas/gc/array-new-default-exnref.wat
@@ -20,6 +20,7 @@
;; region7 = 196 ""
;; region8 = 108 ""
;; region9 = 206 ""
+;; region10 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -113,7 +114,7 @@
;;
;; block5(v83: i64):
;; v134 = iconst.i32 0
-;; @001f store user2 little region8 v134, v83 ; v134 = 0
+;; @001f store user2 little region10 v134, v83 ; v134 = 0
;; v135 = iconst.i64 4
;; v136 = iadd v83, v135 ; v135 = 4
;; @001f v86 = icmp eq v136, v80
diff --git a/tests/disas/gc/array-new-default-externref.wat b/tests/disas/gc/array-new-default-externref.wat
index 50256f62a1..08b5864ad5 100644
--- a/tests/disas/gc/array-new-default-externref.wat
+++ b/tests/disas/gc/array-new-default-externref.wat
@@ -20,6 +20,7 @@
;; region7 = 196 ""
;; region8 = 108 ""
;; region9 = 206 ""
+;; region10 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -113,7 +114,7 @@
;;
;; block5(v83: i64):
;; v134 = iconst.i32 0
-;; @001f store user2 little region8 v134, v83 ; v134 = 0
+;; @001f store user2 little region10 v134, v83 ; v134 = 0
;; v135 = iconst.i64 4
;; v136 = iadd v83, v135 ; v135 = 4
;; @001f v86 = icmp eq v136, v80
diff --git a/tests/disas/gc/array-new-default-f32.wat b/tests/disas/gc/array-new-default-f32.wat
index 2d9e8a8402..3d2fc82fb6 100644
--- a/tests/disas/gc/array-new-default-f32.wat
+++ b/tests/disas/gc/array-new-default-f32.wat
@@ -21,7 +21,7 @@
;; region7 = 196 ""
;; region8 = 108 ""
;; region9 = 206 ""
-;; region10 = 232 ""
+;; region10 = 135 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/gc/array-new-default-f64.wat b/tests/disas/gc/array-new-default-f64.wat
index 4a42102677..b32760d579 100644
--- a/tests/disas/gc/array-new-default-f64.wat
+++ b/tests/disas/gc/array-new-default-f64.wat
@@ -21,7 +21,7 @@
;; region7 = 196 ""
;; region8 = 108 ""
;; region9 = 206 ""
-;; region10 = 232 ""
+;; region10 = 135 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/gc/array-new-default-funcref.wat b/tests/disas/gc/array-new-default-funcref.wat
index b32b30f634..418b68dc24 100644
--- a/tests/disas/gc/array-new-default-funcref.wat
+++ b/tests/disas/gc/array-new-default-funcref.wat
@@ -21,7 +21,8 @@
;; region7 = 196 ""
;; region8 = 108 ""
;; region9 = 206 ""
-;; region10 = 232 ""
+;; region10 = 5 ""
+;; region11 = 135 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -89,7 +90,7 @@
;;
;; block4(v40: i32, v41: i64):
;; v97 = stack_addr.i64 ss0
-;; store notrap aligned region10 v40, v97
+;; store notrap aligned region11 v40, v97
;; @001f v42 = iconst.i64 16
;; @001f v43 = iadd v41, v42 ; v42 = 16
;; @001f store.i32 user2 region8 v2, v43
@@ -119,7 +120,7 @@
;; @001f brif v84, block6, block5(v65)
;;
;; block5(v85: i64):
-;; @001f store.i32 notrap aligned little region8 v81, v85
+;; @001f store.i32 notrap aligned little region10 v81, v85
;; v144 = iconst.i64 4
;; v145 = iadd v85, v144 ; v144 = 4
;; @001f v88 = icmp eq v145, v82
@@ -129,6 +130,6 @@
;; @0022 jump block1
;;
;; block1:
-;; v90 = load.i32 notrap aligned region10 v97
+;; v90 = load.i32 notrap aligned region11 v97
;; @0022 return v90
;; }
diff --git a/tests/disas/gc/array-new-default-i16.wat b/tests/disas/gc/array-new-default-i16.wat
index 59f4c32ad9..49f4299e12 100644
--- a/tests/disas/gc/array-new-default-i16.wat
+++ b/tests/disas/gc/array-new-default-i16.wat
@@ -21,7 +21,7 @@
;; region7 = 196 ""
;; region8 = 108 ""
;; region9 = 206 ""
-;; region10 = 232 ""
+;; region10 = 135 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/gc/array-new-default-i32.wat b/tests/disas/gc/array-new-default-i32.wat
index 544024e0ed..b9d949384b 100644
--- a/tests/disas/gc/array-new-default-i32.wat
+++ b/tests/disas/gc/array-new-default-i32.wat
@@ -21,7 +21,7 @@
;; region7 = 196 ""
;; region8 = 108 ""
;; region9 = 206 ""
-;; region10 = 232 ""
+;; region10 = 135 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/gc/array-new-default-i64.wat b/tests/disas/gc/array-new-default-i64.wat
index 92d11bd05d..a6c2921355 100644
--- a/tests/disas/gc/array-new-default-i64.wat
+++ b/tests/disas/gc/array-new-default-i64.wat
@@ -21,7 +21,7 @@
;; region7 = 196 ""
;; region8 = 108 ""
;; region9 = 206 ""
-;; region10 = 232 ""
+;; region10 = 135 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/gc/array-new-default-i8.wat b/tests/disas/gc/array-new-default-i8.wat
index 8993608de8..a0d90c0a1d 100644
--- a/tests/disas/gc/array-new-default-i8.wat
+++ b/tests/disas/gc/array-new-default-i8.wat
@@ -21,7 +21,7 @@
;; region7 = 196 ""
;; region8 = 108 ""
;; region9 = 206 ""
-;; region10 = 232 ""
+;; region10 = 135 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/gc/copying/array-fill.wat b/tests/disas/gc/copying/array-fill.wat
index 1932aa6b5f..8445d5d24a 100644
--- a/tests/disas/gc/copying/array-fill.wat
+++ b/tests/disas/gc/copying/array-fill.wat
@@ -14,6 +14,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -52,7 +53,7 @@
;; @0027 brif v42, block3, block2(v29)
;;
;; block2(v43: i64):
-;; @0027 store.i64 user2 little region4 v4, v43
+;; @0027 store.i64 user2 little region5 v4, v43
;; v54 = iconst.i64 8
;; v55 = iadd v43, v54 ; v54 = 8
;; @0027 v46 = icmp eq v55, v40
diff --git a/tests/disas/gc/copying/array-get-s.wat b/tests/disas/gc/copying/array-get-s.wat
index 7b7223cb30..65d77c50d7 100644
--- a/tests/disas/gc/copying/array-get-s.wat
+++ b/tests/disas/gc/copying/array-get-s.wat
@@ -14,6 +14,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -43,7 +44,7 @@
;; @0022 v28 = isub v19, v22
;; @0022 v29 = uextend.i64 v28
;; @0022 v30 = isub v27, v29
-;; @0022 v31 = load.i8 user2 little region4 v30
+;; @0022 v31 = load.i8 user2 little region5 v30
;; @0025 jump block1
;;
;; block1:
diff --git a/tests/disas/gc/copying/array-get-u.wat b/tests/disas/gc/copying/array-get-u.wat
index 9d76df8483..345dfebc32 100644
--- a/tests/disas/gc/copying/array-get-u.wat
+++ b/tests/disas/gc/copying/array-get-u.wat
@@ -14,6 +14,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -43,7 +44,7 @@
;; @0022 v28 = isub v19, v22
;; @0022 v29 = uextend.i64 v28
;; @0022 v30 = isub v27, v29
-;; @0022 v31 = load.i8 user2 little region4 v30
+;; @0022 v31 = load.i8 user2 little region5 v30
;; @0025 jump block1
;;
;; block1:
diff --git a/tests/disas/gc/copying/array-get.wat b/tests/disas/gc/copying/array-get.wat
index 2abbd3a8ae..cd5ba16a34 100644
--- a/tests/disas/gc/copying/array-get.wat
+++ b/tests/disas/gc/copying/array-get.wat
@@ -14,6 +14,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -48,7 +49,7 @@
;; @0022 v28 = isub v19, v22
;; @0022 v29 = uextend.i64 v28
;; @0022 v30 = isub v27, v29
-;; @0022 v31 = load.i64 user2 little region4 v30
+;; @0022 v31 = load.i64 user2 little region5 v30
;; @0025 jump block1
;;
;; block1:
diff --git a/tests/disas/gc/copying/array-new-fixed-of-gc-refs.wat b/tests/disas/gc/copying/array-new-fixed-of-gc-refs.wat
index e4f7c700de..90a0702533 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
@@ -22,9 +22,10 @@
;; region7 = 196 ""
;; region8 = 108 ""
;; region9 = 206 ""
-;; region10 = 232 ""
-;; region11 = 240 ""
-;; region12 = 208 ""
+;; region10 = 5 ""
+;; region11 = 135 ""
+;; region12 = 187 ""
+;; region13 = 26 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -34,11 +35,11 @@
;;
;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32):
;; v137 = stack_addr.i64 ss2
-;; store notrap aligned region12 v2, v137
+;; store notrap aligned region13 v2, v137
;; v138 = stack_addr.i64 ss1
-;; store notrap aligned region11 v3, v138
+;; store notrap aligned region12 v3, v138
;; v139 = stack_addr.i64 ss0
-;; store notrap aligned region10 v4, v139
+;; store notrap aligned region11 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
@@ -50,19 +51,19 @@
;; @0025 brif v25, block2, block3
;;
;; block2:
-;; v253 = iconst.i32 32
-;; v165 = iadd.i32 v15, v253 ; v253 = 32
+;; v231 = iconst.i32 32
+;; v165 = iadd.i32 v15, v231 ; v231 = 32
;; @0025 store notrap aligned region3 v165, v14
-;; v254 = iconst.i32 -1476394994
-;; v255 = load.i64 notrap aligned readonly can_move region0 v0+8
-;; v256 = load.i64 notrap aligned readonly can_move region7 v255+32
-;; @0025 v39 = iadd v256, v22
-;; @0025 store user2 region8 v254, v39 ; v254 = -1476394994
-;; v257 = load.i64 notrap aligned readonly can_move region5 v0+40
-;; v258 = load.i32 notrap aligned readonly can_move region6 v257
-;; @0025 store user2 region8 v258, v39+4
-;; v259 = iconst.i64 32
-;; @0025 istore32 user2 region8 v259, v39+8 ; v259 = 32
+;; v232 = iconst.i32 -1476394994
+;; v233 = load.i64 notrap aligned readonly can_move region0 v0+8
+;; v234 = load.i64 notrap aligned readonly can_move region7 v233+32
+;; @0025 v39 = iadd v234, v22
+;; @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
+;; v237 = iconst.i64 32
+;; @0025 istore32 user2 region8 v237, v39+8 ; v237 = 32
;; @0025 jump block4(v15, v39)
;;
;; block3 cold:
@@ -84,68 +85,48 @@
;; @0025 v46 = iadd v44, v45 ; v45 = 16
;; @0025 store user2 region8 v5, v46 ; v5 = 3
;; @0025 trapz v43, user16
-;; v260 = load.i64 notrap aligned readonly can_move region0 v0+8
-;; v261 = load.i64 notrap aligned readonly can_move region7 v260+32
+;; 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 v261, v48
+;; @0025 v51 = iadd v239, v48
;; @0025 v53 = iadd v51, v45 ; v45 = 16
;; @0025 v54 = load.i32 user2 readonly region8 v53
;; @0025 trapz v54, user17
;; @0025 v57 = uextend.i64 v54
;; v142 = iconst.i64 2
;; v172 = ishl v57, v142 ; v142 = 2
-;; v262 = iconst.i64 32
-;; v263 = ushr v172, v262 ; v262 = 32
-;; @0025 trapnz v263, user2
+;; v240 = iconst.i64 32
+;; v241 = ushr v172, v240 ; v240 = 32
+;; @0025 trapnz v241, user2
;; v179 = iconst.i32 2
;; v180 = ishl v54, v179 ; v179 = 2
;; @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 region12 v137
+;; v136 = load.i32 notrap aligned region13 v137
;; @0025 v68 = uextend.i64 v67
-;; @0025 v71 = iadd v261, v68
+;; @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 region8 v136, v74
-;; @0025 v82 = load.i32 user2 readonly region8 v53
+;; @0025 store user2 little region10 v136, v74
;; @0025 v75 = iconst.i32 1
-;; v196 = icmp ugt v82, v75 ; v75 = 1
+;; v196 = icmp ugt v54, v75 ; v75 = 1
;; @0025 trapz v196, user17
-;; @0025 v85 = uextend.i64 v82
-;; v199 = ishl v85, v142 ; v142 = 2
-;; v264 = ushr v199, v262 ; v262 = 32
-;; @0025 trapnz v264, user2
-;; v204 = ishl v82, v179 ; v179 = 2
-;; @0025 v91 = uadd_overflow_trap v204, v6, user2 ; v6 = 20
-;; @0025 v95 = uadd_overflow_trap v43, v91, user2
-;; v134 = load.i32 notrap aligned region11 v138
-;; @0025 v96 = uextend.i64 v95
-;; @0025 v99 = iadd v261, v96
-;; v216 = iconst.i32 24
-;; @0025 v100 = isub v91, v216 ; v216 = 24
+;; v134 = load.i32 notrap aligned region12 v138
+;; v205 = iconst.i32 24
+;; @0025 v100 = isub v63, v205 ; v205 = 24
;; @0025 v101 = uextend.i64 v100
-;; @0025 v102 = isub v99, v101
-;; @0025 store user2 little region8 v134, v102
-;; @0025 v110 = load.i32 user2 readonly region8 v53
-;; v222 = icmp ugt v110, v179 ; v179 = 2
-;; @0025 trapz v222, user17
-;; @0025 v113 = uextend.i64 v110
-;; v225 = ishl v113, v142 ; v142 = 2
-;; v265 = ushr v225, v262 ; v262 = 32
-;; @0025 trapnz v265, user2
-;; v230 = ishl v110, v179 ; v179 = 2
-;; @0025 v119 = uadd_overflow_trap v230, v6, user2 ; v6 = 20
-;; @0025 v123 = uadd_overflow_trap v43, v119, user2
-;; v132 = load.i32 notrap aligned region10 v139
-;; @0025 v124 = uextend.i64 v123
-;; @0025 v127 = iadd v261, v124
-;; v247 = iconst.i32 28
-;; @0025 v128 = isub v119, v247 ; v247 = 28
+;; @0025 v102 = isub v71, v101
+;; @0025 store user2 little region10 v134, v102
+;; v211 = icmp ugt v54, v179 ; v179 = 2
+;; @0025 trapz v211, user17
+;; v132 = load.i32 notrap aligned region11 v139
+;; v225 = iconst.i32 28
+;; @0025 v128 = isub v63, v225 ; v225 = 28
;; @0025 v129 = uextend.i64 v128
-;; @0025 v130 = isub v127, v129
-;; @0025 store user2 little region8 v132, v130
+;; @0025 v130 = isub v71, v129
+;; @0025 store user2 little region10 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.wat
index 90f918f87b..00dfee036d 100644
--- a/tests/disas/gc/copying/array-new-fixed.wat
+++ b/tests/disas/gc/copying/array-new-fixed.wat
@@ -19,6 +19,7 @@
;; region7 = 196 ""
;; region8 = 108 ""
;; region9 = 206 ""
+;; region10 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -38,19 +39,19 @@
;; @0025 brif v25, block2, block3
;;
;; block2:
-;; v241 = iconst.i32 48
-;; v155 = iadd.i32 v15, v241 ; v241 = 48
+;; v219 = iconst.i32 48
+;; v155 = iadd.i32 v15, v219 ; v219 = 48
;; @0025 store notrap aligned region3 v155, v14
-;; v242 = iconst.i32 -1476395002
-;; v243 = load.i64 notrap aligned readonly can_move region0 v0+8
-;; v244 = load.i64 notrap aligned readonly can_move region7 v243+32
-;; @0025 v39 = iadd v244, v22
-;; @0025 store user2 region8 v242, v39 ; v242 = -1476395002
-;; v245 = load.i64 notrap aligned readonly can_move region5 v0+40
-;; v246 = load.i32 notrap aligned readonly can_move region6 v245
-;; @0025 store user2 region8 v246, v39+4
-;; v247 = iconst.i64 48
-;; @0025 istore32 user2 region8 v247, v39+8 ; v247 = 48
+;; v220 = iconst.i32 -1476395002
+;; v221 = load.i64 notrap aligned readonly can_move region0 v0+8
+;; v222 = load.i64 notrap aligned readonly can_move region7 v221+32
+;; @0025 v39 = iadd v222, v22
+;; @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
+;; v225 = iconst.i64 48
+;; @0025 istore32 user2 region8 v225, v39+8 ; v225 = 48
;; @0025 jump block4(v15, v39)
;;
;; block3 cold:
@@ -72,10 +73,10 @@
;; @0025 v46 = iadd v44, v45 ; v45 = 16
;; @0025 store user2 region8 v5, v46 ; v5 = 3
;; @0025 trapz v43, user16
-;; v248 = load.i64 notrap aligned readonly can_move region0 v0+8
-;; v249 = load.i64 notrap aligned readonly can_move region7 v248+32
+;; 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 v249, v48
+;; @0025 v51 = iadd v227, v48
;; @0025 v53 = iadd v51, v45 ; v45 = 16
;; @0025 v54 = load.i32 user2 readonly region8 v53
;; @0025 trapz v54, user17
@@ -90,47 +91,27 @@
;; @0025 v63 = uadd_overflow_trap v169, v6, user2 ; v6 = 24
;; @0025 v67 = uadd_overflow_trap v43, v63, user2
;; @0025 v68 = uextend.i64 v67
-;; @0025 v71 = iadd v249, v68
+;; @0025 v71 = iadd v227, v68
;; @0025 v72 = isub v63, v6 ; v6 = 24
;; @0025 v73 = uextend.i64 v72
;; @0025 v74 = isub v71, v73
-;; @0025 store.i64 user2 little region8 v2, v74
-;; @0025 v82 = load.i32 user2 readonly region8 v53
+;; @0025 store.i64 user2 little region10 v2, v74
;; @0025 v75 = iconst.i32 1
-;; v185 = icmp ugt v82, v75 ; v75 = 1
+;; v185 = icmp ugt v54, v75 ; v75 = 1
;; @0025 trapz v185, user17
-;; @0025 v85 = uextend.i64 v82
-;; v188 = ishl v85, v131 ; v131 = 3
-;; @0025 v88 = ushr v188, v10 ; v10 = 32
-;; @0025 trapnz v88, user2
-;; v193 = ishl v82, v5 ; v5 = 3
-;; @0025 v91 = uadd_overflow_trap v193, v6, user2 ; v6 = 24
-;; @0025 v95 = uadd_overflow_trap v43, v91, user2
-;; @0025 v96 = uextend.i64 v95
-;; @0025 v99 = iadd v249, v96
-;; v205 = iconst.i32 32
-;; @0025 v100 = isub v91, v205 ; v205 = 32
+;; v194 = iconst.i32 32
+;; @0025 v100 = isub v63, v194 ; v194 = 32
;; @0025 v101 = uextend.i64 v100
-;; @0025 v102 = isub v99, v101
-;; @0025 store.i64 user2 little region8 v3, v102
-;; @0025 v110 = load.i32 user2 readonly region8 v53
+;; @0025 v102 = isub v71, v101
+;; @0025 store.i64 user2 little region10 v3, v102
;; @0025 v103 = iconst.i32 2
-;; v211 = icmp ugt v110, v103 ; v103 = 2
-;; @0025 trapz v211, user17
-;; @0025 v113 = uextend.i64 v110
-;; v214 = ishl v113, v131 ; v131 = 3
-;; @0025 v116 = ushr v214, v10 ; v10 = 32
-;; @0025 trapnz v116, user2
-;; v219 = ishl v110, v5 ; v5 = 3
-;; @0025 v119 = uadd_overflow_trap v219, v6, user2 ; v6 = 24
-;; @0025 v123 = uadd_overflow_trap v43, v119, user2
-;; @0025 v124 = uextend.i64 v123
-;; @0025 v127 = iadd v249, v124
-;; v235 = iconst.i32 40
-;; @0025 v128 = isub v119, v235 ; v235 = 40
+;; v200 = icmp ugt v54, v103 ; v103 = 2
+;; @0025 trapz v200, user17
+;; v213 = iconst.i32 40
+;; @0025 v128 = isub v63, v213 ; v213 = 40
;; @0025 v129 = uextend.i64 v128
-;; @0025 v130 = isub v127, v129
-;; @0025 store.i64 user2 little region8 v4, v130
+;; @0025 v130 = isub v71, v129
+;; @0025 store.i64 user2 little region10 v4, v130
;; @0029 jump block1
;;
;; block1:
diff --git a/tests/disas/gc/copying/array-new.wat b/tests/disas/gc/copying/array-new.wat
index d8052a2847..9a7736d55a 100644
--- a/tests/disas/gc/copying/array-new.wat
+++ b/tests/disas/gc/copying/array-new.wat
@@ -19,6 +19,7 @@
;; region7 = 196 ""
;; region8 = 108 ""
;; region9 = 206 ""
+;; region10 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -110,7 +111,7 @@
;; @0022 brif v82, block6, block5(v65)
;;
;; block5(v83: i64):
-;; @0022 store.i64 user2 little region8 v2, v83
+;; @0022 store.i64 user2 little region10 v2, v83
;; v134 = iconst.i64 8
;; v135 = iadd v83, v134 ; v134 = 8
;; @0022 v86 = icmp eq v135, v80
diff --git a/tests/disas/gc/copying/array-set.wat b/tests/disas/gc/copying/array-set.wat
index 5ef884de7e..e39b71ef39 100644
--- a/tests/disas/gc/copying/array-set.wat
+++ b/tests/disas/gc/copying/array-set.wat
@@ -14,6 +14,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -48,7 +49,7 @@
;; @0024 v29 = isub v20, v23
;; @0024 v30 = uextend.i64 v29
;; @0024 v31 = isub v28, v30
-;; @0024 store user2 little region4 v4, v31
+;; @0024 store user2 little region5 v4, v31
;; @0027 jump block1
;;
;; block1:
diff --git a/tests/disas/gc/copying/funcref-in-gc-heap-get.wat b/tests/disas/gc/copying/funcref-in-gc-heap-get.wat
index 84ac64d032..c79a2f0857 100644
--- a/tests/disas/gc/copying/funcref-in-gc-heap-get.wat
+++ b/tests/disas/gc/copying/funcref-in-gc-heap-get.wat
@@ -13,7 +13,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 147 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/gc/copying/funcref-in-gc-heap-new.wat b/tests/disas/gc/copying/funcref-in-gc-heap-new.wat
index 32340a8407..6e3e981b87 100644
--- a/tests/disas/gc/copying/funcref-in-gc-heap-new.wat
+++ b/tests/disas/gc/copying/funcref-in-gc-heap-new.wat
@@ -19,7 +19,8 @@
;; region6 = 6 ""
;; region7 = 196 ""
;; region8 = 108 ""
-;; region9 = 232 ""
+;; region9 = 147 ""
+;; region10 = 135 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -71,15 +72,15 @@
;;
;; block4(v33: i32, v34: i64):
;; v41 = stack_addr.i64 ss0
-;; store notrap aligned region9 v33, v41
+;; store notrap aligned region10 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 region8 v38, v36
+;; @0020 store user2 little region9 v38, v36
;; @0023 jump block1
;;
;; block1:
-;; v40 = load.i32 notrap aligned region9 v41
+;; v40 = load.i32 notrap aligned region10 v41
;; @0023 return v40
;; }
diff --git a/tests/disas/gc/copying/funcref-in-gc-heap-set.wat b/tests/disas/gc/copying/funcref-in-gc-heap-set.wat
index 657dabab52..6df206f4b7 100644
--- a/tests/disas/gc/copying/funcref-in-gc-heap-set.wat
+++ b/tests/disas/gc/copying/funcref-in-gc-heap-set.wat
@@ -13,7 +13,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 147 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/gc/copying/multiple-array-get.wat b/tests/disas/gc/copying/multiple-array-get.wat
index 493b490da3..571eb47731 100644
--- a/tests/disas/gc/copying/multiple-array-get.wat
+++ b/tests/disas/gc/copying/multiple-array-get.wat
@@ -15,6 +15,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -49,7 +50,7 @@
;; @0024 v29 = isub v20, v23
;; @0024 v30 = uextend.i64 v29
;; @0024 v31 = isub v28, v30
-;; @0024 v32 = load.i64 user2 little region4 v31
+;; @0024 v32 = load.i64 user2 little region5 v31
;; @002b v40 = icmp ult v4, v11
;; @002b trapz v40, user17
;; v78 = ishl v4, v70 ; v70 = 3
@@ -57,7 +58,7 @@
;; @002b v57 = isub v20, v51
;; @002b v58 = uextend.i64 v57
;; @002b v59 = isub v28, v58
-;; @002b v60 = load.i64 user2 little region4 v59
+;; @002b v60 = load.i64 user2 little region5 v59
;; @002e jump block1
;;
;; block1:
diff --git a/tests/disas/gc/copying/multiple-struct-get.wat b/tests/disas/gc/copying/multiple-struct-get.wat
index 905a866932..58b7b906ef 100644
--- a/tests/disas/gc/copying/multiple-struct-get.wat
+++ b/tests/disas/gc/copying/multiple-struct-get.wat
@@ -15,7 +15,8 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 147 ""
+;; region5 = 225 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -32,7 +33,7 @@
;; @0023 v9 = load.f32 user2 little region4 v8
;; @0029 v14 = iconst.i64 20
;; @0029 v15 = iadd v6, v14 ; v14 = 20
-;; @0029 v16 = load.i8 user2 little region4 v15
+;; @0029 v16 = load.i8 user2 little region5 v15
;; @002d jump block1
;;
;; block1:
diff --git a/tests/disas/gc/copying/struct-get.wat b/tests/disas/gc/copying/struct-get.wat
index 7ecce01ad8..71214509fc 100644
--- a/tests/disas/gc/copying/struct-get.wat
+++ b/tests/disas/gc/copying/struct-get.wat
@@ -27,7 +27,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 147 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -53,7 +53,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 225 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -80,7 +80,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 225 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -107,7 +107,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 152 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/gc/copying/struct-new-default.wat b/tests/disas/gc/copying/struct-new-default.wat
index 2acf7ec270..0f1bbb796d 100644
--- a/tests/disas/gc/copying/struct-new-default.wat
+++ b/tests/disas/gc/copying/struct-new-default.wat
@@ -20,6 +20,9 @@
;; region6 = 6 ""
;; region7 = 196 ""
;; region8 = 108 ""
+;; region9 = 147 ""
+;; region10 = 225 ""
+;; region11 = 152 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -71,14 +74,14 @@
;; @0021 v2 = f32const 0.0
;; @0021 v37 = iconst.i64 16
;; @0021 v38 = iadd v36, v37 ; v37 = 16
-;; @0021 store user2 little region8 v2, v38 ; v2 = 0.0
+;; @0021 store user2 little region9 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 region8 v3, v40 ; v3 = 0
+;; @0021 istore8 user2 little region10 v3, v40 ; v3 = 0
;; @0021 v41 = iconst.i64 24
;; @0021 v42 = iadd v36, v41 ; v41 = 24
-;; @0021 store user2 little region8 v3, v42 ; v3 = 0
+;; @0021 store user2 little region11 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.wat
index a329233a99..a2a3646466 100644
--- a/tests/disas/gc/copying/struct-new.wat
+++ b/tests/disas/gc/copying/struct-new.wat
@@ -21,7 +21,10 @@
;; region6 = 6 ""
;; region7 = 196 ""
;; region8 = 108 ""
-;; region9 = 232 ""
+;; region9 = 147 ""
+;; region10 = 225 ""
+;; region11 = 152 ""
+;; region12 = 135 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -31,7 +34,7 @@
;;
;; block0(v0: i64, v1: i64, v2: f32, v3: i32, v4: i32):
;; v45 = stack_addr.i64 ss0
-;; store notrap aligned region9 v4, v45
+;; store notrap aligned region12 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
@@ -74,14 +77,14 @@
;; block4(v35: i32, v36: i64):
;; @002a v37 = iconst.i64 16
;; @002a v38 = iadd v36, v37 ; v37 = 16
-;; @002a store.f32 user2 little region8 v2, v38
+;; @002a store.f32 user2 little region9 v2, v38
;; @002a v39 = iconst.i64 20
;; @002a v40 = iadd v36, v39 ; v39 = 20
-;; @002a istore8.i32 user2 little region8 v3, v40
-;; v44 = load.i32 notrap aligned region9 v45
+;; @002a istore8.i32 user2 little region10 v3, v40
+;; v44 = load.i32 notrap aligned region12 v45
;; @002a v41 = iconst.i64 24
;; @002a v42 = iadd v36, v41 ; v41 = 24
-;; @002a store user2 little region8 v44, v42
+;; @002a store user2 little region11 v44, v42
;; @002d jump block1
;;
;; block1:
diff --git a/tests/disas/gc/copying/struct-set.wat b/tests/disas/gc/copying/struct-set.wat
index fb6ae9597f..743b705cbb 100644
--- a/tests/disas/gc/copying/struct-set.wat
+++ b/tests/disas/gc/copying/struct-set.wat
@@ -23,7 +23,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 147 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -49,7 +49,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 225 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -75,7 +75,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 152 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/gc/copying/v128-fields.wat b/tests/disas/gc/copying/v128-fields.wat
index 850f965d3c..dc7b87087d 100644
--- a/tests/disas/gc/copying/v128-fields.wat
+++ b/tests/disas/gc/copying/v128-fields.wat
@@ -15,7 +15,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 147 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/gc/drc/array-fill.wat b/tests/disas/gc/drc/array-fill.wat
index 0d1325a5d4..77c99ad8b4 100644
--- a/tests/disas/gc/drc/array-fill.wat
+++ b/tests/disas/gc/drc/array-fill.wat
@@ -15,6 +15,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; 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 @@
;; @0027 brif v42, block3, block2(v29)
;;
;; block2(v43: i64):
-;; @0027 store.i64 user2 little region4 v4, v43
+;; @0027 store.i64 user2 little region5 v4, v43
;; v54 = iconst.i64 8
;; v55 = iadd v43, v54 ; v54 = 8
;; @0027 v46 = icmp eq v55, v40
diff --git a/tests/disas/gc/drc/array-get-s.wat b/tests/disas/gc/drc/array-get-s.wat
index f076a9630e..b8d0463059 100644
--- a/tests/disas/gc/drc/array-get-s.wat
+++ b/tests/disas/gc/drc/array-get-s.wat
@@ -15,6 +15,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -44,7 +45,7 @@
;; @0022 v28 = isub v19, v22
;; @0022 v29 = uextend.i64 v28
;; @0022 v30 = isub v27, v29
-;; @0022 v31 = load.i8 user2 little region4 v30
+;; @0022 v31 = load.i8 user2 little region5 v30
;; @0025 jump block1
;;
;; block1:
diff --git a/tests/disas/gc/drc/array-get-u.wat b/tests/disas/gc/drc/array-get-u.wat
index 131323b42c..759331c512 100644
--- a/tests/disas/gc/drc/array-get-u.wat
+++ b/tests/disas/gc/drc/array-get-u.wat
@@ -15,6 +15,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -44,7 +45,7 @@
;; @0022 v28 = isub v19, v22
;; @0022 v29 = uextend.i64 v28
;; @0022 v30 = isub v27, v29
-;; @0022 v31 = load.i8 user2 little region4 v30
+;; @0022 v31 = load.i8 user2 little region5 v30
;; @0025 jump block1
;;
;; block1:
diff --git a/tests/disas/gc/drc/array-get.wat b/tests/disas/gc/drc/array-get.wat
index 7294e7d952..3b1fe05749 100644
--- a/tests/disas/gc/drc/array-get.wat
+++ b/tests/disas/gc/drc/array-get.wat
@@ -15,6 +15,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -49,7 +50,7 @@
;; @0022 v28 = isub v19, v22
;; @0022 v29 = uextend.i64 v28
;; @0022 v30 = isub v27, v29
-;; @0022 v31 = load.i64 user2 little region4 v30
+;; @0022 v31 = load.i64 user2 little region5 v30
;; @0025 jump block1
;;
;; block1:
diff --git a/tests/disas/gc/drc/array-new-fixed-of-gc-refs.wat b/tests/disas/gc/drc/array-new-fixed-of-gc-refs.wat
index c4e68d26da..7e413bf27e 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
@@ -20,9 +20,10 @@
;; region4 = 196 ""
;; region5 = 108 ""
;; region6 = 206 ""
-;; region7 = 232 ""
-;; region8 = 240 ""
-;; region9 = 208 ""
+;; region7 = 5 ""
+;; region8 = 135 ""
+;; region9 = 187 ""
+;; region10 = 26 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -32,11 +33,11 @@
;;
;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32):
;; v202 = stack_addr.i64 ss2
-;; store notrap aligned region9 v2, v202
+;; store notrap aligned region10 v2, v202
;; v203 = stack_addr.i64 ss1
-;; store notrap aligned region8 v3, v203
+;; store notrap aligned region9 v3, v203
;; v204 = stack_addr.i64 ss0
-;; store notrap aligned region7 v4, v204
+;; store notrap aligned region8 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
@@ -53,7 +54,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 region9 v202
+;; v201 = load.i32 notrap aligned region10 v202
;; @0025 v53 = iconst.i32 1
;; @0025 v54 = band v201, v53 ; v53 = 1
;; @0025 v25 = iconst.i32 0
@@ -78,7 +79,7 @@
;; @0025 v49 = iadd.i64 v20, v46
;; v206 = iconst.i64 12
;; @0025 v52 = isub v49, v206 ; v206 = 12
-;; @0025 store.i32 user2 little region5 v201, v52
+;; @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
@@ -95,7 +96,7 @@
;; @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 region8 v203
+;; v191 = load.i32 notrap aligned region9 v203
;; v308 = band v191, v306 ; v306 = 1
;; v309 = iconst.i32 0
;; v310 = icmp eq v191, v309 ; v309 = 0
@@ -121,7 +122,7 @@
;; @0025 v99 = isub.i32 v90, v269 ; v269 = 32
;; @0025 v100 = uextend.i64 v99
;; @0025 v101 = isub v98, v100
-;; @0025 store.i32 user2 little region5 v191, v101
+;; @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
@@ -137,7 +138,7 @@
;; 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 region7 v204
+;; v181 = load.i32 notrap aligned region8 v204
;; v322 = iconst.i32 1
;; v323 = band v181, v322 ; v322 = 1
;; v324 = iconst.i32 0
@@ -164,7 +165,7 @@
;; @0025 v148 = isub.i32 v139, v299 ; v299 = 36
;; @0025 v149 = uextend.i64 v148
;; @0025 v150 = isub v147, v149
-;; @0025 store.i32 user2 little region5 v181, v150
+;; @0025 store.i32 user2 little region7 v181, v150
;; @0029 jump block1
;;
;; block1:
diff --git a/tests/disas/gc/drc/array-new-fixed.wat b/tests/disas/gc/drc/array-new-fixed.wat
index 49b43a06cf..ebb503cbc7 100644
--- a/tests/disas/gc/drc/array-new-fixed.wat
+++ b/tests/disas/gc/drc/array-new-fixed.wat
@@ -17,6 +17,7 @@
;; region4 = 196 ""
;; region5 = 108 ""
;; region6 = 206 ""
+;; region7 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -44,46 +45,13 @@
;; @0025 v46 = uextend.i64 v45
;; @0025 v49 = iadd v20, v46
;; @0025 v52 = isub v49, v110 ; v110 = 24
-;; @0025 store user2 little region5 v2, v52
-;; @0025 v60 = load.i32 user2 readonly region5 v24
-;; @0025 v53 = iconst.i32 1
-;; v150 = icmp ugt v60, v53 ; v53 = 1
-;; @0025 trapz v150, user17
-;; @0025 v63 = uextend.i64 v60
-;; v109 = iconst.i64 3
-;; v153 = ishl v63, v109 ; v109 = 3
-;; @0025 v10 = iconst.i64 32
-;; @0025 v66 = ushr v153, v10 ; v10 = 32
-;; @0025 trapnz v66, user2
-;; v158 = ishl v60, v5 ; v5 = 3
-;; @0025 v6 = iconst.i32 32
-;; @0025 v69 = uadd_overflow_trap v158, v6, user2 ; v6 = 32
-;; @0025 v73 = uadd_overflow_trap v18, v69, user2
-;; @0025 v74 = uextend.i64 v73
-;; @0025 v77 = iadd v20, v74
-;; v170 = iconst.i32 40
-;; @0025 v78 = isub v69, v170 ; v170 = 40
-;; @0025 v79 = uextend.i64 v78
-;; @0025 v80 = isub v77, v79
-;; @0025 store user2 little region5 v3, v80
-;; @0025 v88 = load.i32 user2 readonly region5 v24
-;; @0025 v81 = iconst.i32 2
-;; v176 = icmp ugt v88, v81 ; v81 = 2
-;; @0025 trapz v176, user17
-;; @0025 v91 = uextend.i64 v88
-;; v179 = ishl v91, v109 ; v109 = 3
-;; @0025 v94 = ushr v179, v10 ; v10 = 32
-;; @0025 trapnz v94, user2
-;; v184 = ishl v88, v5 ; v5 = 3
-;; @0025 v97 = uadd_overflow_trap v184, v6, user2 ; v6 = 32
-;; @0025 v101 = uadd_overflow_trap v18, v97, user2
-;; @0025 v102 = uextend.i64 v101
-;; @0025 v105 = iadd v20, v102
-;; v201 = iconst.i32 48
-;; @0025 v106 = isub v97, v201 ; v201 = 48
-;; @0025 v107 = uextend.i64 v106
-;; @0025 v108 = isub v105, v107
-;; @0025 store user2 little region5 v4, v108
+;; @0025 store user2 little region7 v2, v52
+;; v178 = iconst.i64 16
+;; @0025 v80 = isub v49, v178 ; v178 = 16
+;; @0025 store user2 little region7 v3, v80
+;; @0025 v8 = iconst.i64 8
+;; @0025 v108 = isub v49, v8 ; v8 = 8
+;; @0025 store user2 little region7 v4, v108
;; @0029 jump block1
;;
;; block1:
diff --git a/tests/disas/gc/drc/array-new.wat b/tests/disas/gc/drc/array-new.wat
index 454539ecec..0bc0685d4c 100644
--- a/tests/disas/gc/drc/array-new.wat
+++ b/tests/disas/gc/drc/array-new.wat
@@ -17,6 +17,7 @@
;; region4 = 196 ""
;; region5 = 108 ""
;; region6 = 206 ""
+;; region7 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -61,7 +62,7 @@
;; @0022 brif v60, block3, block2(v43)
;;
;; block2(v61: i64):
-;; @0022 store.i64 user2 little region5 v2, v61
+;; @0022 store.i64 user2 little region7 v2, v61
;; v91 = iconst.i64 8
;; v92 = iadd v61, v91 ; v91 = 8
;; @0022 v64 = icmp eq v92, v58
diff --git a/tests/disas/gc/drc/array-set.wat b/tests/disas/gc/drc/array-set.wat
index bfd8b06b55..a9fd815da7 100644
--- a/tests/disas/gc/drc/array-set.wat
+++ b/tests/disas/gc/drc/array-set.wat
@@ -15,6 +15,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -49,7 +50,7 @@
;; @0024 v29 = isub v20, v23
;; @0024 v30 = uextend.i64 v29
;; @0024 v31 = isub v28, v30
-;; @0024 store user2 little region4 v4, v31
+;; @0024 store user2 little region5 v4, v31
;; @0027 jump block1
;;
;; block1:
diff --git a/tests/disas/gc/drc/externref-globals.wat b/tests/disas/gc/drc/externref-globals.wat
index e727f6ba9a..a4708eed04 100644
--- a/tests/disas/gc/drc/externref-globals.wat
+++ b/tests/disas/gc/drc/externref-globals.wat
@@ -24,7 +24,7 @@
;; region7 = 210 ""
;; region8 = 115 ""
;; region9 = 137 ""
-;; region10 = 232 ""
+;; region10 = 135 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/gc/drc/funcref-in-gc-heap-get.wat b/tests/disas/gc/drc/funcref-in-gc-heap-get.wat
index c4e0b6ff71..54cbd4883b 100644
--- a/tests/disas/gc/drc/funcref-in-gc-heap-get.wat
+++ b/tests/disas/gc/drc/funcref-in-gc-heap-get.wat
@@ -14,7 +14,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 147 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/gc/drc/funcref-in-gc-heap-new.wat b/tests/disas/gc/drc/funcref-in-gc-heap-new.wat
index 4fe0d6552d..302ee00f24 100644
--- a/tests/disas/gc/drc/funcref-in-gc-heap-new.wat
+++ b/tests/disas/gc/drc/funcref-in-gc-heap-new.wat
@@ -16,8 +16,8 @@
;; region2 = 130 ""
;; region3 = 6 ""
;; region4 = 196 ""
-;; region5 = 108 ""
-;; region6 = 232 ""
+;; region5 = 147 ""
+;; region6 = 135 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/gc/drc/funcref-in-gc-heap-set.wat b/tests/disas/gc/drc/funcref-in-gc-heap-set.wat
index c29ad8b26c..bfed4dcbe7 100644
--- a/tests/disas/gc/drc/funcref-in-gc-heap-set.wat
+++ b/tests/disas/gc/drc/funcref-in-gc-heap-set.wat
@@ -14,7 +14,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 147 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/gc/drc/multiple-array-get.wat b/tests/disas/gc/drc/multiple-array-get.wat
index bc9463649c..4e8eb6ec23 100644
--- a/tests/disas/gc/drc/multiple-array-get.wat
+++ b/tests/disas/gc/drc/multiple-array-get.wat
@@ -16,6 +16,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -50,7 +51,7 @@
;; @0024 v29 = isub v20, v23
;; @0024 v30 = uextend.i64 v29
;; @0024 v31 = isub v28, v30
-;; @0024 v32 = load.i64 user2 little region4 v31
+;; @0024 v32 = load.i64 user2 little region5 v31
;; @002b v40 = icmp ult v4, v11
;; @002b trapz v40, user17
;; v78 = ishl v4, v70 ; v70 = 3
@@ -58,7 +59,7 @@
;; @002b v57 = isub v20, v51
;; @002b v58 = uextend.i64 v57
;; @002b v59 = isub v28, v58
-;; @002b v60 = load.i64 user2 little region4 v59
+;; @002b v60 = load.i64 user2 little region5 v59
;; @002e jump block1
;;
;; block1:
diff --git a/tests/disas/gc/drc/multiple-struct-get.wat b/tests/disas/gc/drc/multiple-struct-get.wat
index 1a4ee93694..e0e9e5d6d9 100644
--- a/tests/disas/gc/drc/multiple-struct-get.wat
+++ b/tests/disas/gc/drc/multiple-struct-get.wat
@@ -16,7 +16,8 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 147 ""
+;; region5 = 225 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -33,7 +34,7 @@
;; @0023 v9 = load.f32 user2 little region4 v8
;; @0029 v14 = iconst.i64 28
;; @0029 v15 = iadd v6, v14 ; v14 = 28
-;; @0029 v16 = load.i8 user2 little region4 v15
+;; @0029 v16 = load.i8 user2 little region5 v15
;; @002d jump block1
;;
;; block1:
diff --git a/tests/disas/gc/drc/struct-get.wat b/tests/disas/gc/drc/struct-get.wat
index 47c6e6d75f..4e9e230a9f 100644
--- a/tests/disas/gc/drc/struct-get.wat
+++ b/tests/disas/gc/drc/struct-get.wat
@@ -28,7 +28,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 147 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -54,7 +54,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 225 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -81,7 +81,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 225 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -109,12 +109,13 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
-;; region5 = 65 ""
-;; region6 = 210 ""
-;; region7 = 115 ""
-;; region8 = 137 ""
-;; region9 = 232 ""
+;; region4 = 152 ""
+;; region5 = 108 ""
+;; region6 = 65 ""
+;; region7 = 210 ""
+;; region8 = 115 ""
+;; region9 = 137 ""
+;; region10 = 135 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -132,7 +133,7 @@
;; @004e v8 = iadd v6, v7 ; v7 = 32
;; @004e v9 = load.i32 user2 little region4 v8
;; v81 = stack_addr.i64 ss0
-;; store notrap aligned region9 v9, v81
+;; store notrap aligned region10 v9, v81
;; @004e v10 = iconst.i32 1
;; @004e v11 = band v9, v10 ; v10 = 1
;; @004e v12 = iconst.i32 0
@@ -144,32 +145,32 @@
;; block2:
;; @004e v16 = uextend.i64 v9
;; @004e v19 = iadd.i64 v5, v16
-;; @004e v20 = load.i32 user2 region4 v19
+;; @004e v20 = load.i32 user2 region5 v19
;; @004e v21 = iconst.i32 2
;; @004e v22 = band v20, v21 ; v21 = 2
;; @004e brif v22, block4, block3
;;
;; block3:
-;; @004e v23 = load.i64 notrap aligned readonly can_move region5 v0+32
-;; @004e v24 = load.i32 notrap aligned region6 v23
+;; @004e v23 = load.i64 notrap aligned readonly can_move region6 v0+32
+;; @004e v24 = load.i32 notrap aligned region7 v23
;; @004e v29 = iconst.i64 16
;; @004e v30 = iadd.i64 v19, v29 ; v29 = 16
-;; @004e store user2 region4 v24, v30
+;; @004e store user2 region5 v24, v30
;; v82 = iconst.i32 2
;; v83 = bor.i32 v20, v82 ; v82 = 2
-;; @004e store user2 region4 v83, v19
+;; @004e store user2 region5 v83, v19
;; @004e v41 = iconst.i64 8
;; @004e v42 = iadd.i64 v19, v41 ; v41 = 8
-;; @004e v43 = load.i64 user2 region4 v42
+;; @004e v43 = load.i64 user2 region5 v42
;; @004e v44 = iconst.i64 1
;; @004e v45 = iadd v43, v44 ; v44 = 1
-;; @004e store user2 region4 v45, v42
-;; @004e store.i32 notrap aligned region6 v9, v23
-;; @004e v52 = load.i32 notrap aligned region7 v23+4
+;; @004e store user2 region5 v45, v42
+;; @004e store.i32 notrap aligned region7 v9, v23
+;; @004e v52 = load.i32 notrap aligned region8 v23+4
;; v84 = iconst.i32 1
;; v85 = iadd v52, v84 ; v84 = 1
-;; @004e store notrap aligned region7 v85, v23+4
-;; @004e v57 = load.i32 notrap aligned region8 v23+8
+;; @004e store notrap aligned region8 v85, v23+4
+;; @004e v57 = load.i32 notrap aligned region9 v23+8
;; @004e v58 = iadd v57, v57
;; @004e v59 = iconst.i32 1024
;; @004e v60 = umax v58, v59 ; v59 = 1024
@@ -187,6 +188,6 @@
;; @0052 jump block1
;;
;; block1:
-;; v64 = load.i32 notrap aligned region9 v81
+;; v64 = load.i32 notrap aligned region10 v81
;; @0052 return v64
;; }
diff --git a/tests/disas/gc/drc/struct-new-default.wat b/tests/disas/gc/drc/struct-new-default.wat
index a11ac5f14b..a3b0f352cc 100644
--- a/tests/disas/gc/drc/struct-new-default.wat
+++ b/tests/disas/gc/drc/struct-new-default.wat
@@ -17,8 +17,11 @@
;; region2 = 130 ""
;; region3 = 6 ""
;; region4 = 196 ""
-;; region5 = 108 ""
-;; region6 = 206 ""
+;; region5 = 147 ""
+;; region6 = 225 ""
+;; region7 = 152 ""
+;; region8 = 206 ""
+;; region9 = 108 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -44,14 +47,14 @@
;; @0021 v3 = iconst.i32 0
;; @0021 v17 = iconst.i64 28
;; @0021 v18 = iadd v14, v17 ; v17 = 28
-;; @0021 istore8 user2 little region5 v3, v18 ; v3 = 0
+;; @0021 istore8 user2 little region6 v3, v18 ; v3 = 0
;; @0021 jump block3
;;
;; block3:
;; v59 = iconst.i32 0
;; @0021 v19 = iconst.i64 32
;; @0021 v20 = iadd.i64 v14, v19 ; v19 = 32
-;; @0021 store user2 little region5 v59, v20 ; v59 = 0
+;; @0021 store user2 little region7 v59, v20 ; v59 = 0
;; @0024 jump block1
;;
;; block1:
diff --git a/tests/disas/gc/drc/struct-new.wat b/tests/disas/gc/drc/struct-new.wat
index bc908530ad..09b244415f 100644
--- a/tests/disas/gc/drc/struct-new.wat
+++ b/tests/disas/gc/drc/struct-new.wat
@@ -18,9 +18,12 @@
;; region2 = 130 ""
;; region3 = 6 ""
;; region4 = 196 ""
-;; region5 = 108 ""
-;; region6 = 206 ""
-;; region7 = 232 ""
+;; region5 = 147 ""
+;; region6 = 225 ""
+;; region7 = 152 ""
+;; region8 = 206 ""
+;; region9 = 108 ""
+;; region10 = 135 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -30,7 +33,7 @@
;;
;; block0(v0: i64, v1: i64, v2: f32, v3: i32, v4: i32):
;; v52 = stack_addr.i64 ss0
-;; store notrap aligned region7 v4, v52
+;; store notrap aligned region10 v4, v52
;; @002a v6 = iconst.i32 -1342177280
;; @002a v7 = load.i64 notrap aligned readonly can_move region2 v0+40
;; @002a v8 = load.i32 notrap aligned readonly can_move region3 v7
@@ -46,8 +49,8 @@
;; @002a store user2 little region5 v2, v16
;; @002a v17 = iconst.i64 28
;; @002a v18 = iadd v14, v17 ; v17 = 28
-;; @002a istore8 user2 little region5 v3, v18
-;; v51 = load.i32 notrap aligned region7 v52
+;; @002a istore8 user2 little region6 v3, v18
+;; v51 = load.i32 notrap aligned region10 v52
;; @002a v21 = iconst.i32 1
;; @002a v22 = band v51, v21 ; v21 = 1
;; @002a v23 = iconst.i32 0
@@ -61,16 +64,16 @@
;; @002a v30 = iadd.i64 v12, v27
;; @002a v31 = iconst.i64 8
;; @002a v32 = iadd v30, v31 ; v31 = 8
-;; @002a v33 = load.i64 user2 region5 v32
+;; @002a v33 = load.i64 user2 region9 v32
;; @002a v34 = iconst.i64 1
;; @002a v35 = iadd v33, v34 ; v34 = 1
-;; @002a store user2 region5 v35, v32
+;; @002a store user2 region9 v35, v32
;; @002a jump block3
;;
;; block3:
;; @002a v19 = iconst.i64 32
;; @002a v20 = iadd.i64 v14, v19 ; v19 = 32
-;; @002a store.i32 user2 little region5 v51, v20
+;; @002a store.i32 user2 little region7 v51, v20
;; @002d jump block1
;;
;; block1:
diff --git a/tests/disas/gc/drc/struct-set.wat b/tests/disas/gc/drc/struct-set.wat
index d931c8e02a..44ab8fdab7 100644
--- a/tests/disas/gc/drc/struct-set.wat
+++ b/tests/disas/gc/drc/struct-set.wat
@@ -24,7 +24,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 147 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -50,7 +50,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 225 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -76,7 +76,8 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 152 ""
+;; region5 = 108 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -106,10 +107,10 @@
;; @004a v20 = iadd.i64 v6, v17
;; @004a v21 = iconst.i64 8
;; @004a v22 = iadd v20, v21 ; v21 = 8
-;; @004a v23 = load.i64 user2 region4 v22
+;; @004a v23 = load.i64 user2 region5 v22
;; @004a v24 = iconst.i64 1
;; @004a v25 = iadd v23, v24 ; v24 = 1
-;; @004a store user2 region4 v25, v22
+;; @004a store user2 region5 v25, v22
;; @004a jump block3
;;
;; block3:
@@ -128,7 +129,7 @@
;; @004a v41 = iadd.i64 v6, v38
;; v73 = iconst.i64 8
;; @004a v43 = iadd v41, v73 ; v73 = 8
-;; @004a v44 = load.i64 user2 region4 v43
+;; @004a v44 = load.i64 user2 region5 v43
;; v74 = iconst.i64 1
;; v66 = icmp eq v44, v74 ; v74 = 1
;; @004a brif v66, block5, block6
@@ -141,7 +142,7 @@
;; @004a v45 = iconst.i64 -1
;; @004a v46 = iadd.i64 v44, v45 ; v45 = -1
;; v75 = iadd.i64 v41, v73 ; v73 = 8
-;; @004a store user2 region4 v46, v75
+;; @004a store user2 region5 v46, v75
;; @004a jump block7
;;
;; block7:
diff --git a/tests/disas/gc/null/array-fill.wat b/tests/disas/gc/null/array-fill.wat
index 74520b2156..15e4617553 100644
--- a/tests/disas/gc/null/array-fill.wat
+++ b/tests/disas/gc/null/array-fill.wat
@@ -15,6 +15,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -52,7 +53,7 @@
;; @0027 brif v42, block3, block2(v29)
;;
;; block2(v43: i64):
-;; @0027 store.i64 user2 little region4 v4, v43
+;; @0027 store.i64 user2 little region5 v4, v43
;; v54 = iconst.i64 8
;; v55 = iadd v43, v54 ; v54 = 8
;; @0027 v46 = icmp eq v55, v40
diff --git a/tests/disas/gc/null/array-get-s.wat b/tests/disas/gc/null/array-get-s.wat
index 9091036b78..cb303a90ca 100644
--- a/tests/disas/gc/null/array-get-s.wat
+++ b/tests/disas/gc/null/array-get-s.wat
@@ -15,6 +15,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -44,7 +45,7 @@
;; @0022 v28 = isub v19, v22
;; @0022 v29 = uextend.i64 v28
;; @0022 v30 = isub v27, v29
-;; @0022 v31 = load.i8 user2 little region4 v30
+;; @0022 v31 = load.i8 user2 little region5 v30
;; @0025 jump block1
;;
;; block1:
diff --git a/tests/disas/gc/null/array-get-u.wat b/tests/disas/gc/null/array-get-u.wat
index e581086a75..27fd275864 100644
--- a/tests/disas/gc/null/array-get-u.wat
+++ b/tests/disas/gc/null/array-get-u.wat
@@ -15,6 +15,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -44,7 +45,7 @@
;; @0022 v28 = isub v19, v22
;; @0022 v29 = uextend.i64 v28
;; @0022 v30 = isub v27, v29
-;; @0022 v31 = load.i8 user2 little region4 v30
+;; @0022 v31 = load.i8 user2 little region5 v30
;; @0025 jump block1
;;
;; block1:
diff --git a/tests/disas/gc/null/array-get.wat b/tests/disas/gc/null/array-get.wat
index 4b886ca567..a71fc7304f 100644
--- a/tests/disas/gc/null/array-get.wat
+++ b/tests/disas/gc/null/array-get.wat
@@ -15,6 +15,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -49,7 +50,7 @@
;; @0022 v28 = isub v19, v22
;; @0022 v29 = uextend.i64 v28
;; @0022 v30 = isub v27, v29
-;; @0022 v31 = load.i64 user2 little region4 v30
+;; @0022 v31 = load.i64 user2 little region5 v30
;; @0025 jump block1
;;
;; block1:
diff --git a/tests/disas/gc/null/array-new-fixed-of-gc-refs.wat b/tests/disas/gc/null/array-new-fixed-of-gc-refs.wat
index b3fb1ed280..05a73a33aa 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
@@ -22,9 +22,10 @@
;; region6 = 130 ""
;; region7 = 6 ""
;; region8 = 108 ""
-;; region9 = 232 ""
-;; region10 = 240 ""
-;; region11 = 208 ""
+;; region9 = 5 ""
+;; region10 = 135 ""
+;; region11 = 187 ""
+;; region12 = 26 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -34,11 +35,11 @@
;;
;; block0(v0: i64, v1: i64, v2: i32, v3: i32, v4: i32):
;; v131 = stack_addr.i64 ss2
-;; store notrap aligned region11 v2, v131
+;; store notrap aligned region12 v2, v131
;; v132 = stack_addr.i64 ss1
-;; store notrap aligned region10 v3, v132
+;; store notrap aligned region11 v3, v132
;; v133 = stack_addr.i64 ss0
-;; store notrap aligned region9 v4, v133
+;; store notrap aligned region10 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
@@ -56,9 +57,9 @@
;; block2:
;; v158 = iconst.i32 -1476394984
;; @0025 v32 = load.i64 notrap aligned readonly can_move region5 v26+32
-;; v252 = band.i32 v21, v157 ; v157 = -8
-;; v253 = uextend.i64 v252
-;; @0025 v34 = iadd v32, v253
+;; v253 = band.i32 v21, v157 ; v157 = -8
+;; v254 = uextend.i64 v253
+;; @0025 v34 = iadd v32, v254
;; @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
@@ -68,56 +69,22 @@
;; @0025 v39 = iconst.i64 8
;; @0025 v40 = iadd v34, v39 ; v39 = 8
;; @0025 store user2 region8 v5, v40 ; v5 = 3
-;; @0025 trapz v252, user16
-;; v254 = iconst.i32 24
-;; @0025 v61 = uadd_overflow_trap v252, v254, user2 ; v254 = 24
-;; v130 = load.i32 notrap aligned region11 v131
+;; @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
;; @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 region8 v130, v68
-;; @0025 v76 = load.i32 user2 readonly region8 v40
-;; @0025 v69 = iconst.i32 1
-;; v196 = icmp ugt v76, v69 ; v69 = 1
-;; @0025 trapz v196, user17
-;; @0025 v79 = uextend.i64 v76
-;; v136 = iconst.i64 2
-;; v199 = ishl v79, v136 ; v136 = 2
-;; @0025 v10 = iconst.i64 32
-;; @0025 v82 = ushr v199, v10 ; v10 = 32
-;; @0025 trapnz v82, user2
-;; v175 = iconst.i32 2
-;; v204 = ishl v76, v175 ; v175 = 2
-;; @0025 v6 = iconst.i32 12
-;; @0025 v85 = uadd_overflow_trap v204, v6, user2 ; v6 = 12
-;; @0025 v89 = uadd_overflow_trap v252, v85, user2
-;; v128 = load.i32 notrap aligned region10 v132
-;; @0025 v90 = uextend.i64 v89
-;; @0025 v93 = iadd v32, v90
-;; v216 = iconst.i32 16
-;; @0025 v94 = isub v85, v216 ; v216 = 16
-;; @0025 v95 = uextend.i64 v94
-;; @0025 v96 = isub v93, v95
-;; @0025 store user2 little region8 v128, v96
-;; @0025 v104 = load.i32 user2 readonly region8 v40
-;; v222 = icmp ugt v104, v175 ; v175 = 2
-;; @0025 trapz v222, user17
-;; @0025 v107 = uextend.i64 v104
-;; v225 = ishl v107, v136 ; v136 = 2
-;; @0025 v110 = ushr v225, v10 ; v10 = 32
-;; @0025 trapnz v110, user2
-;; v230 = ishl v104, v175 ; v175 = 2
-;; @0025 v113 = uadd_overflow_trap v230, v6, user2 ; v6 = 12
-;; @0025 v117 = uadd_overflow_trap v252, v113, user2
-;; v126 = load.i32 notrap aligned region9 v133
-;; @0025 v118 = uextend.i64 v117
-;; @0025 v121 = iadd v32, v118
-;; v246 = iconst.i32 20
-;; @0025 v122 = isub v113, v246 ; v246 = 20
-;; @0025 v123 = uextend.i64 v122
-;; @0025 v124 = isub v121, v123
-;; @0025 store user2 little region8 v126, v124
+;; @0025 store user2 little region9 v130, v68
+;; v128 = load.i32 notrap aligned region11 v132
+;; @0025 v96 = isub v65, v39 ; v39 = 8
+;; @0025 store user2 little region9 v128, v96
+;; v126 = load.i32 notrap aligned region10 v133
+;; @0025 v8 = iconst.i64 4
+;; @0025 v124 = isub v65, v8 ; v8 = 4
+;; @0025 store user2 little region9 v126, v124
;; @0029 jump block1
;;
;; block3 cold:
@@ -126,6 +93,6 @@
;; @0025 jump block2
;;
;; block1:
-;; v255 = band.i32 v21, v157 ; v157 = -8
-;; @0029 return v255
+;; v256 = band.i32 v21, v157 ; v157 = -8
+;; @0029 return v256
;; }
diff --git a/tests/disas/gc/null/array-new-fixed.wat b/tests/disas/gc/null/array-new-fixed.wat
index 5ca8f625f5..93d9fa174f 100644
--- a/tests/disas/gc/null/array-new-fixed.wat
+++ b/tests/disas/gc/null/array-new-fixed.wat
@@ -19,6 +19,7 @@
;; region6 = 130 ""
;; region7 = 6 ""
;; region8 = 108 ""
+;; region9 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -44,9 +45,9 @@
;; block2:
;; v149 = iconst.i32 -1476394968
;; @0025 v32 = load.i64 notrap aligned readonly can_move region5 v26+32
-;; v240 = band.i32 v21, v148 ; v148 = -8
-;; v241 = uextend.i64 v240
-;; @0025 v34 = iadd v32, v241
+;; v242 = band.i32 v21, v148 ; v148 = -8
+;; v243 = uextend.i64 v242
+;; @0025 v34 = iadd v32, v243
;; @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
@@ -56,53 +57,19 @@
;; @0025 v8 = iconst.i64 8
;; @0025 v40 = iadd v34, v8 ; v8 = 8
;; @0025 store user2 region8 v5, v40 ; v5 = 3
-;; @0025 trapz v240, user16
-;; v242 = iconst.i32 40
-;; @0025 v61 = uadd_overflow_trap v240, v242, user2 ; v242 = 40
+;; @0025 trapz v242, user16
+;; v244 = iconst.i32 40
+;; @0025 v61 = uadd_overflow_trap v242, v244, user2 ; v244 = 40
;; @0025 v62 = uextend.i64 v61
;; @0025 v65 = iadd v32, v62
;; v126 = iconst.i64 24
;; @0025 v68 = isub v65, v126 ; v126 = 24
-;; @0025 store.i64 user2 little region8 v2, v68
-;; @0025 v76 = load.i32 user2 readonly region8 v40
-;; @0025 v69 = iconst.i32 1
-;; v185 = icmp ugt v76, v69 ; v69 = 1
-;; @0025 trapz v185, user17
-;; @0025 v79 = uextend.i64 v76
-;; v125 = iconst.i64 3
-;; v188 = ishl v79, v125 ; v125 = 3
-;; @0025 v10 = iconst.i64 32
-;; @0025 v82 = ushr v188, v10 ; v10 = 32
-;; @0025 trapnz v82, user2
-;; v193 = ishl v76, v5 ; v5 = 3
-;; @0025 v6 = iconst.i32 16
-;; @0025 v85 = uadd_overflow_trap v193, v6, user2 ; v6 = 16
-;; @0025 v89 = uadd_overflow_trap v240, v85, user2
-;; @0025 v90 = uextend.i64 v89
-;; @0025 v93 = iadd v32, v90
-;; v134 = iconst.i32 24
-;; @0025 v94 = isub v85, v134 ; v134 = 24
-;; @0025 v95 = uextend.i64 v94
-;; @0025 v96 = isub v93, v95
-;; @0025 store.i64 user2 little region8 v3, v96
-;; @0025 v104 = load.i32 user2 readonly region8 v40
-;; @0025 v97 = iconst.i32 2
-;; v210 = icmp ugt v104, v97 ; v97 = 2
-;; @0025 trapz v210, user17
-;; @0025 v107 = uextend.i64 v104
-;; v213 = ishl v107, v125 ; v125 = 3
-;; @0025 v110 = ushr v213, v10 ; v10 = 32
-;; @0025 trapnz v110, user2
-;; v218 = ishl v104, v5 ; v5 = 3
-;; @0025 v113 = uadd_overflow_trap v218, v6, user2 ; v6 = 16
-;; @0025 v117 = uadd_overflow_trap v240, v113, user2
-;; @0025 v118 = uextend.i64 v117
-;; @0025 v121 = iadd v32, v118
-;; v234 = iconst.i32 32
-;; @0025 v122 = isub v113, v234 ; v234 = 32
-;; @0025 v123 = uextend.i64 v122
-;; @0025 v124 = isub v121, v123
-;; @0025 store.i64 user2 little region8 v4, v124
+;; @0025 store.i64 user2 little region9 v2, v68
+;; v211 = iconst.i64 16
+;; @0025 v96 = isub v65, v211 ; v211 = 16
+;; @0025 store.i64 user2 little region9 v3, v96
+;; @0025 v124 = isub v65, v8 ; v8 = 8
+;; @0025 store.i64 user2 little region9 v4, v124
;; @0029 jump block1
;;
;; block3 cold:
@@ -111,6 +78,6 @@
;; @0025 jump block2
;;
;; block1:
-;; v243 = band.i32 v21, v148 ; v148 = -8
-;; @0029 return v243
+;; v245 = band.i32 v21, v148 ; v148 = -8
+;; @0029 return v245
;; }
diff --git a/tests/disas/gc/null/array-new.wat b/tests/disas/gc/null/array-new.wat
index 3e5dd5d53f..691cdefbd6 100644
--- a/tests/disas/gc/null/array-new.wat
+++ b/tests/disas/gc/null/array-new.wat
@@ -19,6 +19,7 @@
;; region6 = 130 ""
;; region7 = 6 ""
;; region8 = 108 ""
+;; region9 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -82,7 +83,7 @@
;; @0022 brif v76, block5, block4(v59)
;;
;; block4(v77: i64):
-;; @0022 store.i64 user2 little region8 v2, v77
+;; @0022 store.i64 user2 little region9 v2, v77
;; v118 = iconst.i64 8
;; v119 = iadd v77, v118 ; v118 = 8
;; @0022 v80 = icmp eq v119, v74
diff --git a/tests/disas/gc/null/array-set.wat b/tests/disas/gc/null/array-set.wat
index 3667bcaeec..1f619955da 100644
--- a/tests/disas/gc/null/array-set.wat
+++ b/tests/disas/gc/null/array-set.wat
@@ -15,6 +15,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -49,7 +50,7 @@
;; @0024 v29 = isub v20, v23
;; @0024 v30 = uextend.i64 v29
;; @0024 v31 = isub v28, v30
-;; @0024 store user2 little region4 v4, v31
+;; @0024 store user2 little region5 v4, v31
;; @0027 jump block1
;;
;; block1:
diff --git a/tests/disas/gc/null/funcref-in-gc-heap-get.wat b/tests/disas/gc/null/funcref-in-gc-heap-get.wat
index e5a7204e7c..bf75705dc9 100644
--- a/tests/disas/gc/null/funcref-in-gc-heap-get.wat
+++ b/tests/disas/gc/null/funcref-in-gc-heap-get.wat
@@ -14,7 +14,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 147 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/gc/null/funcref-in-gc-heap-new.wat b/tests/disas/gc/null/funcref-in-gc-heap-new.wat
index 01bcc8a954..85ec3bfd18 100644
--- a/tests/disas/gc/null/funcref-in-gc-heap-new.wat
+++ b/tests/disas/gc/null/funcref-in-gc-heap-new.wat
@@ -19,6 +19,7 @@
;; region6 = 130 ""
;; region7 = 6 ""
;; region8 = 108 ""
+;; region9 = 147 ""
;; 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 @@
;; @0020 v32 = ireduce.i32 v31
;; @0020 v29 = iconst.i64 8
;; @0020 v30 = iadd v24, v29 ; v29 = 8
-;; @0020 store user2 little region8 v32, v30
+;; @0020 store user2 little region9 v32, v30
;; @0023 jump block1
;;
;; block3 cold:
diff --git a/tests/disas/gc/null/funcref-in-gc-heap-set.wat b/tests/disas/gc/null/funcref-in-gc-heap-set.wat
index 5f9e97237e..f1724a115a 100644
--- a/tests/disas/gc/null/funcref-in-gc-heap-set.wat
+++ b/tests/disas/gc/null/funcref-in-gc-heap-set.wat
@@ -14,7 +14,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 147 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/gc/null/multiple-array-get.wat b/tests/disas/gc/null/multiple-array-get.wat
index 10ac0fad86..10148054aa 100644
--- a/tests/disas/gc/null/multiple-array-get.wat
+++ b/tests/disas/gc/null/multiple-array-get.wat
@@ -16,6 +16,7 @@
;; region2 = 196 ""
;; region3 = 206 ""
;; region4 = 108 ""
+;; region5 = 5 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -50,7 +51,7 @@
;; @0024 v29 = isub v20, v23
;; @0024 v30 = uextend.i64 v29
;; @0024 v31 = isub v28, v30
-;; @0024 v32 = load.i64 user2 little region4 v31
+;; @0024 v32 = load.i64 user2 little region5 v31
;; @002b v40 = icmp ult v4, v11
;; @002b trapz v40, user17
;; v78 = ishl v4, v70 ; v70 = 3
@@ -58,7 +59,7 @@
;; @002b v57 = isub v20, v51
;; @002b v58 = uextend.i64 v57
;; @002b v59 = isub v28, v58
-;; @002b v60 = load.i64 user2 little region4 v59
+;; @002b v60 = load.i64 user2 little region5 v59
;; @002e jump block1
;;
;; block1:
diff --git a/tests/disas/gc/null/multiple-struct-get.wat b/tests/disas/gc/null/multiple-struct-get.wat
index c9ba3c333b..046045aea2 100644
--- a/tests/disas/gc/null/multiple-struct-get.wat
+++ b/tests/disas/gc/null/multiple-struct-get.wat
@@ -16,7 +16,8 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 147 ""
+;; region5 = 225 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -33,7 +34,7 @@
;; @0023 v9 = load.f32 user2 little region4 v8
;; @0029 v14 = iconst.i64 12
;; @0029 v15 = iadd v6, v14 ; v14 = 12
-;; @0029 v16 = load.i8 user2 little region4 v15
+;; @0029 v16 = load.i8 user2 little region5 v15
;; @002d jump block1
;;
;; block1:
diff --git a/tests/disas/gc/null/struct-get-guard-pages.wat b/tests/disas/gc/null/struct-get-guard-pages.wat
index 2dd7fcbeee..880fb21fe0 100644
--- a/tests/disas/gc/null/struct-get-guard-pages.wat
+++ b/tests/disas/gc/null/struct-get-guard-pages.wat
@@ -28,7 +28,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 147 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -54,7 +54,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 225 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -81,7 +81,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 225 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -108,7 +108,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 152 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/gc/null/struct-get-no-guard-pages.wat b/tests/disas/gc/null/struct-get-no-guard-pages.wat
index 04355d77c2..db03aeb9b6 100644
--- a/tests/disas/gc/null/struct-get-no-guard-pages.wat
+++ b/tests/disas/gc/null/struct-get-no-guard-pages.wat
@@ -28,7 +28,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 147 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -60,7 +60,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 225 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -93,7 +93,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 225 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -126,7 +126,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 152 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/gc/null/struct-get.wat b/tests/disas/gc/null/struct-get.wat
index ac5ae2b066..0f9803a22d 100644
--- a/tests/disas/gc/null/struct-get.wat
+++ b/tests/disas/gc/null/struct-get.wat
@@ -28,7 +28,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 147 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -54,7 +54,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 225 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -81,7 +81,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 225 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -108,7 +108,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 152 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/gc/null/struct-new-default.wat b/tests/disas/gc/null/struct-new-default.wat
index 1a9ecc10e6..6a3838177b 100644
--- a/tests/disas/gc/null/struct-new-default.wat
+++ b/tests/disas/gc/null/struct-new-default.wat
@@ -21,6 +21,9 @@
;; region6 = 130 ""
;; region7 = 6 ""
;; region8 = 108 ""
+;; region9 = 147 ""
+;; region10 = 225 ""
+;; region11 = 152 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -57,14 +60,14 @@
;; @0021 v2 = f32const 0.0
;; @0021 v31 = iconst.i64 8
;; @0021 v32 = iadd v26, v31 ; v31 = 8
-;; @0021 store user2 little region8 v2, v32 ; v2 = 0.0
+;; @0021 store user2 little region9 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 region8 v3, v34 ; v3 = 0
+;; @0021 istore8 user2 little region10 v3, v34 ; v3 = 0
;; @0021 v35 = iconst.i64 16
;; @0021 v36 = iadd v26, v35 ; v35 = 16
-;; @0021 store user2 little region8 v3, v36 ; v3 = 0
+;; @0021 store user2 little region11 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.wat
index ade114c649..97a71a597c 100644
--- a/tests/disas/gc/null/struct-new.wat
+++ b/tests/disas/gc/null/struct-new.wat
@@ -22,7 +22,10 @@
;; region6 = 130 ""
;; region7 = 6 ""
;; region8 = 108 ""
-;; region9 = 232 ""
+;; region9 = 147 ""
+;; region10 = 225 ""
+;; region11 = 152 ""
+;; region12 = 135 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -32,7 +35,7 @@
;;
;; block0(v0: i64, v1: i64, v2: f32, v3: i32, v4: i32):
;; v39 = stack_addr.i64 ss0
-;; store notrap aligned region9 v4, v39
+;; store notrap aligned region12 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
@@ -60,14 +63,14 @@
;; @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 region8 v2, v32
+;; @002a store.f32 user2 little region9 v2, v32
;; @002a v33 = iconst.i64 12
;; @002a v34 = iadd v26, v33 ; v33 = 12
-;; @002a istore8.i32 user2 little region8 v3, v34
-;; v38 = load.i32 notrap aligned region9 v39
+;; @002a istore8.i32 user2 little region10 v3, v34
+;; v38 = load.i32 notrap aligned region12 v39
;; @002a v35 = iconst.i64 16
;; @002a v36 = iadd v26, v35 ; v35 = 16
-;; @002a store user2 little region8 v38, v36
+;; @002a store user2 little region11 v38, v36
;; @002d jump block1
;;
;; block3 cold:
diff --git a/tests/disas/gc/null/struct-set.wat b/tests/disas/gc/null/struct-set.wat
index 6b04e0e7ab..e7ad2b26f5 100644
--- a/tests/disas/gc/null/struct-set.wat
+++ b/tests/disas/gc/null/struct-set.wat
@@ -24,7 +24,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 147 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -50,7 +50,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 225 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -76,7 +76,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 152 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/gc/null/v128-fields.wat b/tests/disas/gc/null/v128-fields.wat
index 590b4e7ff9..7b4657be9e 100644
--- a/tests/disas/gc/null/v128-fields.wat
+++ b/tests/disas/gc/null/v128-fields.wat
@@ -16,7 +16,7 @@
;; region1 = 160 ""
;; region2 = 196 ""
;; region3 = 206 ""
-;; region4 = 108 ""
+;; region4 = 147 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/gc/struct-new-default.wat b/tests/disas/gc/struct-new-default.wat
index 34db67d9c1..b56bf7dcde 100644
--- a/tests/disas/gc/struct-new-default.wat
+++ b/tests/disas/gc/struct-new-default.wat
@@ -22,6 +22,10 @@
;; region6 = 6 ""
;; region7 = 196 ""
;; region8 = 108 ""
+;; region9 = 147 ""
+;; region10 = 225 ""
+;; region11 = 152 ""
+;; region12 = 245 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -74,18 +78,18 @@
;; @0023 v2 = f32const 0.0
;; @0023 v38 = iconst.i64 16
;; @0023 v39 = iadd v37, v38 ; v38 = 16
-;; @0023 store user2 little region8 v2, v39 ; v2 = 0.0
+;; @0023 store user2 little region9 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 region8 v3, v41 ; v3 = 0
+;; @0023 istore8 user2 little region10 v3, v41 ; v3 = 0
;; @0023 v42 = iconst.i64 24
;; @0023 v43 = iadd v37, v42 ; v42 = 24
-;; @0023 store user2 little region8 v3, v43 ; v3 = 0
+;; @0023 store user2 little region11 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 region8 v5, v45 ; v5 = const0
+;; @0023 store user2 little region12 v5, v45 ; v5 = const0
;; @0026 jump block1
;;
;; block1:
diff --git a/tests/disas/gc/struct-new.wat b/tests/disas/gc/struct-new.wat
index 9f2be42fb2..5d1e77c63a 100644
--- a/tests/disas/gc/struct-new.wat
+++ b/tests/disas/gc/struct-new.wat
@@ -22,7 +22,10 @@
;; region6 = 6 ""
;; region7 = 196 ""
;; region8 = 108 ""
-;; region9 = 232 ""
+;; region9 = 147 ""
+;; region10 = 225 ""
+;; region11 = 152 ""
+;; region12 = 135 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -32,7 +35,7 @@
;;
;; block0(v0: i64, v1: i64, v2: f32, v3: i32, v4: i32):
;; v45 = stack_addr.i64 ss0
-;; store notrap aligned region9 v4, v45
+;; store notrap aligned region12 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
@@ -75,14 +78,14 @@
;; block4(v35: i32, v36: i64):
;; @002a v37 = iconst.i64 16
;; @002a v38 = iadd v36, v37 ; v37 = 16
-;; @002a store.f32 user2 little region8 v2, v38
+;; @002a store.f32 user2 little region9 v2, v38
;; @002a v39 = iconst.i64 20
;; @002a v40 = iadd v36, v39 ; v39 = 20
-;; @002a istore8.i32 user2 little region8 v3, v40
-;; v44 = load.i32 notrap aligned region9 v45
+;; @002a istore8.i32 user2 little region10 v3, v40
+;; v44 = load.i32 notrap aligned region12 v45
;; @002a v41 = iconst.i64 24
;; @002a v42 = iadd v36, v41 ; v41 = 24
-;; @002a store user2 little region8 v44, v42
+;; @002a store user2 little region11 v44, v42
;; @002d jump block1
;;
;; block1:
diff --git a/tests/disas/gc/typed-select-and-stack-maps.wat b/tests/disas/gc/typed-select-and-stack-maps.wat
index 0bc9b4444c..5a8f75b574 100644
--- a/tests/disas/gc/typed-select-and-stack-maps.wat
+++ b/tests/disas/gc/typed-select-and-stack-maps.wat
@@ -45,7 +45,7 @@
;; region1 = 160 ""
;; region2 = 25 ""
;; region3 = 68 ""
-;; region4 = 232 ""
+;; region4 = 135 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/guest-debugging.wat b/tests/disas/guest-debugging.wat
index 7baf840142..c5b9d00e51 100644
--- a/tests/disas/guest-debugging.wat
+++ b/tests/disas/guest-debugging.wat
@@ -22,7 +22,7 @@
;; ss0 = explicit_slot 28, key = 0
;; region0 = 123 ""
;; region1 = 160 ""
-;; region2 = 232 ""
+;; region2 = 135 ""
;; sig0 = (i64 vmctx, i8) tail
;; sig1 = (i64 vmctx) tail
;; sig2 = (i64) preserve_all
diff --git a/tests/disas/stack-switching/symmetric-switch.wat b/tests/disas/stack-switching/symmetric-switch.wat
index 2318571bda..9747d7298d 100644
--- a/tests/disas/stack-switching/symmetric-switch.wat
+++ b/tests/disas/stack-switching/symmetric-switch.wat
@@ -47,7 +47,7 @@
;; region16 = 224 ""
;; region17 = 179 ""
;; region18 = 211 ""
-;; region19 = 240 ""
+;; region19 = 187 ""
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
diff --git a/tests/disas/startup-passive-segment.wat b/tests/disas/startup-passive-segment.wat
index 88c37ea6ba..b71ea27e13 100644
--- a/tests/disas/startup-passive-segment.wat
+++ b/tests/disas/startup-passive-segment.wat
@@ -40,7 +40,7 @@
;; }
;;
;; function u2415919104:0(i64 vmctx, i64) tail {
-;; region0 = 191 ""
+;; region0 = 116 ""
;; sig0 = (i64 vmctx, i32) -> i64 tail
;; fn0 = colocated u805306368:4 sig0
;;
diff --git a/tests/misc_testsuite/gc/alias-region-gc-field-inlining.wast b/tests/misc_testsuite/gc/alias-region-gc-field-inlining.wast
new file mode 100644
index 0000000000..c4d525fb16
--- /dev/null
+++ b/tests/misc_testsuite/gc/alias-region-gc-field-inlining.wast
@@ -0,0 +1,53 @@
+;;! gc = true
+
+;; Field regions must be stable across the whole compilation, since inlining
+;; merges a callee's regions into its caller by `user_id`.
+
+(component
+ (core module $A
+ (type $s (sub (struct (field (mut i32)))))
+
+ (func (export "set") (param (ref $s)) (param i32)
+ (struct.set $s 0 (local.get 0) (local.get 1)))
+ )
+ (core instance $a (instantiate $A))
+
+ (core module $B
+ (type $unused0 (struct (field f64)))
+ (type $unused1 (array (mut i64)))
+ (type $s1 (sub (struct (field (mut i32)))))
+ ;; The same type again, at another type index.
+ (type $s2 (sub (struct (field (mut i32)))))
+
+ (import "" "set" (func $set-cross-module (param (ref $s1)) (param i32)))
+
+ (func $set (param (ref $s2)) (param i32)
+ (struct.set $s2 0 (local.get 0) (local.get 1)))
+
+ (func $op (param $x (ref $s1)) (result i32)
+ (struct.set $s1 0 (local.get $x) (i32.const 0x1111))
+ (call $set (local.get $x) (i32.const 0x2222))
+ (struct.get $s1 0 (local.get $x))) ;; must be 0x2222
+
+ (func (export "inlined") (result i32)
+ (call $op (struct.new $s1 (i32.const 0))))
+
+ (func $op-cross-module (param $x (ref $s1)) (result i32)
+ (struct.set $s1 0 (local.get $x) (i32.const 0x1111))
+ (call $set-cross-module (local.get $x) (i32.const 0x2222))
+ (struct.get $s1 0 (local.get $x))) ;; must be 0x2222
+
+ (func (export "cross-module") (result i32)
+ (call $op-cross-module (struct.new $s2 (i32.const 0))))
+ )
+ (core instance $b (instantiate $B
+ (with "" (instance (export "set" (func $a "set"))))))
+
+ (func (export "inlined") (result u32)
+ (canon lift (core func $b "inlined")))
+ (func (export "cross-module") (result u32)
+ (canon lift (core func $b "cross-module")))
+)
+
+(assert_return (invoke "inlined") (u32.const 0x2222))
+(assert_return (invoke "cross-module") (u32.const 0x2222))
diff --git a/tests/misc_testsuite/gc/alias-region-struct-subtype.wast b/tests/misc_testsuite/gc/alias-region-struct-subtype.wast
new file mode 100644
index 0000000000..7f07800193
--- /dev/null
+++ b/tests/misc_testsuite/gc/alias-region-struct-subtype.wast
@@ -0,0 +1,72 @@
+;;! gc = true
+
+;; A field's region is keyed on the type that introduced it, and every wasm
+;; spec-level type index naming the same interned type must agree on that
+;; answer.
+
+(component
+ (core module $A
+ (type $base (sub (struct (field (mut i32)))))
+ (type $derived (sub $base (struct (field (mut i32))
+ (field (mut i32)))))
+
+ (func (export "set-via-base") (param (ref $base)) (param i32)
+ (struct.set $base 0 (local.get 0) (local.get 1)))
+ )
+
+ (core instance $a (instantiate $A))
+
+ (core module $B
+ (type $unused (struct (field f64)))
+
+ (type $base (sub (struct (field (mut i32)))))
+ (type $derived (sub $base (struct (field (mut i32))
+ (field (mut i32)))))
+
+ (type $base2 (sub (struct (field (mut i32)))))
+ (type $derived2 (sub $base2 (struct (field (mut i32))
+ (field (mut i32)))))
+
+ (import "" "set-via-base" (func $set-via-base (param (ref $base)) (param i32)))
+
+ (func $introducer (param $d (ref $derived)) (result i32)
+ (struct.set $derived 0 (local.get $d) (i32.const 0x1111))
+ (struct.set $base 0 (local.get $d) (i32.const 0x2222))
+ ;; A different field, in its own region, which must not satisfy the load.
+ (struct.set $derived 1 (local.get $d) (i32.const 0x3333))
+ (struct.get $derived 0 (local.get $d))) ;; must be 0x2222
+
+ (func (export "introducer") (result i32)
+ (call $introducer (struct.new $derived (i32.const 0) (i32.const 0))))
+
+ (func $dup-type-index (param $d (ref $derived)) (result i32)
+ (struct.set $derived 0 (local.get $d) (i32.const 0x1111))
+ (struct.set $base2 0 (local.get $d) (i32.const 0x2222))
+ (struct.set $derived2 1 (local.get $d) (i32.const 0x3333))
+ (struct.get $derived 0 (local.get $d))) ;; must be 0x2222
+
+ (func (export "dup-type-index") (result i32)
+ (call $dup-type-index (struct.new $derived2 (i32.const 0) (i32.const 0))))
+
+ (func $cross-module (param $d (ref $derived)) (result i32)
+ (call $set-via-base (local.get $d) (i32.const 0x2222))
+ (struct.get $derived 0 (local.get $d))) ;; must be 0x2222
+
+ (func (export "cross-module") (result i32)
+ (call $cross-module (struct.new $derived (i32.const 0) (i32.const 0))))
+ )
+
+ (core instance $b (instantiate $B
+ (with "" (instance (export "set-via-base" (func $a "set-via-base"))))))
+
+ (func (export "introducer") (result u32)
+ (canon lift (core func $b "introducer")))
+ (func (export "dup-type-index") (result u32)
+ (canon lift (core func $b "dup-type-index")))
+ (func (export "cross-module") (result u32)
+ (canon lift (core func $b "cross-module")))
+)
+
+(assert_return (invoke "introducer") (u32.const 0x2222))
+(assert_return (invoke "dup-type-index") (u32.const 0x2222))
+(assert_return (invoke "cross-module") (u32.const 0x2222))