summaryrefslogtreecommitdiff
path: root/src/wasm
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm')
-rw-r--r--src/wasm/wasm-type.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/wasm/wasm-type.cpp b/src/wasm/wasm-type.cpp
index fc42fe230..af382da23 100644
--- a/src/wasm/wasm-type.cpp
+++ b/src/wasm/wasm-type.cpp
@@ -653,6 +653,11 @@ template<typename Info> struct Store {
}
bool hasCanonical(const Info& info, typename Info::type_t& canonical);
+ void clear() {
+ typeIDs.clear();
+ constructedTypes.clear();
+ }
+
private:
template<typename Ref> typename Info::type_t doInsert(Ref& infoRef) {
const Info& info = [&]() {
@@ -754,12 +759,20 @@ struct SignatureTypeCache {
std::lock_guard<std::mutex> lock(mutex);
cache.insert({type.getSignature(), type});
}
+
+ void clear() { cache.clear(); }
};
static SignatureTypeCache nominalSignatureCache;
} // anonymous namespace
+void destroyAllTypesForTestingPurposesOnly() {
+ globalTypeStore.clear();
+ globalHeapTypeStore.clear();
+ nominalSignatureCache.clear();
+}
+
Type::Type(std::initializer_list<Type> types) : Type(Tuple(types)) {}
Type::Type(const Tuple& tuple) {