Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GR-36671] [GR-35917] Re-introduce JDK8OrEarlier/JDK11OrLater and extend build output. #4277

Merged
merged 3 commits into from
Jan 29, 2022
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
40 changes: 22 additions & 18 deletions docs/reference-manual/native-image/BuildOutput.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ GraalVM Native Image: Generating 'helloworld'...
13.57MB in total
--------------------------------------------------------------------------------
Top 10 packages in code area: Top 10 object types in image heap:
606.23KB java.util 1.64MB byte[] for general heap data
282.34KB java.lang 715.56KB java.lang.String
222.47KB java.util.regex 549.46KB java.lang.Class
219.55KB java.text 451.79KB byte[] for java.lang.String
193.17KB com.oracle.svm.jni 363.23KB java.util.HashMap$Node
149.80KB java.util.concurrent 192.00KB java.util.HashMap$Node[]
118.07KB java.math 139.83KB java.lang.String[]
103.60KB com.oracle.svm.core.reflect 139.04KB char[]
97.83KB sun.text.normalizer 130.59KB j.u.c.ConcurrentHashMap$Node
88.78KB c.oracle.svm.core.genscavenge 103.92KB s.u.l.LocaleObjec~e$CacheEntry
... 111 additional packages ... 723 additional object types
607.28KB java.util 862.66KB byte[] for general heap data
288.63KB java.lang 834.02KB byte[] for code metadata
223.34KB java.util.regex 723.00KB java.lang.String
220.45KB java.text 534.05KB java.lang.Class
194.21KB com.oracle.svm.jni 457.63KB byte[] for java.lang.String
153.69KB java.util.concurrent 363.75KB java.util.HashMap$Node
118.78KB java.math 192.70KB java.util.HashMap$Node[]
99.00KB com.oracle.svm.core.reflect 140.03KB java.lang.String[]
98.21KB sun.text.normalizer 139.04KB char[]
89.95KB c.oracle.svm.core.genscavenge 132.78KB c.o.s.c.h.DynamicHubCompanion
... 112 additional packages ... 734 additional object types
(use GraalVM Dashboard to see all)
--------------------------------------------------------------------------------
0.9s (5.6% of total time) in 17 GCs | Peak RSS: 3.22GB | CPU load: 10.87
Expand Down Expand Up @@ -114,24 +114,28 @@ Debug info is also generated as part of this stage (if requested).

#### <a name="glossary-code-area"></a>Code Area
The code area contains machine code produced by the Graal compiler for all reachable methods.
Therefore, reducing the number of reachable methods also reduces the size of the code area.
Therefore, reducing the number of [reachable methods](#glossary-reachability) also reduces the size of the code area.

#### <a name="glossary-image-heap"></a>Image Heap
The image heap contains reachable objects such as static data, classes initialized at run-time, and `byte[]` for different purposes.

##### <a name="glossary-general-heap-data"></a>General Heap Data Stored in `byte[]`
The total size of all `byte[]` objects that are neither used for `java.lang.String`, nor [graph encodings](#glossary-graph-encodings), nor [method metadata](#glossary-method-metadata).
This typically dominates
The total size of all `byte[]` objects that are neither used for `java.lang.String`, nor [code metadata](#glossary-code-metadata), nor [method metadata](#glossary-method-metadata), nor [graph encodings](#glossary-graph-encodings).
Therefore, this can also include `byte[]` objects from application code.

##### <a name="glossary-graph-encodings"></a>Graph Encodings Stored in `byte[]`
The total size of all `byte[]` objects used for graph encodings.
These encodings are a result of [runtime compiled methods](#glossary-runtime-methods).
Therefore, reducing the number of such methods also reduces the size of corresponding graph encodings.
##### <a name="glossary-code-metadata"></a>Code Metadata Stored in `byte[]`
The total size of all `byte[]` objects used for metadata for the [code area](#glossary-code-area).
Therefore, reducing the number of [reachable methods](#glossary-reachability) also reduces the size of this metadata.

##### <a name="glossary-method-metadata"></a>Method Metadata Stored in `byte[]`
The total size of all `byte[]` objects used for method metadata, a type of reflection metadata.
To reduce the amount of method metadata, reduce the number of [classes registered for reflection](#glossary-reflection-classes).

##### <a name="glossary-graph-encodings"></a>Graph Encodings Stored in `byte[]`
The total size of all `byte[]` objects used for graph encodings.
These encodings are a result of [runtime compiled methods](#glossary-runtime-methods).
Therefore, reducing the number of such methods also reduces the size of corresponding graph encodings.

#### <a name="glossary-debug-info"></a>Debug Info
The total size of generated debug information (if enabled).

Expand Down
1 change: 1 addition & 0 deletions substratevm/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ This changelog summarizes major changes to GraalVM Native Image.

## Version 22.1.0
* (GR-35898) Improved handling of static synchronized methods: the lock is no longer stored in the secondary monitor map, but in the mutable DynamicHubCompanion object.
* Remove support for JDK8. As a result, `JDK8OrEarlier` and `JDK11OrLater` have been deprecated and will be removed in a future release.

## Version 22.0.0
* (GR-33930) Decouple HostedOptionParser setup from classpath/modulepath scanning (use ServiceLoader for collecting options).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ public HostedImageCodeInfo getHostedImageCodeInfo() {
return hostedImageCodeInfo;
}

public long getTotalByteArraySize() {
return codeInfoIndex.length + codeInfoEncodings.length + referenceMapEncoding.length + frameInfoEncodings.length;
}

/**
* Pure-hosted {@link CodeInfo} to collect and persist image code metadata in
* {@link ImageCodeInfo} and provide accesses during image generation.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.svm.core.jdk;

import java.util.function.BooleanSupplier;

@Deprecated(since = "22.1.0", forRemoval = true)
public class JDK11OrLater implements BooleanSupplier {
@Override
public boolean getAsBoolean() {
return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.svm.core.jdk;

import java.util.function.BooleanSupplier;

@Deprecated(since = "22.1.0", forRemoval = true)
public class JDK8OrEarlier implements BooleanSupplier {
@Override
public boolean getAsBoolean() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import com.oracle.svm.core.SubstrateOptions;
import com.oracle.svm.core.VM;
import com.oracle.svm.core.annotate.AutomaticFeature;
import com.oracle.svm.core.code.CodeInfoTable;
import com.oracle.svm.core.option.HostedOptionValues;
import com.oracle.svm.core.reflect.MethodMetadataDecoder;
import com.oracle.svm.core.util.VMError;
Expand Down Expand Up @@ -489,6 +490,9 @@ private Map<String, Long> calculateHeapBreakdown(Collection<ObjectInfo> heapObje
long remainingBytes = byteArraySize;
classNameToSize.put(BREAKDOWN_BYTE_ARRAY_PREFIX + "java.lang.String", stringByteLength);
remainingBytes -= stringByteLength;
long codeInfoSize = CodeInfoTable.getImageCodeCache().getTotalByteArraySize();
classNameToSize.put(BREAKDOWN_BYTE_ARRAY_PREFIX + linePrinter.asDocLink("code metadata", "#glossary-code-metadata"), codeInfoSize);
remainingBytes -= codeInfoSize;
long metadataByteLength = ImageSingletons.lookup(MethodMetadataDecoder.class).getMetadataByteLength();
if (metadataByteLength > 0) {
classNameToSize.put(BREAKDOWN_BYTE_ARRAY_PREFIX + linePrinter.asDocLink("method metadata", "#glossary-method-metadata"), metadataByteLength);
Expand All @@ -515,7 +519,7 @@ public void printEpilog(String imageName, NativeImageGenerator generator, boolea
l().a(" ").link(p).dim().a(" (").a(artifactType.name().toLowerCase()).a(")").reset().flushln();
}
});
if (ImageBuildStatistics.Options.CollectImageBuildStatistics.getValue(parsedHostedOptions)) {
if (generator.getBigbang() != null && ImageBuildStatistics.Options.CollectImageBuildStatistics.getValue(parsedHostedOptions)) {
l().a(" ").link(reportImageBuildStatistics(imageName, generator.getBigbang())).flushln();
}
l().a(" ").link(reportBuildArtifacts(imageName, generator.getBuildArtifacts())).flushln();
Expand Down