From d53f195c27f83afa18d1f35cc97877341eb03be4 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 23 Oct 2020 12:57:38 -0700 Subject: 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. --- src/tools/execution-results.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') 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 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 " -- cgit v1.2.3