Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix binary encoding of rtt and i31 #25

Merged
merged 1 commit into from
Nov 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/wasp/base/inc/heap_kind.inc
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ WASP_V(0x70, Func, "func")
WASP_FEATURE_V(0x6f, Extern, "extern", reference_types)
WASP_FEATURE_V(0x6e, Any, "any", gc)
WASP_FEATURE_V(0x6d, Eq, "eq", gc)
WASP_FEATURE_V(0x69, I31, "i31", gc)
WASP_FEATURE_V(0x6a, I31, "i31", gc)
WASP_FEATURE_V(0x68, Exn, "exn", exceptions)
2 changes: 1 addition & 1 deletion include/wasp/base/inc/reference_kind.inc
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ WASP_V(0x70, Funcref, "funcref")
WASP_FEATURE_V(0x6f, Externref, "externref", reference_types)
WASP_FEATURE_V(0x6e, Anyref, "anyref", gc)
WASP_FEATURE_V(0x6d, Eqref, "eqref", gc)
WASP_FEATURE_V(0x69, I31ref, "i31ref", gc)
WASP_FEATURE_V(0x6a, I31ref, "i31ref", gc)
WASP_FEATURE_V(0x68, Exnref, "exnref", exceptions)
2 changes: 1 addition & 1 deletion include/wasp/binary/encoding.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ struct ReferenceKind {
};

struct Rtt {
static constexpr u8 RttPrefix = 0x6a;
static constexpr u8 RttPrefix = 0x69;

static bool Is(u8);
};
Expand Down
82 changes: 41 additions & 41 deletions test/binary/constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const HT HT_Func{At{"\x70"_su8, HeapKind::Func}};
const HT HT_Extern{At{"\x6f"_su8, HeapKind::Extern}};
const HT HT_Any{At{"\x6e"_su8, HeapKind::Any}};
const HT HT_Eq{At{"\x6d"_su8, HeapKind::Eq}};
const HT HT_I31{At{"\x69"_su8, HeapKind::I31}};
const HT HT_I31{At{"\x6a"_su8, HeapKind::I31}};
const HT HT_Exn{At{"\x68"_su8, HeapKind::Exn}};
const HT HT_0{At{"\x00"_su8, Index{0}}};
const HT HT_1{At{"\x01"_su8, Index{1}}};
Expand All @@ -43,8 +43,8 @@ const RefType RefType_Any{At{"\x6e"_su8, HT_Any}, Null::No};
const RefType RefType_NullAny{At{"\x6e"_su8, HT_Any}, Null::Yes};
const RefType RefType_Eq{At{"\x6d"_su8, HT_Eq}, Null::No};
const RefType RefType_NullEq{At{"\x6d"_su8, HT_Eq}, Null::Yes};
const RefType RefType_I31{At{"\x69"_su8, HT_I31}, Null::No};
const RefType RefType_NullI31{At{"\x69"_su8, HT_I31}, Null::Yes};
const RefType RefType_I31{At{"\x6a"_su8, HT_I31}, Null::No};
const RefType RefType_NullI31{At{"\x6a"_su8, HT_I31}, Null::Yes};
const RefType RefType_Exn{At{"\x68"_su8, HT_Exn}, Null::No};
const RefType RefType_NullExn{At{"\x68"_su8, HT_Exn}, Null::Yes};
const RefType RefType_0{At{"\x00"_su8, HT_0}, Null::No};
Expand All @@ -58,7 +58,7 @@ const RT RT_Funcref{At{"\x70"_su8, ReferenceKind::Funcref}};
const RT RT_Externref{At{"\x6f"_su8, ReferenceKind::Externref}};
const RT RT_Anyref{At{"\x6e"_su8, ReferenceKind::Anyref}};
const RT RT_Eqref{At{"\x6d"_su8, ReferenceKind::Eqref}};
const RT RT_I31ref{At{"\x69"_su8, ReferenceKind::I31ref}};
const RT RT_I31ref{At{"\x6a"_su8, ReferenceKind::I31ref}};
const RT RT_Exnref{At{"\x68"_su8, ReferenceKind::Exnref}};
const RT RT_RefFunc{At{"\x6b\x70"_su8, RefType_Func}};
const RT RT_RefNullFunc{At{"\x6c\x70"_su8, RefType_NullFunc}};
Expand All @@ -68,8 +68,8 @@ const RT RT_RefAny{At{"\x6b\x6e"_su8, RefType_Any}};
const RT RT_RefNullAny{At{"\x6c\x6e"_su8, RefType_NullAny}};
const RT RT_RefEq{At{"\x6b\x6d"_su8, RefType_Eq}};
const RT RT_RefNullEq{At{"\x6c\x6d"_su8, RefType_NullEq}};
const RT RT_RefI31{At{"\x6b\x69"_su8, RefType_I31}};
const RT RT_RefNullI31{At{"\x6c\x69"_su8, RefType_NullI31}};
const RT RT_RefI31{At{"\x6b\x6a"_su8, RefType_I31}};
const RT RT_RefNullI31{At{"\x6c\x6a"_su8, RefType_NullI31}};
const RT RT_RefExn{At{"\x6b\x68"_su8, RefType_Exn}};
const RT RT_RefNullExn{At{"\x6c\x68"_su8, RefType_NullExn}};
const RT RT_Ref0{At{"\x6b\x00"_su8, RefType_0}};
Expand All @@ -83,7 +83,7 @@ const Rtt RTT_0_Func{At{"\x00"_su8, 0u}, At{"\x70"_su8, HT_Func}};
const Rtt RTT_0_Extern{At{"\x00"_su8, 0u}, At{"\x6f"_su8, HT_Extern}};
const Rtt RTT_0_Any{At{"\x00"_su8, 0u}, At{"\x6e"_su8, HT_Any}};
const Rtt RTT_0_Eq{At{"\x00"_su8, 0u}, At{"\x6d"_su8, HT_Eq}};
const Rtt RTT_0_I31{At{"\x00"_su8, 0u}, At{"\x69"_su8, HT_I31}};
const Rtt RTT_0_I31{At{"\x00"_su8, 0u}, At{"\x6a"_su8, HT_I31}};
const Rtt RTT_0_Exn{At{"\x00"_su8, 0u}, At{"\x68"_su8, HT_Exn}};
const Rtt RTT_0_0{At{"\x00"_su8, 0u}, At{"\x00"_su8, HT_0}};
const Rtt RTT_0_1{At{"\x00"_su8, 0u}, At{"\x01"_su8, HT_1}};
Expand All @@ -92,7 +92,7 @@ const Rtt RTT_1_Func{At{"\x01"_su8, 1u}, At{"\x70"_su8, HT_Func}};
const Rtt RTT_1_Extern{At{"\x01"_su8, 1u}, At{"\x6f"_su8, HT_Extern}};
const Rtt RTT_1_Any{At{"\x01"_su8, 1u}, At{"\x6e"_su8, HT_Any}};
const Rtt RTT_1_Eq{At{"\x01"_su8, 1u}, At{"\x6d"_su8, HT_Eq}};
const Rtt RTT_1_I31{At{"\x01"_su8, 1u}, At{"\x69"_su8, HT_I31}};
const Rtt RTT_1_I31{At{"\x01"_su8, 1u}, At{"\x6a"_su8, HT_I31}};
const Rtt RTT_1_Exn{At{"\x01"_su8, 1u}, At{"\x68"_su8, HT_Exn}};
const Rtt RTT_1_0{At{"\x01"_su8, 1u}, At{"\x00"_su8, HT_0}};
const Rtt RTT_1_1{At{"\x01"_su8, 1u}, At{"\x01"_su8, HT_1}};
Expand All @@ -107,7 +107,7 @@ const VT VT_Funcref{At{"\x70"_su8, RT_Funcref}};
const VT VT_Externref{At{"\x6f"_su8, RT_Externref}};
const VT VT_Anyref{At{"\x6e"_su8, RT_Anyref}};
const VT VT_Eqref{At{"\x6d"_su8, RT_Eqref}};
const VT VT_I31ref{At{"\x69"_su8, RT_I31ref}};
const VT VT_I31ref{At{"\x6a"_su8, RT_I31ref}};
const VT VT_Exnref{At{"\x68"_su8, RT_Exnref}};
const VT VT_RefFunc{At{"\x6b\x70"_su8, RT_RefFunc}};
const VT VT_RefNullFunc{At{"\x6c\x70"_su8, RT_RefNullFunc}};
Expand All @@ -117,8 +117,8 @@ const VT VT_RefAny{At{"\x6b\x6e"_su8, RT_RefAny}};
const VT VT_RefNullAny{At{"\x6c\x6e"_su8, RT_RefNullAny}};
const VT VT_RefEq{At{"\x6b\x6d"_su8, RT_RefEq}};
const VT VT_RefNullEq{At{"\x6c\x6d"_su8, RT_RefNullEq}};
const VT VT_RefI31{At{"\x6b\x69"_su8, RT_RefI31}};
const VT VT_RefNullI31{At{"\x6c\x69"_su8, RT_RefNullI31}};
const VT VT_RefI31{At{"\x6b\x6a"_su8, RT_RefI31}};
const VT VT_RefNullI31{At{"\x6c\x6a"_su8, RT_RefNullI31}};
const VT VT_RefExn{At{"\x6b\x68"_su8, RT_RefExn}};
const VT VT_RefNullExn{At{"\x6c\x68"_su8, RT_RefNullExn}};
const VT VT_Ref0{At{"\x6b\x00"_su8, RT_Ref0}};
Expand All @@ -127,24 +127,24 @@ const VT VT_Ref1{At{"\x6b\x01"_su8, RT_Ref1}};
const VT VT_RefNull1{At{"\x6c\x01"_su8, RT_RefNull1}};
const VT VT_Ref2{At{"\x6b\x02"_su8, RT_Ref2}};
const VT VT_RefNull2{At{"\x6c\x02"_su8, RT_RefNull2}};
const VT VT_RTT_0_Func{At{"\x6a\x00\x70"_su8, RTT_0_Func}};
const VT VT_RTT_0_Extern{At{"\x6a\x00\x6f"_su8, RTT_0_Extern}};
const VT VT_RTT_0_Any{At{"\x6a\x00\x6e"_su8, RTT_0_Any}};
const VT VT_RTT_0_Eq{At{"\x6a\x00\x6d"_su8, RTT_0_Eq}};
const VT VT_RTT_0_I31{At{"\x6a\x00\x69"_su8, RTT_0_I31}};
const VT VT_RTT_0_Exn{At{"\x6a\x00\x68"_su8, RTT_0_Exn}};
const VT VT_RTT_0_0{At{"\x6a\x00\x00"_su8, RTT_0_0}};
const VT VT_RTT_0_1{At{"\x6a\x00\x01"_su8, RTT_0_1}};
const VT VT_RTT_0_2{At{"\x6a\x00\x02"_su8, RTT_0_2}};
const VT VT_RTT_1_Func{At{"\x6a\x01\x70"_su8, RTT_1_Func}};
const VT VT_RTT_1_Extern{At{"\x6a\x01\x6f"_su8, RTT_1_Extern}};
const VT VT_RTT_1_Any{At{"\x6a\x01\x6e"_su8, RTT_1_Any}};
const VT VT_RTT_1_Eq{At{"\x6a\x01\x6d"_su8, RTT_1_Eq}};
const VT VT_RTT_1_I31{At{"\x6a\x01\x69"_su8, RTT_1_I31}};
const VT VT_RTT_1_Exn{At{"\x6a\x01\x68"_su8, RTT_1_Exn}};
const VT VT_RTT_1_0{At{"\x6a\x01\x00"_su8, RTT_1_0}};
const VT VT_RTT_1_1{At{"\x6a\x01\x01"_su8, RTT_1_1}};
const VT VT_RTT_1_2{At{"\x6a\x01\x02"_su8, RTT_1_2}};
const VT VT_RTT_0_Func{At{"\x69\x00\x70"_su8, RTT_0_Func}};
const VT VT_RTT_0_Extern{At{"\x69\x00\x6f"_su8, RTT_0_Extern}};
const VT VT_RTT_0_Any{At{"\x69\x00\x6e"_su8, RTT_0_Any}};
const VT VT_RTT_0_Eq{At{"\x69\x00\x6d"_su8, RTT_0_Eq}};
const VT VT_RTT_0_I31{At{"\x69\x00\x6a"_su8, RTT_0_I31}};
const VT VT_RTT_0_Exn{At{"\x69\x00\x68"_su8, RTT_0_Exn}};
const VT VT_RTT_0_0{At{"\x69\x00\x00"_su8, RTT_0_0}};
const VT VT_RTT_0_1{At{"\x69\x00\x01"_su8, RTT_0_1}};
const VT VT_RTT_0_2{At{"\x69\x00\x02"_su8, RTT_0_2}};
const VT VT_RTT_1_Func{At{"\x69\x01\x70"_su8, RTT_1_Func}};
const VT VT_RTT_1_Extern{At{"\x69\x01\x6f"_su8, RTT_1_Extern}};
const VT VT_RTT_1_Any{At{"\x69\x01\x6e"_su8, RTT_1_Any}};
const VT VT_RTT_1_Eq{At{"\x69\x01\x6d"_su8, RTT_1_Eq}};
const VT VT_RTT_1_I31{At{"\x69\x01\x6a"_su8, RTT_1_I31}};
const VT VT_RTT_1_Exn{At{"\x69\x01\x68"_su8, RTT_1_Exn}};
const VT VT_RTT_1_0{At{"\x69\x01\x00"_su8, RTT_1_0}};
const VT VT_RTT_1_1{At{"\x69\x01\x01"_su8, RTT_1_1}};
const VT VT_RTT_1_2{At{"\x69\x01\x02"_su8, RTT_1_2}};

const BT BT_I32{At{"\x7f"_su8, VT_I32}};
const BT BT_I64{At{"\x7e"_su8, VT_I64}};
Expand All @@ -155,7 +155,7 @@ const BT BT_Funcref{At{"\x70"_su8, VT_Funcref}};
const BT BT_Externref{At{"\x6f"_su8, VT_Externref}};
const BT BT_Anyref{At{"\x6e"_su8, VT_Anyref}};
const BT BT_Eqref{At{"\x6d"_su8, VT_Eqref}};
const BT BT_I31ref{At{"\x69"_su8, VT_I31ref}};
const BT BT_I31ref{At{"\x6a"_su8, VT_I31ref}};
const BT BT_Exnref{At{"\x68"_su8, VT_Exnref}};
const BT BT_Void{At{"\x40"_su8, binary::VoidType{}}};
const BT BT_RefFunc{At{"\x6b\x70"_su8, VT_RefFunc}};
Expand All @@ -166,8 +166,8 @@ const BT BT_RefAny{At{"\x6b\x6e"_su8, VT_RefAny}};
const BT BT_RefNullAny{At{"\x6c\x6e"_su8, VT_RefNullAny}};
const BT BT_RefEq{At{"\x6b\x6d"_su8, VT_RefEq}};
const BT BT_RefNullEq{At{"\x6c\x6d"_su8, VT_RefNullEq}};
const BT BT_RefI31{At{"\x6b\x69"_su8, VT_RefI31}};
const BT BT_RefNullI31{At{"\x6c\x69"_su8, VT_RefNullI31}};
const BT BT_RefI31{At{"\x6b\x6a"_su8, VT_RefI31}};
const BT BT_RefNullI31{At{"\x6c\x6a"_su8, VT_RefNullI31}};
const BT BT_RefExn{At{"\x6b\x68"_su8, VT_RefExn}};
const BT BT_RefNullExn{At{"\x6c\x68"_su8, VT_RefNullExn}};
const BT BT_Ref0{At{"\x6b\x00"_su8, VT_Ref0}};
Expand All @@ -176,15 +176,15 @@ const BT BT_Ref1{At{"\x6b\x01"_su8, VT_Ref1}};
const BT BT_RefNull1{At{"\x6c\x01"_su8, VT_RefNull1}};
const BT BT_Ref2{At{"\x6b\x02"_su8, VT_Ref2}};
const BT BT_RefNull2{At{"\x6c\x02"_su8, VT_RefNull2}};
const BT BT_RTT_0_Func{At{"\x6a\x00\x70"_su8, VT_RTT_0_Func}};
const BT BT_RTT_0_Extern{At{"\x6a\x00\x6f"_su8, VT_RTT_0_Extern}};
const BT BT_RTT_0_Any{At{"\x6a\x00\x6e"_su8, VT_RTT_0_Any}};
const BT BT_RTT_0_Eq{At{"\x6a\x00\x6d"_su8, VT_RTT_0_Eq}};
const BT BT_RTT_0_I31{At{"\x6a\x00\x69"_su8, VT_RTT_0_I31}};
const BT BT_RTT_0_Exn{At{"\x6a\x00\x68"_su8, VT_RTT_0_Exn}};
const BT BT_RTT_0_0{At{"\x6a\x00\x00"_su8, VT_RTT_0_0}};
const BT BT_RTT_0_1{At{"\x6a\x00\x01"_su8, VT_RTT_0_1}};
const BT BT_RTT_0_2{At{"\x6a\x00\x02"_su8, VT_RTT_0_2}};
const BT BT_RTT_0_Func{At{"\x69\x00\x70"_su8, VT_RTT_0_Func}};
const BT BT_RTT_0_Extern{At{"\x69\x00\x6f"_su8, VT_RTT_0_Extern}};
const BT BT_RTT_0_Any{At{"\x69\x00\x6e"_su8, VT_RTT_0_Any}};
const BT BT_RTT_0_Eq{At{"\x69\x00\x6d"_su8, VT_RTT_0_Eq}};
const BT BT_RTT_0_I31{At{"\x69\x00\x6a"_su8, VT_RTT_0_I31}};
const BT BT_RTT_0_Exn{At{"\x69\x00\x68"_su8, VT_RTT_0_Exn}};
const BT BT_RTT_0_0{At{"\x69\x00\x00"_su8, VT_RTT_0_0}};
const BT BT_RTT_0_1{At{"\x69\x00\x01"_su8, VT_RTT_0_1}};
const BT BT_RTT_0_2{At{"\x69\x00\x02"_su8, VT_RTT_0_2}};

} // namespace test
} // namespace binary
Expand Down
44 changes: 22 additions & 22 deletions test/binary/read_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ TEST_F(BinaryReadTest, BlockType_gc) {

OK(Read<BlockType>, BT_Anyref, "\x6e"_su8);
OK(Read<BlockType>, BT_Eqref, "\x6d"_su8);
OK(Read<BlockType>, BT_I31ref, "\x69"_su8);
OK(Read<BlockType>, BT_I31ref, "\x6a"_su8);
OK(Read<BlockType>, BT_RefFunc, "\x6b\x70"_su8);
OK(Read<BlockType>, BT_RefNullFunc, "\x6c\x70"_su8);
OK(Read<BlockType>, BT_RefExtern, "\x6b\x6f"_su8);
Expand All @@ -181,16 +181,16 @@ TEST_F(BinaryReadTest, BlockType_gc) {
OK(Read<BlockType>, BT_RefNullAny, "\x6c\x6e"_su8);
OK(Read<BlockType>, BT_RefEq, "\x6b\x6d"_su8);
OK(Read<BlockType>, BT_RefNullEq, "\x6c\x6d"_su8);
OK(Read<BlockType>, BT_RefI31, "\x6b\x69"_su8);
OK(Read<BlockType>, BT_RefNullI31, "\x6c\x69"_su8);
OK(Read<BlockType>, BT_RefI31, "\x6b\x6a"_su8);
OK(Read<BlockType>, BT_RefNullI31, "\x6c\x6a"_su8);
OK(Read<BlockType>, BT_Ref0, "\x6b\x00"_su8);
OK(Read<BlockType>, BT_RefNull0, "\x6c\x00"_su8);
OK(Read<BlockType>, BT_RTT_0_Func, "\x6a\x00\x70"_su8);
OK(Read<BlockType>, BT_RTT_0_Extern, "\x6a\x00\x6f"_su8);
OK(Read<BlockType>, BT_RTT_0_Any, "\x6a\x00\x6e"_su8);
OK(Read<BlockType>, BT_RTT_0_Eq, "\x6a\x00\x6d"_su8);
OK(Read<BlockType>, BT_RTT_0_I31, "\x6a\x00\x69"_su8);
OK(Read<BlockType>, BT_RTT_0_0, "\x6a\x00\x00"_su8);
OK(Read<BlockType>, BT_RTT_0_Func, "\x69\x00\x70"_su8);
OK(Read<BlockType>, BT_RTT_0_Extern, "\x69\x00\x6f"_su8);
OK(Read<BlockType>, BT_RTT_0_Any, "\x69\x00\x6e"_su8);
OK(Read<BlockType>, BT_RTT_0_Eq, "\x69\x00\x6d"_su8);
OK(Read<BlockType>, BT_RTT_0_I31, "\x69\x00\x6a"_su8);
OK(Read<BlockType>, BT_RTT_0_0, "\x69\x00\x00"_su8);
}

TEST_F(BinaryReadTest, BlockType_Unknown) {
Expand Down Expand Up @@ -975,7 +975,7 @@ TEST_F(BinaryReadTest, ReferenceType_gc) {

OK(Read<ReferenceType>, RT_Anyref, "\x6e"_su8);
OK(Read<ReferenceType>, RT_Eqref, "\x6d"_su8);
OK(Read<ReferenceType>, RT_I31ref, "\x69"_su8);
OK(Read<ReferenceType>, RT_I31ref, "\x6a"_su8);
OK(Read<ReferenceType>, RT_RefFunc, "\x6b\x70"_su8);
OK(Read<ReferenceType>, RT_RefNullFunc, "\x6c\x70"_su8);
OK(Read<ReferenceType>, RT_RefExtern, "\x6b\x6f"_su8);
Expand All @@ -984,8 +984,8 @@ TEST_F(BinaryReadTest, ReferenceType_gc) {
OK(Read<ReferenceType>, RT_RefNullAny, "\x6c\x6e"_su8);
OK(Read<ReferenceType>, RT_RefEq, "\x6b\x6d"_su8);
OK(Read<ReferenceType>, RT_RefNullEq, "\x6c\x6d"_su8);
OK(Read<ReferenceType>, RT_RefI31, "\x6b\x69"_su8);
OK(Read<ReferenceType>, RT_RefNullI31, "\x6c\x69"_su8);
OK(Read<ReferenceType>, RT_RefI31, "\x6b\x6a"_su8);
OK(Read<ReferenceType>, RT_RefNullI31, "\x6c\x6a"_su8);
OK(Read<ReferenceType>, RT_Ref0, "\x6b\x00"_su8);
OK(Read<ReferenceType>, RT_RefNull0, "\x6c\x00"_su8);
}
Expand Down Expand Up @@ -1268,7 +1268,7 @@ TEST_F(BinaryReadTest, HeapType_gc) {

OK(Read<HeapType>, HT_Any, "\x6e"_su8);
OK(Read<HeapType>, HT_Eq, "\x6d"_su8);
OK(Read<HeapType>, HT_I31, "\x69"_su8);
OK(Read<HeapType>, HT_I31, "\x6a"_su8);
}

TEST_F(BinaryReadTest, HeapType2Immediate) {
Expand Down Expand Up @@ -3740,7 +3740,7 @@ TEST_F(BinaryReadTest, ValueType_gc) {

OK(Read<ValueType>, VT_Anyref, "\x6e"_su8);
OK(Read<ValueType>, VT_Eqref, "\x6d"_su8);
OK(Read<ValueType>, VT_I31ref, "\x69"_su8);
OK(Read<ValueType>, VT_I31ref, "\x6a"_su8);
OK(Read<ValueType>, VT_RefFunc, "\x6b\x70"_su8);
OK(Read<ValueType>, VT_RefNullFunc, "\x6c\x70"_su8);
OK(Read<ValueType>, VT_RefExtern, "\x6b\x6f"_su8);
Expand All @@ -3749,16 +3749,16 @@ TEST_F(BinaryReadTest, ValueType_gc) {
OK(Read<ValueType>, VT_RefNullAny, "\x6c\x6e"_su8);
OK(Read<ValueType>, VT_RefEq, "\x6b\x6d"_su8);
OK(Read<ValueType>, VT_RefNullEq, "\x6c\x6d"_su8);
OK(Read<ValueType>, VT_RefI31, "\x6b\x69"_su8);
OK(Read<ValueType>, VT_RefNullI31, "\x6c\x69"_su8);
OK(Read<ValueType>, VT_RefI31, "\x6b\x6a"_su8);
OK(Read<ValueType>, VT_RefNullI31, "\x6c\x6a"_su8);
OK(Read<ValueType>, VT_Ref0, "\x6b\x00"_su8);
OK(Read<ValueType>, VT_RefNull0, "\x6c\x00"_su8);
OK(Read<ValueType>, VT_RTT_0_Func, "\x6a\x00\x70"_su8);
OK(Read<ValueType>, VT_RTT_0_Extern, "\x6a\x00\x6f"_su8);
OK(Read<ValueType>, VT_RTT_0_Any, "\x6a\x00\x6e"_su8);
OK(Read<ValueType>, VT_RTT_0_Eq, "\x6a\x00\x6d"_su8);
OK(Read<ValueType>, VT_RTT_0_I31, "\x6a\x00\x69"_su8);
OK(Read<ValueType>, VT_RTT_0_0, "\x6a\x00\x00"_su8);
OK(Read<ValueType>, VT_RTT_0_Func, "\x69\x00\x70"_su8);
OK(Read<ValueType>, VT_RTT_0_Extern, "\x69\x00\x6f"_su8);
OK(Read<ValueType>, VT_RTT_0_Any, "\x69\x00\x6e"_su8);
OK(Read<ValueType>, VT_RTT_0_Eq, "\x69\x00\x6d"_su8);
OK(Read<ValueType>, VT_RTT_0_I31, "\x69\x00\x6a"_su8);
OK(Read<ValueType>, VT_RTT_0_0, "\x69\x00\x00"_su8);
}

TEST_F(BinaryReadTest, ValueType_Unknown) {
Expand Down
44 changes: 22 additions & 22 deletions test/binary/write_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,19 @@ TEST(BinaryWriteTest, BlockType_function_references) {
TEST(BinaryWriteTest, BlockType_function_gc) {
ExpectWrite("\x6e"_su8, BT_Anyref);
ExpectWrite("\x6d"_su8, BT_Eqref);
ExpectWrite("\x69"_su8, BT_I31ref);
ExpectWrite("\x6a"_su8, BT_I31ref);
ExpectWrite("\x6b\x6e"_su8, BT_RefAny);
ExpectWrite("\x6c\x6e"_su8, BT_RefNullAny);
ExpectWrite("\x6b\x6d"_su8, BT_RefEq);
ExpectWrite("\x6c\x6d"_su8, BT_RefNullEq);
ExpectWrite("\x6b\x69"_su8, BT_RefI31);
ExpectWrite("\x6c\x69"_su8, BT_RefNullI31);
ExpectWrite("\x6a\x00\x70"_su8, BT_RTT_0_Func);
ExpectWrite("\x6a\x00\x6f"_su8, BT_RTT_0_Extern);
ExpectWrite("\x6a\x00\x6e"_su8, BT_RTT_0_Any);
ExpectWrite("\x6a\x00\x6d"_su8, BT_RTT_0_Eq);
ExpectWrite("\x6a\x00\x69"_su8, BT_RTT_0_I31);
ExpectWrite("\x6a\x00\x00"_su8, BT_RTT_0_0);
ExpectWrite("\x6b\x6a"_su8, BT_RefI31);
ExpectWrite("\x6c\x6a"_su8, BT_RefNullI31);
ExpectWrite("\x69\x00\x70"_su8, BT_RTT_0_Func);
ExpectWrite("\x69\x00\x6f"_su8, BT_RTT_0_Extern);
ExpectWrite("\x69\x00\x6e"_su8, BT_RTT_0_Any);
ExpectWrite("\x69\x00\x6d"_su8, BT_RTT_0_Eq);
ExpectWrite("\x69\x00\x6a"_su8, BT_RTT_0_I31);
ExpectWrite("\x69\x00\x00"_su8, BT_RTT_0_0);
}

TEST(BinaryWriteTest, BrOnCastImmediate) {
Expand Down Expand Up @@ -276,13 +276,13 @@ TEST(BinaryWriteTest, ReferenceType_function_references) {
TEST(BinaryWriteTest, ReferenceType_gc) {
ExpectWrite("\x6e"_su8, RT_Anyref);
ExpectWrite("\x6d"_su8, RT_Eqref);
ExpectWrite("\x69"_su8, RT_I31ref);
ExpectWrite("\x6a"_su8, RT_I31ref);
ExpectWrite("\x6b\x6e"_su8, RT_RefAny);
ExpectWrite("\x6c\x6e"_su8, RT_RefNullAny);
ExpectWrite("\x6b\x6d"_su8, RT_RefEq);
ExpectWrite("\x6c\x6d"_su8, RT_RefNullEq);
ExpectWrite("\x6b\x69"_su8, RT_RefI31);
ExpectWrite("\x6c\x69"_su8, RT_RefNullI31);
ExpectWrite("\x6b\x6a"_su8, RT_RefI31);
ExpectWrite("\x6c\x6a"_su8, RT_RefNullI31);
}

TEST(BinaryWriteTest, Event) {
Expand Down Expand Up @@ -481,7 +481,7 @@ TEST(BinaryWriteTest, HeapType_function_references) {
TEST(BinaryWriteTest, HeapType_gc) {
ExpectWrite("\x6e"_su8, HT_Any);
ExpectWrite("\x6d"_su8, HT_Eq);
ExpectWrite("\x69"_su8, HT_I31);
ExpectWrite("\x6a"_su8, HT_I31);
}

TEST(BinaryWriteTest, HeapType2Immediate) {
Expand Down Expand Up @@ -2015,19 +2015,19 @@ TEST(BinaryWriteTest, ValueType_function_references) {
TEST(BinaryWriteTest, ValueType_gc) {
ExpectWrite("\x6e"_su8, VT_Anyref);
ExpectWrite("\x6d"_su8, VT_Eqref);
ExpectWrite("\x69"_su8, VT_I31ref);
ExpectWrite("\x6a"_su8, VT_I31ref);
ExpectWrite("\x6b\x6e"_su8, VT_RefAny);
ExpectWrite("\x6c\x6e"_su8, VT_RefNullAny);
ExpectWrite("\x6b\x6d"_su8, VT_RefEq);
ExpectWrite("\x6c\x6d"_su8, VT_RefNullEq);
ExpectWrite("\x6b\x69"_su8, VT_RefI31);
ExpectWrite("\x6c\x69"_su8, VT_RefNullI31);
ExpectWrite("\x6a\x00\x70"_su8, VT_RTT_0_Func);
ExpectWrite("\x6a\x00\x6f"_su8, VT_RTT_0_Extern);
ExpectWrite("\x6a\x00\x6e"_su8, VT_RTT_0_Any);
ExpectWrite("\x6a\x00\x6d"_su8, VT_RTT_0_Eq);
ExpectWrite("\x6a\x00\x69"_su8, VT_RTT_0_I31);
ExpectWrite("\x6a\x00\x00"_su8, VT_RTT_0_0);
ExpectWrite("\x6b\x6a"_su8, VT_RefI31);
ExpectWrite("\x6c\x6a"_su8, VT_RefNullI31);
ExpectWrite("\x69\x00\x70"_su8, VT_RTT_0_Func);
ExpectWrite("\x69\x00\x6f"_su8, VT_RTT_0_Extern);
ExpectWrite("\x69\x00\x6e"_su8, VT_RTT_0_Any);
ExpectWrite("\x69\x00\x6d"_su8, VT_RTT_0_Eq);
ExpectWrite("\x69\x00\x6a"_su8, VT_RTT_0_I31);
ExpectWrite("\x69\x00\x00"_su8, VT_RTT_0_0);
}

TEST(BinaryWriteTest, WriteVector_u8) {
Expand Down