Skip to content

Commit adaf406

Browse files
authored
Merge branch 'WebAssembly:main' into patch-1
2 parents 91b6257 + 517cab4 commit adaf406

File tree

9 files changed

+444
-567
lines changed

9 files changed

+444
-567
lines changed

design/mvp/Binary.md

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,9 @@ Notes:
102102
for aliases (below).
103103
* Validation of `core:instantiatearg` initially only allows the `instance`
104104
sort, but would be extended to accept other sorts as core wasm is extended.
105-
* Validation of `instantiate` requires that `name` is present in an
106-
`externname` of `c` (with a matching type).
105+
* Validation of `instantiate` requires that each `<name>` or `<iid>` in an
106+
imported `externname` in `c` matches a `string` in a `with` argument and that
107+
the argument's type matches the import's type.
107108
* When validating `instantiate`, after each individual type-import is supplied
108109
via `with`, the actual type supplied is immediately substituted for all uses
109110
of the import, so that subsequent imports and all exports are now specialized
@@ -281,9 +282,9 @@ Notes:
281282
```
282283
canon ::= 0x00 0x00 f:<core:funcidx> opts:<opts> ft:<typeidx> => (canon lift f opts type-index-space[ft])
283284
| 0x01 0x00 f:<funcidx> opts:<opts> => (canon lower f opts (core func))
284-
| 0x02 t:<typeidx> => (canon resource.new t (core func))
285-
| 0x03 t:<valtype> => (canon resource.drop t (core func))
286-
| 0x04 t:<typeidx> => (canon resource.rep t (core func))
285+
| 0x02 rt:<typeidx> => (canon resource.new rt (core func))
286+
| 0x03 rt:<typdidx> => (canon resource.drop rt (core func))
287+
| 0x04 rt:<typeidx> => (canon resource.rep rt (core func))
287288
opts ::= opt*:vec(<canonopt>) => opt*
288289
canonopt ::= 0x00 => string-encoding=utf8
289290
| 0x01 => string-encoding=utf16
@@ -327,33 +328,21 @@ flags are set.
327328
(See [Import and Export Definitions](Explainer.md#import-and-export-definitions)
328329
in the explainer.)
329330
```
330-
import ::= en:<externname> ed:<externdesc> => (import en ed)
331-
export ::= en:<externname> si:<sortidx> ed?:<externdesc>? => (export en si ed?)
332-
externname ::= 0x00 n:<name> => n
333-
| 0x01 n:<id> => (interface n)
334-
id ::= len:<u32> n:<id-chars> => n (if len = |n|)
335-
336-
id-chars ::= ns:<label> ':' pkg:<label> '/' n:<label> v:<id-version> => ns:pkg/nv
337-
id-version ::= => ϵ
338-
| '@' version:<version> pre:<verpre> build:<verbuild> => version pre build
339-
340-
version ::= major:<num> '.' minor:<num> '.' patch:<num> => major.minor.patch
341-
version-number ::= digit+:[0x30-0x39] => char(digit)+
342-
343-
verpre ::= => ϵ
344-
| '-' (a:<label> '.') b:<label> => -(a.*)b
345-
verbuild ::= => ϵ
346-
| '+' (a:<label> '.') b:<label> => +(a.*)b
331+
import ::= en:<externname> ed:<externdesc> => (import en ed)
332+
export ::= en:<externname> si:<sortidx> ed?:<externdesc>? => (export en si ed?)
333+
externname ::= 0x00 n:<name> => n
334+
| 0x01 iid:<iid> => (interface iid)
335+
iid ::= len:<u32> c:<iid-chars> => c (if len = |c|)
336+
iid-chars ::= ns:<label> ':' pkg:<label> '/' n:<label> v:<version> => ns:pkg/nv
337+
version ::= => ϵ
338+
| '@' v:<valid semver> => @v
347339
```
348340

349341
Notes:
350342
* All exports (of all `sort`s) introduce a new index that aliases the exported
351343
definition and can be used by all subsequent definitions just like an alias.
352344
* Validation requires that all resource types transitively used in the type of an
353345
export are introduced by a preceding `importdecl` or `exportdecl`.
354-
* The "parses as a URL" condition is defined by executing the [basic URL
355-
parser] with `char(b)*` as *input*, no optional parameters and non-fatal
356-
validation errors (which coincides with definition of `URL` in JS and `rust-url`).
357346
* Validation requires any exported `sortidx` to have a valid `externdesc`
358347
(which disallows core sorts other than `core module`). When the optional
359348
`externdesc` immediate is present, validation requires it to be a supertype
@@ -364,7 +353,7 @@ Notes:
364353
* The `id` fields of `externname` (that are present) must independently be
365354
unique among imports and exports, respectively. (An import and export *may*
366355
have the same `id`.)
367-
* URLs are compared for equality by plain byte identity.
356+
* `<valid semver>` is as defined by [https://semver.org](https://semver.org/)
368357

369358
## Name Section
370359

@@ -407,5 +396,3 @@ named once.
407396

408397
[type-imports]: https://github.com/WebAssembly/proposal-type-imports/blob/master/proposals/type-imports/Overview.md
409398
[module-linking]: https://github.com/WebAssembly/module-linking/blob/main/proposals/module-linking/Explainer.md
410-
411-
[Basic URL Parser]: https://url.spec.whatwg.org/#concept-basic-url-parser

0 commit comments

Comments
 (0)