Skip to content

Commit 84e2079

Browse files
committed
Binary encoding of opcodes after 0xfb prefix are LEBs
Fixes #9.
1 parent cd8473a commit 84e2079

File tree

1 file changed

+31
-28
lines changed

1 file changed

+31
-28
lines changed

proposals/stringref/Overview.md

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -599,34 +599,34 @@ wtf8_policy ::= 0x00 ⇒ utf8
599599
| 0x02 ⇒ replace
600600
601601
instr ::= ...
602-
| 0xfb 0x80 $mem:u32 $policy:u32 ⇒ string.new_wtf8 $mem $policy
603-
| 0xfb 0x81 $mem:u32 ⇒ string.new_wtf16 $mem
604-
| 0xfb 0x82 $idx:u32 ⇒ string.const $idx
605-
| 0xfb 0x84 $policy:u32 ⇒ string.measure_wtf8 $policy
606-
| 0xfb 0x85 ⇒ string.measure_wtf16
607-
| 0xfb 0x86 $mem:u32 $policy:u32 ⇒ string.encode_wtf8 $mem $policy
608-
| 0xfb 0x87 $mem:u32 ⇒ string.encode_wtf16 $mem
609-
| 0xfb 0x88 ⇒ string.concat
610-
| 0xfb 0x89 ⇒ string.eq
611-
| 0xfb 0x8a ⇒ string.is_usv_sequence
612-
| 0xfb 0x90 ⇒ string.as_wtf8
613-
| 0xfb 0x91 ⇒ stringview_wtf8.advance
614-
| 0xfb 0x92 $mem:u32 $policy:u32 ⇒ stringview_wtf8.encode $mem $policy
615-
| 0xfb 0x93 ⇒ stringview_wtf8.slice
616-
| 0xfb 0x98 ⇒ string.as_wtf16
617-
| 0xfb 0x99 ⇒ stringview_wtf16.length
618-
| 0xfb 0x9a ⇒ stringview_wtf16.get_codeunit
619-
| 0xfb 0x9b $mem:u32 ⇒ stringview_wtf16.encode $mem
620-
| 0xfb 0x9c ⇒ stringview_wtf16.slice
621-
| 0xfb 0xa0 ⇒ string.as_iter
622-
| 0xfb 0xa1 ⇒ stringview_iter.next
623-
| 0xfb 0xa2 ⇒ stringview_iter.advance
624-
| 0xfb 0xa3 ⇒ stringview_iter.rewind
625-
| 0xfb 0xa4 ⇒ stringview_iter.slice
626-
| 0xfb 0xb0 $policy:u32 [gc] ⇒ string.new_wtf8_array $policy
627-
| 0xfb 0xb1 [gc] ⇒ string.new_wtf16_array
628-
| 0xfb 0xb2 $policy:u32 [gc] ⇒ string.encode_wtf8_array $policy
629-
| 0xfb 0xb3 [gc] ⇒ string.encode_wtf16_array
602+
| 0xfb 0x80:u32 $mem:u32 $policy:u32 ⇒ string.new_wtf8 $mem $policy
603+
| 0xfb 0x81:u32 $mem:u32 ⇒ string.new_wtf16 $mem
604+
| 0xfb 0x82:u32 $idx:u32 ⇒ string.const $idx
605+
| 0xfb 0x84:u32 $policy:u32 ⇒ string.measure_wtf8 $policy
606+
| 0xfb 0x85:u32 ⇒ string.measure_wtf16
607+
| 0xfb 0x86:u32 $mem:u32 $policy:u32 ⇒ string.encode_wtf8 $mem $policy
608+
| 0xfb 0x87:u32 $mem:u32 ⇒ string.encode_wtf16 $mem
609+
| 0xfb 0x88:u32 ⇒ string.concat
610+
| 0xfb 0x89:u32 ⇒ string.eq
611+
| 0xfb 0x8a:u32 ⇒ string.is_usv_sequence
612+
| 0xfb 0x90:u32 ⇒ string.as_wtf8
613+
| 0xfb 0x91:u32 ⇒ stringview_wtf8.advance
614+
| 0xfb 0x92:u32 $mem:u32 $policy:u32 ⇒ stringview_wtf8.encode $mem $policy
615+
| 0xfb 0x93:u32 ⇒ stringview_wtf8.slice
616+
| 0xfb 0x98:u32 ⇒ string.as_wtf16
617+
| 0xfb 0x99:u32 ⇒ stringview_wtf16.length
618+
| 0xfb 0x9a:u32 ⇒ stringview_wtf16.get_codeunit
619+
| 0xfb 0x9b:u32 $mem:u32 ⇒ stringview_wtf16.encode $mem
620+
| 0xfb 0x9c:u32 ⇒ stringview_wtf16.slice
621+
| 0xfb 0xa0:u32 ⇒ string.as_iter
622+
| 0xfb 0xa1:u32 ⇒ stringview_iter.next
623+
| 0xfb 0xa2:u32 ⇒ stringview_iter.advance
624+
| 0xfb 0xa3:u32 ⇒ stringview_iter.rewind
625+
| 0xfb 0xa4:u32 ⇒ stringview_iter.slice
626+
| 0xfb 0xb0:u32 $policy:u32 [gc] ⇒ string.new_wtf8_array $policy
627+
| 0xfb 0xb1:u32 [gc] ⇒ string.new_wtf16_array
628+
| 0xfb 0xb2:u32 $policy:u32 [gc] ⇒ string.encode_wtf8_array $policy
629+
| 0xfb 0xb3:u32 [gc] ⇒ string.encode_wtf16_array
630630
631631
;; New section. If present, must be present only once, and right before
632632
;; the globals section (or where the globals section would be). Each
@@ -637,6 +637,9 @@ instr ::= ...
637637
stringrefs ::= section_14(0x00 vec(vec(u8)))
638638
```
639639

640+
Note that the u32 (uleb) encoding for the opcode after the `0xfb` prefix
641+
takes two bytes, for opcode values between 0x80 and 0x3fff.
642+
640643
## Examples
641644

642645
We assume that the textual syntax for instructions that take a memory

0 commit comments

Comments
 (0)