Skip to content

Commit

Permalink
[test] Fix the binary.wast test for multi-bytes table indices (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
gahaas authored Sep 12, 2019
1 parent c69a117 commit bc81602
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions interpreter/binary/decode.ml
Original file line number Diff line number Diff line change
Expand Up @@ -637,32 +637,32 @@ let elem_refs s =
vec (at elem_expr) s

let table_segment s =
match vu32 s with
| 0l ->
match u8 s with
| 0x00 ->
let index = Source.(0l @@ Source.no_region) in
let offset = const s in
let init = elem_indices s in
ActiveElem {index; offset; etype = FuncRefType; init}
| 1l ->
| 0x01 ->
let etype = elem_kind s in
let data = elem_indices s in
PassiveElem {etype; data}
| 2l ->
| 0x02 ->
let index = at var s in
let offset = const s in
let etype = elem_kind s in
let init = elem_indices s in
ActiveElem {index; offset; etype; init}
| 4l ->
| 0x04 ->
let index = Source.(0l @@ Source.no_region) in
let offset = const s in
let init = elem_refs s in
ActiveElem {index; offset; etype = FuncRefType; init}
| 5l ->
| 0x05 ->
let etype = elem_type s in
let data = elem_refs s in
PassiveElem {etype; data}
| 6l ->
| 0x06 ->
let index = at var s in
let offset = const s in
let etype = elem_type s in
Expand Down
6 changes: 3 additions & 3 deletions test/core/binary.wast
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@
"\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
"\09\09\01" ;; Element section with 1 entry
"\02\80\00" ;; Table index 0, encoded with 2 bytes
"\41\00\0b\00\00" ;; (i32.const 0) with no elements
)

;; Unsigned LEB128 must not be overlong
Expand Down

0 comments on commit bc81602

Please sign in to comment.