Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/ir/possible-contents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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<TNHOracle>(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<SubTypes>(wasm);
maxDepths = subTypes->getMaxDepths();

#ifdef POSSIBLE_CONTENTS_DEBUG
std::cout << "... " << timer.lastElapsed() << "\n";
std::cout << "parallel phase\n";
#endif

Expand Down Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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
Expand All @@ -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).
}
Expand Down
2 changes: 1 addition & 1 deletion src/support/timing.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading