You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 3, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 3, 2021. It is now read-only.
What about making the low-order bit of the flags field for the first table indicate whether a table index immediate follows? That way, no table lookup is necessary for a decoder to skip to the next entry, just a bit check.
I generally would prefer compatibility with the flag layout for data segments, i.e., use more bits, but have the same bits mean the same thing. I also wouldn't mind a bit more separation of te various dimensions.
For data segments we have:
Bit
Meaning
0
is passive
1
is zero idx (if bit 0 clear) or clear otherwise
For elements that would suggest:
Bit
Meaning
0
is passive
1
is zero idx (if bit 0 clear) or is declared (if bit 0 set)
2
is elemexpr
That is, we add bit 2, and reuse bit 1 for a previously unused case.
Furthermore, I would suggest to put the table index first if present, directly after the flag. That's consistent with data segments, plus that way the special backwards compat case with table 0 can be viewed as just a compression of two consecutive bytes.
Together that would yield:
Flag
Meaning
Field
Field
Field
Payload
0
legacy active, externval
offset
idx*
1
passive, externval
externkind
idx*
2
active, externval
tableidx
offset
externkind
idx*
3
declared, externval
externkind
idx*
4
legacy active, elemexpr
offset
expr*
5
passive, elemexpr
elemtype
expr*
6
active, elemexpr
tableidx
offset
elemtype
expr*
7
declared, elemexpr
elemtype
expr*
Other than renumbering, the only differences to your scheme are: (1) the tableidx is put first, (2) active elemexpr segments have an elemtype as well, and (3) it allows declared segments with elemexpr (which seems unnecessary to rule out).
We could also reorder the flags to make this table look nicer, but then we should do the same for data segments.
@tlively there are separate meanings in my proposal too, I've updated to show what they mean, and updated the table to match his format too. That said, I'm ok w/ @rossberg's proposal too.
Activity
binji commentedon Jun 28, 2019
Proposed encoding (from slide 14):
Memory layout (from slide 16) (updated to match @rossberg's format below)
(update added meaning of bits)
Any concerns with this?
lars-t-hansen commentedon Jul 1, 2019
No concerns.
titzer commentedon Jul 1, 2019
I guess this is a bikeshedding thread. :-)
What about making the low-order bit of the flags field for the first table indicate whether a table index immediate follows? That way, no table lookup is necessary for a decoder to skip to the next entry, just a bit check.
rossberg commentedon Jul 1, 2019
I generally would prefer compatibility with the flag layout for data segments, i.e., use more bits, but have the same bits mean the same thing. I also wouldn't mind a bit more separation of te various dimensions.
For data segments we have:
For elements that would suggest:
That is, we add bit 2, and reuse bit 1 for a previously unused case.
Furthermore, I would suggest to put the table index first if present, directly after the flag. That's consistent with data segments, plus that way the special backwards compat case with table 0 can be viewed as just a compression of two consecutive bytes.
Together that would yield:
Other than renumbering, the only differences to your scheme are: (1) the tableidx is put first, (2) active elemexpr segments have an elemtype as well, and (3) it allows declared segments with elemexpr (which seems unnecessary to rule out).
We could also reorder the flags to make this table look nicer, but then we should do the same for data segments.
tlively commentedon Jul 1, 2019
I think having separate meanings for each bit as in @rossberg's scheme is a good idea.
binji commentedon Jul 1, 2019
@tlively there are separate meanings in my proposal too, I've updated to show what they mean, and updated the table to match his format too. That said, I'm ok w/ @rossberg's proposal too.
tlively commentedon Jul 1, 2019
Oh right, thanks for making those explicit. I'd be fine with either of these schemes.
rossberg commentedon Jul 2, 2019
Yes, the main point of my modification is consistency with data segments and consistency regarding the presence of elemtype.
binji commentedon Jul 8, 2019
OK, let's do @rossberg's scheme then. @lars-t-hansen OK w/ you?
lars-t-hansen commentedon Jul 8, 2019
Sure, no problem.
Bug 1559963 - Wasm: Update decoding of element segments for bulk-memo…
Bug 1559963 - Wasm: Update wasmTextToBinary for bulk-memory#98. r=bbo…
Bug 1559963 - Wasm: Update decoding of element segments for bulk-memo…
Bug 1559963 - Wasm: Update wasmTextToBinary for bulk-memory#98. r=bbo…
Bug 1559963 - Wasm: Update decoding of element segments for bulk-memo…
Bug 1559963 - Wasm: Update wasmTextToBinary for bulk-memory#98. r=bbo…
Bug 1559963 - Wasm: Update decoding of element segments for bulk-memo…
Bug 1559963 - Wasm: Update wasmTextToBinary for bulk-memory#98. r=bbo…
Bug 1559963 - Wasm: Update decoding of element segments for bulk-memo…
Bug 1559963 - Wasm: Update wasmTextToBinary for bulk-memory#98. r=bbo…
Switch to treating segment flags as a bitfield. NFC
Switch to treating segment flags as a bitfield. NFC
Switch to treating segment flags as a bitfield. NFC
Switch to treating segment flags as a bitfield. NFC
Switch to treating segment flags as a bitfield. NFC (#1232)
rossberg commentedon Nov 23, 2019
This was done.