A lightweight WebAssembly runtime that is fast, secure, and standards-compliant
Components: implement exception-tag translation in core module types. (#12122)
Chris Fallin058a9bc16bc2
diff --git a/crates/environ/src/component/types_builder.rs b/crates/environ/src/component/types_builder.rsindex aa7b1ba934..d14fa99f40 100644--- a/crates/environ/src/component/types_builder.rs+++ b/crates/environ/src/component/types_builder.rs@@ -411,7 +411,16 @@ impl ComponentTypesBuilder {Table(ty) => EntityType::Table(self.convert_table_type(ty)?),Memory(ty) => EntityType::Memory((*ty).into()),Global(ty) => EntityType::Global(self.convert_global_type(ty)?),- Tag(_) => bail!("exceptions proposal not implemented"),+ Tag(id) => {+ let func = self.module_types_builder_mut().intern_type(types, *id)?;+ let exc = self+ .module_types_builder_mut()+ .define_exception_type_for_tag(func);+ EntityType::Tag(crate::types::Tag {+ signature: func.into(),+ exception: exc.into(),+ })+ }FuncExact(_) => bail!("custom-descriptors proposal not implemented"),})}diff --git a/tests/misc_testsuite/component-model/modules.wast b/tests/misc_testsuite/component-model/modules.wastindex 6014f94eb1..5ec4f2fa5f 100644--- a/tests/misc_testsuite/component-model/modules.wast+++ b/tests/misc_testsuite/component-model/modules.wast@@ -1,4 +1,5 @@;;! reference_types = true+;;! exceptions = true(component $foo(core module (export "a-module"))@@ -477,3 +478,12 @@(core instance (instantiate $import_globals (with "" (instance $m)))))++(component $tag-module+ (core module (export "m")+ (tag (export "t") (param i32))))+(component+ (import "tag-module" (instance+ (export "m"+ (core module+ (export "t" (tag (param i32))))))))