Skip to content

Commit

Permalink
Remove old build output.
Browse files Browse the repository at this point in the history
  • Loading branch information
fniephaus committed Jun 28, 2022
1 parent da90917 commit f40aacb
Show file tree
Hide file tree
Showing 14 changed files with 60 additions and 169 deletions.
3 changes: 3 additions & 0 deletions substratevm/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -73,11 +73,6 @@ public interface BigBang extends ReachabilityAnalysis, HeapScanning {

List<DebugHandlersFactory> getDebugHandlerFactories();

/**
* Prints all analysis timers.
*/
void printTimers();

/**
* Prints more detailed information about all analysis timers.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -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() {
Expand All @@ -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. */
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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<String, Timer> timers = new ConcurrentHashMap<>();
private final String imageName;

public TimerCollection(String imageName) {
this.imageName = imageName;
}

public Timer get(String name) {
Timer timer = timers.get(name);
Expand All @@ -85,32 +77,20 @@ 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) {
return singleton().get(type).start();
}

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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Boolean> BuildOutputUseNewStyle = new HostedOptionKey<>(true);

@Option(help = "Prefix build output with '<pid>:<image name>'", type = OptionType.User)//
public static final HostedOptionKey<Boolean> BuildOutputPrefix = new HostedOptionKey<>(false);

Expand Down
Loading

0 comments on commit f40aacb

Please sign in to comment.