File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -2731,14 +2731,23 @@ std::unordered_set<HeapType> getIgnorablePublicTypes() {
2731
2731
2732
2732
namespace wasm ::HeapTypes {
2733
2733
2734
+ // We could get laziness for free by making these local statics, but that would
2735
+ // come with unnecessary implicity synchronization overhead.
2736
+ static std::optional<HeapType> theMutI8Array;
2737
+ static std::optional<HeapType> theMutI16Array;
2738
+
2734
2739
HeapType getMutI8Array () {
2735
- static HeapType i8Array = Array (Field (Field::i8 , Mutable));
2736
- return i8Array;
2740
+ if (!theMutI8Array) {
2741
+ theMutI8Array = Array (Field (Field::i8 , Mutable));
2742
+ }
2743
+ return *theMutI8Array;
2737
2744
}
2738
2745
2739
2746
HeapType getMutI16Array () {
2740
- static HeapType i16Array = Array (Field (Field::i16 , Mutable));
2741
- return i16Array;
2747
+ if (!theMutI16Array) {
2748
+ theMutI16Array = Array (Field (Field::i16 , Mutable));
2749
+ }
2750
+ return *theMutI16Array;
2742
2751
}
2743
2752
2744
2753
} // namespace wasm::HeapTypes
You can’t perform that action at this time.
0 commit comments