summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2023-03-13 12:10:10 -0700
committerGitHub <noreply@github.com>2023-03-13 12:10:10 -0700
commit831c2f93aa49f6ef4ff7cf33a5b0c7b0757f1cef (patch)
tree77b0216a0a286928a99c802b1f27d311929c6bba /test
parentb280366c6e4f81d9483aed7c38c957257ac3396b (diff)
downloadbinaryen-831c2f93aa49f6ef4ff7cf33a5b0c7b0757f1cef.tar.gz
binaryen-831c2f93aa49f6ef4ff7cf33a5b0c7b0757f1cef.tar.bz2
binaryen-831c2f93aa49f6ef4ff7cf33a5b0c7b0757f1cef.zip
Fuzzer: Avoid emitting massive nested structs (#5564)
The nesting limit of around 20 was enough to cause exponential blowup. A 20K input file lead to a 2GB wasm in one case I saw (!) which takes many seconds to fuzz. Instead, reduce the limit, and also check if random tells us that the random input is done; when that's done we should stop, which limits us to O(input size). Also do this for non-nullable types, and handle that in globals (we cannot emit a RefAsNulNull there, so switch the global type if necessary).
Diffstat (limited to 'test')
-rw-r--r--test/passes/translate-to-fuzz_all-features_metrics_noprint.txt67
1 files changed, 33 insertions, 34 deletions
diff --git a/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt b/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt
index f3ab68180..04f0f6405 100644
--- a/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt
+++ b/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt
@@ -1,43 +1,42 @@
total
- [exports] : 7
- [funcs] : 10
+ [exports] : 5
+ [funcs] : 13
[globals] : 5
[imports] : 5
[memories] : 1
[memory-data] : 20
- [table-data] : 1
+ [table-data] : 0
[tables] : 1
[tags] : 1
- [total] : 849
- [vars] : 6
- ArrayNew : 2
- ArrayNewFixed : 5
- Binary : 97
- Block : 127
- Break : 15
- Call : 13
- CallRef : 3
- Const : 186
- DataDrop : 1
- Drop : 6
- GlobalGet : 58
- GlobalSet : 58
+ [total] : 460
+ [vars] : 23
+ ArrayNewFixed : 1
+ AtomicCmpxchg : 1
+ AtomicRMW : 1
+ Binary : 66
+ Block : 56
+ Break : 3
+ Call : 15
+ Const : 98
+ Drop : 8
+ GlobalGet : 26
+ GlobalSet : 26
I31New : 2
- If : 38
- Load : 23
- LocalGet : 38
- LocalSet : 23
- Loop : 20
- Nop : 18
- RefEq : 1
- RefFunc : 7
- RefNull : 2
- Return : 1
+ If : 16
+ Load : 17
+ LocalGet : 33
+ LocalSet : 21
+ Loop : 3
+ Nop : 9
+ RefAs : 2
+ RefFunc : 2
+ RefNull : 5
+ Return : 3
SIMDExtract : 1
- Select : 3
- Store : 8
- StructNew : 6
- TupleExtract : 3
- TupleMake : 6
- Unary : 48
- Unreachable : 30
+ Select : 1
+ Store : 1
+ StructNew : 4
+ TupleExtract : 2
+ TupleMake : 4
+ Unary : 17
+ Unreachable : 16