diff options
author | Alon Zakai <azakai@google.com> | 2022-06-29 09:34:26 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-29 09:34:26 -0700 |
commit | 7f75427f7671562874a22981c9dcc4a8e223f48b (patch) | |
tree | bd3237d5b43197127e7a17c63fec3b9f5102b5f9 /src/wasm-binary.h | |
parent | 9dbe45780d8c78dbb49c208fe4505cd1624a98ac (diff) | |
download | binaryen-7f75427f7671562874a22981c9dcc4a8e223f48b.tar.gz binaryen-7f75427f7671562874a22981c9dcc4a8e223f48b.tar.bz2 binaryen-7f75427f7671562874a22981c9dcc4a8e223f48b.zip |
[Strings] Add string proposal types (#4755)
This starts to implement the Wasm Strings proposal
https://github.com/WebAssembly/stringref/blob/main/proposals/stringref/Overview.md
This just adds the types.
Diffstat (limited to 'src/wasm-binary.h')
-rw-r--r-- | src/wasm-binary.h | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h index 659e0f58b..3b3fa30f6 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -375,8 +375,13 @@ enum EncodedType { // run-time type info type, with depth index n rtt_n = -0x17, // 0x69 // run-time type info type, without depth index n - rtt = -0x18, // 0x68 - dataref = -0x19, // 0x67 + rtt = -0x18, // 0x68 + // gc and string reference types + dataref = -0x19, // 0x67 + stringref = -0x1c, // 0x64 + stringview_wtf8 = -0x1d, // 0x63 + stringview_wtf16 = -0x1e, // 0x62 + stringview_iter = -0x1f, // 0x61 // type forms Func = -0x20, // 0x60 Struct = -0x21, // 0x5f @@ -393,11 +398,18 @@ enum EncodedType { }; enum EncodedHeapType { - func = -0x10, // 0x70 - any = -0x11, // 0x6f - eq = -0x13, // 0x6d - i31 = -0x16, // 0x6a - data = -0x19, // 0x67 + func = -0x10, // 0x70 + any = -0x11, // 0x6f + eq = -0x13, // 0x6d + i31 = -0x16, // 0x6a + data = -0x19, // 0x67 + string = -0x1c, // 0x64 + // stringview/iter constants are identical to type, and cannot be duplicated + // here as that would be a compiler error, so add _heap suffixes. See + // https://github.com/WebAssembly/stringref/issues/12 + stringview_wtf8_heap = -0x1d, // 0x63 + stringview_wtf16_heap = -0x1e, // 0x62 + stringview_iter_heap = -0x1f, // 0x61 }; namespace UserSections { |