Commit 3694eba7 authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

[wasm][fuzzer] More output for failed instantiation

The fuzzers sometimes fail to instantiate a module that we already
instantiated before. This is nondetermistic and hard to reproduce (maybe
an out-of-memory situation).
Make the fuzzers print the error message so we learn more about those
failures.

R=ahaas@chromium.org

Bug: chromium:1330572
Change-Id: I0db103bdb113b1c1cedf662e02fb7a7f9d34ebd7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3680298
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80893}
parent 0df222ac
...@@ -153,21 +153,31 @@ void InterpretAndExecuteModule(i::Isolate* isolate, ...@@ -153,21 +153,31 @@ void InterpretAndExecuteModule(i::Isolate* isolate,
// Reset the instance before the test run. // Reset the instance before the test run.
{ {
ErrorThrower thrower(isolate, "Second Instantiation"); ErrorThrower thrower(isolate, "Second Instantiation");
// We instantiated before, so the second instantiation must also succeed: // We instantiated before, so the second instantiation must also succeed.
CHECK(GetWasmEngine() if (!GetWasmEngine()
->SyncInstantiate(isolate, &thrower, module_object, {}, ->SyncInstantiate(isolate, &thrower, module_object, {},
{}) // no imports & memory {}) // no imports & memory
.ToHandle(&instance)); .ToHandle(&instance)) {
DCHECK(thrower.error());
FATAL("Second instantiation failed unexpectedly: %s",
thrower.error_msg());
}
DCHECK(!thrower.error());
} }
} else { } else {
Handle<WasmInstanceObject> instance_ref; Handle<WasmInstanceObject> instance_ref;
{ {
ErrorThrower thrower(isolate, "WebAssembly Instantiation"); ErrorThrower thrower(isolate, "WebAssembly Instantiation");
// We instantiated before, so the second instantiation must also succeed: // We instantiated before, so the second instantiation must also succeed.
CHECK(GetWasmEngine() if (!GetWasmEngine()
->SyncInstantiate(isolate, &thrower, module_ref, {}, ->SyncInstantiate(isolate, &thrower, module_ref, {},
{}) // no imports & memory {}) // no imports & memory
.ToHandle(&instance_ref)); .ToHandle(&instance_ref)) {
DCHECK(thrower.error());
FATAL("Second instantiation failed unexpectedly: %s",
thrower.error_msg());
}
DCHECK(!thrower.error());
} }
result_ref = testing::CallWasmFunctionForTesting( result_ref = testing::CallWasmFunctionForTesting(
isolate, instance_ref, "main", static_cast<int>(compiled_args.size()), isolate, instance_ref, "main", static_cast<int>(compiled_args.size()),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment