Skip to content

Value definitions: First time that parsing depends on previous section? #352

@primoly

Description

@primoly

In #336 parsing of a value section depends on the contents of a component type section.

The types of all non primvaltypes refer to a typeidx. So a parser needs to look up the actual type in the component type section to know how to interpret the succeeding bytes.

val(i:<typeidx>) ::= v:<val(type-index-space[i])> => v

Is this the first time that the parsing of a section requires knowledge of the contents of a previous section?

It’s obviously already necessary for validation and execution, but I don’t think it has so far been the case for parsing in either Wasm modules or components, even for code sections. I believe that some Wasm consumers even use this property to do parsing and validation of sections in parallel which would no longer be possible, at least not when hitting a value section. I just wanted to check if I am correct.

I noticed this when working on adding support for value sections in wasmparser.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions