From 3f4d3b3eff5d8112a9da3674a5f5eea696ca3c7d Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 21 Jan 2021 22:09:47 +0000 Subject: [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. --- src/wasm/wasm-s-parser.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/wasm/wasm-s-parser.cpp') 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); } -- cgit v1.2.3