Skip to content

Commit

Permalink
[GR-44722] Adjust version strings and properties.
Browse files Browse the repository at this point in the history
PullRequest: graal/14132
  • Loading branch information
fniephaus committed Mar 28, 2023
2 parents 54ca5bf + 924c91c commit 1ec172b
Show file tree
Hide file tree
Showing 18 changed files with 213 additions and 159 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2023, 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 @@ -197,20 +197,15 @@ public boolean isLatestJVMCI() {

@Override
public String getName() {
String compilerConfigurationName = getCompilerConfigurationName();
assert compilerConfigurationName != null;
String suffix;
if (compilerConfigurationName == null) {
suffix = "Unknown";
} else if (compilerConfigurationName.equals("community")) {
suffix = "CE";
} else if (compilerConfigurationName.equals("enterprise")) {
suffix = "EE";
} else {
assert false : "unexpected compiler configuration name: " + compilerConfigurationName;
suffix = compilerConfigurationName;
}
return "GraalVM " + suffix;
String compilerConfigurationName = String.valueOf(getCompilerConfigurationName());
return switch (compilerConfigurationName) {
case "community" -> "GraalVM CE";
case "enterprise" -> "Oracle GraalVM";
default -> {
assert false : "unexpected compiler configuration name: " + compilerConfigurationName;
yield "GraalVM " + compilerConfigurationName;
}
};
}

/**
Expand Down
84 changes: 40 additions & 44 deletions docs/reference-manual/native-image/BuildOutput.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,55 +20,55 @@ Below is the example output when building a native executable of the `HelloWorld
================================================================================
GraalVM Native Image: Generating 'helloworld' (executable)...
================================================================================
[1/8] Initializing... (3.3s @ 0.25GB)
Version info: 'GraalVM dev Java 19+36-jvmci-23.0-b01 CE'
Java version info: '19+36-jvmci-23.0-b01'
Graal compiler: optimization level: '0', target machine: 'x86-64-v3'
C compiler: gcc (linux, x86_64, 11.3.0)
[1/8] Initializing... (3.3s @ 0.15GB)
Java version: 17.0.7+4, vendor: GraalVM Community
Graal compiler: optimization level: '2', target machine: 'x86-64-v3'
C compiler: gcc (linux, x86_64, 12.2.0)
Garbage collector: Serial GC (max heap size: 80% of RAM)
[2/8] Performing analysis... [****] (6.2s @ 0.47GB)
2,880 (71.50%) of 4,028 types reachable
3,519 (51.06%) of 6,892 fields reachable
13,339 (45.11%) of 29,570 methods reachable
879 types, 0 fields, and 356 methods registered for reflection
57 types, 56 fields, and 52 methods registered for JNI access
[2/8] Performing analysis... [***] (6.4s @ 0.83GB)
2,905 (71.75%) of 4,049 types reachable
3,534 (51.13%) of 6,912 fields reachable
13,234 (43.97%) of 30,095 methods reachable
901 types, 0 fields, and 344 methods registered for reflection
58 types, 58 fields, and 52 methods registered for JNI access
4 native libraries: dl, pthread, rt, z
[3/8] Building universe... (1.1s @ 2.26GB)
[4/8] Parsing methods... [*] (1.0s @ 2.76GB)
[5/8] Inlining methods... [***] (0.8s @ 0.99GB)
[6/8] Compiling methods... [***] (6.4s @ 4.86GB)
[7/8] Layouting methods... [**] (4.2s @ 3.98GB)
[8/8] Creating image... [*] (4.0s @ 2.04GB)
4.52MB (22.97%) for code area: 7,470 compilation units
7.06MB (35.87%) for image heap: 101,764 objects and 5 resources
7.52MB (38.24%) for debug info generated in 1.8s
590.19KB ( 2.93%) for other data
19.68MB in total
[3/8] Building universe... (1.2s @ 0.34GB)
[4/8] Parsing methods... [*] (0.8s @ 0.84GB)
[5/8] Inlining methods... [***] (0.5s @ 1.19GB)
[6/8] Compiling methods... [***] (5.6s @ 0.84GB)
[7/8] Layouting methods... [*] (1.1s @ 1.03GB)
[8/8] Creating image... [**] (3.9s @ 2.14GB)
4.42MB (23.20%) for code area: 7,526 compilation units
8.18MB (42.92%) for image heap: 107,049 objects and 5 resources
5.87MB (30.78%) for debug info generated in 1.2s
605.20KB ( 3.10%) for other data
19.06MB in total
--------------------------------------------------------------------------------
Top 10 origins of code area: Top 10 object types in image heap:
3.43MB java.base 1.01MB byte[] for code metadata
760.98KB svm.jar (Native Image) 1000.72KB java.lang.String
102.06KB java.logging 884.18KB byte[] for general heap data
48.03KB org.graalvm.nativeimage.base 686.91KB byte[] for java.lang.String
40.49KB jdk.proxy1 659.87KB java.lang.Class
38.23KB jdk.proxy3 247.50KB c.o.s.c.h.DynamicHubCompanion
25.73KB jdk.internal.vm.ci 239.25KB java.lang.Object[]
23.55KB org.graalvm.sdk 226.08KB java.util.HashMap$Node
11.10KB jdk.proxy2 173.15KB java.lang.String[]
8.10KB jdk.internal.vm.compiler 163.22KB j.u.c.ConcurrentHashMap$Node
1.39KB for 2 more origins 1.70MB for 808 more object types
3.37MB java.base 1008.75KB byte[] for code metadata
792.12KB svm.jar (Native Image) 995.63KB java.lang.String
112.32KB java.logging 887.47KB byte[] for general heap data
62.07KB org.graalvm.nativeimage.base 685.47KB byte[] for java.lang.String
24.15KB jdk.internal.vm.ci 670.38KB java.lang.Class
23.14KB org.graalvm.sdk 490.13KB java.util.HashMap$Node
6.11KB jdk.internal.vm.compiler 297.43KB byte[] for embedded resources
1.35KB jdk.proxy1 249.65KB c.o.s.c.h.DynamicHubCompanion
1.27KB jdk.proxy3 195.52KB java.util.HashMap$Node[]
1.18KB jdk.localedata 171.84KB java.lang.String[]
594.00B for 2 more packages 1.68MB for 824 more object types
--------------------------------------------------------------------------------
Recommendations:
HEAP: Set max heap for improved and more predictable memory usage.
CPU: Enable more CPU features with '-march=native' for improved performance.
--------------------------------------------------------------------------------
0.5s (1.8% of total time) in 24 GCs | Peak RSS: 5.62GB | CPU load: 8.92
0.5s (2.0% of total time) in 17 GCs | Peak RSS: 3.29GB | CPU load: 10.97
--------------------------------------------------------------------------------
Produced artifacts:
/home/janedoe/helloworld/helloworld (executable, debug_info)
/home/janedoe/helloworld/helloworld (executable)
/home/janedoe/helloworld/helloworld.debug (debug_info)
/home/janedoe/helloworld/sources (debug_info)
================================================================================
Finished generating 'helloworld' in 27.4s.
Finished generating 'helloworld' in 23.3s.
```
## Build Stages
Expand All @@ -79,14 +79,10 @@ In this stage, the Native Image build process is set up and [`Features`](https:/
#### <a name="glossary-imagekind"></a>Native Image Kind
By default, Native Image generates *executables* but it can also generate [*native shared libraries*](InteropWithNativeCode.md) and [*static executables*](guides/build-static-and-mostly-static-executable.md).
#### <a name="glossary-version-info"></a>Version Info
The version info of the Native Image process.
This string is also used for the `java.vm.version` property within the generated native binary.
Please report this version info when you [file issues](https://github.com/oracle/graal/issues/new).
#### <a name="glossary-java-version-info"></a>Java Version Info
The Java version info (`java.runtime.version` property) of the Native Image build process.
Please report this version info when you [file issues](https://github.com/oracle/graal/issues/new).
#### <a name="glossary-java-info"></a>Java Version Info
The Java version and vendor of the Native Image process.
Both are also used for the `java.vm.version` and `java.vm.vendor` properties within the generated native binary.
Please report version and vendor when you [file issues](https://github.com/oracle/graal/issues/new).
#### <a name="glossary-graal-compiler"></a>Graal Compiler
The selected optimization level and targeted machine type used by the Graal compiler.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"name",
"graalvm_version",
"java_version",
"vendor",
"graal_compiler",
"c_compiler",
"garbage_collector"
Expand All @@ -32,12 +33,17 @@
"graalvm_version": {
"type": "string",
"default": "",
"title": "The GraalVM Native Image version. This value is also used for the 'java.vm.version' property within the generated image"
"title": "The GraalVM Native Image version. Deprecated: Please use java_version and vendor instead."
},
"java_version": {
"type": ["string", "null"],
"type": "string",
"default": null,
"title": "The Java version of the Native Image build process. This value is also used for the 'java.vm.version' property within the generated image"
},
"vendor": {
"type": "string",
"default": null,
"title": "The Java version of the Native Image build process (or null if not available)"
"title": "The vendor of the VM of the generated image. This value is also used for the 'java.vm.vendor' property within the generated image"
},
"graal_compiler": {
"type": "object",
Expand Down Expand Up @@ -76,13 +82,14 @@
"examples": [
{
"name": "helloworld",
"graalvm_version": "GraalVM 22.2.0-dev Java 17 EE",
"graalvm_version": "GraalVM CE 17.0.7+4",
"graal_compiler": {
"pgo": false,
"march": "x86-64-v3",
"optimization_level": "0"
},
"java_version": "17.0.4+5-jvmci-22.2-b03",
"java_version": "17.0.7+4",
"vendor": "GraalVM Community",
"c_compiler": "gcc (linux, x86_64, 9.3.0)",
"garbage_collector": "Serial GC"
}
Expand Down Expand Up @@ -506,12 +513,13 @@
{
"general_info": {
"name": "helloworld",
"graalvm_version": "GraalVM 22.2.0-dev Java 17 CE",
"graalvm_version": "GraalVM CE 17.0.7+4",
"graal_compiler": {
"march": "x86-64-v3",
"optimization_level": "0"
},
"java_version": "17.0.4+5-jvmci-22.2-b03",
"java_version": "17.0.7+4",
"vendor": "GraalVM Community",
"c_compiler": "gcc (linux, x86_64, 9.3.0)",
"garbage_collector": "Serial GC"
},
Expand Down Expand Up @@ -574,12 +582,13 @@
{
"general_info": {
"name": "helloworld",
"graalvm_version": "GraalVM 22.2.0-dev Java 17 CE",
"graalvm_version": "GraalVM CE 17.0.7+4",
"graal_compiler": {
"march": "x86-64-v3",
"optimization_level": "0"
},
"java_version": null,
"java_version": "17.0.7+4",
"vendor": "GraalVM Community",
"c_compiler": null,
"garbage_collector": "Serial GC"
},
Expand Down
28 changes: 7 additions & 21 deletions sdk/mx.sdk/mx_sdk_vm_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,11 @@ def unicode_utf8(string):


_graalvm_base_name = 'GraalVM'

_registered_graalvm_components = {}
_project_name = 'graal'

default_components = []

graalvm_version_regex = re.compile(r'.*\n.*\n[0-9a-zA-Z()\- ]+GraalVM[a-zA-Z_ ]+(?P<graalvm_version>[0-9a-z_\-.+]+) \(build [0-9a-zA-Z\-.+]+, mixed mode[a-z, ]*\)')

_registered_graalvm_components = {}
_env_tests = []

_project_name = 'graal'

mx.add_argument('--base-dist-name', help='Sets the name of the GraalVM base image ( for complete, ruby ... images), default to "base"', default='base')

Expand Down Expand Up @@ -494,7 +489,7 @@ def _add_link(_dest, _target, _component=None, _dest_base_name=None):
if stage1:
# 1. we do not want a GraalVM to be used as base-JDK
# 2. we don't need to check if the base JDK is JVMCI-enabled, since JVMCIVersionCheck takes care of that when the GraalVM compiler is a registered component
check_versions(_src_jdk, graalvm_version_regex=graalvm_version_regex, expect_graalvm=False, check_jvmci=False)
check_versions(_src_jdk, expect_graalvm=False, check_jvmci=False)

# Add base JDK
if mx.get_os() == 'darwin':
Expand Down Expand Up @@ -3600,10 +3595,9 @@ def _str_to_bool(val):
return val


def check_versions(jdk, graalvm_version_regex, expect_graalvm, check_jvmci):
def check_versions(jdk, expect_graalvm, check_jvmci):
"""
:type jdk: mx.JDKConfig | str
:type graalvm_version_regex: typing.Pattern
:type expect_graalvm: bool
:type check_jvmci: bool
"""
Expand All @@ -3623,14 +3617,8 @@ def check_versions(jdk, graalvm_version_regex, expect_graalvm, check_jvmci):
if os.environ.get('JDK_VERSION_CHECK', None) != 'ignore' and (jdk_version <= mx.VersionSpec('1.8') or mx.VersionSpec('9') <= jdk_version < mx.VersionSpec('11')):
mx.abort("GraalVM requires >=JDK11 as base-JDK, while the selected JDK ('{}') is '{}':\n{}\n\n{}.".format(jdk.home, jdk_version, out, check_env))

if os.environ.get('GRAALVM_VERSION_CHECK', None) != 'ignore':
match = graalvm_version_regex.match(out)
if expect_graalvm and match is None:
mx.abort("'{}' is not a GraalVM. Its version string:\n{}\ndoes not match:\n{}".format(jdk.home, out, graalvm_version_regex.pattern))
elif expect_graalvm and match.group('graalvm_version') != _suite.release_version():
mx.abort("'{}' has a wrong GraalVM version:\n{}\nexpected:\n{}".format(jdk.home, match.group('graalvm_version'), _suite.release_version()))
elif not expect_graalvm and match:
mx.abort("GraalVM cannot be built using a GraalVM as base-JDK ('{}').\n{}.".format(jdk.home, check_env))
if not expect_graalvm and "GraalVM" in out:
mx.abort("GraalVM cannot be built using a GraalVM as base-JDK ('{}').\n{}.".format(jdk.home, check_env))


def print_graalvm_vm_name(args):
Expand All @@ -3654,9 +3642,7 @@ def graalvm_vendor_version(graalvm_dist):
:type jdk_home: str
:rtype str:
"""
vendor_version = '{} {}'.format(graalvm_dist.base_name, graalvm_dist.vm_config_name.upper()) if graalvm_dist.vm_config_name else graalvm_dist.base_name
vendor_version += ' {}'.format(graalvm_version())
return vendor_version
return 'Oracle GraalVM' if get_graalvm_edition() == 'ee' else 'GraalVM CE'


# GR-37542 current debug info on darwin bloats binary (stripping to a separate .dSYM folder is not implemented) and
Expand Down
1 change: 1 addition & 0 deletions substratevm/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ This changelog summarizes major changes to GraalVM Native Image.
* (GR-44110) Native Image now targets `x86-64-v3` by default on AMD64 and supports a new `-march` option. Use `-march=compatibility` for best compatibility (previous default) or `-march=native` for best performance if the native executable is deployed on the same machine or on a machine with the same CPU features. To list all available machine types, use `-march=list`.
* (GR-43971) Add native-image option `-E<env-var-key>[=<env-var-value>]` and support environment variable capturing in bundles. Previously almost all environment variables were available in the builder. To temporarily revert back to the old behaviour, env setting `NATIVE_IMAGE_DEPRECATED_BUILDER_SANITATION=true` can be used. The old behaviour will be removed in a future release.
* (GR-43382) The build output now includes a section with recommendations that help you get the best out of Native Image.
* (GR-44722) The output of `native-image --version` and various Java properties (e.g. `java.vm.version`) have been aligned with the OpenJDK. To distinguish between GraalVM CE, Oracle GraalVM, and GraalVM distributions from other vendors, please refer to `java.vm.vendor`.

## Version 22.3.0
* (GR-35721) Remove old build output style and the `-H:±BuildOutputUseNewStyle` option.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2023, 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 All @@ -24,25 +24,47 @@
*/
package com.oracle.svm.core;

import org.graalvm.nativeimage.ImageSingletons;
import org.graalvm.nativeimage.Platform;
import org.graalvm.nativeimage.Platforms;
import org.graalvm.nativeimage.impl.ImageSingletonsSupport;

public final class VM {

public final String info;
public final String version;
public final String vendor;
public final String vendorUrl;
public final String runtimeName;
public final String vendorVersion;
public final String supportURL;

@Platforms(Platform.HOSTED_ONLY.class)
public VM() {
String versionStr = System.getProperty("org.graalvm.version", "Unknown Version");
String edition = System.getProperty("org.graalvm.config", "CE");
version = String.format("GraalVM %s Java %s %s", versionStr, Runtime.version(), edition);
vendor = System.getProperty("org.graalvm.vendor", "Oracle Corporation");
vendorUrl = System.getProperty("org.graalvm.vendorurl", "https://www.graalvm.org/");
runtimeName = System.getProperty("java.runtime.name", "Unknown Runtime Environment");
public VM(String vmInfo) {
info = vmInfo;
supportURL = System.getProperty("org.graalvm.supporturl", "https://graalvm.org/native-image/error-report/");
version = stripJVMCISuffix(System.getProperty("java.runtime.version"));
vendor = System.getProperty("org.graalvm.vendor", "GraalVM Community");
vendorUrl = System.getProperty("org.graalvm.vendorurl", "https://www.graalvm.org/");
vendorVersion = System.getProperty("org.graalvm.vendorversion", "GraalVM CE");
}

@Platforms(Platform.HOSTED_ONLY.class)
public static VM getErrorReportingInstance() {
if (ImageSingletonsSupport.isInstalled() && ImageSingletons.contains(VM.class)) {
return ImageSingletons.lookup(VM.class);
} else {
// create a fall back instance
return new VM(System.getProperty("java.vm.info", ""));
}
}

@Platforms(Platform.HOSTED_ONLY.class)
private static String stripJVMCISuffix(String javaRuntimeVersion) {
int jvmciIndex = javaRuntimeVersion.indexOf("-jvmci");
if (jvmciIndex >= 0) {
return javaRuntimeVersion.substring(0, jvmciIndex);
} else {
return javaRuntimeVersion;
}
}
}
Loading

0 comments on commit 1ec172b

Please sign in to comment.