From ffac06650507ac413d60d72aadc1e33fb1f91ccf Mon Sep 17 00:00:00 2001 From: Abbas Mashayekh Date: Wed, 24 Mar 2021 21:43:45 +0430 Subject: [RT] Support expressions in element segments (#3666) This PR adds support for `ref.null t` as a valid element segment item. The abbreviated format of `(elem ... func $f $g...)` is kept in both printing and binary emitting if all items are `ref.func`s. Public APIs aren't updated in this PR. --- src/ir/table-utils.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/ir/table-utils.cpp') diff --git a/src/ir/table-utils.cpp b/src/ir/table-utils.cpp index 639f8fbe6..80ef885f9 100644 --- a/src/ir/table-utils.cpp +++ b/src/ir/table-utils.cpp @@ -15,6 +15,7 @@ */ #include "table-utils.h" +#include "element-utils.h" #include "find_all.h" #include "module-utils.h" @@ -31,11 +32,8 @@ std::set getFunctionsNeedingElemDeclare(Module& wasm) { // Find all the names in the tables. std::unordered_set tableNames; - for (auto& segment : wasm.elementSegments) { - for (auto name : segment->data) { - tableNames.insert(name); - } - } + ElementUtils::iterAllElementFunctionNames( + &wasm, [&](Name name) { tableNames.insert(name); }); // Find all the names in ref.funcs. using Names = std::unordered_set; -- cgit v1.2.3