summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tools/fuzzing.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h
index ecc548e22..088aa3c96 100644
--- a/src/tools/fuzzing.h
+++ b/src/tools/fuzzing.h
@@ -2803,17 +2803,27 @@ private:
// removed during optimization
// - there's no point in logging externref or anyref because these are opaque
// - don't bother logging tuples
- std::vector<Type> getLoggableTypes() {
- return items(
- FeatureOptions<Type>()
- .add(FeatureSet::MVP, Type::i32, Type::i64, Type::f32, Type::f64)
- .add(FeatureSet::SIMD, Type::v128)
- .add(FeatureSet::ReferenceTypes | FeatureSet::ExceptionHandling,
- Type::exnref));
+ std::vector<Type> loggableTypes;
+
+ const std::vector<Type>& getLoggableTypes() {
+ if (loggableTypes.empty()) {
+ loggableTypes = items(
+ FeatureOptions<Type>()
+ .add(FeatureSet::MVP, Type::i32, Type::i64, Type::f32, Type::f64)
+ .add(FeatureSet::SIMD, Type::v128)
+ .add(FeatureSet::ReferenceTypes | FeatureSet::ExceptionHandling,
+ Type::exnref));
+ }
+ return loggableTypes;
}
Type getLoggableType() { return pick(getLoggableTypes()); }
+ bool isLoggableType(Type type) {
+ const auto& types = getLoggableTypes();
+ return std::find(types.begin(), types.end(), type) != types.end();
+ }
+
// statistical distributions
// 0 to the limit, logarithmic scale