Skip to content

Commit b520ed6

Browse files
Move getI64Pair to wasm::Types (#8658)
Followup to #8638 (comment)
1 parent c6a5e65 commit b520ed6

3 files changed

Lines changed: 16 additions & 6 deletions

File tree

src/wasm-type.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,9 +645,15 @@ constexpr HeapType noexn = HeapType::noexn;
645645
HeapType getMutI8Array();
646646
HeapType getMutI16Array();
647647

648+
} // namespace HeapTypes
649+
650+
namespace Types {
651+
652+
// Certain Types are used by standard operations. Provide central accessors
653+
// for them to avoid having to build them everywhere they are used.
648654
Type getI64Pair();
649655

650-
} // namespace HeapTypes
656+
} // namespace Types
651657

652658
// A recursion group consisting of one or more HeapTypes. HeapTypes with single
653659
// members are encoded without using any additional memory, which is why

src/wasm/wasm-type.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2834,9 +2834,7 @@ std::unordered_set<HeapType> getIgnorablePublicTypes() {
28342834
return set;
28352835
}
28362836

2837-
} // namespace wasm
2838-
2839-
namespace wasm::HeapTypes {
2837+
namespace HeapTypes {
28402838

28412839
HeapType getMutI8Array() {
28422840
static HeapType i8Array = Array(Field(Field::i8, Mutable));
@@ -2848,12 +2846,18 @@ HeapType getMutI16Array() {
28482846
return i16Array;
28492847
}
28502848

2849+
} // namespace HeapTypes
2850+
2851+
namespace Types {
2852+
28512853
Type getI64Pair() {
28522854
static Type i64Pair({Type::i64, Type::i64});
28532855
return i64Pair;
28542856
}
28552857

2856-
} // namespace wasm::HeapTypes
2858+
} // namespace Types
2859+
2860+
} // namespace wasm
28572861

28582862
namespace std {
28592863

src/wasm/wasm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ void WideIntAddSub::finalize() {
810810
rightHigh->type == Type::unreachable) {
811811
type = Type::unreachable;
812812
} else {
813-
static Type i64Pair = HeapTypes::getI64Pair();
813+
static Type i64Pair = Types::getI64Pair();
814814
type = i64Pair;
815815
}
816816
}

0 commit comments

Comments
 (0)