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/passes/InstrumentMemory.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/passes/InstrumentMemory.cpp') diff --git a/src/passes/InstrumentMemory.cpp b/src/passes/InstrumentMemory.cpp index 6c81f8588..38a23a658 100644 --- a/src/passes/InstrumentMemory.cpp +++ b/src/passes/InstrumentMemory.cpp @@ -158,12 +158,10 @@ private: Index id; void addImport(Module* curr, Name name, Type params, Type results) { - auto import = new Function; - import->name = name; + auto import = Builder::makeFunction(name, Signature(params, results), {}); import->module = ENV; import->base = name; - import->sig = Signature(params, results); - curr->addFunction(import); + curr->addFunction(std::move(import)); } }; -- cgit v1.2.3