author | yzheng |
Wed, 16 Oct 2019 16:54:56 +0200 | |
changeset 58650 | d068b1e534de |
parent 52381 | 7f90bc64b0fc |
permissions | -rw-r--r-- |
43972 | 1 |
/* |
58650
d068b1e534de
8231754: [JVMCI] Make r27 unconditionally reserved in JVMCI
yzheng
parents:
52381
diff
changeset
|
2 |
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. |
43972 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
package jdk.vm.ci.hotspot.aarch64; |
|
24 |
||
25 |
import static jdk.vm.ci.common.InitTimer.timer; |
|
26 |
||
27 |
import java.util.EnumSet; |
|
28 |
||
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; |
|
50858 | 38 |
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; |
43972 | 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 |
||
52381
7f90bc64b0fc
8213203: [JVMCI] adopt formatting changes from jvmci 8
never
parents:
50858
diff
changeset
|
46 |
private static EnumSet<AArch64.CPUFeature> computeFeatures(@SuppressWarnings("unused") AArch64HotSpotVMConfig config) { |
43972 | 47 |
// Configure the feature set using the HotSpot flag settings. |
48 |
EnumSet<AArch64.CPUFeature> features = EnumSet.noneOf(AArch64.CPUFeature.class); |
|
49673
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
49 |
|
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
50 |
if ((config.vmVersionFeatures & config.aarch64FP) != 0) { |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
51 |
features.add(AArch64.CPUFeature.FP); |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
52 |
} |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
53 |
if ((config.vmVersionFeatures & config.aarch64ASIMD) != 0) { |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
54 |
features.add(AArch64.CPUFeature.ASIMD); |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
55 |
} |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
56 |
if ((config.vmVersionFeatures & config.aarch64EVTSTRM) != 0) { |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
57 |
features.add(AArch64.CPUFeature.EVTSTRM); |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
58 |
} |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
59 |
if ((config.vmVersionFeatures & config.aarch64AES) != 0) { |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
60 |
features.add(AArch64.CPUFeature.AES); |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
61 |
} |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
62 |
if ((config.vmVersionFeatures & config.aarch64PMULL) != 0) { |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
63 |
features.add(AArch64.CPUFeature.PMULL); |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
64 |
} |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
65 |
if ((config.vmVersionFeatures & config.aarch64SHA1) != 0) { |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
66 |
features.add(AArch64.CPUFeature.SHA1); |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
67 |
} |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
68 |
if ((config.vmVersionFeatures & config.aarch64SHA2) != 0) { |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
69 |
features.add(AArch64.CPUFeature.SHA2); |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
70 |
} |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
71 |
if ((config.vmVersionFeatures & config.aarch64CRC32) != 0) { |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
72 |
features.add(AArch64.CPUFeature.CRC32); |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
73 |
} |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
74 |
if ((config.vmVersionFeatures & config.aarch64LSE) != 0) { |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
75 |
features.add(AArch64.CPUFeature.LSE); |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
76 |
} |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
77 |
if ((config.vmVersionFeatures & config.aarch64STXR_PREFETCH) != 0) { |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
78 |
features.add(AArch64.CPUFeature.STXR_PREFETCH); |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
79 |
} |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
80 |
if ((config.vmVersionFeatures & config.aarch64A53MAC) != 0) { |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
81 |
features.add(AArch64.CPUFeature.A53MAC); |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
82 |
} |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
83 |
if ((config.vmVersionFeatures & config.aarch64DMB_ATOMICS) != 0) { |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
84 |
features.add(AArch64.CPUFeature.DMB_ATOMICS); |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
85 |
} |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
86 |
|
43972 | 87 |
return features; |
88 |
} |
|
89 |
||
52381
7f90bc64b0fc
8213203: [JVMCI] adopt formatting changes from jvmci 8
never
parents:
50858
diff
changeset
|
90 |
private static EnumSet<AArch64.Flag> computeFlags(@SuppressWarnings("unused") AArch64HotSpotVMConfig config) { |
43972 | 91 |
EnumSet<AArch64.Flag> flags = EnumSet.noneOf(AArch64.Flag.class); |
49673
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
92 |
|
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
93 |
if (config.useBarriersForVolatile) { |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
94 |
flags.add(AArch64.Flag.UseBarriersForVolatile); |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
95 |
} |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
96 |
if (config.useCRC32) { |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
97 |
flags.add(AArch64.Flag.UseCRC32); |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
98 |
} |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
99 |
if (config.useNeon) { |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
100 |
flags.add(AArch64.Flag.UseNeon); |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
101 |
} |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
102 |
if (config.useSIMDForMemoryOps) { |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
103 |
flags.add(AArch64.Flag.UseSIMDForMemoryOps); |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
104 |
} |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
105 |
if (config.avoidUnalignedAccesses) { |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
106 |
flags.add(AArch64.Flag.AvoidUnalignedAccesses); |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
107 |
} |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
108 |
if (config.useLSE) { |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
109 |
flags.add(AArch64.Flag.UseLSE); |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
110 |
} |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
111 |
if (config.useBlockZeroing) { |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
112 |
flags.add(AArch64.Flag.UseBlockZeroing); |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
113 |
} |
46b2f783116c
8200524: AArch64: CPUFeature and Flag enums are not passed through JVMCI
dstewart
parents:
47216
diff
changeset
|
114 |
|
43972 | 115 |
return flags; |
116 |
} |
|
117 |
||
52381
7f90bc64b0fc
8213203: [JVMCI] adopt formatting changes from jvmci 8
never
parents:
50858
diff
changeset
|
118 |
private static TargetDescription createTarget(AArch64HotSpotVMConfig config) { |
43972 | 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 |
||
50858 | 126 |
protected HotSpotConstantReflectionProvider createConstantReflection(HotSpotJVMCIRuntime runtime) { |
43972 | 127 |
return new HotSpotConstantReflectionProvider(runtime); |
128 |
} |
|
129 |
||
58650
d068b1e534de
8231754: [JVMCI] Make r27 unconditionally reserved in JVMCI
yzheng
parents:
52381
diff
changeset
|
130 |
private static RegisterConfig createRegisterConfig(TargetDescription target) { |
d068b1e534de
8231754: [JVMCI] Make r27 unconditionally reserved in JVMCI
yzheng
parents:
52381
diff
changeset
|
131 |
return new AArch64HotSpotRegisterConfig(target); |
43972 | 132 |
} |
133 |
||
50858 | 134 |
protected HotSpotCodeCacheProvider createCodeCache(HotSpotJVMCIRuntime runtime, TargetDescription target, RegisterConfig regConfig) { |
52381
7f90bc64b0fc
8213203: [JVMCI] adopt formatting changes from jvmci 8
never
parents:
50858
diff
changeset
|
135 |
return new HotSpotCodeCacheProvider(runtime, target, regConfig); |
43972 | 136 |
} |
137 |
||
50858 | 138 |
protected HotSpotMetaAccessProvider createMetaAccess(HotSpotJVMCIRuntime runtime) { |
43972 | 139 |
return new HotSpotMetaAccessProvider(runtime); |
140 |
} |
|
141 |
||
142 |
@Override |
|
143 |
public String getArchitecture() { |
|
144 |
return "aarch64"; |
|
145 |
} |
|
146 |
||
147 |
@Override |
|
148 |
public String toString() { |
|
149 |
return "JVMCIBackend:" + getArchitecture(); |
|
150 |
} |
|
151 |
||
50858 | 152 |
@Override |
43972 | 153 |
@SuppressWarnings("try") |
50858 | 154 |
public JVMCIBackend createJVMCIBackend(HotSpotJVMCIRuntime runtime, JVMCIBackend host) { |
43972 | 155 |
|
156 |
assert host == null; |
|
157 |
AArch64HotSpotVMConfig config = new AArch64HotSpotVMConfig(runtime.getConfigStore()); |
|
158 |
TargetDescription target = createTarget(config); |
|
159 |
||
160 |
RegisterConfig regConfig; |
|
161 |
HotSpotCodeCacheProvider codeCache; |
|
162 |
ConstantReflectionProvider constantReflection; |
|
163 |
HotSpotMetaAccessProvider metaAccess; |
|
164 |
StackIntrospection stackIntrospection; |
|
165 |
try (InitTimer t = timer("create providers")) { |
|
166 |
try (InitTimer rt = timer("create MetaAccess provider")) { |
|
167 |
metaAccess = createMetaAccess(runtime); |
|
168 |
} |
|
169 |
try (InitTimer rt = timer("create RegisterConfig")) { |
|
58650
d068b1e534de
8231754: [JVMCI] Make r27 unconditionally reserved in JVMCI
yzheng
parents:
52381
diff
changeset
|
170 |
regConfig = createRegisterConfig(target); |
43972 | 171 |
} |
172 |
try (InitTimer rt = timer("create CodeCache provider")) { |
|
173 |
codeCache = createCodeCache(runtime, target, regConfig); |
|
174 |
} |
|
175 |
try (InitTimer rt = timer("create ConstantReflection provider")) { |
|
176 |
constantReflection = createConstantReflection(runtime); |
|
177 |
} |
|
178 |
try (InitTimer rt = timer("create StackIntrospection provider")) { |
|
179 |
stackIntrospection = new HotSpotStackIntrospection(runtime); |
|
180 |
} |
|
181 |
} |
|
182 |
try (InitTimer rt = timer("instantiate backend")) { |
|
183 |
return createBackend(metaAccess, codeCache, constantReflection, stackIntrospection); |
|
184 |
} |
|
185 |
} |
|
186 |
||
187 |
protected JVMCIBackend createBackend(HotSpotMetaAccessProvider metaAccess, HotSpotCodeCacheProvider codeCache, ConstantReflectionProvider constantReflection, |
|
188 |
StackIntrospection stackIntrospection) { |
|
189 |
return new JVMCIBackend(metaAccess, codeCache, constantReflection, stackIntrospection); |
|
190 |
} |
|
191 |
} |