From 7e7dd338b9ae6026f54f3384bebe095fefb9fab5 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 28 Oct 2022 12:15:16 -0700 Subject: [Wasm GC] Fix the depth of the new array heap type (#5186) --- src/ir/subtypes.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ir/subtypes.h b/src/ir/subtypes.h index 0d8fccdbc..198a69b7a 100644 --- a/src/ir/subtypes.h +++ b/src/ir/subtypes.h @@ -113,12 +113,22 @@ struct SubTypes { } // Add the max depths of basic types. - // TODO: update when we get structtype and arraytype + // TODO: update when we get structtype for (auto type : types) { - HeapType basic = type.isData() ? HeapType::data : HeapType::func; + HeapType basic; + if (type.isStruct()) { + basic = HeapType::data; + } else if (type.isArray()) { + basic = HeapType::array; + } else { + assert(type.isSignature()); + basic = HeapType::func; + } depths[basic] = std::max(depths[basic], depths[type] + 1); } + depths[HeapType::data] = + std::max(depths[HeapType::data], depths[HeapType::array] + 1); depths[HeapType::eq] = std::max(Index(1), depths[HeapType::data] + 1); depths[HeapType::any] = depths[HeapType::eq] + 1; -- cgit v1.2.3