From f40aacb3c36e211664514e3788679807ff74838b Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Tue, 28 Jun 2022 10:13:15 +0200 Subject: [PATCH] Remove old build output. --- substratevm/CHANGELOG.md | 3 + .../pointsto/AbstractAnalysisEngine.java | 9 +-- .../com/oracle/graal/pointsto/BigBang.java | 7 +-- .../graal/pointsto/PointsToAnalysis.java | 14 +---- .../com/oracle/graal/pointsto/util/Timer.java | 49 +-------------- .../graal/pointsto/util/TimerCollection.java | 62 +++++++------------ .../ReachabilityAnalysisEngine.java | 12 +--- .../graal/llvm/LLVMNativeImageCodeCache.java | 10 +-- .../com/oracle/svm/core/SubstrateOptions.java | 3 - .../svm/hosted/NativeImageGenerator.java | 20 +++--- .../hosted/NativeImageGeneratorRunner.java | 7 +-- .../oracle/svm/hosted/ProgressReporter.java | 29 +++------ .../hosted/image/LIRNativeImageCodeCache.java | 2 +- .../hosted/image/NativeImageCodeCache.java | 2 +- 14 files changed, 60 insertions(+), 169 deletions(-) diff --git a/substratevm/CHANGELOG.md b/substratevm/CHANGELOG.md index a08f7024d878..dd6f97bb2e2a 100644 --- a/substratevm/CHANGELOG.md +++ b/substratevm/CHANGELOG.md @@ -2,6 +2,9 @@ This changelog summarizes major changes to GraalVM Native Image. +## Version 22.3.0 +* (GR-35721) Remove old build output style and the `-H:±BuildOutputUseNewStyle` option. + ## Version 22.2.0 * (GR-20653) Re-enable the usage of all CPU features for JIT compilation on AMD64. * (GR-38413) Add support for `-XX:+ExitOnOutOfMemoryError`. diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/AbstractAnalysisEngine.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/AbstractAnalysisEngine.java index 4cb32b862cee..ee436de16220 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/AbstractAnalysisEngine.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/AbstractAnalysisEngine.java @@ -98,7 +98,7 @@ public AbstractAnalysisEngine(OptionValues options, AnalysisUniverse universe, H this.processFeaturesTimer = timerCollection.get(TimerCollection.Registry.FEATURES); this.verifyHeapTimer = timerCollection.get(TimerCollection.Registry.VERIFY_HEAP); - this.reachabilityTimer = timerCollection.createTimer("(reachability)", false); + this.reachabilityTimer = timerCollection.createTimer("(reachability)"); this.analysisTimer = timerCollection.get(TimerCollection.Registry.ANALYSIS); this.extendedAsserts = PointstoOptions.ExtendedAsserts.getValue(options); @@ -182,13 +182,6 @@ public void cleanupAfterAnalysis() { universe.getHeapVerifier().cleanupAfterAnalysis(); } - @Override - public void printTimers() { - reachabilityTimer.print(); - verifyHeapTimer.print(); - processFeaturesTimer.print(); - } - @Override public void printTimerStatistics(PrintWriter out) { // todo print reachability here diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/BigBang.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/BigBang.java index df6a0071ae1b..4b2f761e7af9 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/BigBang.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/BigBang.java @@ -51,7 +51,7 @@ * Central static analysis interface that groups together the functionality of reachability analysis * and heap scanning and adds utility methods and lifecycle hooks that should be used to query and * change the state of the analysis. - * + * * In long term, all mutable accesses that change the state of the analysis should go through this * interface. * @@ -73,11 +73,6 @@ public interface BigBang extends ReachabilityAnalysis, HeapScanning { List getDebugHandlerFactories(); - /** - * Prints all analysis timers. - */ - void printTimers(); - /** * Prints more detailed information about all analysis timers. */ diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/PointsToAnalysis.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/PointsToAnalysis.java index b559797bd132..71dbe9657c5b 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/PointsToAnalysis.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/PointsToAnalysis.java @@ -142,8 +142,7 @@ public PointsToAnalysis(OptionValues options, AnalysisUniverse universe, HostedP this.debugHandlerFactories = Collections.singletonList(new GraalDebugHandlersFactory(providers.getSnippetReflection())); this.debug = new Builder(options, debugHandlerFactories).build(); this.hostVM = hostVM; - String imageName = hostVM.getImageName(); - this.typeFlowTimer = timerCollection.createTimer(imageName, "(typeflow)", false); + this.typeFlowTimer = timerCollection.createTimer("(typeflow)"); this.verifyHeapTimer = timerCollection.get(TimerCollection.Registry.VERIFY_HEAP); this.processFeaturesTimer = timerCollection.get(TimerCollection.Registry.FEATURES); this.analysisTimer = timerCollection.get(TimerCollection.Registry.ANALYSIS); @@ -184,13 +183,6 @@ public PointsToAnalysis(OptionValues options, AnalysisUniverse universe, HostedP : HeapScanningPolicy.skipTypes(skippedHeapTypes()); } - @Override - public void printTimers() { - typeFlowTimer.print(); - verifyHeapTimer.print(); - processFeaturesTimer.print(); - } - @Override public void printTimerStatistics(PrintWriter out) { StatisticsPrinter.print(out, "typeflow_time_ms", typeFlowTimer.getTotalTime()); @@ -465,7 +457,7 @@ public AnalysisMethod addRootMethod(AnalysisMethod aMethod, boolean invokeSpecia * virtual invoke type flow. Since the virtual invoke observes the receiver flow * state it will get notified for any future reachable subtypes and will resolve the * method in each subtype. - * + * * In both cases the context-insensitive invoke parameters are initialized with the * corresponding declared type state. When a callee is resolved the method is parsed * and the actual parameter type state is propagated to the formal parameters. Then @@ -483,7 +475,7 @@ public AnalysisMethod addRootMethod(AnalysisMethod aMethod, boolean invokeSpecia * Initialize the type flow of the invoke's actual parameters with the * corresponding parameter declared type. Thus, when the invoke links callees it * will propagate the parameter types too. - * + * * The parameter iteration skips the primitive parameters, as these are not * modeled. The type flow of the receiver is set to the receiver type already * when the invoke is created. diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/util/Timer.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/util/Timer.java index 92e511bb8d43..91a382854a2a 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/util/Timer.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/util/Timer.java @@ -24,15 +24,8 @@ */ package com.oracle.graal.pointsto.util; -import org.graalvm.compiler.serviceprovider.GraalServices; - public class Timer { - private static boolean disablePrinting = false; - - private String prefix; - private final String name; - private final boolean autoPrint; /** Timer start time in nanoseconds. */ private long startTime; /** Timer total time in nanoseconds. */ @@ -42,25 +35,11 @@ public class Timer { /** * Timers should only be instantiated via factory methods in TimerCollection. - * + * * @see TimerCollection */ - Timer(String prefix, String name, boolean autoPrint) { - this.prefix = prefix; + Timer(String name) { this.name = name; - this.autoPrint = autoPrint; - } - - public static void disablePrinting() { - disablePrinting = true; - } - - /** - * Registers the prefix to be used when {@linkplain Timer#print(long) printing} a timer. This - * allows the output of interlaced native image executions to be disambiguated. - */ - public void setPrefix(String value) { - this.prefix = value; } public StopTimer start() { @@ -72,30 +51,6 @@ public void stop() { long addTime = System.nanoTime() - startTime; totalTime += addTime; totalMemory = Runtime.getRuntime().totalMemory(); - if (autoPrint) { - print(addTime); - } - } - - private void print(long time) { - // TODO GR-35721 - if (disablePrinting) { - return; - } - final String concurrentPrefix; - if (prefix != null) { - // Add the PID to further disambiguate concurrent builds of images with the same name - String pid = GraalServices.getExecutionID(); - concurrentPrefix = String.format("[%s:%s] ", prefix, pid); - } else { - concurrentPrefix = ""; - } - double totalMemoryGB = totalMemory / 1024.0 / 1024.0 / 1024.0; - System.out.format("%s%12s: %,10.2f ms, %,5.2f GB%n", concurrentPrefix, name, time / 1000000d, totalMemoryGB); - } - - public void print() { - print(totalTime); } /** Get timer total time in milliseconds. */ diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/util/TimerCollection.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/util/TimerCollection.java index 7663cce1348a..439969b9a6ff 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/util/TimerCollection.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/util/TimerCollection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,39 +44,31 @@ public static TimerCollection singleton() { * A registry of well-known timers used when building images. */ public enum Registry { - TOTAL("total", false), - SETUP("setup", true), - CLASSLIST("classlist", false), - CLINIT("(clinit)", true), - FEATURES("(features)", false), - VERIFY_HEAP("(verify)", false), - ANALYSIS("analysis", true), - UNIVERSE("universe", true), - COMPILE_TOTAL("compile", true), - PARSE("(parse)", true), - INLINE("(inline)", true), - COMPILE("(compile)", true), - DEBUG_INFO("dbginfo", true), - IMAGE("image", true), - WRITE("write", true); + TOTAL("total"), + SETUP("setup"), + CLASSLIST("classlist"), + CLINIT("(clinit)"), + FEATURES("(features)"), + VERIFY_HEAP("(verify)"), + ANALYSIS("analysis"), + UNIVERSE("universe"), + COMPILE_TOTAL("compile"), + PARSE("(parse)"), + INLINE("(inline)"), + COMPILE("(compile)"), + DEBUG_INFO("dbginfo"), + IMAGE("image"), + WRITE("write"); public final String name; - public final boolean autoPrint; - - Registry(String name, boolean autoPrint) { + Registry(String name) { this.name = name; - this.autoPrint = autoPrint; } } private final Map timers = new ConcurrentHashMap<>(); - private final String imageName; - - public TimerCollection(String imageName) { - this.imageName = imageName; - } public Timer get(String name) { Timer timer = timers.get(name); @@ -85,11 +77,11 @@ public Timer get(String name) { } public Timer get(TimerCollection.Registry type) { - return timers.computeIfAbsent(type.name, (name) -> new Timer(imageName, name, type.autoPrint)); + return timers.computeIfAbsent(type.name, (name) -> new Timer(name)); } - public static Timer.StopTimer createTimerAndStart(String prefix, String name) { - return singleton().createTimer(prefix, name).start(); + public static Timer.StopTimer createTimerAndStart(String name) { + return singleton().createTimer(name).start(); } public static Timer.StopTimer createTimerAndStart(TimerCollection.Registry type) { @@ -97,20 +89,8 @@ public static Timer.StopTimer createTimerAndStart(TimerCollection.Registry type) } public Timer createTimer(String name) { - return createTimer(null, name, true); - } - - public Timer createTimer(String prefix, String name) { - return createTimer(prefix, name, true); - } - - public Timer createTimer(String name, boolean autoPrint) { - return createTimer(null, name, autoPrint); - } - - public Timer createTimer(String prefix, String name, boolean autoPrint) { GraalError.guarantee(!timers.containsKey(name), "Name %s for a timer is already taken.", name); - Timer timer = new Timer(prefix, name, autoPrint); + Timer timer = new Timer(name); timers.put(timer.getName(), timer); return timer; } diff --git a/substratevm/src/com.oracle.graal.reachability/src/com/oracle/graal/reachability/ReachabilityAnalysisEngine.java b/substratevm/src/com.oracle.graal.reachability/src/com/oracle/graal/reachability/ReachabilityAnalysisEngine.java index ef9a92193bb5..b3b837b0303c 100644 --- a/substratevm/src/com.oracle.graal.reachability/src/com/oracle/graal/reachability/ReachabilityAnalysisEngine.java +++ b/substratevm/src/com.oracle.graal.reachability/src/com/oracle/graal/reachability/ReachabilityAnalysisEngine.java @@ -32,8 +32,6 @@ import java.util.Set; import java.util.concurrent.ForkJoinPool; -import com.oracle.graal.pointsto.meta.InvokeInfo; -import com.oracle.graal.pointsto.util.AnalysisError; import org.graalvm.compiler.debug.Indent; import org.graalvm.compiler.nodes.StructuredGraph; import org.graalvm.compiler.options.OptionValues; @@ -46,6 +44,8 @@ import com.oracle.graal.pointsto.meta.AnalysisType; import com.oracle.graal.pointsto.meta.AnalysisUniverse; import com.oracle.graal.pointsto.meta.HostedProviders; +import com.oracle.graal.pointsto.meta.InvokeInfo; +import com.oracle.graal.pointsto.util.AnalysisError; import com.oracle.graal.pointsto.util.CompletionExecutor; import com.oracle.graal.pointsto.util.Timer; import com.oracle.graal.pointsto.util.TimerCollection; @@ -78,7 +78,7 @@ public ReachabilityAnalysisEngine(OptionValues options, AnalysisUniverse univers UnsupportedFeatures unsupportedFeatures, MethodSummaryProvider methodSummaryProvider, TimerCollection timerCollection) { super(options, universe, providers, hostVM, executorService, heartbeatCallback, unsupportedFeatures, timerCollection); this.methodSummaryProvider = methodSummaryProvider; - this.summaryTimer = timerCollection.createTimer("((summaries))", false); + this.summaryTimer = timerCollection.createTimer("((summaries))"); ReachabilityAnalysisType objectType = assertReachabilityAnalysisType(metaAccess.lookupJavaType(Object.class)); this.allInstantiatedTypes = Collections.unmodifiableSet(objectType.getInstantiatedSubtypes()); } @@ -409,10 +409,4 @@ public static ReachabilityAnalysisMethod assertReachabilityAnalysisMethod(Analys public static ReachabilityAnalysisType assertReachabilityAnalysisType(AnalysisType type) { return (ReachabilityAnalysisType) type; } - - @Override - public void printTimers() { - summaryTimer.print(); - super.printTimers(); - } } diff --git a/substratevm/src/com.oracle.svm.core.graal.llvm/src/com/oracle/svm/core/graal/llvm/LLVMNativeImageCodeCache.java b/substratevm/src/com.oracle.svm.core.graal.llvm/src/com/oracle/svm/core/graal/llvm/LLVMNativeImageCodeCache.java index 68766c60a2f0..cd57cdf50926 100644 --- a/substratevm/src/com.oracle.svm.core.graal.llvm/src/com/oracle/svm/core/graal/llvm/LLVMNativeImageCodeCache.java +++ b/substratevm/src/com.oracle.svm.core.graal.llvm/src/com/oracle/svm/core/graal/llvm/LLVMNativeImageCodeCache.java @@ -131,20 +131,20 @@ public int codeSizeFor(HostedMethod method) { @Override @SuppressWarnings({"unused", "try"}) - public void layoutMethods(DebugContext debug, String imageName, BigBang bb, ForkJoinPool threadPool) { + public void layoutMethods(DebugContext debug, BigBang bb, ForkJoinPool threadPool) { try (Indent indent = debug.logAndIndent("layout methods")) { BatchExecutor executor = new BatchExecutor(bb, threadPool); - try (StopTimer t = TimerCollection.createTimerAndStart(imageName, "(bitcode)")) { + try (StopTimer t = TimerCollection.createTimerAndStart("(bitcode)")) { writeBitcode(executor); } int numBatches; - try (StopTimer t = TimerCollection.createTimerAndStart(imageName, "(prelink)")) { + try (StopTimer t = TimerCollection.createTimerAndStart("(prelink)")) { numBatches = createBitcodeBatches(executor, debug); } - try (StopTimer t = TimerCollection.createTimerAndStart(imageName, "(llvm)")) { + try (StopTimer t = TimerCollection.createTimerAndStart("(llvm)")) { compileBitcodeBatches(executor, debug, numBatches); } - try (StopTimer t = TimerCollection.createTimerAndStart(imageName, "(postlink)")) { + try (StopTimer t = TimerCollection.createTimerAndStart("(postlink)")) { linkCompiledBatches(executor, debug, numBatches); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java index 4c0995e00032..3e587205b031 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java @@ -394,9 +394,6 @@ public Boolean getValue(OptionValues values) { /* * Build output options. */ - @Option(help = "Use new build output style", type = OptionType.User, deprecated = true, deprecationMessage = "The old build output style will be removed in a future release.")// - public static final HostedOptionKey BuildOutputUseNewStyle = new HostedOptionKey<>(true); - @Option(help = "Prefix build output with ':'", type = OptionType.User)// public static final HostedOptionKey BuildOutputPrefix = new HostedOptionKey<>(false); diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageGenerator.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageGenerator.java index b4fff031879f..4133d7bb4a5b 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageGenerator.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageGenerator.java @@ -566,7 +566,7 @@ private void doRun(Map entryPoints, SnippetReflectionProvider originalSnippetReflection = GraalAccess.getOriginalSnippetReflection(); try (DebugContext debug = new Builder(options, new GraalDebugHandlersFactory(originalSnippetReflection)).build(); DebugCloseable featureCleanup = () -> featureHandler.forEachFeature(Feature::cleanup)) { - setupNativeImage(imageName, options, entryPoints, javaMainSupport, harnessSubstitutions, analysisExecutor, originalSnippetReflection, debug); + setupNativeImage(options, entryPoints, javaMainSupport, harnessSubstitutions, analysisExecutor, originalSnippetReflection, debug); reporter.printFeatures(featureHandler.getUserSpecificFeatures()); boolean returnAfterAnalysis = runPointsToAnalysis(imageName, options, debug); @@ -650,7 +650,7 @@ private void doRun(Map entryPoints, codeCache = NativeImageCodeCacheFactory.get().newCodeCache(compileQueue, heap, loader.platform, ImageSingletons.lookup(TemporaryBuildDirectoryProvider.class).getTemporaryBuildDirectory()); codeCache.layoutConstants(); - codeCache.layoutMethods(debug, imageName, bb, compilationExecutor); + codeCache.layoutMethods(debug, bb, compilationExecutor); BuildPhaseProvider.markCompilationFinished(); AfterCompilationAccessImpl config = new AfterCompilationAccessImpl(featureHandler, loader, aUniverse, hUniverse, compileQueue.getCompilations(), heap, debug, runtime); @@ -746,7 +746,7 @@ private boolean runPointsToAnalysis(String imageName, OptionValues options, Debu } catch (AnalysisError e) { throw UserError.abort(e, "Analysis step failed. Reason: %s.", e.getMessage()); } - assert verifyAssignableTypes(imageName); + assert verifyAssignableTypes(); /* * Libraries defined via @CLibrary annotations are added at the end of the list of @@ -761,8 +761,6 @@ private boolean runPointsToAnalysis(String imageName, OptionValues options, Debu checkUniverse(); - bb.printTimers(); - /* report the unsupported features by throwing UnsupportedFeatureException */ bb.getUnsupportedFeatures().report(bb); bb.checkUserLimitations(); @@ -793,7 +791,7 @@ private boolean runPointsToAnalysis(String imageName, OptionValues options, Debu } @SuppressWarnings("try") - private boolean verifyAssignableTypes(String imageName) { + private boolean verifyAssignableTypes() { /* * This verification has quadratic complexity, so do it only once after the static analysis * has finished, and can be disabled with an option. @@ -801,13 +799,13 @@ private boolean verifyAssignableTypes(String imageName) { if (SubstrateOptions.DisableTypeIdResultVerification.getValue()) { return true; } - try (StopTimer t = TimerCollection.createTimerAndStart(imageName, "(verifyAssignableTypes)")) { + try (StopTimer t = TimerCollection.createTimerAndStart("(verifyAssignableTypes)")) { return AnalysisType.verifyAssignableTypes(bb); } } @SuppressWarnings("try") - private void setupNativeImage(String imageName, OptionValues options, Map entryPoints, JavaMainSupport javaMainSupport, + private void setupNativeImage(OptionValues options, Map entryPoints, JavaMainSupport javaMainSupport, SubstitutionProcessor harnessSubstitutions, ForkJoinPool analysisExecutor, SnippetReflectionProvider originalSnippetReflection, DebugContext debug) { try (Indent ignored = debug.logAndIndent("setup native-image builder")) { @@ -908,7 +906,7 @@ private void setupNativeImage(String imageName, OptionValues options, Map feature.duringSetup(config)); @@ -1102,9 +1100,9 @@ public static Inflation createBigBang(OptionValues options, TargetDescription ta } @SuppressWarnings("try") - private NativeLibraries setupNativeLibraries(String imageName, ConstantReflectionProvider aConstantReflection, MetaAccessProvider aMetaAccess, + private NativeLibraries setupNativeLibraries(ConstantReflectionProvider aConstantReflection, MetaAccessProvider aMetaAccess, SnippetReflectionProvider aSnippetReflection, CEnumCallWrapperSubstitutionProcessor cEnumProcessor, ClassInitializationSupport classInitializationSupport, DebugContext debug) { - try (StopTimer ignored = TimerCollection.createTimerAndStart(imageName, "(cap)")) { + try (StopTimer ignored = TimerCollection.createTimerAndStart("(cap)")) { NativeLibraries nativeLibs = new NativeLibraries(aConstantReflection, aMetaAccess, aSnippetReflection, ConfigurationValues.getTarget(), classInitializationSupport, ImageSingletons.lookup(TemporaryBuildDirectoryProvider.class).getTemporaryBuildDirectory(), debug); cEnumProcessor.setNativeLibraries(nativeLibs); diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageGeneratorRunner.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageGeneratorRunner.java index 20848e189165..3b6d04138ac2 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageGeneratorRunner.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageGeneratorRunner.java @@ -271,7 +271,7 @@ private int buildImage(ImageClassLoader classLoader) { OptionValues parsedHostedOptions = classLoader.classLoaderSupport.getParsedHostedOptions(); String imageName = SubstrateOptions.Name.getValue(parsedHostedOptions); - TimerCollection timerCollection = new TimerCollection(imageName); + TimerCollection timerCollection = new TimerCollection(); Timer totalTimer = timerCollection.get(TimerCollection.Registry.TOTAL); if (NativeImageOptions.ListCPUFeatures.getValue(parsedHostedOptions)) { @@ -296,10 +296,6 @@ private int buildImage(ImageClassLoader classLoader) { throw UserError.abort("No output file name specified. Use '%s'.", SubstrateOptionsParser.commandArgument(SubstrateOptions.Name, "")); } try { - - // print the time here to avoid interactions with flags processing - classlistTimer.print(); - Map entryPoints = new HashMap<>(); Pair mainEntryPointData = Pair.empty(); JavaMainSupport javaMainSupport = null; @@ -462,7 +458,6 @@ private int buildImage(ImageClassLoader classLoader) { NativeImageGeneratorRunner.reportFatalError(e); return 1; } finally { - totalTimer.print(); if (imageName != null && generator != null) { reporter.printEpilog(imageName, generator, wasSuccessfulBuild, parsedHostedOptions); } diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ProgressReporter.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ProgressReporter.java index fcf2db0f3a6a..f0100ecfb051 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ProgressReporter.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ProgressReporter.java @@ -101,7 +101,6 @@ public class ProgressReporter { private final NativeImageSystemIOWrappers builderIO; - private final boolean isEnabled; // TODO: clean up when deprecating old output (GR-35721). private final DirectPrinter linePrinter = new DirectPrinter(); private final StagePrinter stagePrinter; private final ColorStrategy colorStrategy; @@ -167,10 +166,6 @@ public static ProgressReporter singleton() { public ProgressReporter(OptionValues options) { builderIO = NativeImageSystemIOWrappers.singleton(); - isEnabled = SubstrateOptions.BuildOutputUseNewStyle.getValue(options); - if (isEnabled) { - Timer.disablePrinting(); - } usePrefix = SubstrateOptions.BuildOutputPrefix.getValue(options); boolean enableColors = !IS_DUMB_TERM && !IS_CI && OS.getCurrent() != OS.WINDOWS && System.getenv("NO_COLOR") == null /* https://no-color.org/ */; @@ -597,20 +592,20 @@ private void printArtifacts(String imageName, NativeImageGenerator generator, Op }); } - private Path reportImageBuildStatistics(String imageName, BigBang bb) { + private static Path reportImageBuildStatistics(String imageName, BigBang bb) { Consumer statsReporter = ImageSingletons.lookup(ImageBuildStatistics.class).getReporter(); String description = "image build statistics"; if (ImageBuildStatistics.Options.ImageBuildStatisticsFile.hasBeenSet(bb.getOptions())) { final File file = new File(ImageBuildStatistics.Options.ImageBuildStatisticsFile.getValue(bb.getOptions())); - return ReportUtils.report(description, file.getAbsoluteFile().toPath(), statsReporter, !isEnabled); + return ReportUtils.report(description, file.getAbsoluteFile().toPath(), statsReporter, false); } else { String name = "image_build_statistics_" + ReportUtils.extractImageName(imageName); String path = SubstrateOptions.Path.getValue() + File.separatorChar + "reports"; - return ReportUtils.report(description, path, name, "json", statsReporter, !isEnabled); + return ReportUtils.report(description, path, name, "json", statsReporter, false); } } - private Path reportBuildArtifacts(String imageName, Map> buildArtifacts) { + private static Path reportBuildArtifacts(String imageName, Map> buildArtifacts) { Path buildDir = NativeImageGenerator.generatedFiles(HostedOptionValues.singleton()); Consumer writerConsumer = writer -> buildArtifacts.forEach((artifactType, paths) -> { @@ -623,7 +618,7 @@ private Path reportBuildArtifacts(String imageName, Map paths.stream().map(Path::toAbsolutePath).map(buildDir::relativize).forEach(writer::println); writer.println(); }); - return ReportUtils.report("build artifacts", buildDir.resolve(imageName + ".build_artifacts.txt"), writerConsumer, !isEnabled); + return ReportUtils.report("build artifacts", buildDir.resolve(imageName + ".build_artifacts.txt"), writerConsumer, false); } private void printResourceStatistics() { @@ -820,21 +815,15 @@ public void close() { */ private void print(char text) { - if (isEnabled) { - builderIO.getOut().print(text); - } + builderIO.getOut().print(text); } private void print(String text) { - if (isEnabled) { - builderIO.getOut().print(text); - } + builderIO.getOut().print(text); } private void println() { - if (isEnabled) { - builderIO.getOut().println(); - } + builderIO.getOut().println(); } /* @@ -1180,7 +1169,7 @@ TwoColumnPrinter jumpToMiddle() { int remaining = (CHARACTERS_PER_LINE / 2) - getCurrentTextLength(); assert remaining >= 0 : "Column text too wide"; a(Utils.stringFilledWith(remaining, " ")); - assert !isEnabled || getCurrentTextLength() == CHARACTERS_PER_LINE / 2; + assert getCurrentTextLength() == CHARACTERS_PER_LINE / 2; return this; } diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/LIRNativeImageCodeCache.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/LIRNativeImageCodeCache.java index ce4463e220d5..9693fc87f46a 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/LIRNativeImageCodeCache.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/LIRNativeImageCodeCache.java @@ -152,7 +152,7 @@ private boolean verifyMethodLayout() { @SuppressWarnings("try") @Override - public void layoutMethods(DebugContext debug, String imageName, BigBang bb, ForkJoinPool threadPool) { + public void layoutMethods(DebugContext debug, BigBang bb, ForkJoinPool threadPool) { try (Indent indent = debug.logAndIndent("layout methods")) { // Assign initial location to all methods. diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageCodeCache.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageCodeCache.java index e7ba49fd5f50..bdfd8c0bbeb5 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageCodeCache.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageCodeCache.java @@ -169,7 +169,7 @@ protected CompilationResult compilationResultFor(HostedMethod method) { return compilations.get(method); } - public abstract void layoutMethods(DebugContext debug, String imageName, BigBang bb, ForkJoinPool threadPool); + public abstract void layoutMethods(DebugContext debug, BigBang bb, ForkJoinPool threadPool); public void layoutConstants() { for (Pair pair : getOrderedCompilations()) {