-
Notifications
You must be signed in to change notification settings - Fork 27
Incompatibility with long LEB128 form from the core spec #153
Description
While implementing bulk memory proposal in my parser, I've noticed regressions in some core spec tests. In particular these two are very representative:
bulk-memory-operations/test/core/binary-leb128.wast
Lines 24 to 39 in 66d90a7
(module binary | |
"\00asm" "\01\00\00\00" | |
"\05\03\01" ;; Memory section with 1 entry | |
"\00\00" ;; no max, minimum 0 | |
"\0b\07\01" ;; Data section with 1 entry | |
"\80\00" ;; Memory index 0, encoded with 2 bytes | |
"\41\00\0b\00" ;; (i32.const 0) with contents "" | |
) | |
(module binary | |
"\00asm" "\01\00\00\00" | |
"\04\04\01" ;; Table section with 1 entry | |
"\70\00\00" ;; no max, minimum 0, funcref | |
"\09\07\01" ;; Element section with 1 entry | |
"\80\00" ;; Table index 0, encoded with 2 bytes | |
"\41\00\0b\00" ;; (i32.const 0) with no elements | |
) |
Here, a 0
table index (the only one allowed previously) is encoded in a suboptimal form of 0x80 0x00
.
The new layout used by this proposal relies on the table index previously being always zero and encoded as 0x00
, and assigns a different meaning to byte at the same position as 0x80
and expects it to be one of the following values:
Such long form is likely not something used by implementations in the wild, but it might be worth double-checking and either supporting such long form too, or at least making an explicit decision about this backward-incompatible binary representation change and removing (?) corresponding tests.