Skip to content

components: Implement automatic deduplicating of text format type sugar #598

Open
@alexcrichton

Description

@alexcrichton

Currently a module textually represented like so:

(component
    (import "" (func))
    (import "" (func))
)

dumps as:

  0x0 | 00 61 73 6d | version 65546 (Component)
      | 0a 00 01 00
  0x8 | 01 05       | type section
  0xa | 02          | 2 count
  0xb | 7f          | [type 0] Interface(Primitive(Unit))
  0xc | 4c 00 00    | [type 1] Function(ComponentFuncType { params: [], result: Type(0) })
  0xf | 02 03       | import section
 0x11 | 01          | 1 count
 0x12 | 00 01       | [func 0] ComponentImport { name: "", ty: 1 }
 0x14 | 01 05       | type section
 0x16 | 02          | 2 count
 0x17 | 7f          | [type 2] Interface(Primitive(Unit))
 0x18 | 4c 00 02    | [type 3] Function(ComponentFuncType { params: [], result: Type(2) })
 0x1b | 02 03       | import section
 0x1d | 01          | 1 count
 0x1e | 00 03       | [func 1] ComponentImport { name: "", ty: 3 }

Here two function types are added (type 1 and type 3 above) but instead only one should be added. There are annotated FIXME annotations for this in the codebase where hashing support needs to be added.

Metadata

Metadata

Assignees

No one assigned

    Labels

    component-modelIssues related to the implementation of the component modelwastRelated to the text format of WebAssembly (wat/wast)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions