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/function-utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ir/function-utils.h') diff --git a/src/ir/function-utils.h b/src/ir/function-utils.h index f172240e2..b1654d965 100644 --- a/src/ir/function-utils.h +++ b/src/ir/function-utils.h @@ -28,13 +28,13 @@ namespace FunctionUtils { // everything but their name (which can't be the same, in the same // module!) - same params, vars, body, result, etc. inline bool equal(Function* left, Function* right) { - if (left->sig != right->sig) { + if (left->type != right->type) { return false; } if (left->getNumVars() != right->getNumVars()) { return false; } - for (Index i = left->sig.params.size(); i < left->getNumLocals(); i++) { + for (Index i = left->getParams().size(); i < left->getNumLocals(); i++) { if (left->getLocalType(i) != right->getLocalType(i)) { return false; } -- cgit v1.2.3