diff options
author | Alon Zakai <azakai@google.com> | 2022-10-28 12:15:16 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-28 19:15:16 +0000 |
commit | 7e7dd338b9ae6026f54f3384bebe095fefb9fab5 (patch) | |
tree | f388c8d088e1c52ab6e629a88a7109959a26e4ed /src | |
parent | 1762c33df1d1fcd704cf4d7497ba5788ee93a07d (diff) | |
download | binaryen-7e7dd338b9ae6026f54f3384bebe095fefb9fab5.tar.gz binaryen-7e7dd338b9ae6026f54f3384bebe095fefb9fab5.tar.bz2 binaryen-7e7dd338b9ae6026f54f3384bebe095fefb9fab5.zip |
[Wasm GC] Fix the depth of the new array heap type (#5186)
Diffstat (limited to 'src')
-rw-r--r-- | src/ir/subtypes.h | 14 |
1 files changed, 12 insertions, 2 deletions
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; |