Skip to content

Commit 4d6e519

Browse files
authored
Merge pull request #92 from WebAssembly/start-arity
Add explicit result arity to start definitions
2 parents b4e513e + 21666e2 commit 4d6e519

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

design/mvp/Binary.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,11 @@ Notes:
266266

267267
(See [Start Definitions](Explainer.md#start-definitions) in the explainer.)
268268
```
269-
start ::= f:<funcidx> arg*:vec(<valueidx>) => (start f (value arg)*)
269+
start ::= f:<funcidx> arg*:vec(<valueidx>) r:<u32> => (start f (value arg)* (result (value))ʳ)
270270
```
271271
Notes:
272-
* Validation requires `f` have `functype` with `param` arity and types matching `arg*`.
272+
* Validation requires `f` have `functype` with `param` arity and types matching `arg*`
273+
and `result` arity `r`.
273274
* Validation appends the `result` types of `f` to the value index space (making
274275
them available for reference by subsequent definitions).
275276

design/mvp/Explainer.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,13 +758,14 @@ instantiation. Unlike modules, components can call start functions at multiple
758758
points during instantiation with each such call having parameters and results.
759759
Thus, `start` definitions in components look like function calls:
760760
```
761-
start ::= (start <funcidx> (value <valueidx>)* (result (value <id>))?)
761+
start ::= (start <funcidx> (value <valueidx>)* (result (value <id>?))*)
762762
```
763763
The `(value <valueidx>)*` list specifies the arguments passed to `funcidx` by
764764
indexing into the *value index space*. Value definitions (in the value index
765765
space) are like immutable `global` definitions in Core WebAssembly except that
766766
validation requires them to be consumed exactly once at instantiation-time
767-
(i.e., they are [linear]).
767+
(i.e., they are [linear]). The arity and types of the two value lists are
768+
validated to match the signature of `funcidx`.
768769

769770
As with all definition sorts, values may be imported and exported by
770771
components. As an example value import:

0 commit comments

Comments
 (0)