Skip to content

Commit

Permalink
[EH] Use random value for exnref encoding when legacy GC is used (Web…
Browse files Browse the repository at this point in the history
…Assembly#6166)

Currently the legacy GC encoding's nullexternref encoding overlaps with
exnref's. We assume the legacy GC encoding won't be used with the exnref
for the moment and assign a random value to it to prevent the clash.
  • Loading branch information
aheejin committed Dec 12, 2023
1 parent ee113c7 commit 0b70948
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/wasm-binary.h
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,15 @@ enum EncodedType {
nullable = -0x14, // 0x6c
nonnullable = -0x15, // 0x6b
#endif
#if STANDARD_GC_ENCODINGS
// exception handling
exnref = -0x17, // 0x69
exnref = -0x17, // 0x69
#else
// Currently the legacy GC encoding's nullexternref encoding overlaps with
// exnref's. We assume the legacy GC encoding won't be used with the exnref
// for the moment and assign a random value to it to prevent the clash.
exnref = -0xfe,
#endif
nullexnref = -0xff, // TODO
// string reference types
#if STANDARD_GC_ENCODINGS
Expand Down Expand Up @@ -456,11 +463,18 @@ enum EncodedHeapType {
nofunc = -0x18, // 0x68
none = -0x1b, // 0x65
#endif
func = -0x10, // 0x70
ext = -0x11, // 0x6f
any = -0x12, // 0x6e
eq = -0x13, // 0x6d
exn = -0x17, // 0x69
func = -0x10, // 0x70
ext = -0x11, // 0x6f
any = -0x12, // 0x6e
eq = -0x13, // 0x6d
#if STANDARD_GC_ENCODINGS
exn = -0x17, // 0x69
#else
// Currently the legacy GC encoding's nullexternref encoding overlaps with
// exnref's. We assume the legacy GC encoding won't be used with the exnref
// for the moment and assign a random value to it to prevent the clash.
exn = -0xfe,
#endif
noexn = -0xff, // TODO
#if STANDARD_GC_ENCODINGS
i31 = -0x14, // 0x6c
Expand Down

0 comments on commit 0b70948

Please sign in to comment.