Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/wasm-type.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions src/wasm/wasm-type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2834,9 +2834,7 @@ std::unordered_set<HeapType> getIgnorablePublicTypes() {
return set;
}

} // namespace wasm

namespace wasm::HeapTypes {
namespace HeapTypes {

HeapType getMutI8Array() {
static HeapType i8Array = Array(Field(Field::i8, Mutable));
Expand All @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion src/wasm/wasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
Loading