Skip to content
This repository was archived by the owner on Nov 3, 2021. It is now read-only.

[spec] Introduce multi-results and block parameters - #1

Merged
rossberg merged 1 commit into
masterfrom
spec
Oct 12, 2017
Merged

rossberg merged 1 commit into
masterfrom
spec

Conversation

@rossberg

@rossberg rossberg commented Jul 27, 2017 •

Copy link
Copy Markdown
Member

This does all changes to the spec necessary to support multi-results and block parameters:

  • Replaces all occurrences of result types [t?] with [t*]
  • Extends the syntax of block signatures to allow for a type index that denotes a function type
  • Generalises the validation rules for block/loop/if to allow block params
  • Generalises the exectuion rules for block/loop/if to allow block params
  • Extends the binary format with type indices as block sigs
  • Extends the text format with typeuse and param decls (which must not contain identifiers)
  • Removes respective notes about future extensions

Most of these changes are very simple. The main complication ironically is the mere representation of block sigs in the syntax and binary format, which necessarily becomes a bit ad-hoc because it has to support both the old and the new format. Moreover, interpreting a block type may now require a lookup in the type section, which is a minor structural complication in the respective rules.

Preview at https://webassembly.github.io/multi-value/

Plenty of tests and a respective patch for the interpreter are in PR #2.

@lukewagner

Copy link
Copy Markdown
Member

Pre-existing, but accentuated by binary format changes to blocktype: to clarify the "must not collide with" relationship between the byte codes for the valtypes, anyfunc, function ctor, and ε, it'd be useful to collect them into a single table (perhaps like you've done with the instructions). E.g., in SM we have a TypeCode enum that is then used to define ValType etc.

In general, blocktype changes makes sense from what I scanned.

@rossberg

Copy link
Copy Markdown
Member Author

@lukewagner, added type index as part of WebAssembly/spec#526.

@lukewagner

Copy link
Copy Markdown
Member

Beautiful, thanks!

@rossberg
rossberg merged commit 4893665 into master Oct 12, 2017
rossberg pushed a commit that referenced this pull request Mar 18, 2019
Rebase from upstream and adapt limits
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants