From eb566054dd246c15997c12bb8bb0b0c1b47ed5a5 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 24 Apr 2024 11:04:14 -0700 Subject: Fuzzer: Compare strings (#6530) --- src/tools/execution-results.h | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/tools/execution-results.h b/src/tools/execution-results.h index 40d844f19..d9fa5cd9b 100644 --- a/src/tools/execution-results.h +++ b/src/tools/execution-results.h @@ -175,17 +175,21 @@ struct ExecutionResults { } bool areEqual(Literal a, Literal b) { - if (a.type.isRef()) { - // 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. + // 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. + // + // We can, however, compare strings as they refer to simple data that has a + // consistent representation (the same reasons as why we can print them in + // printValue(), above). + // + // 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. + if (a.type.isRef() && !a.type.isString()) { return true; } if (a != b) { -- cgit v1.2.3