From 5f45ce70c02f1f51aa3558d6933cb271da0c6479 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 13 Nov 2020 17:46:40 -0800 Subject: [s-parsing] Store full function signatures (#3356) We will need this for typed function references support, as then we need to know full function signatures for all functions when we reach a ref.func, whose type is then that signature and not the generic funcref. --- src/wasm/wasm-s-parser.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 34e1eb8a6..0636836d7 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -673,7 +673,7 @@ void SExpressionWasmBuilder::preParseFunctionType(Element& s) { functionCounter++; Signature sig; parseTypeUse(s, i, sig); - functionTypes[name] = sig.results; + functionSignatures[name] = sig; } size_t SExpressionWasmBuilder::parseFunctionNames(Element& s, @@ -765,7 +765,7 @@ void SExpressionWasmBuilder::parseFunction(Element& s, bool preParseImport) { im->module = importModule; im->base = importBase; im->sig = sig; - functionTypes[name] = sig.results; + functionSignatures[name] = sig; if (wasm.getFunctionOrNull(im->name)) { throw ParseException("duplicate import", s.line, s.col); } @@ -1773,7 +1773,7 @@ Expression* SExpressionWasmBuilder::makeCall(Element& s, bool isReturn) { auto target = getFunctionName(*s[1]); auto ret = allocator.alloc(); ret->target = target; - ret->type = functionTypes[ret->target]; + ret->type = functionSignatures[ret->target].results; parseCallOperands(s, 2, s.size(), ret); ret->isReturn = isReturn; ret->finalize(); @@ -2444,7 +2444,7 @@ void SExpressionWasmBuilder::parseImport(Element& s) { func->setName(name, hasExplicitName); func->module = module; func->base = base; - functionTypes[name] = func->sig.results; + functionSignatures[name] = func->sig; wasm.addFunction(func.release()); } else if (kind == ExternalKind::Global) { Type type; -- cgit v1.2.3