diff options
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/execution-results.h | 2 | ||||
-rw-r--r-- | src/tools/fuzzing.h | 28 | ||||
-rw-r--r-- | src/tools/js-wrapper.h | 2 | ||||
-rw-r--r-- | src/tools/wasm-reduce.cpp | 10 |
4 files changed, 21 insertions, 21 deletions
diff --git a/src/tools/execution-results.h b/src/tools/execution-results.h index 13771a69d..9ef3d2e1e 100644 --- a/src/tools/execution-results.h +++ b/src/tools/execution-results.h @@ -71,7 +71,7 @@ struct ExecutionResults { // this has a result results[exp->name] = run(func, wasm, instance); // ignore the result if we hit an unreachable and returned no value - if (isConcreteType(results[exp->name].type)) { + if (results[exp->name].type.isConcrete()) { std::cout << "[fuzz-exec] note result: " << exp->name << " => " << results[exp->name] << '\n'; } diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h index 0e5184826..fe4a3955a 100644 --- a/src/tools/fuzzing.h +++ b/src/tools/fuzzing.h @@ -457,7 +457,7 @@ private: void addImportLoggingSupport() { for (auto type : getConcreteTypes()) { auto* func = new Function; - Name name = std::string("log-") + printType(type); + Name name = std::string("log-") + type.toString(); func->name = name; func->module = "fuzzing-support"; func->base = name; @@ -790,7 +790,7 @@ private: args.push_back(makeConst(type)); } Expression* invoke = builder.makeCall(func->name, args, func->result); - if (isConcreteType(func->result)) { + if (func->result.isConcrete()) { invoke = builder.makeDrop(invoke); } invocations.push_back(invoke); @@ -827,7 +827,7 @@ private: // when we should stop, emit something small (but not necessarily trivial) if (finishedInput || nesting >= 5 * NESTING_LIMIT || // hard limit (nesting >= NESTING_LIMIT && !oneIn(3))) { - if (isConcreteType(type)) { + if (type.isConcrete()) { if (oneIn(2)) { return makeConst(type); } else { @@ -996,7 +996,7 @@ private: // make something with no chance of infinite recursion Expression* makeTrivial(Type type) { - if (isConcreteType(type)) { + if (type.isConcrete()) { if (oneIn(2)) { return makeLocalGet(type); } else { @@ -1007,7 +1007,7 @@ private: } assert(type == unreachable); Expression* ret = nullptr; - if (isConcreteType(func->result)) { + if (func->result.isConcrete()) { ret = makeTrivial(func->result); } return builder.makeReturn(ret); @@ -1039,13 +1039,13 @@ private: } // give a chance to make the final element an unreachable break, instead // of concrete - a common pattern (branch to the top of a loop etc.) - if (!finishedInput && isConcreteType(type) && oneIn(2)) { + if (!finishedInput && type.isConcrete() && oneIn(2)) { ret->list.push_back(makeBreak(unreachable)); } else { ret->list.push_back(make(type)); } breakableStack.pop_back(); - if (isConcreteType(type)) { + if (type.isConcrete()) { ret->finalize(type); } else { ret->finalize(); @@ -1131,7 +1131,7 @@ private: auto* target = pick(breakableStack); auto name = getTargetName(target); auto valueType = getTargetType(target); - if (isConcreteType(type)) { + if (type.isConcrete()) { // we are flowing out a value if (valueType != type) { // we need to break to a proper place @@ -1485,7 +1485,7 @@ private: Expression* makeStore(Type type) { // exnref type cannot be stored in memory - if (!allowMemory || isReferenceType(type)) { + if (!allowMemory || type.isRef()) { return makeTrivial(type); } auto* ret = makeNonAtomicStore(type); @@ -1982,7 +1982,7 @@ private: return makeTrivial(type); } // There's no binary ops for exnref - if (isReferenceType(type)) { + if (type.isRef()) { makeTrivial(type); } @@ -2238,7 +2238,7 @@ private: auto default_ = names.back(); names.pop_back(); auto temp1 = make(i32), - temp2 = isConcreteType(valueType) ? make(valueType) : nullptr; + temp2 = valueType.isConcrete() ? make(valueType) : nullptr; return builder.makeSwitch(names, default_, temp1, temp2); } @@ -2248,8 +2248,8 @@ private: } Expression* makeReturn(Type type) { - return builder.makeReturn(isConcreteType(func->result) ? make(func->result) - : nullptr); + return builder.makeReturn(func->result.isConcrete() ? make(func->result) + : nullptr); } Expression* makeNop(Type type) { @@ -2607,7 +2607,7 @@ private: Expression* makeLogging() { auto type = getConcreteType(); return builder.makeCall( - std::string("log-") + printType(type), {make(type)}, none); + std::string("log-") + type.toString(), {make(type)}, none); } Expression* makeMemoryHashLogging() { diff --git a/src/tools/js-wrapper.h b/src/tools/js-wrapper.h index 32b46affa..34a823e97 100644 --- a/src/tools/js-wrapper.h +++ b/src/tools/js-wrapper.h @@ -113,7 +113,7 @@ static std::string generateJSWrapper(Module& wasm) { } ret += ")"; if (func->result != none) { - ret += ", '" + std::string(printType(func->result)) + "'))"; + ret += ", '" + func->result.toString() + "'))"; // TODO: getTempRet } ret += ";\n"; diff --git a/src/tools/wasm-reduce.cpp b/src/tools/wasm-reduce.cpp index ba9f10264..f1fbebc24 100644 --- a/src/tools/wasm-reduce.cpp +++ b/src/tools/wasm-reduce.cpp @@ -466,7 +466,7 @@ struct Reducer if (tryToReduceCurrentToNop()) { return; } - } else if (isConcreteType(curr->type)) { + } else if (curr->type.isConcrete()) { if (tryToReduceCurrentToConst()) { return; } @@ -556,7 +556,7 @@ struct Reducer } // Finally, try to replace with a child. for (auto* child : ChildIterator(curr)) { - if (isConcreteType(child->type) && curr->type == none) { + if (child->type.isConcrete() && curr->type == none) { if (tryToReplaceCurrent(builder->makeDrop(child))) { return; } @@ -567,13 +567,13 @@ struct Reducer } } // If that didn't work, try to replace with a child + a unary conversion - if (isConcreteType(curr->type) && + if (curr->type.isConcrete() && !curr->is<Unary>()) { // but not if it's already unary for (auto* child : ChildIterator(curr)) { if (child->type == curr->type) { continue; // already tried } - if (!isConcreteType(child->type)) { + if (!child->type.isConcrete()) { continue; // no conversion } Expression* fixed = nullptr; @@ -870,7 +870,7 @@ struct Reducer auto funcResult = func->result; auto* funcBody = func->body; for (auto* child : ChildIterator(func->body)) { - if (!(isConcreteType(child->type) || child->type == none)) { + if (!(child->type.isConcrete() || child->type == none)) { continue; // not something a function can return } // Try to replace the body with the child, fixing up the function |