diff options
author | Thomas Lively <tlively@google.com> | 2022-11-17 17:07:21 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-17 17:07:21 -0800 |
commit | 2218b63902cac62e02d9672034fc8d8415945973 (patch) | |
tree | e8d5f4d665cfc40160f32973e62b50f9ad8931ef /src | |
parent | 977d653f9801b3eedc7dd667e4068573e73d2bb5 (diff) | |
download | binaryen-2218b63902cac62e02d9672034fc8d8415945973.tar.gz binaryen-2218b63902cac62e02d9672034fc8d8415945973.tar.bz2 binaryen-2218b63902cac62e02d9672034fc8d8415945973.zip |
Do not compare reference values across executions (#5276)
Since we optimize assuming a closed world, optimizations can change the types
and structure of GC data even in externally-visible ways. Because differences
are expected, the fuzzer already did not compare reference-typed values from
before and after optimizations when running with nominal typing. Update it to
not compare these values under any type system.
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/execution-results.h | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/tools/execution-results.h b/src/tools/execution-results.h index 723ddffda..925c9b6d8 100644 --- a/src/tools/execution-results.h +++ b/src/tools/execution-results.h @@ -143,25 +143,17 @@ struct ExecutionResults { } bool areEqual(Literal a, Literal b) { - // We allow nulls to have different types (as they compare equal regardless) - // but anything else must have an identical type. - // We cannot do this in nominal typing, however, as different modules will - // have different types in general. We could perhaps compare the entire - // graph structurally TODO - if (getTypeSystem() != TypeSystem::Nominal) { - if (a.type != b.type && !(a.isNull() && b.isNull())) { - std::cout << "types not identical! " << a << " != " << b << '\n'; - return false; - } - } if (a.type.isRef()) { - // Don't compare references - only their types. There are several issues - // here that we can't fully handle, see - // https://github.com/WebAssembly/binaryen/issues/3378, but the core issue - // is that we are comparing results between two separate wasm modules (and - // a separate instance of each) - we can't really identify an identical - // reference between such things. We can only compare things structurally, - // for which we compare the types. + // Don't compare references. There are several issues here that we can't + // fully handle, see https://github.com/WebAssembly/binaryen/issues/3378, + // but the core issue is that since we optimize assuming a closed world, + // the types and structure of GC data can arbitrarily change after + // optimizations, even in ways that are externally visible from outside + // the module. + // + // TODO: Once we support optimizing under some form of open-world + // assumption, we should be able to check that the types and/or structure + // of GC data passed out of the module does not change. return true; } if (a != b) { |