diff --git a/src/ir/possible-contents.cpp b/src/ir/possible-contents.cpp index f8be015f6ca..9170a16524d 100644 --- a/src/ir/possible-contents.cpp +++ b/src/ir/possible-contents.cpp @@ -27,6 +27,9 @@ #include "ir/module-utils.h" #include "ir/possible-contents.h" #include "support/insert_ordered.h" +#ifdef POSSIBLE_CONTENTS_DEBUG +#include "support/timing.h" +#endif #include "wasm-type.h" #include "wasm.h" @@ -2274,18 +2277,24 @@ Flower::Flower(Module& wasm, const PassOptions& options) if (options.trapsNeverHappen && wasm.features.hasGC()) { #ifdef POSSIBLE_CONTENTS_DEBUG std::cout << "tnh phase\n"; + Timer timer; #endif tnhOracle = std::make_unique(wasm, options); +#ifdef POSSIBLE_CONTENTS_DEBUG + std::cout << "... " << timer.lastElapsed() << "\n"; +#endif } #ifdef POSSIBLE_CONTENTS_DEBUG std::cout << "subtypes phase\n"; + Timer timer; #endif subTypes = std::make_unique(wasm); maxDepths = subTypes->getMaxDepths(); #ifdef POSSIBLE_CONTENTS_DEBUG + std::cout << "... " << timer.lastElapsed() << "\n"; std::cout << "parallel phase\n"; #endif @@ -2324,6 +2333,7 @@ Flower::Flower(Module& wasm, const PassOptions& options) }); #ifdef POSSIBLE_CONTENTS_DEBUG + std::cout << "... " << timer.lastElapsed() << "\n"; std::cout << "single phase\n"; #endif @@ -2334,6 +2344,7 @@ Flower::Flower(Module& wasm, const PassOptions& options) finder.walkModuleCode(&wasm); #ifdef POSSIBLE_CONTENTS_DEBUG + std::cout << "... " << timer.lastElapsed() << "\n"; std::cout << "global init phase\n"; #endif @@ -2358,6 +2369,7 @@ Flower::Flower(Module& wasm, const PassOptions& options) // go. #ifdef POSSIBLE_CONTENTS_DEBUG + std::cout << "... " << timer.lastElapsed() << "\n"; std::cout << "merging+indexing phase\n"; #endif @@ -2402,6 +2414,7 @@ Flower::Flower(Module& wasm, const PassOptions& options) analysis.map.clear(); #ifdef POSSIBLE_CONTENTS_DEBUG + std::cout << "... " << timer.lastElapsed() << "\n"; std::cout << "external phase\n"; #endif @@ -2494,6 +2507,7 @@ Flower::Flower(Module& wasm, const PassOptions& options) } #ifdef POSSIBLE_CONTENTS_DEBUG + std::cout << "... " << timer.lastElapsed() << "\n"; std::cout << "function subtyping phase\n"; #endif @@ -2519,6 +2533,7 @@ Flower::Flower(Module& wasm, const PassOptions& options) } #ifdef POSSIBLE_CONTENTS_DEBUG + std::cout << "... " << timer.lastElapsed() << "\n"; std::cout << "Link-targets phase\n"; #endif @@ -2537,6 +2552,7 @@ Flower::Flower(Module& wasm, const PassOptions& options) #endif #ifdef POSSIBLE_CONTENTS_DEBUG + std::cout << "... " << timer.lastElapsed() << "\n"; std::cout << "roots phase\n"; #endif @@ -2554,6 +2570,7 @@ Flower::Flower(Module& wasm, const PassOptions& options) } #ifdef POSSIBLE_CONTENTS_DEBUG + std::cout << "... " << timer.lastElapsed() << "\n"; std::cout << "flow phase\n"; size_t iters = 0; #endif @@ -2574,6 +2591,10 @@ Flower::Flower(Module& wasm, const PassOptions& options) flowAfterUpdate(locationIndex); } +#ifdef POSSIBLE_CONTENTS_DEBUG + std::cout << "... " << timer.lastElapsed() << "\n"; +#endif + // TODO: Add analysis and retrieval logic for fields of immutable globals, // including multiple levels of depth (necessary for itables in j2wasm). } diff --git a/src/support/timing.h b/src/support/timing.h index 4521d5b6812..bfe83de5973 100644 --- a/src/support/timing.h +++ b/src/support/timing.h @@ -31,7 +31,7 @@ class Timer { public: Timer() { restart(); } - // Resets the timer's start time and returns the time since its last start. + // Resets the timer's start and last times. void restart() { auto now = std::chrono::steady_clock::now(); lastTime = startTime = now;