From 7f39a85708d7e8dc9ac108cea781aadfb6ee1114 Mon Sep 17 00:00:00 2001 From: stevenfontanella Date: Wed, 29 Apr 2026 16:50:36 +0000 Subject: [PATCH] Move getI64Pair to wasm::Types --- src/wasm-type.h | 8 +++++++- src/wasm/wasm-type.cpp | 12 ++++++++---- src/wasm/wasm.cpp | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/wasm-type.h b/src/wasm-type.h index 767c005faaa..97ccd98108e 100644 --- a/src/wasm-type.h +++ b/src/wasm-type.h @@ -645,9 +645,15 @@ constexpr HeapType noexn = HeapType::noexn; HeapType getMutI8Array(); HeapType getMutI16Array(); +} // namespace HeapTypes + +namespace Types { + +// Certain Types are used by standard operations. Provide central accessors +// for them to avoid having to build them everywhere they are used. Type getI64Pair(); -} // namespace HeapTypes +} // namespace Types // A recursion group consisting of one or more HeapTypes. HeapTypes with single // members are encoded without using any additional memory, which is why diff --git a/src/wasm/wasm-type.cpp b/src/wasm/wasm-type.cpp index a842068fa5f..685aace64b4 100644 --- a/src/wasm/wasm-type.cpp +++ b/src/wasm/wasm-type.cpp @@ -2834,9 +2834,7 @@ std::unordered_set getIgnorablePublicTypes() { return set; } -} // namespace wasm - -namespace wasm::HeapTypes { +namespace HeapTypes { HeapType getMutI8Array() { static HeapType i8Array = Array(Field(Field::i8, Mutable)); @@ -2848,12 +2846,18 @@ HeapType getMutI16Array() { return i16Array; } +} // namespace HeapTypes + +namespace Types { + Type getI64Pair() { static Type i64Pair({Type::i64, Type::i64}); return i64Pair; } -} // namespace wasm::HeapTypes +} // namespace Types + +} // namespace wasm namespace std { diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index 4ff165b8e8c..c2feec54bf3 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -810,7 +810,7 @@ void WideIntAddSub::finalize() { rightHigh->type == Type::unreachable) { type = Type::unreachable; } else { - static Type i64Pair = HeapTypes::getI64Pair(); + static Type i64Pair = Types::getI64Pair(); type = i64Pair; } }