From ca27f40a2f1070a16ee7c0efc18ff35d342d8027 Mon Sep 17 00:00:00 2001 From: Thomas Lively <7121787+tlively@users.noreply.github.com> Date: Thu, 1 Jul 2021 01:56:23 +0000 Subject: Preserve Function HeapTypes (#3952) When using nominal types, func.ref of two functions with identical signatures but different HeapTypes will yield different types. To preserve these semantics, Functions need to track their HeapTypes, not just their Signatures. This PR replaces the Signature field in Function with a HeapType field and adds new utility methods to make it almost as simple to update and query the function HeapType as it was to update and query the Function Signature. --- src/ir/module-utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ir/module-utils.h') diff --git a/src/ir/module-utils.h b/src/ir/module-utils.h index 9c9f5cbfb..2cbab414b 100644 --- a/src/ir/module-utils.h +++ b/src/ir/module-utils.h @@ -33,7 +33,7 @@ namespace ModuleUtils { inline Function* copyFunction(Function* func, Module& out) { auto* ret = new Function(); ret->name = func->name; - ret->sig = func->sig; + ret->type = func->type; ret->vars = func->vars; ret->localNames = func->localNames; ret->localIndices = func->localIndices; @@ -526,7 +526,7 @@ inline void collectHeapTypes(Module& wasm, // Collect info from functions in parallel. ModuleUtils::ParallelFunctionAnalysis analysis( wasm, [&](Function* func, Counts& counts) { - counts.note(func->sig); + counts.note(func->type); for (auto type : func->vars) { counts.note(type); } -- cgit v1.2.3