diff options
author | Heejin Ahn <aheejin@gmail.com> | 2023-12-11 22:26:18 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-11 22:26:18 -0800 |
commit | 0b70948126deb2af3447f70752098d6f7fcfd2ed (patch) | |
tree | 0ced65ddb45b7ddcc28df851ce63dc736f2d8055 /src | |
parent | ee113c7e4cdff655c395598ee9f61512c3a5b3eb (diff) | |
download | binaryen-0b70948126deb2af3447f70752098d6f7fcfd2ed.tar.gz binaryen-0b70948126deb2af3447f70752098d6f7fcfd2ed.tar.bz2 binaryen-0b70948126deb2af3447f70752098d6f7fcfd2ed.zip |
[EH] Use random value for exnref encoding when legacy GC is used (#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.
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm-binary.h | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h index 58d641dc9..9e68ca330 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -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 @@ -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 |