Skip to content

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

Fix aliasing tags within a component (#11699)

Alex Crichtond7fb3566437b
diff --git a/crates/environ/src/component/translate/inline.rs b/crates/environ/src/component/translate/inline.rs
index 62e7d28ad8..3dea3e40cb 100644
--- a/crates/environ/src/component/translate/inline.rs
+++ b/crates/environ/src/component/translate/inline.rs
@@ -203,7 +203,7 @@ struct InlinerFrame<'a> {
memories: PrimaryMap<MemoryIndex, dfg::CoreExport<EntityIndex>>,
tables: PrimaryMap<TableIndex, dfg::CoreExport<EntityIndex>>,
globals: PrimaryMap<GlobalIndex, dfg::CoreExport<EntityIndex>>,
- tags: PrimaryMap<GlobalIndex, dfg::CoreExport<EntityIndex>>,
+ tags: PrimaryMap<TagIndex, dfg::CoreExport<EntityIndex>>,
modules: PrimaryMap<ModuleIndex, ModuleDef<'a>>,
// component model index spaces
@@ -1432,7 +1432,7 @@ impl<'a> Inliner<'a> {
EntityIndex::Table(i) => frame.tables[i].clone().into(),
EntityIndex::Global(i) => frame.globals[i].clone().into(),
EntityIndex::Memory(i) => frame.memories[i].clone().into(),
- EntityIndex::Tag(_) => todo!(), // FIXME: #10252 support for tags in the component model
+ EntityIndex::Tag(i) => frame.tags[i].clone().into(),
},
}
}
diff --git a/tests/misc_testsuite/component-model/tags.wast b/tests/misc_testsuite/component-model/tags.wast
new file mode 100644
index 0000000000..cac1fdec29
--- /dev/null
+++ b/tests/misc_testsuite/component-model/tags.wast
@@ -0,0 +1,14 @@
+;;! exceptions = true
+
+(component
+ (core module $a (tag (export "t")))
+ (core module $b (import "a" "t" (tag)))
+
+ (core instance $a (instantiate $a))
+ (core instance (instantiate $b (with "a" (instance $a))))
+ (core instance (instantiate $b
+ (with "a" (instance
+ (export "t" (tag $a "t"))
+ ))
+ ))
+)