Skip to content

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

Merged
peterhuene merged 3 commits intobytecodealliance:mainfrom
peterhuene:ignore-alias-exports-for-types
Aug 4, 2022
Merged

components: ignore export aliases to types in translation.#4604
peterhuene merged 3 commits intobytecodealliance:mainfrom
peterhuene:ignore-alias-exports-for-types

Conversation

@peterhuene
Copy link
Copy Markdown
Member

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.

@peterhuene peterhuene requested a review from alexcrichton August 4, 2022 00:34
Copy link
Copy Markdown
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this may end up necessitating a more complete implementation of type exports because of the issue I commented on below, namely that aliasing into the current module modfies the index space and that needs to be accounted for.

Also ideally I would prefer if we can keep this out of the inline.rs path if possible because type information should be static enough that inlining and dataflow shouldn't be necessary to figure out what the type is.

Finally, could you be sure to add some tests which exercise these paths as well?

Copy link
Copy Markdown
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me with a test added!

Peter Huene added 3 commits August 4, 2022 14:26
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.
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.
@peterhuene peterhuene force-pushed the ignore-alias-exports-for-types branch from 7c5a0ba to 56058a8 Compare August 4, 2022 21:29
@peterhuene peterhuene enabled auto-merge (squash) August 4, 2022 21:31
@peterhuene peterhuene merged commit 42233e8 into bytecodealliance:main Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants