From 5e57a13614c56f959faab675d6bcabbd629ec562 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 26 Jan 2021 21:09:31 +0000 Subject: [GC] RefIsNull => RefIs. (#3516) This internal refactoring prepares us for ref.is_func/data/i31, by renaming the node and adding an "op" field. For now that field must always be "Null" which means it is a ref.is_null. This adjusts the C API to match the new IR shape. The high-level JS API is unchanged. --- src/wasm/wasm-s-parser.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (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 857c0143b..b2212db18 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -51,7 +51,7 @@ int unhex(char c) { namespace wasm { static Name STRUCT("struct"), FIELD("field"), ARRAY("array"), I8("i8"), - I16("i16"), RTT("rtt"); + I16("i16"), RTT("rtt"), REF_IS_NULL("ref.is_null"); static Address getAddress(const Element* s) { return atoll(s->c_str()); } @@ -1922,8 +1922,13 @@ Expression* SExpressionWasmBuilder::makeRefNull(Element& s) { return ret; } -Expression* SExpressionWasmBuilder::makeRefIsNull(Element& s) { - auto ret = allocator.alloc(); +Expression* SExpressionWasmBuilder::makeRefIs(Element& s) { + auto ret = allocator.alloc(); + if (*s[0] == REF_IS_NULL) { + ret->op = RefIsNull; + } else { + WASM_UNREACHABLE("unimplemented ref.is_*"); + } ret->value = parseExpression(s[1]); ret->finalize(); return ret; -- cgit v1.2.3