diff options
-rw-r--r-- | src/tools/execution-results.h | 13 |
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 " |