summaryrefslogtreecommitdiff
path: root/src/tools/fuzzing.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2018-02-28 13:37:59 -0800
committerGitHub <noreply@github.com>2018-02-28 13:37:59 -0800
commiteb8c45786d7b553d94669369b14a388a2a0f7373 (patch)
tree8f934a295c13f87929b109bfff265bdb04929004 /src/tools/fuzzing.h
parent01098f1288d37058b5fbac50468a1b07408d6dec (diff)
downloadbinaryen-eb8c45786d7b553d94669369b14a388a2a0f7373.tar.gz
binaryen-eb8c45786d7b553d94669369b14a388a2a0f7373.tar.bz2
binaryen-eb8c45786d7b553d94669369b14a388a2a0f7373.zip
Fuzz parameter improvements: more params&vars (#1451)
Diffstat (limited to 'src/tools/fuzzing.h')
-rw-r--r--src/tools/fuzzing.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h
index a4c4e054b..88785beb4 100644
--- a/src/tools/fuzzing.h
+++ b/src/tools/fuzzing.h
@@ -145,6 +145,12 @@ private:
size_t pos; // the position in the input
bool finishedInput; // whether we already cycled through all the input (if so, we should try to finish things off)
+ // The maximum amount of params to each function.
+ static const int MAX_PARAMS = 10;
+
+ // The maximum amount of vars in each function.
+ static const int MAX_VARS = 20;
+
// some things require luck, try them a few times
static const int TRIES = 10;
@@ -359,13 +365,13 @@ private:
func->name = std::string("func_") + std::to_string(num);
func->result = getReachableType();
assert(typeLocals.empty());
- Index numParams = upToSquared(5);
+ Index numParams = upToSquared(MAX_PARAMS);
for (Index i = 0; i < numParams; i++) {
auto type = getConcreteType();
typeLocals[type].push_back(func->params.size());
func->params.push_back(type);
}
- Index numVars = upToSquared(10);
+ Index numVars = upToSquared(MAX_VARS);
for (Index i = 0; i < numVars; i++) {
auto type = getConcreteType();
typeLocals[type].push_back(func->params.size() + func->vars.size());