From d19c31b371aab47dedd166c2d056f1c583c6a9a0 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Mon, 30 Jan 2023 12:04:30 -0600 Subject: [NFC] Improve debug printing for type canonicalization (#5465) Use an `IndexedTypeNameGenerator` to give types stable names for the entire `dump` method rather than generating fresh type names every time a single type is printed. This makes it possible to understand the relationships between the types in the debug output. --- src/wasm/wasm-type.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/wasm/wasm-type.cpp b/src/wasm/wasm-type.cpp index e5493c8d1..2c26f0e21 100644 --- a/src/wasm/wasm-type.cpp +++ b/src/wasm/wasm-type.cpp @@ -2490,13 +2490,14 @@ struct CanonicalizationState { #if TRACE_CANONICALIZATION void dump() { + IndexedTypeNameGenerator print(results); std::cerr << "Results:\n"; for (size_t i = 0; i < results.size(); ++i) { - std::cerr << i << ": " << results[i] << "\n"; + std::cerr << i << ": " << print(results[i]) << "\n"; } std::cerr << "NewInfos:\n"; for (size_t i = 0; i < newInfos.size(); ++i) { - std::cerr << asHeapType(newInfos[i]) << "\n"; + std::cerr << print(asHeapType(newInfos[i])) << "\n"; } std::cerr << '\n'; } -- cgit v1.2.3