Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

Commit

Permalink
Adding support for tracking time needed for method layouting.
Browse files Browse the repository at this point in the history
  • Loading branch information
Milena Vujosevic Janicic committed Jul 21, 2022
1 parent d8298e6 commit cc92627
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public enum Registry {
PARSE("(parse)"),
INLINE("(inline)"),
COMPILE("(compile)"),
LAYOUT("(layout)"),
DEBUG_INFO("dbginfo"),
IMAGE("image"),
WRITE("write");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -648,10 +648,12 @@ private void doRun(Map<Method, CEntryPointData> entryPoints,
/* release memory taken by graphs for the image writing */
hUniverse.getMethods().forEach(HostedMethod::clear);

codeCache = NativeImageCodeCacheFactory.get().newCodeCache(compileQueue, heap, loader.platform,
ImageSingletons.lookup(TemporaryBuildDirectoryProvider.class).getTemporaryBuildDirectory());
codeCache.layoutConstants();
codeCache.layoutMethods(debug, bb, compilationExecutor);
try (ProgressReporter.ReporterClosable ac = reporter.printLayout()) {
codeCache = NativeImageCodeCacheFactory.get().newCodeCache(compileQueue, heap, loader.platform,
ImageSingletons.lookup(TemporaryBuildDirectoryProvider.class).getTemporaryBuildDirectory());
codeCache.layoutConstants();
codeCache.layoutMethods(debug, bb, compilationExecutor);
}

BuildPhaseProvider.markCompilationFinished();
AfterCompilationAccessImpl config = new AfterCompilationAccessImpl(featureHandler, loader, aUniverse, hUniverse, compileQueue.getCompilations(), codeCache, heap, debug, runtime);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ private enum BuildStage {
PARSING("Parsing methods", true, true),
INLINING("Inlining methods", true, false),
COMPILING("Compiling methods", true, true),
LAYOUTING("Layouting methods", true, true),
CREATING("Creating image");

private static final int NUM_STAGES = values().length;
Expand Down Expand Up @@ -428,6 +429,19 @@ public void closeAction() {
};
}

public ReporterClosable printLayout() {
Timer timer = getTimer(TimerCollection.Registry.LAYOUT);
timer.start();
stagePrinter.start(BuildStage.LAYOUTING);
return new ReporterClosable() {
@Override
public void closeAction() {
timer.stop();
stagePrinter.end(timer);
}
};
}

// TODO: merge printCreationStart and printCreationEnd at some point (GR-35721).
public void printCreationStart() {
stagePrinter.start(BuildStage.CREATING);
Expand Down

0 comments on commit cc92627

Please sign in to comment.