components: ignore export aliases to types in translation. (#4604)

* components: ignore export aliases to types in translation.

Currently, translation is ignoring type exports from components during
translation by skipping over them before adding them to the exports map.

If a component instantiates an inner component and aliases a type export of
that instance, it will cause wasmtime to panic with a failure to find the
export in the exports map.

The fix is to add a representation for exported types to the map that is simply
ignored when encountered. This also makes it easier to track places where we
would have to support type exports in translation in the future.

* Keep type information for type exports.

This commit keeps the type information for type exports so that types can be
properly aliased from an instance export and thereby adjusting the type index
space accordingly.

* Add a simple test case for type exports for the component model.
This commit is contained in:
Peter Huene
2022-08-04 15:45:11 -07:00
committed by GitHub
parent cd847d071d
commit 42233e8eda
4 changed files with 34 additions and 13 deletions

View File

@@ -102,6 +102,17 @@
)
)
;; type exports work
(component $C
(component $C2
(type string)
(export "x" (type 0))
)
(instance (instantiate 0))
(alias export 0 "x" (type))
(export "x" (type 0))
)
(component
(core module $m (func (export "") (param i32) (result i32) local.get 0))
(core instance $m (instantiate $m))