29 import jdk.vm.ci.aarch64.AArch64;
30 import jdk.vm.ci.code.Architecture;
31 import jdk.vm.ci.code.RegisterConfig;
32 import jdk.vm.ci.code.TargetDescription;
33 import jdk.vm.ci.code.stack.StackIntrospection;
34 import jdk.vm.ci.common.InitTimer;
35 import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider;
36 import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider;
37 import jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory;
38 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider;
39 import jdk.vm.ci.hotspot.HotSpotMetaAccessProvider;
40 import jdk.vm.ci.hotspot.HotSpotStackIntrospection;
41 import jdk.vm.ci.meta.ConstantReflectionProvider;
42 import jdk.vm.ci.runtime.JVMCIBackend;
43
44 public class AArch64HotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFactory {
45
46 protected EnumSet<AArch64.CPUFeature> computeFeatures(@SuppressWarnings("unused") AArch64HotSpotVMConfig config) {
47 // Configure the feature set using the HotSpot flag settings.
48 EnumSet<AArch64.CPUFeature> features = EnumSet.noneOf(AArch64.CPUFeature.class);
49 return features;
50 }
51
52 protected EnumSet<AArch64.Flag> computeFlags(@SuppressWarnings("unused") AArch64HotSpotVMConfig config) {
53 EnumSet<AArch64.Flag> flags = EnumSet.noneOf(AArch64.Flag.class);
54 return flags;
55 }
56
57 protected TargetDescription createTarget(AArch64HotSpotVMConfig config) {
58 final int stackFrameAlignment = 16;
59 final int implicitNullCheckLimit = 4096;
60 final boolean inlineObjects = true;
61 Architecture arch = new AArch64(computeFeatures(config), computeFlags(config));
62 return new TargetDescription(arch, true, stackFrameAlignment, implicitNullCheckLimit, inlineObjects);
63 }
64
65 protected HotSpotConstantReflectionProvider createConstantReflection(HotSpotJVMCIRuntimeProvider runtime) {
66 return new HotSpotConstantReflectionProvider(runtime);
67 }
68
69 protected RegisterConfig createRegisterConfig(AArch64HotSpotVMConfig config, TargetDescription target) {
70 return new AArch64HotSpotRegisterConfig(target, config.useCompressedOops);
71 }
72
73 protected HotSpotCodeCacheProvider createCodeCache(HotSpotJVMCIRuntimeProvider runtime, TargetDescription target, RegisterConfig regConfig) {
|
29 import jdk.vm.ci.aarch64.AArch64;
30 import jdk.vm.ci.code.Architecture;
31 import jdk.vm.ci.code.RegisterConfig;
32 import jdk.vm.ci.code.TargetDescription;
33 import jdk.vm.ci.code.stack.StackIntrospection;
34 import jdk.vm.ci.common.InitTimer;
35 import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider;
36 import jdk.vm.ci.hotspot.HotSpotConstantReflectionProvider;
37 import jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory;
38 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider;
39 import jdk.vm.ci.hotspot.HotSpotMetaAccessProvider;
40 import jdk.vm.ci.hotspot.HotSpotStackIntrospection;
41 import jdk.vm.ci.meta.ConstantReflectionProvider;
42 import jdk.vm.ci.runtime.JVMCIBackend;
43
44 public class AArch64HotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFactory {
45
46 protected EnumSet<AArch64.CPUFeature> computeFeatures(@SuppressWarnings("unused") AArch64HotSpotVMConfig config) {
47 // Configure the feature set using the HotSpot flag settings.
48 EnumSet<AArch64.CPUFeature> features = EnumSet.noneOf(AArch64.CPUFeature.class);
49
50 if ((config.vmVersionFeatures & config.aarch64FP) != 0) {
51 features.add(AArch64.CPUFeature.FP);
52 }
53 if ((config.vmVersionFeatures & config.aarch64ASIMD) != 0) {
54 features.add(AArch64.CPUFeature.ASIMD);
55 }
56 if ((config.vmVersionFeatures & config.aarch64EVTSTRM) != 0) {
57 features.add(AArch64.CPUFeature.EVTSTRM);
58 }
59 if ((config.vmVersionFeatures & config.aarch64AES) != 0) {
60 features.add(AArch64.CPUFeature.AES);
61 }
62 if ((config.vmVersionFeatures & config.aarch64PMULL) != 0) {
63 features.add(AArch64.CPUFeature.PMULL);
64 }
65 if ((config.vmVersionFeatures & config.aarch64SHA1) != 0) {
66 features.add(AArch64.CPUFeature.SHA1);
67 }
68 if ((config.vmVersionFeatures & config.aarch64SHA2) != 0) {
69 features.add(AArch64.CPUFeature.SHA2);
70 }
71 if ((config.vmVersionFeatures & config.aarch64CRC32) != 0) {
72 features.add(AArch64.CPUFeature.CRC32);
73 }
74 if ((config.vmVersionFeatures & config.aarch64LSE) != 0) {
75 features.add(AArch64.CPUFeature.LSE);
76 }
77 if ((config.vmVersionFeatures & config.aarch64STXR_PREFETCH) != 0) {
78 features.add(AArch64.CPUFeature.STXR_PREFETCH);
79 }
80 if ((config.vmVersionFeatures & config.aarch64A53MAC) != 0) {
81 features.add(AArch64.CPUFeature.A53MAC);
82 }
83 if ((config.vmVersionFeatures & config.aarch64DMB_ATOMICS) != 0) {
84 features.add(AArch64.CPUFeature.DMB_ATOMICS);
85 }
86
87 return features;
88 }
89
90 protected EnumSet<AArch64.Flag> computeFlags(@SuppressWarnings("unused") AArch64HotSpotVMConfig config) {
91 EnumSet<AArch64.Flag> flags = EnumSet.noneOf(AArch64.Flag.class);
92
93 if (config.useBarriersForVolatile) {
94 flags.add(AArch64.Flag.UseBarriersForVolatile);
95 }
96 if (config.useCRC32) {
97 flags.add(AArch64.Flag.UseCRC32);
98 }
99 if (config.useNeon) {
100 flags.add(AArch64.Flag.UseNeon);
101 }
102 if (config.useSIMDForMemoryOps) {
103 flags.add(AArch64.Flag.UseSIMDForMemoryOps);
104 }
105 if (config.avoidUnalignedAccesses) {
106 flags.add(AArch64.Flag.AvoidUnalignedAccesses);
107 }
108 if (config.useLSE) {
109 flags.add(AArch64.Flag.UseLSE);
110 }
111 if (config.useBlockZeroing) {
112 flags.add(AArch64.Flag.UseBlockZeroing);
113 }
114
115 return flags;
116 }
117
118 protected TargetDescription createTarget(AArch64HotSpotVMConfig config) {
119 final int stackFrameAlignment = 16;
120 final int implicitNullCheckLimit = 4096;
121 final boolean inlineObjects = true;
122 Architecture arch = new AArch64(computeFeatures(config), computeFlags(config));
123 return new TargetDescription(arch, true, stackFrameAlignment, implicitNullCheckLimit, inlineObjects);
124 }
125
126 protected HotSpotConstantReflectionProvider createConstantReflection(HotSpotJVMCIRuntimeProvider runtime) {
127 return new HotSpotConstantReflectionProvider(runtime);
128 }
129
130 protected RegisterConfig createRegisterConfig(AArch64HotSpotVMConfig config, TargetDescription target) {
131 return new AArch64HotSpotRegisterConfig(target, config.useCompressedOops);
132 }
133
134 protected HotSpotCodeCacheProvider createCodeCache(HotSpotJVMCIRuntimeProvider runtime, TargetDescription target, RegisterConfig regConfig) {
|