From cc0439224cfc2eabe8f8c28d782ab6b44a0f24f9 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 6 Apr 2021 10:08:35 -0700 Subject: Fuzzing in JS VMs: Print types when we have nothing better (#3773) This matches #3747 which makes us not log out reference values, instead we print just their types. This also prints a type for non-reference things, replacing a previous exception, which affects things like SIMD and BigInts, but those trap anyhow at the JS boundary I believe (or did that change for SIMD?). Anyhow, printing the type won't give a false "ok" when comparing wasm2js output to the interpreter, assuming the interpreter prints out a value and not just a type (which is the case). We could try to do better, but this code is on the JS side, where we don't have the type - just a string representation of it, which we'd need to parse etc. --- src/tools/js-wrapper.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/tools/js-wrapper.h') diff --git a/src/tools/js-wrapper.h b/src/tools/js-wrapper.h index 3a1a1aa4a..9568bccc0 100644 --- a/src/tools/js-wrapper.h +++ b/src/tools/js-wrapper.h @@ -60,7 +60,8 @@ static std::string generateJSWrapper(Module& wasm) { " ret += Number(x).toString();\n" " break;\n" " }\n" - " default: throw 'what?';\n" + " // For anything else, just print the type.\n" + " default: ret += type; break;\n" " }\n" " return ret;\n" "}\n" -- cgit v1.2.3