8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
Summary: AArch64 VM_Version::features and flags are correspondingly set in CPUFeature and Flags
Reviewed-by: kvn, fyang
--- a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp Wed Apr 04 14:51:26 2018 +0200
+++ b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp Fri Mar 30 13:39:43 2018 -0400
@@ -680,6 +680,20 @@
#define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \
volatile_nonstatic_field(JavaFrameAnchor, _last_Java_fp, intptr_t*)
+#define VM_INT_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) \
+ declare_constant(VM_Version::CPU_FP) \
+ declare_constant(VM_Version::CPU_ASIMD) \
+ declare_constant(VM_Version::CPU_EVTSTRM) \
+ declare_constant(VM_Version::CPU_AES) \
+ declare_constant(VM_Version::CPU_PMULL) \
+ declare_constant(VM_Version::CPU_SHA1) \
+ declare_constant(VM_Version::CPU_SHA2) \
+ declare_constant(VM_Version::CPU_CRC32) \
+ declare_constant(VM_Version::CPU_LSE) \
+ declare_constant(VM_Version::CPU_STXR_PREFETCH) \
+ declare_constant(VM_Version::CPU_A53MAC) \
+ declare_constant(VM_Version::CPU_DMB_ATOMICS)
+
#endif
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot.aarch64/src/jdk/vm/ci/hotspot/aarch64/AArch64HotSpotJVMCIBackendFactory.java Wed Apr 04 14:51:26 2018 +0200
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot.aarch64/src/jdk/vm/ci/hotspot/aarch64/AArch64HotSpotJVMCIBackendFactory.java Fri Mar 30 13:39:43 2018 -0400
@@ -46,11 +46,72 @@
protected EnumSet<AArch64.CPUFeature> computeFeatures(@SuppressWarnings("unused") AArch64HotSpotVMConfig config) {
// Configure the feature set using the HotSpot flag settings.
EnumSet<AArch64.CPUFeature> features = EnumSet.noneOf(AArch64.CPUFeature.class);
+
+ if ((config.vmVersionFeatures & config.aarch64FP) != 0) {
+ features.add(AArch64.CPUFeature.FP);
+ }
+ if ((config.vmVersionFeatures & config.aarch64ASIMD) != 0) {
+ features.add(AArch64.CPUFeature.ASIMD);
+ }
+ if ((config.vmVersionFeatures & config.aarch64EVTSTRM) != 0) {
+ features.add(AArch64.CPUFeature.EVTSTRM);
+ }
+ if ((config.vmVersionFeatures & config.aarch64AES) != 0) {
+ features.add(AArch64.CPUFeature.AES);
+ }
+ if ((config.vmVersionFeatures & config.aarch64PMULL) != 0) {
+ features.add(AArch64.CPUFeature.PMULL);
+ }
+ if ((config.vmVersionFeatures & config.aarch64SHA1) != 0) {
+ features.add(AArch64.CPUFeature.SHA1);
+ }
+ if ((config.vmVersionFeatures & config.aarch64SHA2) != 0) {
+ features.add(AArch64.CPUFeature.SHA2);
+ }
+ if ((config.vmVersionFeatures & config.aarch64CRC32) != 0) {
+ features.add(AArch64.CPUFeature.CRC32);
+ }
+ if ((config.vmVersionFeatures & config.aarch64LSE) != 0) {
+ features.add(AArch64.CPUFeature.LSE);
+ }
+ if ((config.vmVersionFeatures & config.aarch64STXR_PREFETCH) != 0) {
+ features.add(AArch64.CPUFeature.STXR_PREFETCH);
+ }
+ if ((config.vmVersionFeatures & config.aarch64A53MAC) != 0) {
+ features.add(AArch64.CPUFeature.A53MAC);
+ }
+ if ((config.vmVersionFeatures & config.aarch64DMB_ATOMICS) != 0) {
+ features.add(AArch64.CPUFeature.DMB_ATOMICS);
+ }
+
return features;
}
protected EnumSet<AArch64.Flag> computeFlags(@SuppressWarnings("unused") AArch64HotSpotVMConfig config) {
EnumSet<AArch64.Flag> flags = EnumSet.noneOf(AArch64.Flag.class);
+
+ if (config.useBarriersForVolatile) {
+ flags.add(AArch64.Flag.UseBarriersForVolatile);
+ }
+ if (config.useCRC32) {
+ flags.add(AArch64.Flag.UseCRC32);
+ }
+ if (config.useNeon) {
+ flags.add(AArch64.Flag.UseNeon);
+ }
+ if (config.useSIMDForMemoryOps) {
+ flags.add(AArch64.Flag.UseSIMDForMemoryOps);
+ }
+ if (config.avoidUnalignedAccesses) {
+ flags.add(AArch64.Flag.AvoidUnalignedAccesses);
+ }
+ if (config.useLSE) {
+ flags.add(AArch64.Flag.UseLSE);
+ }
+ if (config.useBlockZeroing) {
+ flags.add(AArch64.Flag.UseBlockZeroing);
+ }
+
return flags;
}
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot.aarch64/src/jdk/vm/ci/hotspot/aarch64/AArch64HotSpotVMConfig.java Wed Apr 04 14:51:26 2018 +0200
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot.aarch64/src/jdk/vm/ci/hotspot/aarch64/AArch64HotSpotVMConfig.java Fri Mar 30 13:39:43 2018 -0400
@@ -39,4 +39,35 @@
final boolean linuxOs = System.getProperty("os.name", "").startsWith("Linux");
final boolean useCompressedOops = getFlag("UseCompressedOops", Boolean.class);
+
+ // CPU Capabilities
+
+ /*
+ * These flags are set based on the corresponding command line flags.
+ */
+ final boolean useBarriersForVolatile = getFlag("UseBarriersForVolatile", Boolean.class);
+ final boolean useCRC32 = getFlag("UseCRC32", Boolean.class);
+ final boolean useNeon = getFlag("UseNeon", Boolean.class);
+ final boolean useSIMDForMemoryOps = getFlag("UseSIMDForMemoryOps", Boolean.class);
+ final boolean avoidUnalignedAccesses = getFlag("AvoidUnalignedAccesses", Boolean.class);
+ final boolean useLSE = getFlag("UseLSE", Boolean.class);
+ final boolean useBlockZeroing = getFlag("UseBlockZeroing", Boolean.class);
+
+ final long vmVersionFeatures = getFieldValue("Abstract_VM_Version::_features", Long.class, "uint64_t");
+
+ /*
+ * These flags are set if the corresponding support is in the hardware.
+ */
+ final long aarch64FP = getConstant("VM_Version::CPU_FP", Long.class);
+ final long aarch64ASIMD = getConstant("VM_Version::CPU_ASIMD", Long.class);
+ final long aarch64EVTSTRM = getConstant("VM_Version::CPU_EVTSTRM", Long.class);
+ final long aarch64AES = getConstant("VM_Version::CPU_AES", Long.class);
+ final long aarch64PMULL = getConstant("VM_Version::CPU_PMULL", Long.class);
+ final long aarch64SHA1 = getConstant("VM_Version::CPU_SHA1", Long.class);
+ final long aarch64SHA2 = getConstant("VM_Version::CPU_SHA2", Long.class);
+ final long aarch64CRC32 = getConstant("VM_Version::CPU_CRC32", Long.class);
+ final long aarch64LSE = getConstant("VM_Version::CPU_LSE", Long.class);
+ final long aarch64STXR_PREFETCH = getConstant("VM_Version::CPU_STXR_PREFETCH", Long.class);
+ final long aarch64A53MAC = getConstant("VM_Version::CPU_A53MAC", Long.class);
+ final long aarch64DMB_ATOMICS = getConstant("VM_Version::CPU_DMB_ATOMICS", Long.class);
}