author | roland |
Mon, 12 Dec 2016 11:29:51 -0800 | |
changeset 42653 | 62a5d76872d4 |
parent 41323 | ddd5600d4762 |
child 46814 | 2e45cd2fdcb6 |
permissions | -rw-r--r-- |
29183 | 1 |
/* |
40010 | 2 |
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. |
30209
8ea30dc99369
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
29183
diff
changeset
|
3 |
* Copyright (c) 2015, Red Hat Inc. All rights reserved. |
29183 | 4 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 |
* |
|
6 |
* This code is free software; you can redistribute it and/or modify it |
|
7 |
* under the terms of the GNU General Public License version 2 only, as |
|
8 |
* published by the Free Software Foundation. |
|
9 |
* |
|
10 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
11 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
14 |
* accompanied this code). |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License version |
|
17 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
18 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
19 |
* |
|
20 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
21 |
* or visit www.oracle.com if you need additional information or have any |
|
22 |
* questions. |
|
23 |
* |
|
24 |
*/ |
|
25 |
||
26 |
#include "precompiled.hpp" |
|
27 |
#include "asm/macroAssembler.hpp" |
|
28 |
#include "asm/macroAssembler.inline.hpp" |
|
29 |
#include "memory/resourceArea.hpp" |
|
30 |
#include "runtime/java.hpp" |
|
31 |
#include "runtime/stubCodeGenerator.hpp" |
|
40010 | 32 |
#include "utilities/macros.hpp" |
29183 | 33 |
#include "vm_version_aarch64.hpp" |
40010 | 34 |
|
35 |
#include OS_HEADER_INLINE(os) |
|
29183 | 36 |
|
37 |
#ifndef BUILTIN_SIM |
|
38 |
#include <sys/auxv.h> |
|
39 |
#include <asm/hwcap.h> |
|
40 |
#else |
|
41 |
#define getauxval(hwcap) 0 |
|
42 |
#endif |
|
43 |
||
44 |
#ifndef HWCAP_AES |
|
45 |
#define HWCAP_AES (1<<3) |
|
46 |
#endif |
|
47 |
||
31961
70adcff5840c
8131062: aarch64: add support for GHASH acceleration
enevill
parents:
31960
diff
changeset
|
48 |
#ifndef HWCAP_PMULL |
70adcff5840c
8131062: aarch64: add support for GHASH acceleration
enevill
parents:
31960
diff
changeset
|
49 |
#define HWCAP_PMULL (1<<4) |
70adcff5840c
8131062: aarch64: add support for GHASH acceleration
enevill
parents:
31960
diff
changeset
|
50 |
#endif |
70adcff5840c
8131062: aarch64: add support for GHASH acceleration
enevill
parents:
31960
diff
changeset
|
51 |
|
29183 | 52 |
#ifndef HWCAP_SHA1 |
53 |
#define HWCAP_SHA1 (1<<5) |
|
54 |
#endif |
|
55 |
||
56 |
#ifndef HWCAP_SHA2 |
|
57 |
#define HWCAP_SHA2 (1<<6) |
|
58 |
#endif |
|
59 |
||
60 |
#ifndef HWCAP_CRC32 |
|
61 |
#define HWCAP_CRC32 (1<<7) |
|
62 |
#endif |
|
63 |
||
36562
4d1e93624d6a
8150394: aarch64: add support for 8.1 LSE CAS instructions
enevill
parents:
35841
diff
changeset
|
64 |
#ifndef HWCAP_ATOMICS |
4d1e93624d6a
8150394: aarch64: add support for 8.1 LSE CAS instructions
enevill
parents:
35841
diff
changeset
|
65 |
#define HWCAP_ATOMICS (1<<8) |
4d1e93624d6a
8150394: aarch64: add support for 8.1 LSE CAS instructions
enevill
parents:
35841
diff
changeset
|
66 |
#endif |
4d1e93624d6a
8150394: aarch64: add support for 8.1 LSE CAS instructions
enevill
parents:
35841
diff
changeset
|
67 |
|
29183 | 68 |
int VM_Version::_cpu; |
69 |
int VM_Version::_model; |
|
30429
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
70 |
int VM_Version::_model2; |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
71 |
int VM_Version::_variant; |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
72 |
int VM_Version::_revision; |
29183 | 73 |
int VM_Version::_stepping; |
38143 | 74 |
VM_Version::PsrInfo VM_Version::_psr_info = { 0, }; |
29183 | 75 |
|
76 |
static BufferBlob* stub_blob; |
|
77 |
static const int stub_size = 550; |
|
78 |
||
79 |
extern "C" { |
|
80 |
typedef void (*getPsrInfo_stub_t)(void*); |
|
81 |
} |
|
82 |
static getPsrInfo_stub_t getPsrInfo_stub = NULL; |
|
83 |
||
84 |
||
85 |
class VM_Version_StubGenerator: public StubCodeGenerator { |
|
86 |
public: |
|
87 |
||
88 |
VM_Version_StubGenerator(CodeBuffer *c) : StubCodeGenerator(c) {} |
|
89 |
||
90 |
address generate_getPsrInfo() { |
|
91 |
StubCodeMark mark(this, "VM_Version", "getPsrInfo_stub"); |
|
92 |
# define __ _masm-> |
|
93 |
address start = __ pc(); |
|
94 |
||
95 |
#ifdef BUILTIN_SIM |
|
96 |
__ c_stub_prolog(1, 0, MacroAssembler::ret_type_void); |
|
97 |
#endif |
|
98 |
||
38143 | 99 |
// void getPsrInfo(VM_Version::PsrInfo* psr_info); |
29183 | 100 |
|
101 |
address entry = __ pc(); |
|
102 |
||
38143 | 103 |
__ enter(); |
29183 | 104 |
|
38143 | 105 |
__ get_dczid_el0(rscratch1); |
106 |
__ strw(rscratch1, Address(c_rarg0, in_bytes(VM_Version::dczid_el0_offset()))); |
|
107 |
||
38714
170464570e45
8157841: aarch64: prefetch ignores cache line size
enevill
parents:
38143
diff
changeset
|
108 |
__ get_ctr_el0(rscratch1); |
170464570e45
8157841: aarch64: prefetch ignores cache line size
enevill
parents:
38143
diff
changeset
|
109 |
__ strw(rscratch1, Address(c_rarg0, in_bytes(VM_Version::ctr_el0_offset()))); |
170464570e45
8157841: aarch64: prefetch ignores cache line size
enevill
parents:
38143
diff
changeset
|
110 |
|
38143 | 111 |
__ leave(); |
29183 | 112 |
__ ret(lr); |
113 |
||
114 |
# undef __ |
|
115 |
||
116 |
return start; |
|
117 |
} |
|
118 |
}; |
|
119 |
||
120 |
||
121 |
void VM_Version::get_processor_features() { |
|
122 |
_supports_cx8 = true; |
|
123 |
_supports_atomic_getset4 = true; |
|
124 |
_supports_atomic_getadd4 = true; |
|
125 |
_supports_atomic_getset8 = true; |
|
126 |
_supports_atomic_getadd8 = true; |
|
127 |
||
38143 | 128 |
getPsrInfo_stub(&_psr_info); |
129 |
||
38714
170464570e45
8157841: aarch64: prefetch ignores cache line size
enevill
parents:
38143
diff
changeset
|
130 |
int dcache_line = VM_Version::dcache_line_size(); |
170464570e45
8157841: aarch64: prefetch ignores cache line size
enevill
parents:
38143
diff
changeset
|
131 |
|
29183 | 132 |
if (FLAG_IS_DEFAULT(AllocatePrefetchDistance)) |
38714
170464570e45
8157841: aarch64: prefetch ignores cache line size
enevill
parents:
38143
diff
changeset
|
133 |
FLAG_SET_DEFAULT(AllocatePrefetchDistance, 3*dcache_line); |
29183 | 134 |
if (FLAG_IS_DEFAULT(AllocatePrefetchStepSize)) |
38714
170464570e45
8157841: aarch64: prefetch ignores cache line size
enevill
parents:
38143
diff
changeset
|
135 |
FLAG_SET_DEFAULT(AllocatePrefetchStepSize, dcache_line); |
170464570e45
8157841: aarch64: prefetch ignores cache line size
enevill
parents:
38143
diff
changeset
|
136 |
if (FLAG_IS_DEFAULT(PrefetchScanIntervalInBytes)) |
170464570e45
8157841: aarch64: prefetch ignores cache line size
enevill
parents:
38143
diff
changeset
|
137 |
FLAG_SET_DEFAULT(PrefetchScanIntervalInBytes, 3*dcache_line); |
35841
39f8dc1df42b
8149365: aarch64: memory copy does not prefetch on backwards copy
enevill
parents:
35581
diff
changeset
|
138 |
if (FLAG_IS_DEFAULT(PrefetchCopyIntervalInBytes)) |
38714
170464570e45
8157841: aarch64: prefetch ignores cache line size
enevill
parents:
38143
diff
changeset
|
139 |
FLAG_SET_DEFAULT(PrefetchCopyIntervalInBytes, 3*dcache_line); |
170464570e45
8157841: aarch64: prefetch ignores cache line size
enevill
parents:
38143
diff
changeset
|
140 |
|
170464570e45
8157841: aarch64: prefetch ignores cache line size
enevill
parents:
38143
diff
changeset
|
141 |
if (PrefetchCopyIntervalInBytes != -1 && |
170464570e45
8157841: aarch64: prefetch ignores cache line size
enevill
parents:
38143
diff
changeset
|
142 |
((PrefetchCopyIntervalInBytes & 7) || (PrefetchCopyIntervalInBytes >= 32768))) { |
170464570e45
8157841: aarch64: prefetch ignores cache line size
enevill
parents:
38143
diff
changeset
|
143 |
warning("PrefetchCopyIntervalInBytes must be -1, or a multiple of 8 and < 32768"); |
35841
39f8dc1df42b
8149365: aarch64: memory copy does not prefetch on backwards copy
enevill
parents:
35581
diff
changeset
|
144 |
PrefetchCopyIntervalInBytes &= ~7; |
39f8dc1df42b
8149365: aarch64: memory copy does not prefetch on backwards copy
enevill
parents:
35581
diff
changeset
|
145 |
if (PrefetchCopyIntervalInBytes >= 32768) |
39f8dc1df42b
8149365: aarch64: memory copy does not prefetch on backwards copy
enevill
parents:
35581
diff
changeset
|
146 |
PrefetchCopyIntervalInBytes = 32760; |
39f8dc1df42b
8149365: aarch64: memory copy does not prefetch on backwards copy
enevill
parents:
35581
diff
changeset
|
147 |
} |
29183 | 148 |
|
149 |
unsigned long auxv = getauxval(AT_HWCAP); |
|
150 |
||
151 |
char buf[512]; |
|
152 |
||
35148 | 153 |
_features = auxv; |
30429
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
154 |
|
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
155 |
int cpu_lines = 0; |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
156 |
if (FILE *f = fopen("/proc/cpuinfo", "r")) { |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
157 |
char buf[128], *p; |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
158 |
while (fgets(buf, sizeof (buf), f) != NULL) { |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
159 |
if (p = strchr(buf, ':')) { |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
160 |
long v = strtol(p+1, NULL, 0); |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
161 |
if (strncmp(buf, "CPU implementer", sizeof "CPU implementer" - 1) == 0) { |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
162 |
_cpu = v; |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
163 |
cpu_lines++; |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
164 |
} else if (strncmp(buf, "CPU variant", sizeof "CPU variant" - 1) == 0) { |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
165 |
_variant = v; |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
166 |
} else if (strncmp(buf, "CPU part", sizeof "CPU part" - 1) == 0) { |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
167 |
if (_model != v) _model2 = _model; |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
168 |
_model = v; |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
169 |
} else if (strncmp(buf, "CPU revision", sizeof "CPU revision" - 1) == 0) { |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
170 |
_revision = v; |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
171 |
} |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
172 |
} |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
173 |
} |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
174 |
fclose(f); |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
175 |
} |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
176 |
|
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
177 |
// Enable vendor specific features |
40023
49d647eeb7f0
8159063: aarch64: optimise unaligned array copy long
enevill
parents:
38714
diff
changeset
|
178 |
if (_cpu == CPU_CAVIUM) { |
49d647eeb7f0
8159063: aarch64: optimise unaligned array copy long
enevill
parents:
38714
diff
changeset
|
179 |
if (_variant == 0) _features |= CPU_DMB_ATOMICS; |
49d647eeb7f0
8159063: aarch64: optimise unaligned array copy long
enevill
parents:
38714
diff
changeset
|
180 |
if (FLAG_IS_DEFAULT(AvoidUnalignedAccesses)) { |
49d647eeb7f0
8159063: aarch64: optimise unaligned array copy long
enevill
parents:
38714
diff
changeset
|
181 |
FLAG_SET_DEFAULT(AvoidUnalignedAccesses, true); |
49d647eeb7f0
8159063: aarch64: optimise unaligned array copy long
enevill
parents:
38714
diff
changeset
|
182 |
} |
49d647eeb7f0
8159063: aarch64: optimise unaligned array copy long
enevill
parents:
38714
diff
changeset
|
183 |
if (FLAG_IS_DEFAULT(UseSIMDForMemoryOps)) { |
49d647eeb7f0
8159063: aarch64: optimise unaligned array copy long
enevill
parents:
38714
diff
changeset
|
184 |
FLAG_SET_DEFAULT(UseSIMDForMemoryOps, (_variant > 0)); |
49d647eeb7f0
8159063: aarch64: optimise unaligned array copy long
enevill
parents:
38714
diff
changeset
|
185 |
} |
49d647eeb7f0
8159063: aarch64: optimise unaligned array copy long
enevill
parents:
38714
diff
changeset
|
186 |
} |
35148 | 187 |
if (_cpu == CPU_ARM && (_model == 0xd03 || _model2 == 0xd03)) _features |= CPU_A53MAC; |
38714
170464570e45
8157841: aarch64: prefetch ignores cache line size
enevill
parents:
38143
diff
changeset
|
188 |
if (_cpu == CPU_ARM && (_model == 0xd07 || _model2 == 0xd07)) _features |= CPU_STXR_PREFETCH; |
30429
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
189 |
// If an olde style /proc/cpuinfo (cpu_lines == 1) then if _model is an A57 (0xd07) |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
190 |
// we assume the worst and assume we could be on a big little system and have |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
191 |
// undisclosed A53 cores which we could be swapped to at any stage |
35148 | 192 |
if (_cpu == CPU_ARM && cpu_lines == 1 && _model == 0xd07) _features |= CPU_A53MAC; |
30429
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
193 |
|
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
194 |
sprintf(buf, "0x%02x:0x%x:0x%03x:%d", _cpu, _variant, _model, _revision); |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
195 |
if (_model2) sprintf(buf+strlen(buf), "(0x%03x)", _model2); |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
196 |
if (auxv & HWCAP_ASIMD) strcat(buf, ", simd"); |
29183 | 197 |
if (auxv & HWCAP_CRC32) strcat(buf, ", crc"); |
198 |
if (auxv & HWCAP_AES) strcat(buf, ", aes"); |
|
199 |
if (auxv & HWCAP_SHA1) strcat(buf, ", sha1"); |
|
200 |
if (auxv & HWCAP_SHA2) strcat(buf, ", sha256"); |
|
36562
4d1e93624d6a
8150394: aarch64: add support for 8.1 LSE CAS instructions
enevill
parents:
35841
diff
changeset
|
201 |
if (auxv & HWCAP_ATOMICS) strcat(buf, ", lse"); |
29183 | 202 |
|
35148 | 203 |
_features_string = os::strdup(buf); |
29183 | 204 |
|
205 |
if (FLAG_IS_DEFAULT(UseCRC32)) { |
|
206 |
UseCRC32 = (auxv & HWCAP_CRC32) != 0; |
|
207 |
} |
|
208 |
if (UseCRC32 && (auxv & HWCAP_CRC32) == 0) { |
|
209 |
warning("UseCRC32 specified, but not supported on this CPU"); |
|
210 |
} |
|
32581 | 211 |
|
33176
54393049bf1e
8139043: aarch64: add support for adler32 intrinsic
enevill
parents:
32581
diff
changeset
|
212 |
if (FLAG_IS_DEFAULT(UseAdler32Intrinsics)) { |
54393049bf1e
8139043: aarch64: add support for adler32 intrinsic
enevill
parents:
32581
diff
changeset
|
213 |
FLAG_SET_DEFAULT(UseAdler32Intrinsics, true); |
32581 | 214 |
} |
215 |
||
35110
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
33176
diff
changeset
|
216 |
if (UseVectorizedMismatchIntrinsic) { |
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
33176
diff
changeset
|
217 |
warning("UseVectorizedMismatchIntrinsic specified, but not available on this CPU."); |
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
33176
diff
changeset
|
218 |
FLAG_SET_DEFAULT(UseVectorizedMismatchIntrinsic, false); |
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
33176
diff
changeset
|
219 |
} |
f19bcdf40799
8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents:
33176
diff
changeset
|
220 |
|
36562
4d1e93624d6a
8150394: aarch64: add support for 8.1 LSE CAS instructions
enevill
parents:
35841
diff
changeset
|
221 |
if (auxv & HWCAP_ATOMICS) { |
4d1e93624d6a
8150394: aarch64: add support for 8.1 LSE CAS instructions
enevill
parents:
35841
diff
changeset
|
222 |
if (FLAG_IS_DEFAULT(UseLSE)) |
4d1e93624d6a
8150394: aarch64: add support for 8.1 LSE CAS instructions
enevill
parents:
35841
diff
changeset
|
223 |
FLAG_SET_DEFAULT(UseLSE, true); |
4d1e93624d6a
8150394: aarch64: add support for 8.1 LSE CAS instructions
enevill
parents:
35841
diff
changeset
|
224 |
} else { |
4d1e93624d6a
8150394: aarch64: add support for 8.1 LSE CAS instructions
enevill
parents:
35841
diff
changeset
|
225 |
if (UseLSE) { |
4d1e93624d6a
8150394: aarch64: add support for 8.1 LSE CAS instructions
enevill
parents:
35841
diff
changeset
|
226 |
warning("UseLSE specified, but not supported on this CPU"); |
4d1e93624d6a
8150394: aarch64: add support for 8.1 LSE CAS instructions
enevill
parents:
35841
diff
changeset
|
227 |
} |
4d1e93624d6a
8150394: aarch64: add support for 8.1 LSE CAS instructions
enevill
parents:
35841
diff
changeset
|
228 |
} |
4d1e93624d6a
8150394: aarch64: add support for 8.1 LSE CAS instructions
enevill
parents:
35841
diff
changeset
|
229 |
|
29183 | 230 |
if (auxv & HWCAP_AES) { |
231 |
UseAES = UseAES || FLAG_IS_DEFAULT(UseAES); |
|
232 |
UseAESIntrinsics = |
|
233 |
UseAESIntrinsics || (UseAES && FLAG_IS_DEFAULT(UseAESIntrinsics)); |
|
234 |
if (UseAESIntrinsics && !UseAES) { |
|
235 |
warning("UseAESIntrinsics enabled, but UseAES not, enabling"); |
|
236 |
UseAES = true; |
|
237 |
} |
|
238 |
} else { |
|
239 |
if (UseAES) { |
|
240 |
warning("UseAES specified, but not supported on this CPU"); |
|
241 |
} |
|
242 |
if (UseAESIntrinsics) { |
|
243 |
warning("UseAESIntrinsics specified, but not supported on this CPU"); |
|
244 |
} |
|
245 |
} |
|
246 |
||
35154 | 247 |
if (UseAESCTRIntrinsics) { |
248 |
warning("AES/CTR intrinsics are not available on this CPU"); |
|
249 |
FLAG_SET_DEFAULT(UseAESCTRIntrinsics, false); |
|
250 |
} |
|
251 |
||
29183 | 252 |
if (FLAG_IS_DEFAULT(UseCRC32Intrinsics)) { |
253 |
UseCRC32Intrinsics = true; |
|
254 |
} |
|
255 |
||
31591
82134a118aea
8130687: aarch64: add support for hardware crc32c
enevill
parents:
31588
diff
changeset
|
256 |
if (auxv & HWCAP_CRC32) { |
82134a118aea
8130687: aarch64: add support for hardware crc32c
enevill
parents:
31588
diff
changeset
|
257 |
if (FLAG_IS_DEFAULT(UseCRC32CIntrinsics)) { |
82134a118aea
8130687: aarch64: add support for hardware crc32c
enevill
parents:
31588
diff
changeset
|
258 |
FLAG_SET_DEFAULT(UseCRC32CIntrinsics, true); |
82134a118aea
8130687: aarch64: add support for hardware crc32c
enevill
parents:
31588
diff
changeset
|
259 |
} |
82134a118aea
8130687: aarch64: add support for hardware crc32c
enevill
parents:
31588
diff
changeset
|
260 |
} else if (UseCRC32CIntrinsics) { |
82134a118aea
8130687: aarch64: add support for hardware crc32c
enevill
parents:
31588
diff
changeset
|
261 |
warning("CRC32C is not available on the CPU"); |
31515 | 262 |
FLAG_SET_DEFAULT(UseCRC32CIntrinsics, false); |
263 |
} |
|
264 |
||
42653 | 265 |
if (FLAG_IS_DEFAULT(UseFMA)) { |
266 |
FLAG_SET_DEFAULT(UseFMA, true); |
|
41323 | 267 |
} |
268 |
||
29183 | 269 |
if (auxv & (HWCAP_SHA1 | HWCAP_SHA2)) { |
270 |
if (FLAG_IS_DEFAULT(UseSHA)) { |
|
271 |
FLAG_SET_DEFAULT(UseSHA, true); |
|
272 |
} |
|
273 |
} else if (UseSHA) { |
|
274 |
warning("SHA instructions are not available on this CPU"); |
|
275 |
FLAG_SET_DEFAULT(UseSHA, false); |
|
276 |
} |
|
277 |
||
31588
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31517
diff
changeset
|
278 |
if (UseSHA && (auxv & HWCAP_SHA1)) { |
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31517
diff
changeset
|
279 |
if (FLAG_IS_DEFAULT(UseSHA1Intrinsics)) { |
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31517
diff
changeset
|
280 |
FLAG_SET_DEFAULT(UseSHA1Intrinsics, true); |
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31517
diff
changeset
|
281 |
} |
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31517
diff
changeset
|
282 |
} else if (UseSHA1Intrinsics) { |
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31517
diff
changeset
|
283 |
warning("Intrinsics for SHA-1 crypto hash functions not available on this CPU."); |
29183 | 284 |
FLAG_SET_DEFAULT(UseSHA1Intrinsics, false); |
31588
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31517
diff
changeset
|
285 |
} |
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31517
diff
changeset
|
286 |
|
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31517
diff
changeset
|
287 |
if (UseSHA && (auxv & HWCAP_SHA2)) { |
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31517
diff
changeset
|
288 |
if (FLAG_IS_DEFAULT(UseSHA256Intrinsics)) { |
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31517
diff
changeset
|
289 |
FLAG_SET_DEFAULT(UseSHA256Intrinsics, true); |
29183 | 290 |
} |
31588
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31517
diff
changeset
|
291 |
} else if (UseSHA256Intrinsics) { |
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31517
diff
changeset
|
292 |
warning("Intrinsics for SHA-224 and SHA-256 crypto hash functions not available on this CPU."); |
31960
4e66771a3e0a
8132010: aarch64: regression test fails compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java
enevill
parents:
31955
diff
changeset
|
293 |
FLAG_SET_DEFAULT(UseSHA256Intrinsics, false); |
31588
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31517
diff
changeset
|
294 |
} |
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31517
diff
changeset
|
295 |
|
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31517
diff
changeset
|
296 |
if (UseSHA512Intrinsics) { |
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31517
diff
changeset
|
297 |
warning("Intrinsics for SHA-384 and SHA-512 crypto hash functions not available on this CPU."); |
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31517
diff
changeset
|
298 |
FLAG_SET_DEFAULT(UseSHA512Intrinsics, false); |
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31517
diff
changeset
|
299 |
} |
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31517
diff
changeset
|
300 |
|
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31517
diff
changeset
|
301 |
if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) { |
2a864a4a414c
8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents:
31517
diff
changeset
|
302 |
FLAG_SET_DEFAULT(UseSHA, false); |
29183 | 303 |
} |
304 |
||
31961
70adcff5840c
8131062: aarch64: add support for GHASH acceleration
enevill
parents:
31960
diff
changeset
|
305 |
if (auxv & HWCAP_PMULL) { |
70adcff5840c
8131062: aarch64: add support for GHASH acceleration
enevill
parents:
31960
diff
changeset
|
306 |
if (FLAG_IS_DEFAULT(UseGHASHIntrinsics)) { |
70adcff5840c
8131062: aarch64: add support for GHASH acceleration
enevill
parents:
31960
diff
changeset
|
307 |
FLAG_SET_DEFAULT(UseGHASHIntrinsics, true); |
70adcff5840c
8131062: aarch64: add support for GHASH acceleration
enevill
parents:
31960
diff
changeset
|
308 |
} |
70adcff5840c
8131062: aarch64: add support for GHASH acceleration
enevill
parents:
31960
diff
changeset
|
309 |
} else if (UseGHASHIntrinsics) { |
70adcff5840c
8131062: aarch64: add support for GHASH acceleration
enevill
parents:
31960
diff
changeset
|
310 |
warning("GHASH intrinsics are not available on this CPU"); |
70adcff5840c
8131062: aarch64: add support for GHASH acceleration
enevill
parents:
31960
diff
changeset
|
311 |
FLAG_SET_DEFAULT(UseGHASHIntrinsics, false); |
70adcff5840c
8131062: aarch64: add support for GHASH acceleration
enevill
parents:
31960
diff
changeset
|
312 |
} |
70adcff5840c
8131062: aarch64: add support for GHASH acceleration
enevill
parents:
31960
diff
changeset
|
313 |
|
38143 | 314 |
if (is_zva_enabled()) { |
315 |
if (FLAG_IS_DEFAULT(UseBlockZeroing)) { |
|
316 |
FLAG_SET_DEFAULT(UseBlockZeroing, true); |
|
317 |
} |
|
318 |
if (FLAG_IS_DEFAULT(BlockZeroingLowLimit)) { |
|
319 |
FLAG_SET_DEFAULT(BlockZeroingLowLimit, 4 * VM_Version::zva_length()); |
|
320 |
} |
|
321 |
} else if (UseBlockZeroing) { |
|
322 |
warning("DC ZVA is not available on this CPU"); |
|
323 |
FLAG_SET_DEFAULT(UseBlockZeroing, false); |
|
324 |
} |
|
325 |
||
30209
8ea30dc99369
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
29183
diff
changeset
|
326 |
// This machine allows unaligned memory accesses |
8ea30dc99369
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
29183
diff
changeset
|
327 |
if (FLAG_IS_DEFAULT(UseUnalignedAccesses)) { |
8ea30dc99369
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
29183
diff
changeset
|
328 |
FLAG_SET_DEFAULT(UseUnalignedAccesses, true); |
8ea30dc99369
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
29183
diff
changeset
|
329 |
} |
8ea30dc99369
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
29183
diff
changeset
|
330 |
|
30225
e9722ea461d4
8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents:
30209
diff
changeset
|
331 |
if (FLAG_IS_DEFAULT(UseMultiplyToLenIntrinsic)) { |
e9722ea461d4
8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents:
30209
diff
changeset
|
332 |
UseMultiplyToLenIntrinsic = true; |
e9722ea461d4
8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents:
30209
diff
changeset
|
333 |
} |
e9722ea461d4
8077615: AARCH64: Add C2 intrinsic for BigInteger::multiplyToLen() method
aph
parents:
30209
diff
changeset
|
334 |
|
30429
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
335 |
if (FLAG_IS_DEFAULT(UseBarriersForVolatile)) { |
35148 | 336 |
UseBarriersForVolatile = (_features & CPU_DMB_ATOMICS) != 0; |
30429
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
337 |
} |
c980154ed1a3
8079203: AARCH64: Need to cater for different partner implementations
enevill
parents:
30225
diff
changeset
|
338 |
|
31517 | 339 |
if (FLAG_IS_DEFAULT(UsePopCountInstruction)) { |
340 |
UsePopCountInstruction = true; |
|
341 |
} |
|
342 |
||
31955 | 343 |
if (FLAG_IS_DEFAULT(UseMontgomeryMultiplyIntrinsic)) { |
344 |
UseMontgomeryMultiplyIntrinsic = true; |
|
345 |
} |
|
346 |
if (FLAG_IS_DEFAULT(UseMontgomerySquareIntrinsic)) { |
|
347 |
UseMontgomerySquareIntrinsic = true; |
|
348 |
} |
|
349 |
||
29183 | 350 |
#ifdef COMPILER2 |
351 |
if (FLAG_IS_DEFAULT(OptoScheduling)) { |
|
352 |
OptoScheduling = true; |
|
353 |
} |
|
354 |
#endif |
|
355 |
} |
|
356 |
||
357 |
void VM_Version::initialize() { |
|
358 |
ResourceMark rm; |
|
359 |
||
360 |
stub_blob = BufferBlob::create("getPsrInfo_stub", stub_size); |
|
361 |
if (stub_blob == NULL) { |
|
362 |
vm_exit_during_initialization("Unable to allocate getPsrInfo_stub"); |
|
363 |
} |
|
364 |
||
365 |
CodeBuffer c(stub_blob); |
|
366 |
VM_Version_StubGenerator g(&c); |
|
367 |
getPsrInfo_stub = CAST_TO_FN_PTR(getPsrInfo_stub_t, |
|
368 |
g.generate_getPsrInfo()); |
|
369 |
||
370 |
get_processor_features(); |
|
371 |
} |