Skip to content

Sync syntax/binary of aliases with upstream spec #191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 11, 2021

Conversation

alexcrichton
Copy link
Member

This implements two features from WebAssembly/module-linking#26:

  • First shorthand syntax of (func $instance "export_name") is implemented everywhere for all items as a syntax sugar for alias references.
  • Next a depth argument is added to outer aliases in wasmparser and validation to allow referring to any outer module.

@alexcrichton alexcrichton requested a review from fitzgen January 8, 2021 16:33
@@ -11,8 +11,14 @@ pub struct AliasSectionReader<'a> {

#[derive(Debug)]
pub enum Alias<'a> {
ParentType(u32),
ParentModule(u32),
ParentType {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe name these OuterType and OuterModule to match the spec more closely?

This commit Implements the sugar syntax proposed in
WebAssembly/module-linking#26. The change here was to introduce a new
`ItemRef` construct into the `wast` crate which represents a
parenthesized reference to an item, either in the current module or a
different module (e.g. optional `outer` and optional export names).
Additionally an `IndexOrRef` type was added for parsing references which
are either a bare index or an explicit reference to an item.

All existing references to items were updated to use `ItemRef` where
necessary. Additionally all locations which previously took an `Index`
now store `ItemRef` and are parsed as `IndexOrRef`.
This continues to sync this implementation with
WebAssembly/module-linking#26 by implementing the ability for outer
aliases to have an arbitrary depth listed on them.
@alexcrichton alexcrichton merged commit 5c793a4 into bytecodealliance:main Jan 11, 2021
@alexcrichton alexcrichton deleted the text-format-sugar branch January 11, 2021 15:20
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