Skip to content
This repository has been archived by the owner on Aug 17, 2022. It is now read-only.

Commit

Permalink
Address a few comments about binary encoding
Browse files Browse the repository at this point in the history
* Fix a few typos with `e` vs `e*`
* Change the binary encoding of imports without a field to use a
  zero-length field followed by an invalid byte for an `importdesc`,
  leaving a future possibility for non-utf-8 names.
  • Loading branch information
alexcrichton committed Jul 28, 2020
1 parent 321b1a2 commit 023f4f7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions proposals/module-linking/Binary.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ type ::=
functype ::= rt_1:resulttype rt_2:resulttype -> rt_1 -> rt-2
moduletype ::=
i*:vec(import) e*:vec(exporttype) -> {imports i, exports e}
i*:vec(import) e*:vec(exporttype) -> {imports i*, exports e*}
instancetype ::= e*:vec(exporttype) -> {exports e}
instancetype ::= e*:vec(exporttype) -> {exports e*}
exporttype ::= nm:name d:importdesc -> {name nm, desc d}
```
Expand All @@ -70,12 +70,12 @@ Updates to
[`importdesc`](https://webassembly.github.io/spec/core/binary/modules.html#binary-importdesc)

```
# note that `0x01 0xc0` in MVP-wasm specifies a 1-byte module field of the
# string 0xc0, but the 0xc0 byte is not valid utf-8, so this was not a valid
# MVP import
# note that in MVP wasm this encoding specifies a zero-length field name, but
# the following `0xff` byte is not a valid `importdesc` prefix, so this encoding
# is invalid in MVP wasm
import ::=
...
mod:name 0x01 0xc0 d:importdesc -> {module mod, desc d}
mod:name 0x00 0xff d:importdesc -> {module mod, desc d}
importdesc ::=
...
Expand Down Expand Up @@ -110,7 +110,7 @@ A new section defining local instances
```
instancesec ::= i*:section_101(vec(instancedef)) -> i*
instancedef ::= 0x00 m:moduleidx e*:vec(exportdesc) -> {instantiate m, imports e}
instancedef ::= 0x00 m:moduleidx e*:vec(exportdesc) -> {instantiate m, imports e*}
```

This defines instances in the module, appending to the instance index space.
Expand Down

0 comments on commit 023f4f7

Please sign in to comment.