Skip to content

Add binary encoding#10

Merged
wingo merged 4 commits intomainfrom
binary-encoding
Jun 22, 2022
Merged

Add binary encoding#10
wingo merged 4 commits intomainfrom
binary-encoding

Conversation

@wingo
Copy link
Collaborator

@wingo wingo commented May 10, 2022

A strawman to address #9. Happy to change any of these. I checked with all (!) of the other proposals and with what SpiderMonkey and V8 implement to (attempt to) make sure I wasn't stompling other users.

A strawman to address #9.  Happy to change any of these.  I checked with
all (!) of the other proposals and with what SpiderMonkey and V8
implement to (attempt to) make sure I wasn't stompling other users.
Also update section number to not overlap with the tag section, and fix
reftypes to not overlap with dataref/arrayref shorthands.
@wingo wingo mentioned this pull request May 13, 2022

instr ::= ...
| 0xfb 0x80 $mem:u32 ⇒ string.new_wtf8 $mem
| 0xfb 0x81 $mem:u32 ⇒ string.new_wtf16 $mem
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it's:

0xfb 0x80 $mem:u32 $len:u32              ⇒ string.new_wtf8 $mem $len
0xfb 0x81 $mem:u32 $len:u32              ⇒ string.new_wtf16 $mem $len

possibly in other instruction $len might be missing, unsure.

Copy link
Collaborator Author

@wingo wingo May 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, sloppy notation -- the $ prefix is meant to indicate an immediate. In this case it's which memory to use. The address and length are taken from the operand stack and aren't part of the encoding itself. Hope that is clear.

@wingo
Copy link
Collaborator Author

wingo commented May 23, 2022

Need to update -- 0x65 is unavailable after https://github.com/WebAssembly/gc/pull/295/files.

Copy link
Collaborator

@jakobkummerow jakobkummerow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with two comments:

#11 (comment) suggested a more flexible spec for the literals section
• apparently prefixed opcode spaces should use LEB encoding rather than a custom split between two-byte opcode and "nested prefixes", which would force all opcode encodings suggested here to have three bytes instead. I'm fine with landing this as-is though, because changing these details later is easy.

@wingo wingo merged commit f9024a2 into main Jun 22, 2022
@wingo wingo deleted the binary-encoding branch June 22, 2022 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants