summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2020-10-23 12:57:38 -0700
committerGitHub <noreply@github.com>2020-10-23 12:57:38 -0700
commitd53f195c27f83afa18d1f35cc97877341eb03be4 (patch)
tree964e1b7046176d4561e7ee0e3087f42a04089134
parentbacfd4760c2474c418000c6838a0f4c9fadb1c09 (diff)
downloadbinaryen-d53f195c27f83afa18d1f35cc97877341eb03be4.tar.gz
binaryen-d53f195c27f83afa18d1f35cc97877341eb03be4.tar.bz2
binaryen-d53f195c27f83afa18d1f35cc97877341eb03be4.zip
Handle get/setTempRet0 in fuzzer support (#3279)
This avoids it printing a warning and doing nothing for them. It also increases coverage, for checking 64-bit return values, but any such bug would have already been found already, I think (as we ignored the high bits), so likely the fuzzer is not emitting such things when running JS at least.
-rw-r--r--src/tools/execution-results.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/tools/execution-results.h b/src/tools/execution-results.h
index f57ffe101..1539806d1 100644
--- a/src/tools/execution-results.h
+++ b/src/tools/execution-results.h
@@ -29,6 +29,14 @@ typedef std::vector<Literal> Loggings;
struct LoggingExternalInterface : public ShellExternalInterface {
Loggings& loggings;
+ struct State {
+ // Legalization for JS emits get/setTempRet0 calls ("temp ret 0" means a
+ // temporary return value of 32 bits; "0" is the only important value for
+ // 64-bit legalization, which needs one such 32-bit chunk in addition to
+ // the normal return value which can handle 32 bits).
+ uint32_t tempRet0 = 0;
+ } state;
+
LoggingExternalInterface(Loggings& loggings) : loggings(loggings) {}
Literals callImport(Function* import, LiteralList& arguments) override {
@@ -49,6 +57,11 @@ struct LoggingExternalInterface : public ShellExternalInterface {
}
std::cout << "]\n";
return {};
+ } else if (import->base == "setTempRet0") {
+ state.tempRet0 = arguments[0].geti32();
+ return {};
+ } else if (import->base == "getTempRet0") {
+ return {Literal(state.tempRet0)};
}
}
std::cerr << "[LoggingExternalInterface ignoring an unknown import "