Skip to content

Commit 3f6c059

Browse files
committed
[GR-60081] Update aarch64 to use the 8.1-a instruction set by default.
PullRequest: graal/19423
2 parents 320d02e + 6b14fdb commit 3f6c059

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

substratevm/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ At runtime, premain runtime options are set along with main class' arguments in
1616
* (GR-58383) The length of the printed stack trace when using `-XX:MissingRegistrationReportingMode=Warn` can now be set with `-XX:MissingRegistrationWarnContextLines=` and its default length is now 8.
1717
* (GR-58914) `ActiveProcessorCount` must be set at isolate or VM creation time.
1818
* (GR-59326) Ensure builder ForkJoin commonPool parallelism always respects NativeImageOptions.NumberOfThreads.
19+
* (GR-60081) Native Image now targets `armv8.1-a` by default on AArch64. Use `-march=compatibility` for best compatibility 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`.
1920

2021
## GraalVM for JDK 23 (Internal Version 24.1.0)
2122
* (GR-51520) The old class initialization strategy, which was deprecated in GraalVM for JDK 22, is removed. The option `StrictImageHeap` no longer has any effect.

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageOptions.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public class NativeImageOptions {
8686
public static final String MICRO_ARCHITECTURE_LIST = "list";
8787

8888
@APIOption(name = "-march")//
89-
@Option(help = "Generate instructions for a specific machine type. Defaults to 'x86-64-v3' on AMD64 and 'armv8-a' on AArch64. " +
89+
@Option(help = "Generate instructions for a specific machine type. Defaults to 'x86-64-v3' on AMD64 and 'armv8.1-a' on AArch64. " +
9090
"Use -march=" + MICRO_ARCHITECTURE_COMPATIBILITY + " for best compatibility, or -march=" + MICRO_ARCHITECTURE_NATIVE +
9191
" for best performance if the native executable is deployed on the same machine or on a machine with the same CPU features. " +
9292
"To list all available machine types, use -march=" + MICRO_ARCHITECTURE_LIST + ".", type = User)//

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/util/CPUType.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static String getSelectedOrDefaultMArch() {
8080
} else if (Platform.includedIn(Platform.AMD64.class)) {
8181
return CPUTypeAMD64.getDefaultName(false);
8282
} else if (Platform.includedIn(Platform.AARCH64.class)) {
83-
return CPUTypeAArch64.getDefaultName();
83+
return CPUTypeAArch64.getDefaultName(false);
8484
} else if (Platform.includedIn(Platform.RISCV64.class)) {
8585
return CPUTypeRISCV64.getDefaultName();
8686
} else {

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/util/CPUTypeAArch64.java

+12-3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import com.oracle.svm.core.option.SubstrateOptionsParser;
4646
import com.oracle.svm.core.util.UserError;
4747
import com.oracle.svm.hosted.NativeImageOptions;
48+
import com.oracle.svm.util.LogUtils;
4849
import com.oracle.svm.util.StringUtil;
4950

5051
import jdk.vm.ci.aarch64.AArch64;
@@ -113,15 +114,23 @@ public EnumSet<CPUFeature> getFeatures() {
113114
}
114115
}
115116

116-
public static String getDefaultName() {
117-
return ARMV8_A.getName();
117+
public static String getDefaultName(boolean printFallbackWarning) {
118+
if (NATIVE.getFeatures().containsAll(ARMV8_1_A.getFeatures())) {
119+
return ARMV8_1_A.getName();
120+
} else {
121+
if (printFallbackWarning) {
122+
LogUtils.warning("The host machine does not support all features of '%s'. Falling back to '%s' for best compatibility.",
123+
ARMV8_1_A.getName(), SubstrateOptionsParser.commandArgument(NativeImageOptions.MicroArchitecture, COMPATIBILITY.getName()));
124+
}
125+
return COMPATIBILITY.getName();
126+
}
118127
}
119128

120129
@Platforms(Platform.HOSTED_ONLY.class)
121130
public static EnumSet<CPUFeature> getSelectedFeatures() {
122131
String value = NativeImageOptions.MicroArchitecture.getValue();
123132
if (value == null) {
124-
value = getDefaultName();
133+
value = getDefaultName(true);
125134
}
126135
return getCPUFeaturesForArch(value);
127136
}

0 commit comments

Comments
 (0)