diff options
author | Alon Zakai <azakai@google.com> | 2021-01-21 22:09:47 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-21 14:09:47 -0800 |
commit | 3f4d3b3eff5d8112a9da3674a5f5eea696ca3c7d (patch) | |
tree | 30d3ddedf6ae2de10f56d6acea64f2b17640041b /src/wasm/wasm-s-parser.cpp | |
parent | 527e9f9ed76cee0baaa67e89569c282a3782be08 (diff) | |
download | binaryen-3f4d3b3eff5d8112a9da3674a5f5eea696ca3c7d.tar.gz binaryen-3f4d3b3eff5d8112a9da3674a5f5eea696ca3c7d.tar.bz2 binaryen-3f4d3b3eff5d8112a9da3674a5f5eea696ca3c7d.zip |
[GC] Add dataref type (#3500)
This is not 100% of everything, but is enough to get tests passing, which
includes full binary and text format support, getting all switches to compile
without error, and some additions to InstrumentLocals.
Diffstat (limited to 'src/wasm/wasm-s-parser.cpp')
-rw-r--r-- | src/wasm/wasm-s-parser.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp index 84576fde7..0356db235 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -867,6 +867,10 @@ Type SExpressionWasmBuilder::stringToType(const char* str, if (strncmp(str, "eqref", 5) == 0 && (prefix || str[5] == 0)) { return Type::eqref; } + if (strncmp(str, "dataref", 7) == 0 && (prefix || str[7] == 0)) { + // FIXME: for now, force all inputs to be nullable + return Type(HeapType::BasicHeapType::data, Nullable); + } if (strncmp(str, "i31ref", 6) == 0 && (prefix || str[6] == 0)) { // FIXME: for now, force all inputs to be nullable return Type(HeapType::BasicHeapType::i31, Nullable); @@ -909,6 +913,12 @@ HeapType SExpressionWasmBuilder::stringToHeapType(const char* str, return HeapType::func; } } + if (str[0] == 'd') { + if (str[1] == 'a' && str[2] == 't' && str[3] == 'a' && + (prefix || str[4] == 0)) { + return HeapType::data; + } + } throw ParseException(std::string("invalid wasm heap type: ") + str); } |