From cbe637f6c1517c9fb501453ba3774e73f12489d8 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 17 Apr 2023 09:24:26 -0700 Subject: [Wasm GC] Fix SignatureRefining on a call_ref to a bottom type (#5670) Before this PR we hit the assert on the type not being basic. We could also look into fixing the caller to skip bottom types, but as bottom types trivially have no subtypes, it is more future-facing to simply handle it. --- src/ir/subtypes.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ir/subtypes.h b/src/ir/subtypes.h index 420bdcc1d..2a629a05d 100644 --- a/src/ir/subtypes.h +++ b/src/ir/subtypes.h @@ -37,14 +37,21 @@ struct SubTypes { SubTypes(Module& wasm) : SubTypes(ModuleUtils::collectHeapTypes(wasm)) {} const std::vector& getStrictSubTypes(HeapType type) const { + // When we return an empty result, use a canonical constant empty vec to + // avoid allocation. + static const std::vector empty; + + if (type.isBottom()) { + // Bottom types have no subtypes. + return empty; + } + assert(!type.isBasic()); if (auto iter = typeSubTypes.find(type); iter != typeSubTypes.end()) { return iter->second; } - // No entry exists. Return a canonical constant empty vec, to avoid - // allocation. - static const std::vector empty; + // No entry exists. return empty; } -- cgit v1.2.3