diff --git a/crates/cranelift/src/alias_region.rs b/crates/cranelift/src/alias_region.rs index 24d1dd1d0254..fda5de40830a 100644 --- a/crates/cranelift/src/alias_region.rs +++ b/crates/cranelift/src/alias_region.rs @@ -456,10 +456,15 @@ impl<'a, Offsets> Field<'a, Offsets> { self } + /// Get-or-create this field's alias region. + pub fn region(&mut self, func: &mut ir::Function) -> ir::AliasRegion { + self.regions.region(func, self.key) + } + /// Get-or-create this field's alias region and mix it into this field's /// base flags. fn flags_with_region(&mut self, func: &mut ir::Function) -> ir::MemFlagsData { - let region = self.regions.region(func, self.key); + let region = self.region(func); self.flags.with_alias_region(Some(region)) } @@ -710,7 +715,10 @@ wasmtime_environ::for_each_vm_type!(define_vm_type_alias_region_helpers); /// pointer size, so their accessors are available for any `Offsets: GetPtrSize`. /// Its `dynamic` fields sit at offsets that additionally depend on the module or /// component being compiled, so their accessors are only available when the -/// `AliasRegions` carries that vmctx's own fully-computed offsets. +/// `AliasRegions` carries that vmctx's own fully-computed offsets. The exception +/// is a `dynamic` field marked `#[ptr_size_offset]`, whose offsets are derived +/// only from the pointer size; these live in the `Offsets: GetPtrSize` block as +/// well. /// /// A field marked `#[aggregate]` gets no accessor, for the same reason it gets /// none in [`define_vm_type_alias_region_helpers!`]: it has no single Cranelift @@ -748,6 +756,7 @@ macro_rules! define_vmctx_alias_region_helpers { (@apply_attr $flags:expr, [readonly]) => { $flags.with_readonly() }; (@apply_attr $flags:expr, [can_move]) => { $flags.with_can_move() }; (@apply_attr $flags:expr, [access_as = $($t:tt)*]) => { $flags }; + (@apply_attr $flags:expr, [ptr_size_offset]) => { $flags }; // Compute a field's access flags and Cranelift type from its declared type // and marker attributes, and build the `Field` for it at `$offset`. @@ -784,8 +793,53 @@ macro_rules! define_vmctx_alias_region_helpers { } }; + // ### `dynamic` Section Entries Marked `#[ptr_size_offset]` + // + // These get their offsets from the pointer-size-only `offsets::VMFoo
`
+ // wrapper, and don't require a full `VMOffsets` parameterization.
+
+ (@ptr_size_entry $Name:ident $snake:ident field {
+ #[ptr_size_offset] $(# $fattr:tt)* $fname:ident : $($fty:tt)*
+ }) => {
+ #[doc = concat!(
+ "Get the [`Field`] for the `", stringify!($fname), "` field of `",
+ stringify!($Name), "`."
+ )]
+ pub fn $fname(self) -> Field<'a, Offsets> {
+ let offset = self.regions.offsets.get_ptr_size().$snake().$fname();
+ define_vmctx_alias_region_helpers!(
+ @field $Name (self, offset) [ $($fty)* ] [ $(# $fattr)* ]
+ )
+ }
+ };
+
+ (@ptr_size_entry $Name:ident $snake:ident array {
+ #[ptr_size_offset] $(# $fattr:tt)* $fname:ident [ $count:ident ; $Index:ident ] : $($fty:tt)*
+ }) => {
+ #[doc = concat!(
+ "Get the [`Field`] for the `index`th element of `", stringify!($Name),
+ "`'s `", stringify!($fname), "` array.\n\nThis is not bounds checked: \
+ the array's length depends on the module or component being compiled, \
+ which is precisely what this accessor does not require knowing."
+ )]
+ pub fn $fname(self, index: $Index) -> Field<'a, Offsets> {
+ let offset = self.regions.offsets.get_ptr_size().$snake().$fname(index);
+ define_vmctx_alias_region_helpers!(
+ @field $Name (self, offset) [ $($fty)* ] [ $(# $fattr)* ]
+ )
+ }
+ };
+
+ (@ptr_size_entry $Name:ident $snake:ident $kind:ident $entry:tt) => {};
+
// ### `dynamic` Section Entries
+ // Entries marked `#[ptr_size_offset]` were already handled above; emitting
+ // them here too would be a duplicate definition.
+ (@dynamic_entry $Name:ident $Offsets:tt $kind:ident {
+ #[ptr_size_offset] $($rest:tt)*
+ }) => {};
+
(@dynamic_entry $Name:ident $Offsets:tt align { $al:tt }) => {};
// Aggregates get no accessor.
@@ -848,7 +902,7 @@ macro_rules! define_vmctx_alias_region_helpers {
// Emit the accessor `struct` and both `impl` blocks for one vmctx type.
(@emit $Name:ident $snake:ident $Offsets:tt
static { $($skind:ident $sentry:tt)* }
- dynamic { $($dyn:tt)* }
+ dynamic { $($dkind:ident $dentry:tt)* }
) => {
#[doc = concat!(
"An [`AliasRegions`] accessor for the fields of a `", stringify!($Name),
@@ -879,13 +933,14 @@ macro_rules! define_vmctx_alias_region_helpers {
Offsets: GetPtrSize,
{
$( define_vmctx_alias_region_helpers!(@static_entry $Name $snake $skind $sentry); )*
+ $( define_vmctx_alias_region_helpers!(@ptr_size_entry $Name $snake $dkind $dentry); )*
}
// A dynamically-positioned field's offset depends on the module or
// component being compiled, so these accessors require this vmctx's own
// fully-computed offsets.
define_vmctx_alias_region_helpers!(
- @dynamic_impl $Name $Offsets $Offsets { $($dyn)* }
+ @dynamic_impl $Name $Offsets $Offsets { $($dkind $dentry)* }
);
};
diff --git a/crates/cranelift/src/func_environ.rs b/crates/cranelift/src/func_environ.rs
index 94693c965ce6..7950d480bc79 100644
--- a/crates/cranelift/src/func_environ.rs
+++ b/crates/cranelift/src/func_environ.rs
@@ -37,8 +37,8 @@ use wasmtime_environ::{
BuiltinFunctionIndex, ComponentPC, ConstExpr, ConstOp, DataIndex, DefinedFuncIndex,
DefinedGlobalIndex, DefinedTableIndex, ElemIndex, EngineOrModuleTypeIndex, FactInlineIntrinsic,
FrameStateSlotBuilder, FrameValType, FuncIndex, FuncKey, GlobalConstValue, GlobalIndex,
- IndexType, KnownFunc, Memory, MemoryIndex, MemoryInit, MemorySegmentOffset, MemoryTunables,
- Module, ModuleInternedTypeIndex, ModuleTranslation, ModuleTypesBuilder,
+ IndexType, KnownFunc, KnownGlobal, Memory, MemoryIndex, MemoryInit, MemorySegmentOffset,
+ MemoryTunables, Module, ModuleInternedTypeIndex, ModuleTranslation, ModuleTypesBuilder,
NUM_COMPONENT_CONTEXT_SLOTS, PassiveElemIndex, PtrSize, RuntimeDataIndex, Table, TableIndex,
TableInitialValue, TableSegment, TableSegmentElements, TagIndex, Tunables, TypeConvert,
TypeIndex, VMOffsets, WasmCompositeInnerType, WasmFuncType, WasmHeapTopType, WasmHeapType,
@@ -446,10 +446,20 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
}
}
None => match self.translation.known_imported_globals[global] {
- Some(known) => {
+ Some(KnownGlobal::Defined(known)) => {
self.alias_regions
.defined_global_region(func, known.module, known.index)
}
+ Some(KnownGlobal::ComponentInstanceFlags(instance)) => self
+ .alias_regions
+ .vmcomponent()
+ .may_leave(instance)
+ .region(func),
+ Some(KnownGlobal::TaskMayBlock) => self
+ .alias_regions
+ .vmcomponent()
+ .task_may_block()
+ .region(func),
None => self.alias_regions.public_global_region(func),
},
}
diff --git a/crates/environ/src/compile/module_environ.rs b/crates/environ/src/compile/module_environ.rs
index 1df5a9e2eb78..ed18770b73f8 100644
--- a/crates/environ/src/compile/module_environ.rs
+++ b/crates/environ/src/compile/module_environ.rs
@@ -74,7 +74,7 @@ impl From {
// plus this `VMComponentContext`'s total size. These are all computed by the
// generated `compute_field_offsets` and read by the generated accessors of
// the same names.
- may_leave: u32,
task_may_block: u32,
+ may_leave: u32,
trampoline_func_refs: u32,
intrinsic_func_refs: u32,
lowerings: u32,
@@ -165,8 +165,8 @@ impl {
0
},
num_resources: component.num_resources,
- may_leave: 0,
task_may_block: 0,
+ may_leave: 0,
trampoline_func_refs: 0,
intrinsic_func_refs: 0,
lowerings: 0,
@@ -181,6 +181,15 @@ impl {
ret.compute_field_offsets();
+ // The component-model flags must land where a compiler that only knows
+ // the pointer size can find them.
+ debug_assert_eq!(ret.task_may_block(), ret.ptr.vmcomponent().task_may_block());
+ debug_assert!(
+ (0..ret.num_runtime_component_instances)
+ .map(RuntimeComponentInstanceIndex::from_u32)
+ .all(|i| ret.may_leave().at(i) == ret.ptr.vmcomponent().may_leave(i))
+ );
+
ret
}
@@ -220,3 +229,35 @@ impl {
u32::from(self.ptr.size())
}
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ /// The pointer-size-only flag offsets must match the real layout for every
+ /// pointer width and every number of component instances, since core Wasm
+ /// compilation uses them to build alias regions that must agree with the
+ /// regions the component trampolines use.
+ #[test]
+ fn flag_offsets_match_layout() {
+ for ptr in [4u8, 8] {
+ for num_runtime_component_instances in 0..8 {
+ let component = Component {
+ num_runtime_component_instances,
+ ..Default::default()
+ };
+ let offsets = VMComponentOffsets::new(ptr, &component);
+
+ assert_eq!(offsets.task_may_block(), ptr.vmcomponent().task_may_block());
+
+ for i in 0..num_runtime_component_instances {
+ let index = RuntimeComponentInstanceIndex::from_u32(i);
+ assert_eq!(
+ offsets.may_leave().at(index),
+ ptr.vmcomponent().may_leave(index)
+ );
+ }
+ }
+ }
+ }
+}
diff --git a/crates/environ/src/vmctxtypes.rs b/crates/environ/src/vmctxtypes.rs
index ddac95c64e0b..428f04c76cdb 100644
--- a/crates/environ/src/vmctxtypes.rs
+++ b/crates/environ/src/vmctxtypes.rs
@@ -85,6 +85,12 @@
/// example, the component context's `may_leave` flags are each stored in a
/// whole `VMGlobalDefinition` but only ever accessed as a `u32`.
///
+/// * `#[ptr_size_offset]` (`dynamic` only): this field's offset is a function
+/// of the target pointer size alone, even though it lives in the `dynamic`
+/// section, because it and everything before it have sizes that do not depend
+/// on the vmctx's shape. These fields get generated accessors that do not
+/// need to be parameterized over `VMOffsets`, only `GetPtrSize`.
+///
/// Doc comments are deliberately *not* accepted on fields; use `//` comments for
/// prose about the layout. Accessor documentation is synthesized from the field
/// names instead, so that there is only one place a field can be described.
@@ -227,13 +233,22 @@ macro_rules! for_each_vmctx_type {
// Each of these flags gets a whole `VMGlobalDefinition`'s
// worth of space, but only its first four bytes are ever
// accessed.
+ //
+ // NB: these flags come first, before any field whose offset
+ // depends on the component's shape, so that their offsets
+ // are a function of the target pointer size alone, as marked
+ // by `#[ptr_size_offset]`. Core Wasm compilation does not
+ // have the enclosing `VMComponentContext`'s offsets on hand,
+ // but must still be able to compute these flags' offsets to
+ // build the alias regions for accessing them.
+ field { #[ptr_size_offset] #[access_as = u32] task_may_block: VMGlobalDefinition }
+
array {
+ #[ptr_size_offset]
#[access_as = u32]
may_leave[num_runtime_component_instances; RuntimeComponentInstanceIndex]: VMGlobalDefinition
}
- field { #[access_as = u32] task_may_block: VMGlobalDefinition }
-
align { ptr }
array {
diff --git a/crates/environ/src/vmoffsets.rs b/crates/environ/src/vmoffsets.rs
index f4f6b33b14cc..3293e9745dfa 100644
--- a/crates/environ/src/vmoffsets.rs
+++ b/crates/environ/src/vmoffsets.rs
@@ -224,10 +224,16 @@ macro_rules! define_vm_type_offsets {
/// Generate a `struct VMContext {
- define_vmctx_static_offsets!(@chain ptr [ 0u32 ] [ $($stat)* ]);
+ define_vmctx_static_offsets!(@chain ptr [ 0u32 ] [ $($stat)* ] [ $($dyn)* ]);
}
)*
};
diff --git a/tests/disas/component-may-leave-without-signals-based-traps.wat b/tests/disas/component-may-leave-without-signals-based-traps.wat
index d9834361eaea..bab1a5201a3d 100644
--- a/tests/disas/component-may-leave-without-signals-based-traps.wat
+++ b/tests/disas/component-may-leave-without-signals-based-traps.wat
@@ -24,7 +24,7 @@
;; movq %rbp, %rcx
;; movq 8(%rcx), %rcx
;; movq %rcx, 0x38(%rax)
-;; movl 0x20(%rdi), %eax
+;; movl 0x30(%rdi), %eax
;; testl %eax, %eax
;; je 0x13b
;; fb: movq 8(%rdi), %rax
diff --git a/tests/disas/component-model/direct-adapter-calls-inlining.wat b/tests/disas/component-model/direct-adapter-calls-inlining.wat
index f266e9f9a4fb..a70e875e55c5 100644
--- a/tests/disas/component-model/direct-adapter-calls-inlining.wat
+++ b/tests/disas/component-model/direct-adapter-calls-inlining.wat
@@ -59,7 +59,8 @@
;; region1 = 67108888 "VMStoreContext+0x18"
;; region2 = 1207959576 "VMFunctionImport+0x18"
;; region3 = 1476395008 "VMGlobalImport+0x0"
-;; region4 = 402653184 "PublicGlobal"
+;; region4 = 738197584 "VMComponentContext+0x50"
+;; region5 = 738197568 "VMComponentContext+0x40"
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -91,7 +92,7 @@
;;
;; block9:
;; v11 = load.i64 notrap aligned readonly can_move region3 v3+144
-;; v12 = load.i32 notrap aligned region4 v11
+;; v12 = load.i32 notrap aligned region5 v11
;; jump block12
;;
;; block12:
@@ -101,7 +102,6 @@
;; jump block11
;;
;; block11:
-;; store.i32 notrap aligned region4 v10, v9
;; jump block7
;;
;; block7:
diff --git a/tests/disas/component-model/direct-adapter-calls.wat b/tests/disas/component-model/direct-adapter-calls.wat
index 32963874224f..5c6865a46863 100644
--- a/tests/disas/component-model/direct-adapter-calls.wat
+++ b/tests/disas/component-model/direct-adapter-calls.wat
@@ -99,8 +99,9 @@
;; region0 = 8 "VMContext+0x8"
;; region1 = 67108888 "VMStoreContext+0x18"
;; region2 = 1476395008 "VMGlobalImport+0x0"
-;; region3 = 402653184 "PublicGlobal"
+;; region3 = 738197584 "VMComponentContext+0x50"
;; region4 = 1207959576 "VMFunctionImport+0x18"
+;; region5 = 738197568 "VMComponentContext+0x40"
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -123,7 +124,7 @@
;;
;; block7:
;; @009e v9 = load.i64 notrap aligned readonly can_move region2 v0+144
-;; @009e v10 = load.i32 notrap aligned region3 v9
+;; @009e v10 = load.i32 notrap aligned region5 v9
;; @00ac v14 = load.i64 notrap aligned readonly can_move region4 v0+72
;; @00ac try_call fn0(v14, v0, v2), sig1, block9(ret0), [ context v0, default: block6(exn0) ]
;;
diff --git a/tests/disas/component-model/known-imported-adapter-memory.wat b/tests/disas/component-model/known-imported-adapter-memory.wat
index f0e2c91dac3a..b427a46e580c 100644
--- a/tests/disas/component-model/known-imported-adapter-memory.wat
+++ b/tests/disas/component-model/known-imported-adapter-memory.wat
@@ -150,13 +150,14 @@
;; region0 = 8 "VMContext+0x8"
;; region1 = 67108888 "VMStoreContext+0x18"
;; region2 = 1476395008 "VMGlobalImport+0x0"
-;; region3 = 402653184 "PublicGlobal"
+;; region3 = 738197584 "VMComponentContext+0x50"
;; region4 = 1207959576 "VMFunctionImport+0x18"
-;; region5 = 1275068416 "VMMemoryImport+0x0"
-;; region6 = 603979776 "VMMemoryDefinition+0x0"
-;; region7 = 603979784 "VMMemoryDefinition+0x8"
-;; region8 = 201326592 "DefinedMemory(StaticModuleIndex(0), DefinedMemoryIndex(0))"
-;; region9 = 201588736 "DefinedMemory(StaticModuleIndex(1), DefinedMemoryIndex(0))"
+;; region5 = 738197568 "VMComponentContext+0x40"
+;; region6 = 1275068416 "VMMemoryImport+0x0"
+;; region7 = 603979776 "VMMemoryDefinition+0x0"
+;; region8 = 603979784 "VMMemoryDefinition+0x8"
+;; region9 = 201326592 "DefinedMemory(StaticModuleIndex(0), DefinedMemoryIndex(0))"
+;; region10 = 201588736 "DefinedMemory(StaticModuleIndex(1), DefinedMemoryIndex(0))"
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -179,7 +180,7 @@
;;
;; block7:
;; @0103 v10 = load.i64 notrap aligned readonly can_move region2 v0+320
-;; @0103 v11 = load.i32 notrap aligned region3 v10
+;; @0103 v11 = load.i32 notrap aligned region5 v10
;; @0111 v15 = load.i64 notrap aligned readonly can_move region4 v0+184
;; @0111 try_call fn0(v15, v0, v2), sig1, block9(ret0), [ context v0, default: block6(exn0) ]
;;
@@ -192,8 +193,8 @@
;; @011e jump block11
;;
;; block11:
-;; @0128 v22 = load.i64 notrap aligned readonly can_move region5 v0+48
-;; @0128 v23 = load.i64 notrap aligned region7 v22+8
+;; @0128 v22 = load.i64 notrap aligned readonly can_move region6 v0+48
+;; @0128 v23 = load.i64 notrap aligned region8 v22+8
;; @0128 v24 = iconst.i64 16
;; @0128 v25 = ushr v23, v24 ; v24 = 16
;; @0128 v26 = ireduce.i32 v25
@@ -218,8 +219,8 @@
;; @0142 jump block16
;;
;; block16:
-;; @014c v40 = load.i64 notrap aligned readonly can_move region5 v0+72
-;; @014c v41 = load.i64 notrap aligned region7 v40+8
+;; @014c v40 = load.i64 notrap aligned readonly can_move region6 v0+72
+;; @014c v41 = load.i64 notrap aligned region8 v40+8
;; v82 = iconst.i64 16
;; v83 = ushr v41, v82 ; v82 = 16
;; @014c v44 = ireduce.i32 v83
@@ -238,17 +239,17 @@
;; @015d trap user4
;;
;; block17:
-;; @0165 v57 = load.i64 notrap aligned readonly can_move region6 v22
+;; @0165 v57 = load.i64 notrap aligned readonly can_move region7 v22
;; @0165 v58 = iadd v57, v30
-;; @0165 v59 = load.i32 little region8 v58
-;; @0168 v62 = load.i64 notrap aligned readonly can_move region6 v40
+;; @0165 v59 = load.i32 little region9 v58
+;; @0168 v62 = load.i64 notrap aligned readonly can_move region7 v40
;; @0168 v63 = iadd v62, v48
-;; @0168 store little region9 v59, v63
+;; @0168 store little region10 v59, v63
;; @0170 v68 = iconst.i64 4
;; @0170 v69 = iadd v58, v68 ; v68 = 4
-;; @0170 v70 = load.i32 little region8 v69
+;; @0170 v70 = load.i32 little region9 v69
;; @0173 v76 = iadd v63, v68 ; v68 = 4
-;; @0173 store little region9 v70, v76
+;; @0173 store little region10 v70, v76
;; @0179 store.i32 notrap aligned region3 v8, v7
;; @017b jump block5
;;
diff --git a/tests/disas/component-model/sync-adapter-calls.wat b/tests/disas/component-model/sync-adapter-calls.wat
index b89550743fdf..91ee39342691 100644
--- a/tests/disas/component-model/sync-adapter-calls.wat
+++ b/tests/disas/component-model/sync-adapter-calls.wat
@@ -57,17 +57,19 @@
;; region1 = 67108888 "VMStoreContext+0x18"
;; region2 = 1207959576 "VMFunctionImport+0x18"
;; region3 = 1476395008 "VMGlobalImport+0x0"
-;; region4 = 402653184 "PublicGlobal"
-;; region5 = 67109000 "VMStoreContext+0x88"
-;; region6 = 1006632960 "VMDeferredThread+0x0"
-;; region7 = 1006632968 "VMDeferredThread+0x8"
-;; region8 = 1006632972 "VMDeferredThread+0xc"
-;; region9 = 1006632976 "VMDeferredThread+0x10"
-;; region10 = 67108992 "VMStoreContext+0x80"
-;; region11 = 1006632980 "VMDeferredThread+0x14"
-;; region12 = 67108996 "VMStoreContext+0x84"
-;; region13 = 1006632984 "VMDeferredThread+0x18"
-;; region14 = 1207959560 "VMFunctionImport+0x8"
+;; region4 = 738197584 "VMComponentContext+0x50"
+;; region5 = 738197536 "VMComponentContext+0x20"
+;; region6 = 67109000 "VMStoreContext+0x88"
+;; region7 = 1006632960 "VMDeferredThread+0x0"
+;; region8 = 1006632968 "VMDeferredThread+0x8"
+;; region9 = 1006632972 "VMDeferredThread+0xc"
+;; region10 = 1006632976 "VMDeferredThread+0x10"
+;; region11 = 67108992 "VMStoreContext+0x80"
+;; region12 = 1006632980 "VMDeferredThread+0x14"
+;; region13 = 67108996 "VMStoreContext+0x84"
+;; region14 = 1006632984 "VMDeferredThread+0x18"
+;; region15 = 738197568 "VMComponentContext+0x40"
+;; region16 = 1207959560 "VMFunctionImport+0x8"
;; gv0 = vmctx
;; gv1 = load.i64 notrap aligned readonly can_move region0 gv0+8
;; gv2 = load.i64 notrap aligned region1 gv1+24
@@ -100,27 +102,27 @@
;;
;; block9:
;; v11 = load.i64 notrap aligned readonly can_move region3 v3+256
-;; v12 = load.i32 notrap aligned region4 v11
+;; v12 = load.i32 notrap aligned region5 v11
;; v8 = iconst.i32 0
-;; store notrap aligned region4 v8, v11 ; v8 = 0
+;; store notrap aligned region5 v8, v11 ; v8 = 0
;; v20 = load.i64 notrap aligned readonly can_move region0 v3+8
-;; v21 = load.i64 notrap aligned region5 v20+136
+;; v21 = load.i64 notrap aligned region6 v20+136
;; v19 = stack_addr.i64 ss0
-;; store notrap aligned region6 v21, v19
+;; store notrap aligned region7 v21, v19
;; v15 = iconst.i32 2
-;; store notrap aligned region7 v15, v19+8 ; v15 = 2
-;; store notrap aligned region8 v8, v19+12 ; v8 = 0
+;; store notrap aligned region8 v15, v19+8 ; v15 = 2
+;; store notrap aligned region9 v8, v19+12 ; v8 = 0
;; v17 = iconst.i32 1
-;; store notrap aligned region9 v17, v19+16 ; v17 = 1
-;; v22 = load.i32 notrap aligned region10 v20+128
-;; store notrap aligned region11 v22, v19+20
-;; store notrap aligned region10 v8, v20+128 ; v8 = 0
-;; v24 = load.i32 notrap aligned region12 v20+132
-;; store notrap aligned region13 v24, v19+24
-;; store notrap aligned region12 v8, v20+132 ; v8 = 0
-;; store notrap aligned region5 v19, v20+136
+;; store notrap aligned region10 v17, v19+16 ; v17 = 1
+;; v22 = load.i32 notrap aligned region11 v20+128
+;; store notrap aligned region12 v22, v19+20
+;; store notrap aligned region11 v8, v20+128 ; v8 = 0
+;; v24 = load.i32 notrap aligned region13 v20+132
+;; store notrap aligned region14 v24, v19+24
+;; store notrap aligned region13 v8, v20+132 ; v8 = 0
+;; store notrap aligned region6 v19, v20+136
;; v26 = load.i64 notrap aligned readonly can_move region3 v3+208
-;; v27 = load.i32 notrap aligned region4 v26
+;; v27 = load.i32 notrap aligned region15 v26
;; jump block16
;;
;; block16:
@@ -133,14 +135,14 @@
;; jump block12
;;
;; block12:
-;; store.i64 notrap aligned region5 v21, v20+136
-;; store.i32 notrap aligned region10 v22, v20+128
-;; store.i32 notrap aligned region12 v24, v20+132
+;; store.i64 notrap aligned region6 v21, v20+136
+;; store.i32 notrap aligned region11 v22, v20+128
+;; store.i32 notrap aligned region13 v24, v20+132
;; jump block14
;;
;; block14:
;; store.i32 notrap aligned region4 v10, v9
-;; store.i32 notrap aligned region4 v12, v11
+;; store.i32 notrap aligned region5 v12, v11
;; jump block7
;;
;; block7:
diff --git a/tests/disas/riscv64-component-builtins-asm.wat b/tests/disas/riscv64-component-builtins-asm.wat
index 9a71f7ea3047..b171c7dc830d 100644
--- a/tests/disas/riscv64-component-builtins-asm.wat
+++ b/tests/disas/riscv64-component-builtins-asm.wat
@@ -26,7 +26,7 @@
;; sd a3, 0x30(a1)
;; ld a2, 8(s0)
;; sd a2, 0x38(a1)
-;; lw a1, 0x20(a0)
+;; lw a1, 0x30(a0)
;; sext.w a1, a1
;; bnez a1, 8
;; .byte 0x00, 0x00, 0x00, 0x00
diff --git a/tests/disas/riscv64-component-builtins.wat b/tests/disas/riscv64-component-builtins.wat
index 03db5c955811..57d732beddbd 100644
--- a/tests/disas/riscv64-component-builtins.wat
+++ b/tests/disas/riscv64-component-builtins.wat
@@ -14,7 +14,7 @@
;; region0 = 8 "VMContext+0x8"
;; region1 = 67108912 "VMStoreContext+0x30"
;; region2 = 67108920 "VMStoreContext+0x38"
-;; region3 = 738197536 "VMComponentContext+0x20"
+;; region3 = 738197552 "VMComponentContext+0x30"
;; region4 = 738197512 "VMComponentContext+0x8"
;; region5 = 1879048208 "ComponentBuiltinFunctionsArray+0x10"
;; region6 = 16 "VMContext+0x10"
@@ -28,7 +28,7 @@
;; store notrap aligned region1 v4, v3+48
;; v5 = get_return_address.i64
;; store notrap aligned region2 v5, v3+56
-;; v6 = load.i32 notrap aligned region3 v0+32
+;; v6 = load.i32 notrap aligned region3 v0+48
;; trapz v6, user26
;; v9 = load.i64 notrap aligned readonly region4 v0+8
;; v10 = load.i64 notrap aligned readonly can_move region5 v9+16