From 8fa79710143a7ca701f3bd6abe34af2369d40275 Mon Sep 17 00:00:00 2001 From: Christian Wirth Date: Fri, 29 Aug 2025 10:23:56 +0200 Subject: [PATCH 1/3] make clear we are talking about the image's GC --- .../src/com/oracle/svm/hosted/ProgressReporter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 2aed3c747877..a0111790c14a 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 @@ -260,7 +260,7 @@ public void printInitializeEnd(List features, ImageClassLoader classLoa recordJsonMetric(GeneralInfo.GC, gcName); long maxHeapSize = SubstrateGCOptions.MaxHeapSize.getValue(); String maxHeapValue = maxHeapSize == 0 ? Heap.getHeap().getGC().getDefaultMaxHeapSize() : ByteFormattingUtil.bytesToHuman(maxHeapSize); - l().a(" ").doclink("Garbage collector", "#glossary-gc").a(": ").a(gcName).a(" (").doclink("max heap size", "#glossary-gc-max-heap-size").a(": ").a(maxHeapValue).a(")").println(); + l().a(" ").doclink("Image Garbage collector", "#glossary-gc").a(": ").a(gcName).a(" (").doclink("max heap size", "#glossary-gc-max-heap-size").a(": ").a(maxHeapValue).a(")").println(); printFeatures(features); printExperimentalOptions(classLoader); From b717a759ccdd1917a5288111a9cc06f922819064 Mon Sep 17 00:00:00 2001 From: Christian Wirth Date: Fri, 29 Aug 2025 11:00:20 +0200 Subject: [PATCH 2/3] add assertion status of builder and image to build output --- .../src/com/oracle/svm/core/RuntimeAssertionsSupport.java | 8 ++++++++ .../src/com/oracle/svm/hosted/ProgressReporter.java | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/RuntimeAssertionsSupport.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/RuntimeAssertionsSupport.java index debc7eb6e401..b3593cb06a4f 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/RuntimeAssertionsSupport.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/RuntimeAssertionsSupport.java @@ -193,4 +193,12 @@ private boolean desiredAssertionStatusImpl(String name, ClassLoader classLoader) public boolean desiredAssertionStatus(Class clazz) { return desiredAssertionStatusImpl(clazz.getName(), clazz.getClassLoader()); } + + public boolean getDefaultAssertionStatus() { + return defaultAssertionStatus; + } + + public boolean getDefaultSystemAssertionStatus() { + return systemAssertionStatus; + } } 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 a0111790c14a..f7e637f9f83d 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 @@ -53,6 +53,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import com.oracle.svm.core.RuntimeAssertionsSupport; import org.graalvm.nativeimage.ImageSingletons; import org.graalvm.nativeimage.hosted.Feature; import org.graalvm.nativeimage.impl.ImageSingletonsSupport; @@ -260,13 +261,20 @@ public void printInitializeEnd(List features, ImageClassLoader classLoa recordJsonMetric(GeneralInfo.GC, gcName); long maxHeapSize = SubstrateGCOptions.MaxHeapSize.getValue(); String maxHeapValue = maxHeapSize == 0 ? Heap.getHeap().getGC().getDefaultMaxHeapSize() : ByteFormattingUtil.bytesToHuman(maxHeapSize); + + l().a(" ").a("Builder assertions: ").a(SubstrateUtil.assertionsEnabled() ? "enabled" : "disabled").a(", builder system assertions: ").a(getSystemAssertionStatus() ? "enabled" : "disabled").println(); l().a(" ").doclink("Image Garbage collector", "#glossary-gc").a(": ").a(gcName).a(" (").doclink("max heap size", "#glossary-gc-max-heap-size").a(": ").a(maxHeapValue).a(")").println(); + l().a(" ").a("Image assertions: by default ").a(RuntimeAssertionsSupport.singleton().getDefaultAssertionStatus() ? "enabled" : "disabled").a(", system assertions: by default ").a(RuntimeAssertionsSupport.singleton().getDefaultSystemAssertionStatus() ? "enabled" : "disabled").a(" (class-specific config may apply)").println(); printFeatures(features); printExperimentalOptions(classLoader); printResourceInfo(); } + private boolean getSystemAssertionStatus() { + return java.util.ArrayList.class.desiredAssertionStatus(); + } + private void printFeatures(List features) { int numFeatures = features.size(); if (numFeatures > 0) { From 44f3f989d8aae8559036b4c567f5108efe9f1477 Mon Sep 17 00:00:00 2001 From: Christian Wirth Date: Mon, 1 Sep 2025 19:52:37 +0200 Subject: [PATCH 3/3] structure output in Initializing phase of builder --- .../native-image/BuildOutput.md | 16 ++++++++---- .../oracle/svm/hosted/ProgressReporter.java | 25 +++++++++++++------ 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/docs/reference-manual/native-image/BuildOutput.md b/docs/reference-manual/native-image/BuildOutput.md index b93aea92a895..32ed819c4664 100644 --- a/docs/reference-manual/native-image/BuildOutput.md +++ b/docs/reference-manual/native-image/BuildOutput.md @@ -23,11 +23,17 @@ Below is the example output when building a native executable of the `HelloWorld ================================================================================ GraalVM Native Image: Generating 'helloworld' (executable)... ================================================================================ -[1/8] Initializing... (2.0s @ 0.19GB) - Java version: 26+9, vendor version: GraalVM CE 26-dev+9.1 - Graal compiler: optimization level: 2, target machine: x86-64-v3 - C compiler: gcc (linux, x86_64, 15.2.1) - Garbage collector: Serial GC (max heap size: 80% of RAM) +[1/8] Initializing... (5.1s @ 0.23GB) + Builder configuration: + - Java version: 26+12, vendor version: Oracle GraalVM 26-dev+12.1 + - Graal compiler: optimization level: 2, target machine: x86-64-v3 + - C compiler: gcc (linux, x86_64, 13.3.0) + - Assertions: enabled, system assertions: enabled + - 1 user-specific feature(s): + - com.oracle.svm.thirdparty.gson.GsonFeature + Image configuration: + - Garbage collector: Serial GC (max heap size: 80% of RAM) + - Assertions: disabled (class-specific config may apply), system assertions: disabled -------------------------------------------------------------------------------- Build resources: - 14.69GiB of memory (47.0% of system memory, using all available memory) 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 f7e637f9f83d..0435da70bde9 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 @@ -243,18 +243,21 @@ public void printInitializeEnd(List features, ImageClassLoader classLoa recordJsonMetric(GeneralInfo.JAVA_VERSION, vm.version); recordJsonMetric(GeneralInfo.VENDOR_VERSION, vm.vendorVersion); recordJsonMetric(GeneralInfo.GRAALVM_VERSION, vm.vendorVersion); // deprecated - l().a(" ").doclink("Java version", "#glossary-java-info").a(": ").a(vm.version).a(", ").doclink("vendor version", "#glossary-java-info").a(": ").a(vm.vendorVersion).println(); + + // Builder Configuration section + l().a(" ").a("Builder configuration:").println(); + l().a(" - ").doclink("Java version", "#glossary-java-info").a(": ").a(vm.version).a(", ").doclink("vendor version", "#glossary-java-info").a(": ").a(vm.vendorVersion).println(); String optimizationLevel = SubstrateOptions.Optimize.getValue(); recordJsonMetric(GeneralInfo.GRAAL_COMPILER_OPTIMIZATION_LEVEL, optimizationLevel); String march = CPUType.getSelectedOrDefaultMArch(); recordJsonMetric(GeneralInfo.GRAAL_COMPILER_MARCH, march); - DirectPrinter graalLine = l().a(" ").doclink("Graal compiler", "#glossary-graal-compiler").a(": optimization level: %s, target machine: %s", optimizationLevel, march); + DirectPrinter graalLine = l().a(" - ").doclink("Graal compiler", "#glossary-graal-compiler").a(": optimization level: %s, target machine: %s", optimizationLevel, march); ImageSingletons.lookup(ProgressReporterFeature.class).appendGraalSuffix(graalLine); graalLine.println(); String cCompilerShort = null; if (ImageSingletons.contains(CCompilerInvoker.class)) { cCompilerShort = ImageSingletons.lookup(CCompilerInvoker.class).compilerInfo.getShortDescription(); - l().a(" ").doclink("C compiler", "#glossary-ccompiler").a(": ").a(cCompilerShort).println(); + l().a(" - ").doclink("C compiler", "#glossary-ccompiler").a(": ").a(cCompilerShort).println(); } recordJsonMetric(GeneralInfo.CC, cCompilerShort); String gcName = Heap.getHeap().getGC().getName(); @@ -262,11 +265,17 @@ public void printInitializeEnd(List features, ImageClassLoader classLoa long maxHeapSize = SubstrateGCOptions.MaxHeapSize.getValue(); String maxHeapValue = maxHeapSize == 0 ? Heap.getHeap().getGC().getDefaultMaxHeapSize() : ByteFormattingUtil.bytesToHuman(maxHeapSize); - l().a(" ").a("Builder assertions: ").a(SubstrateUtil.assertionsEnabled() ? "enabled" : "disabled").a(", builder system assertions: ").a(getSystemAssertionStatus() ? "enabled" : "disabled").println(); - l().a(" ").doclink("Image Garbage collector", "#glossary-gc").a(": ").a(gcName).a(" (").doclink("max heap size", "#glossary-gc-max-heap-size").a(": ").a(maxHeapValue).a(")").println(); - l().a(" ").a("Image assertions: by default ").a(RuntimeAssertionsSupport.singleton().getDefaultAssertionStatus() ? "enabled" : "disabled").a(", system assertions: by default ").a(RuntimeAssertionsSupport.singleton().getDefaultSystemAssertionStatus() ? "enabled" : "disabled").a(" (class-specific config may apply)").println(); + l().a(" - ").a("Assertions: ").a(SubstrateUtil.assertionsEnabled() ? "enabled" : "disabled").a(", system assertions: ").a(getSystemAssertionStatus() ? "enabled" : "disabled") + .println(); printFeatures(features); + + // Image Configuration section + l().a(" ").a("Image configuration:").println(); + l().a(" - ").doclink("Garbage collector", "#glossary-gc").a(": ").a(gcName).a(" (").doclink("max heap size", "#glossary-gc-max-heap-size").a(": ").a(maxHeapValue).a(")").println(); + l().a(" - ").a("Assertions: ").a(RuntimeAssertionsSupport.singleton().getDefaultAssertionStatus() ? "enabled" : "disabled").a(" (class-specific config may apply), system assertions: ") + .a(RuntimeAssertionsSupport.singleton().getDefaultSystemAssertionStatus() ? "enabled" : "disabled").println(); + printExperimentalOptions(classLoader); printResourceInfo(); } @@ -278,7 +287,7 @@ private boolean getSystemAssertionStatus() { private void printFeatures(List features) { int numFeatures = features.size(); if (numFeatures > 0) { - l().a(" ").a(numFeatures).a(" ").doclink("user-specific feature(s)", "#glossary-user-specific-features").a(":").println(); + l().a(" - ").a(numFeatures).a(" ").doclink("user-specific feature(s)", "#glossary-user-specific-features").a(":").println(); features.sort(Comparator.comparing(a -> a.getClass().getName())); for (Feature feature : features) { printFeature(l(), feature); @@ -287,7 +296,7 @@ private void printFeatures(List features) { } private static void printFeature(DirectPrinter printer, Feature feature) { - printer.a(" - "); + printer.a(" - "); String name = feature.getClass().getName(); String url = feature.getURL(); if (url != null) {