Line 0
Link Here
|
|
|
1 |
From b6b15000fd62882be19223443f0aa6c468c15a14 Mon Sep 17 00:00:00 2001 |
2 |
From: miki <mikael.urankar@gmail.com> |
3 |
Date: Thu, 11 Apr 2019 20:09:26 +0200 |
4 |
Subject: [PATCH 01/17] copy src/hotspot/os_cpu/linux_aarch64/* to |
5 |
src/hotspot/os_cpu/bsd_aarch64/ |
6 |
|
7 |
copy src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/aarch64/* to |
8 |
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/ |
9 |
|
10 |
and rename files to *bsd* |
11 |
|
12 |
mkdir src/hotspot/os_cpu/bsd_aarch64 |
13 |
for file in $(ls src/hotspot/os_cpu/linux_aarch64/*) |
14 |
do |
15 |
bsd=$(echo $file | sed 's/linux/bsd/g') |
16 |
cp ${file} ${bsd} |
17 |
done |
18 |
|
19 |
mkdir src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64 |
20 |
cp src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/aarch64/LinuxAARCH64CFrame.java \ |
21 |
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java |
22 |
cp src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/linux/aarch64/LinuxAARCH64ThreadContext.java \ |
23 |
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64ThreadContext.java |
24 |
--- |
25 |
.../bsd_aarch64/assembler_bsd_aarch64.cpp | 28 + |
26 |
.../os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp | 75 ++ |
27 |
src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.S | 48 ++ |
28 |
src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.ad | 69 ++ |
29 |
.../bsd_aarch64/bytes_bsd_aarch64.inline.hpp | 45 ++ |
30 |
.../bsd_aarch64/copy_bsd_aarch64.inline.hpp | 188 +++++ |
31 |
.../os_cpu/bsd_aarch64/copy_bsd_aarch64.s | 236 ++++++ |
32 |
.../bsd_aarch64/globals_bsd_aarch64.hpp | 45 ++ |
33 |
.../bsd_aarch64/orderAccess_bsd_aarch64.hpp | 73 ++ |
34 |
.../os_cpu/bsd_aarch64/os_bsd_aarch64.cpp | 733 ++++++++++++++++++ |
35 |
.../os_cpu/bsd_aarch64/os_bsd_aarch64.hpp | 45 ++ |
36 |
.../bsd_aarch64/os_bsd_aarch64.inline.hpp | 40 + |
37 |
.../prefetch_bsd_aarch64.inline.hpp | 46 ++ |
38 |
.../os_cpu/bsd_aarch64/threadLS_bsd_aarch64.s | 44 ++ |
39 |
.../os_cpu/bsd_aarch64/thread_bsd_aarch64.cpp | 104 +++ |
40 |
.../os_cpu/bsd_aarch64/thread_bsd_aarch64.hpp | 80 ++ |
41 |
.../bsd_aarch64/vmStructs_bsd_aarch64.hpp | 55 ++ |
42 |
.../bsd_aarch64/vm_version_bsd_aarch64.cpp | 29 + |
43 |
.../bsd/aarch64/BsdAARCH64CFrame.java | 86 ++ |
44 |
.../bsd/aarch64/BsdAARCH64ThreadContext.java | 47 ++ |
45 |
20 files changed, 2116 insertions(+) |
46 |
create mode 100644 src/hotspot/os_cpu/bsd_aarch64/assembler_bsd_aarch64.cpp |
47 |
create mode 100644 src/hotspot/os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp |
48 |
create mode 100644 src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.S |
49 |
create mode 100644 src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.ad |
50 |
create mode 100644 src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp |
51 |
create mode 100644 src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.inline.hpp |
52 |
create mode 100644 src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.s |
53 |
create mode 100644 src/hotspot/os_cpu/bsd_aarch64/globals_bsd_aarch64.hpp |
54 |
create mode 100644 src/hotspot/os_cpu/bsd_aarch64/orderAccess_bsd_aarch64.hpp |
55 |
create mode 100644 src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp |
56 |
create mode 100644 src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.hpp |
57 |
create mode 100644 src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.inline.hpp |
58 |
create mode 100644 src/hotspot/os_cpu/bsd_aarch64/prefetch_bsd_aarch64.inline.hpp |
59 |
create mode 100644 src/hotspot/os_cpu/bsd_aarch64/threadLS_bsd_aarch64.s |
60 |
create mode 100644 src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.cpp |
61 |
create mode 100644 src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.hpp |
62 |
create mode 100644 src/hotspot/os_cpu/bsd_aarch64/vmStructs_bsd_aarch64.hpp |
63 |
create mode 100644 src/hotspot/os_cpu/bsd_aarch64/vm_version_bsd_aarch64.cpp |
64 |
create mode 100644 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java |
65 |
create mode 100644 src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64ThreadContext.java |
66 |
|
67 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/assembler_bsd_aarch64.cpp b/src/hotspot/os_cpu/bsd_aarch64/assembler_bsd_aarch64.cpp |
68 |
new file mode 100644 |
69 |
index 0000000000..920d94da7f |
70 |
--- /dev/null |
71 |
+++ src/hotspot/os_cpu/bsd_aarch64/assembler_bsd_aarch64.cpp |
72 |
@@ -0,0 +1,28 @@ |
73 |
+/* |
74 |
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. |
75 |
+ * Copyright (c) 2014, Red Hat Inc. All rights reserved. |
76 |
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
77 |
+ * |
78 |
+ * This code is free software; you can redistribute it and/or modify it |
79 |
+ * under the terms of the GNU General Public License version 2 only, as |
80 |
+ * published by the Free Software Foundation. |
81 |
+ * |
82 |
+ * This code is distributed in the hope that it will be useful, but WITHOUT |
83 |
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
84 |
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
85 |
+ * version 2 for more details (a copy is included in the LICENSE file that |
86 |
+ * accompanied this code). |
87 |
+ * |
88 |
+ * You should have received a copy of the GNU General Public License version |
89 |
+ * 2 along with this work; if not, write to the Free Software Foundation, |
90 |
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
91 |
+ * |
92 |
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
93 |
+ * or visit www.oracle.com if you need additional information or have any |
94 |
+ * questions. |
95 |
+ * |
96 |
+ */ |
97 |
+ |
98 |
+// nothing required here |
99 |
+ |
100 |
+ |
101 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp b/src/hotspot/os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp |
102 |
new file mode 100644 |
103 |
index 0000000000..e1f59bb43e |
104 |
--- /dev/null |
105 |
+++ src/hotspot/os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp |
106 |
@@ -0,0 +1,75 @@ |
107 |
+/* |
108 |
+ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. |
109 |
+ * Copyright (c) 2014, Red Hat Inc. All rights reserved. |
110 |
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
111 |
+ * |
112 |
+ * This code is free software; you can redistribute it and/or modify it |
113 |
+ * under the terms of the GNU General Public License version 2 only, as |
114 |
+ * published by the Free Software Foundation. |
115 |
+ * |
116 |
+ * This code is distributed in the hope that it will be useful, but WITHOUT |
117 |
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
118 |
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
119 |
+ * version 2 for more details (a copy is included in the LICENSE file that |
120 |
+ * accompanied this code). |
121 |
+ * |
122 |
+ * You should have received a copy of the GNU General Public License version |
123 |
+ * 2 along with this work; if not, write to the Free Software Foundation, |
124 |
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
125 |
+ * |
126 |
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
127 |
+ * or visit www.oracle.com if you need additional information or have any |
128 |
+ * questions. |
129 |
+ * |
130 |
+ */ |
131 |
+ |
132 |
+#ifndef OS_CPU_LINUX_AARCH64_VM_ATOMIC_LINUX_AARCH64_HPP |
133 |
+#define OS_CPU_LINUX_AARCH64_VM_ATOMIC_LINUX_AARCH64_HPP |
134 |
+ |
135 |
+#include "vm_version_aarch64.hpp" |
136 |
+ |
137 |
+// Implementation of class atomic |
138 |
+ |
139 |
+#define FULL_MEM_BARRIER __sync_synchronize() |
140 |
+#define READ_MEM_BARRIER __atomic_thread_fence(__ATOMIC_ACQUIRE); |
141 |
+#define WRITE_MEM_BARRIER __atomic_thread_fence(__ATOMIC_RELEASE); |
142 |
+ |
143 |
+template<size_t byte_size> |
144 |
+struct Atomic::PlatformAdd |
145 |
+ : Atomic::AddAndFetch<Atomic::PlatformAdd<byte_size> > |
146 |
+{ |
147 |
+ template<typename I, typename D> |
148 |
+ D add_and_fetch(I add_value, D volatile* dest, atomic_memory_order order) const { |
149 |
+ return __sync_add_and_fetch(dest, add_value); |
150 |
+ } |
151 |
+}; |
152 |
+ |
153 |
+template<size_t byte_size> |
154 |
+template<typename T> |
155 |
+inline T Atomic::PlatformXchg<byte_size>::operator()(T exchange_value, |
156 |
+ T volatile* dest, |
157 |
+ atomic_memory_order order) const { |
158 |
+ STATIC_ASSERT(byte_size == sizeof(T)); |
159 |
+ T res = __sync_lock_test_and_set(dest, exchange_value); |
160 |
+ FULL_MEM_BARRIER; |
161 |
+ return res; |
162 |
+} |
163 |
+ |
164 |
+template<size_t byte_size> |
165 |
+template<typename T> |
166 |
+inline T Atomic::PlatformCmpxchg<byte_size>::operator()(T exchange_value, |
167 |
+ T volatile* dest, |
168 |
+ T compare_value, |
169 |
+ atomic_memory_order order) const { |
170 |
+ STATIC_ASSERT(byte_size == sizeof(T)); |
171 |
+ if (order == memory_order_relaxed) { |
172 |
+ T value = compare_value; |
173 |
+ __atomic_compare_exchange(dest, &value, &exchange_value, /*weak*/false, |
174 |
+ __ATOMIC_RELAXED, __ATOMIC_RELAXED); |
175 |
+ return value; |
176 |
+ } else { |
177 |
+ return __sync_val_compare_and_swap(dest, compare_value, exchange_value); |
178 |
+ } |
179 |
+} |
180 |
+ |
181 |
+#endif // OS_CPU_LINUX_AARCH64_VM_ATOMIC_LINUX_AARCH64_HPP |
182 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.S b/src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.S |
183 |
new file mode 100644 |
184 |
index 0000000000..3c863ad1d2 |
185 |
--- /dev/null |
186 |
+++ src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.S |
187 |
@@ -0,0 +1,48 @@ |
188 |
+// |
189 |
+// Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. |
190 |
+// Copyright (c) 2014, Red Hat Inc. All rights reserved. |
191 |
+// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
192 |
+// |
193 |
+// This code is free software; you can redistribute it and/or modify it |
194 |
+// under the terms of the GNU General Public License version 2 only, as |
195 |
+// published by the Free Software Foundation. |
196 |
+// |
197 |
+// This code is distributed in the hope that it will be useful, but WITHOUT |
198 |
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
199 |
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
200 |
+// version 2 for more details (a copy is included in the LICENSE file that |
201 |
+// accompanied this code). |
202 |
+// |
203 |
+// You should have received a copy of the GNU General Public License version |
204 |
+// 2 along with this work; if not, write to the Free Software Foundation, |
205 |
+// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
206 |
+// |
207 |
+// Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
208 |
+// or visit www.oracle.com if you need additional information or have any |
209 |
+// questions. |
210 |
+ |
211 |
+#ifdef BUILTIN_SIM |
212 |
+ |
213 |
+ .globl SafeFetch32, Fetch32PFI, Fetch32Resume |
214 |
+ .align 16 |
215 |
+ .type SafeFetch32,@function |
216 |
+ // Prototype: int SafeFetch32 (int * Adr, int ErrValue) |
217 |
+SafeFetch32: |
218 |
+ movl %esi, %eax |
219 |
+Fetch32PFI: |
220 |
+ movl (%rdi), %eax |
221 |
+Fetch32Resume: |
222 |
+ ret |
223 |
+ |
224 |
+ .globl SafeFetchN, FetchNPFI, FetchNResume |
225 |
+ .align 16 |
226 |
+ .type SafeFetchN,@function |
227 |
+ // Prototype: intptr_t SafeFetchN (intptr_t * Adr, intptr_t ErrValue) |
228 |
+SafeFetchN: |
229 |
+ movq %rsi, %rax |
230 |
+FetchNPFI: |
231 |
+ movq (%rdi), %rax |
232 |
+FetchNResume: |
233 |
+ ret |
234 |
+ |
235 |
+#endif |
236 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.ad b/src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.ad |
237 |
new file mode 100644 |
238 |
index 0000000000..c3b8cd2c45 |
239 |
--- /dev/null |
240 |
+++ src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.ad |
241 |
@@ -0,0 +1,69 @@ |
242 |
+// |
243 |
+// Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. |
244 |
+// Copyright (c) 2014, Red Hat Inc. All rights reserved. |
245 |
+// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
246 |
+// |
247 |
+// This code is free software; you can redistribute it and/or modify it |
248 |
+// under the terms of the GNU General Public License version 2 only, as |
249 |
+// published by the Free Software Foundation. |
250 |
+// |
251 |
+// This code is distributed in the hope that it will be useful, but WITHOUT |
252 |
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
253 |
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
254 |
+// version 2 for more details (a copy is included in the LICENSE file that |
255 |
+// accompanied this code). |
256 |
+// |
257 |
+// You should have received a copy of the GNU General Public License version |
258 |
+// 2 along with this work; if not, write to the Free Software Foundation, |
259 |
+// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
260 |
+// |
261 |
+// Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
262 |
+// or visit www.oracle.com if you need additional information or have any |
263 |
+// questions. |
264 |
+// |
265 |
+// |
266 |
+ |
267 |
+// AArch64 Linux Architecture Description File |
268 |
+ |
269 |
+//----------OS-DEPENDENT ENCODING BLOCK---------------------------------------- |
270 |
+// This block specifies the encoding classes used by the compiler to |
271 |
+// output byte streams. Encoding classes generate functions which are |
272 |
+// called by Machine Instruction Nodes in order to generate the bit |
273 |
+// encoding of the instruction. Operands specify their base encoding |
274 |
+// interface with the interface keyword. There are currently |
275 |
+// supported four interfaces, REG_INTER, CONST_INTER, MEMORY_INTER, & |
276 |
+// COND_INTER. REG_INTER causes an operand to generate a function |
277 |
+// which returns its register number when queried. CONST_INTER causes |
278 |
+// an operand to generate a function which returns the value of the |
279 |
+// constant when queried. MEMORY_INTER causes an operand to generate |
280 |
+// four functions which return the Base Register, the Index Register, |
281 |
+// the Scale Value, and the Offset Value of the operand when queried. |
282 |
+// COND_INTER causes an operand to generate six functions which return |
283 |
+// the encoding code (ie - encoding bits for the instruction) |
284 |
+// associated with each basic boolean condition for a conditional |
285 |
+// instruction. Instructions specify two basic values for encoding. |
286 |
+// They use the ins_encode keyword to specify their encoding class |
287 |
+// (which must be one of the class names specified in the encoding |
288 |
+// block), and they use the opcode keyword to specify, in order, their |
289 |
+// primary, secondary, and tertiary opcode. Only the opcode sections |
290 |
+// which a particular instruction needs for encoding need to be |
291 |
+// specified. |
292 |
+encode %{ |
293 |
+ // Build emit functions for each basic byte or larger field in the intel |
294 |
+ // encoding scheme (opcode, rm, sib, immediate), and call them from C++ |
295 |
+ // code in the enc_class source block. Emit functions will live in the |
296 |
+ // main source block for now. In future, we can generalize this by |
297 |
+ // adding a syntax that specifies the sizes of fields in an order, |
298 |
+ // so that the adlc can build the emit functions automagically |
299 |
+ |
300 |
+ enc_class Java_To_Runtime(method meth) %{ |
301 |
+ %} |
302 |
+ |
303 |
+%} |
304 |
+ |
305 |
+ |
306 |
+// Platform dependent source |
307 |
+ |
308 |
+source %{ |
309 |
+ |
310 |
+%} |
311 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp b/src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp |
312 |
new file mode 100644 |
313 |
index 0000000000..e283f86d10 |
314 |
--- /dev/null |
315 |
+++ src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp |
316 |
@@ -0,0 +1,45 @@ |
317 |
+/* |
318 |
+ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. |
319 |
+ * Copyright (c) 2014, Red Hat Inc. All rights reserved. |
320 |
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
321 |
+ * |
322 |
+ * This code is free software; you can redistribute it and/or modify it |
323 |
+ * under the terms of the GNU General Public License version 2 only, as |
324 |
+ * published by the Free Software Foundation. |
325 |
+ * |
326 |
+ * This code is distributed in the hope that it will be useful, but WITHOUT |
327 |
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
328 |
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
329 |
+ * version 2 for more details (a copy is included in the LICENSE file that |
330 |
+ * accompanied this code). |
331 |
+ * |
332 |
+ * You should have received a copy of the GNU General Public License version |
333 |
+ * 2 along with this work; if not, write to the Free Software Foundation, |
334 |
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
335 |
+ * |
336 |
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
337 |
+ * or visit www.oracle.com if you need additional information or have any |
338 |
+ * questions. |
339 |
+ * |
340 |
+ */ |
341 |
+ |
342 |
+#ifndef OS_CPU_LINUX_AARCH64_VM_BYTES_LINUX_AARCH64_INLINE_HPP |
343 |
+#define OS_CPU_LINUX_AARCH64_VM_BYTES_LINUX_AARCH64_INLINE_HPP |
344 |
+ |
345 |
+#include <byteswap.h> |
346 |
+ |
347 |
+// Efficient swapping of data bytes from Java byte |
348 |
+// ordering to native byte ordering and vice versa. |
349 |
+inline u2 Bytes::swap_u2(u2 x) { |
350 |
+ return bswap_16(x); |
351 |
+} |
352 |
+ |
353 |
+inline u4 Bytes::swap_u4(u4 x) { |
354 |
+ return bswap_32(x); |
355 |
+} |
356 |
+ |
357 |
+inline u8 Bytes::swap_u8(u8 x) { |
358 |
+ return bswap_64(x); |
359 |
+} |
360 |
+ |
361 |
+#endif // OS_CPU_LINUX_AARCH64_VM_BYTES_LINUX_AARCH64_INLINE_HPP |
362 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.inline.hpp b/src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.inline.hpp |
363 |
new file mode 100644 |
364 |
index 0000000000..794ab349b0 |
365 |
--- /dev/null |
366 |
+++ src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.inline.hpp |
367 |
@@ -0,0 +1,188 @@ |
368 |
+/* |
369 |
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. |
370 |
+ * Copyright (c) 2014, Red Hat Inc. All rights reserved. |
371 |
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
372 |
+ * |
373 |
+ * This code is free software; you can redistribute it and/or modify it |
374 |
+ * under the terms of the GNU General Public License version 2 only, as |
375 |
+ * published by the Free Software Foundation. |
376 |
+ * |
377 |
+ * This code is distributed in the hope that it will be useful, but WITHOUT |
378 |
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
379 |
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
380 |
+ * version 2 for more details (a copy is included in the LICENSE file that |
381 |
+ * accompanied this code). |
382 |
+ * |
383 |
+ * You should have received a copy of the GNU General Public License version |
384 |
+ * 2 along with this work; if not, write to the Free Software Foundation, |
385 |
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
386 |
+ * |
387 |
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
388 |
+ * or visit www.oracle.com if you need additional information or have any |
389 |
+ * questions. |
390 |
+ * |
391 |
+ */ |
392 |
+ |
393 |
+#ifndef OS_CPU_LINUX_AARCH64_VM_COPY_LINUX_AARCH64_INLINE_HPP |
394 |
+#define OS_CPU_LINUX_AARCH64_VM_COPY_LINUX_AARCH64_INLINE_HPP |
395 |
+ |
396 |
+#define COPY_SMALL(from, to, count) \ |
397 |
+{ \ |
398 |
+ long tmp0, tmp1, tmp2, tmp3; \ |
399 |
+ long tmp4, tmp5, tmp6, tmp7; \ |
400 |
+ __asm volatile( \ |
401 |
+" adr %[t0], 0f;" \ |
402 |
+" add %[t0], %[t0], %[cnt], lsl #5;" \ |
403 |
+" br %[t0];" \ |
404 |
+" .align 5;" \ |
405 |
+"0:" \ |
406 |
+" b 1f;" \ |
407 |
+" .align 5;" \ |
408 |
+" ldr %[t0], [%[s], #0];" \ |
409 |
+" str %[t0], [%[d], #0];" \ |
410 |
+" b 1f;" \ |
411 |
+" .align 5;" \ |
412 |
+" ldp %[t0], %[t1], [%[s], #0];" \ |
413 |
+" stp %[t0], %[t1], [%[d], #0];" \ |
414 |
+" b 1f;" \ |
415 |
+" .align 5;" \ |
416 |
+" ldp %[t0], %[t1], [%[s], #0];" \ |
417 |
+" ldr %[t2], [%[s], #16];" \ |
418 |
+" stp %[t0], %[t1], [%[d], #0];" \ |
419 |
+" str %[t2], [%[d], #16];" \ |
420 |
+" b 1f;" \ |
421 |
+" .align 5;" \ |
422 |
+" ldp %[t0], %[t1], [%[s], #0];" \ |
423 |
+" ldp %[t2], %[t3], [%[s], #16];" \ |
424 |
+" stp %[t0], %[t1], [%[d], #0];" \ |
425 |
+" stp %[t2], %[t3], [%[d], #16];" \ |
426 |
+" b 1f;" \ |
427 |
+" .align 5;" \ |
428 |
+" ldp %[t0], %[t1], [%[s], #0];" \ |
429 |
+" ldp %[t2], %[t3], [%[s], #16];" \ |
430 |
+" ldr %[t4], [%[s], #32];" \ |
431 |
+" stp %[t0], %[t1], [%[d], #0];" \ |
432 |
+" stp %[t2], %[t3], [%[d], #16];" \ |
433 |
+" str %[t4], [%[d], #32];" \ |
434 |
+" b 1f;" \ |
435 |
+" .align 5;" \ |
436 |
+" ldp %[t0], %[t1], [%[s], #0];" \ |
437 |
+" ldp %[t2], %[t3], [%[s], #16];" \ |
438 |
+" ldp %[t4], %[t5], [%[s], #32];" \ |
439 |
+"2:" \ |
440 |
+" stp %[t0], %[t1], [%[d], #0];" \ |
441 |
+" stp %[t2], %[t3], [%[d], #16];" \ |
442 |
+" stp %[t4], %[t5], [%[d], #32];" \ |
443 |
+" b 1f;" \ |
444 |
+" .align 5;" \ |
445 |
+" ldr %[t6], [%[s], #0];" \ |
446 |
+" ldp %[t0], %[t1], [%[s], #8];" \ |
447 |
+" ldp %[t2], %[t3], [%[s], #24];" \ |
448 |
+" ldp %[t4], %[t5], [%[s], #40];" \ |
449 |
+" str %[t6], [%[d]], #8;" \ |
450 |
+" b 2b;" \ |
451 |
+" .align 5;" \ |
452 |
+" ldp %[t0], %[t1], [%[s], #0];" \ |
453 |
+" ldp %[t2], %[t3], [%[s], #16];" \ |
454 |
+" ldp %[t4], %[t5], [%[s], #32];" \ |
455 |
+" ldp %[t6], %[t7], [%[s], #48];" \ |
456 |
+" stp %[t0], %[t1], [%[d], #0];" \ |
457 |
+" stp %[t2], %[t3], [%[d], #16];" \ |
458 |
+" stp %[t4], %[t5], [%[d], #32];" \ |
459 |
+" stp %[t6], %[t7], [%[d], #48];" \ |
460 |
+"1:" \ |
461 |
+ \ |
462 |
+ : [s]"+r"(from), [d]"+r"(to), [cnt]"+r"(count), \ |
463 |
+ [t0]"=&r"(tmp0), [t1]"=&r"(tmp1), [t2]"=&r"(tmp2), [t3]"=&r"(tmp3), \ |
464 |
+ [t4]"=&r"(tmp4), [t5]"=&r"(tmp5), [t6]"=&r"(tmp6), [t7]"=&r"(tmp7) \ |
465 |
+ : \ |
466 |
+ : "memory", "cc"); \ |
467 |
+} |
468 |
+ |
469 |
+static void pd_conjoint_words(const HeapWord* from, HeapWord* to, size_t count) { |
470 |
+ __asm volatile( "prfm pldl1strm, [%[s], #0];" :: [s]"r"(from) : "memory"); |
471 |
+ if (__builtin_expect(count <= 8, 1)) { |
472 |
+ COPY_SMALL(from, to, count); |
473 |
+ return; |
474 |
+ } |
475 |
+ _Copy_conjoint_words(from, to, count); |
476 |
+} |
477 |
+ |
478 |
+static void pd_disjoint_words(const HeapWord* from, HeapWord* to, size_t count) { |
479 |
+ if (__builtin_constant_p(count)) { |
480 |
+ memcpy(to, from, count * sizeof(HeapWord)); |
481 |
+ return; |
482 |
+ } |
483 |
+ __asm volatile( "prfm pldl1strm, [%[s], #0];" :: [s]"r"(from) : "memory"); |
484 |
+ if (__builtin_expect(count <= 8, 1)) { |
485 |
+ COPY_SMALL(from, to, count); |
486 |
+ return; |
487 |
+ } |
488 |
+ _Copy_disjoint_words(from, to, count); |
489 |
+} |
490 |
+ |
491 |
+static void pd_disjoint_words_atomic(const HeapWord* from, HeapWord* to, size_t count) { |
492 |
+ __asm volatile( "prfm pldl1strm, [%[s], #0];" :: [s]"r"(from) : "memory"); |
493 |
+ if (__builtin_expect(count <= 8, 1)) { |
494 |
+ COPY_SMALL(from, to, count); |
495 |
+ return; |
496 |
+ } |
497 |
+ _Copy_disjoint_words(from, to, count); |
498 |
+} |
499 |
+ |
500 |
+static void pd_aligned_conjoint_words(const HeapWord* from, HeapWord* to, size_t count) { |
501 |
+ pd_conjoint_words(from, to, count); |
502 |
+} |
503 |
+ |
504 |
+static void pd_aligned_disjoint_words(const HeapWord* from, HeapWord* to, size_t count) { |
505 |
+ pd_disjoint_words(from, to, count); |
506 |
+} |
507 |
+ |
508 |
+static void pd_conjoint_bytes(const void* from, void* to, size_t count) { |
509 |
+ (void)memmove(to, from, count); |
510 |
+} |
511 |
+ |
512 |
+static void pd_conjoint_bytes_atomic(const void* from, void* to, size_t count) { |
513 |
+ pd_conjoint_bytes(from, to, count); |
514 |
+} |
515 |
+ |
516 |
+static void pd_conjoint_jshorts_atomic(const jshort* from, jshort* to, size_t count) { |
517 |
+ _Copy_conjoint_jshorts_atomic(from, to, count); |
518 |
+} |
519 |
+ |
520 |
+static void pd_conjoint_jints_atomic(const jint* from, jint* to, size_t count) { |
521 |
+ _Copy_conjoint_jints_atomic(from, to, count); |
522 |
+} |
523 |
+ |
524 |
+static void pd_conjoint_jlongs_atomic(const jlong* from, jlong* to, size_t count) { |
525 |
+ _Copy_conjoint_jlongs_atomic(from, to, count); |
526 |
+} |
527 |
+ |
528 |
+static void pd_conjoint_oops_atomic(const oop* from, oop* to, size_t count) { |
529 |
+ assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size"); |
530 |
+ _Copy_conjoint_jlongs_atomic((const jlong*)from, (jlong*)to, count); |
531 |
+} |
532 |
+ |
533 |
+static void pd_arrayof_conjoint_bytes(const HeapWord* from, HeapWord* to, size_t count) { |
534 |
+ _Copy_arrayof_conjoint_bytes(from, to, count); |
535 |
+} |
536 |
+ |
537 |
+static void pd_arrayof_conjoint_jshorts(const HeapWord* from, HeapWord* to, size_t count) { |
538 |
+ _Copy_arrayof_conjoint_jshorts(from, to, count); |
539 |
+} |
540 |
+ |
541 |
+static void pd_arrayof_conjoint_jints(const HeapWord* from, HeapWord* to, size_t count) { |
542 |
+ _Copy_arrayof_conjoint_jints(from, to, count); |
543 |
+} |
544 |
+ |
545 |
+static void pd_arrayof_conjoint_jlongs(const HeapWord* from, HeapWord* to, size_t count) { |
546 |
+ _Copy_arrayof_conjoint_jlongs(from, to, count); |
547 |
+} |
548 |
+ |
549 |
+static void pd_arrayof_conjoint_oops(const HeapWord* from, HeapWord* to, size_t count) { |
550 |
+ assert(!UseCompressedOops, "foo!"); |
551 |
+ assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size"); |
552 |
+ _Copy_arrayof_conjoint_jlongs(from, to, count); |
553 |
+} |
554 |
+ |
555 |
+#endif // OS_CPU_LINUX_AARCH64_VM_COPY_LINUX_AARCH64_INLINE_HPP |
556 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.s b/src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.s |
557 |
new file mode 100644 |
558 |
index 0000000000..25e3b054f7 |
559 |
--- /dev/null |
560 |
+++ src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.s |
561 |
@@ -0,0 +1,236 @@ |
562 |
+/* |
563 |
+ * Copyright (c) 2016, Linaro Ltd. All rights reserved. |
564 |
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
565 |
+ * |
566 |
+ * This code is free software; you can redistribute it and/or modify it |
567 |
+ * under the terms of the GNU General Public License version 2 only, as |
568 |
+ * published by the Free Software Foundation. |
569 |
+ * |
570 |
+ * This code is distributed in the hope that it will be useful, but WITHOUT |
571 |
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
572 |
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
573 |
+ * version 2 for more details (a copy is included in the LICENSE file that |
574 |
+ * accompanied this code). |
575 |
+ * |
576 |
+ * You should have received a copy of the GNU General Public License version |
577 |
+ * 2 along with this work; if not, write to the Free Software Foundation, |
578 |
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
579 |
+ * |
580 |
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
581 |
+ * or visit www.oracle.com if you need additional information or have any |
582 |
+ * questions. |
583 |
+ * |
584 |
+ */ |
585 |
+ .global _Copy_conjoint_words |
586 |
+ .global _Copy_disjoint_words |
587 |
+ |
588 |
+s .req x0 |
589 |
+d .req x1 |
590 |
+count .req x2 |
591 |
+t0 .req x3 |
592 |
+t1 .req x4 |
593 |
+t2 .req x5 |
594 |
+t3 .req x6 |
595 |
+t4 .req x7 |
596 |
+t5 .req x8 |
597 |
+t6 .req x9 |
598 |
+t7 .req x10 |
599 |
+ |
600 |
+ .align 6 |
601 |
+_Copy_disjoint_words: |
602 |
+ // Ensure 2 word aligned |
603 |
+ tbz s, #3, fwd_copy_aligned |
604 |
+ ldr t0, [s], #8 |
605 |
+ str t0, [d], #8 |
606 |
+ sub count, count, #1 |
607 |
+ |
608 |
+fwd_copy_aligned: |
609 |
+ // Bias s & d so we only pre index on the last copy |
610 |
+ sub s, s, #16 |
611 |
+ sub d, d, #16 |
612 |
+ |
613 |
+ ldp t0, t1, [s, #16] |
614 |
+ ldp t2, t3, [s, #32] |
615 |
+ ldp t4, t5, [s, #48] |
616 |
+ ldp t6, t7, [s, #64]! |
617 |
+ |
618 |
+ subs count, count, #16 |
619 |
+ blo fwd_copy_drain |
620 |
+ |
621 |
+fwd_copy_again: |
622 |
+ prfm pldl1keep, [s, #256] |
623 |
+ stp t0, t1, [d, #16] |
624 |
+ ldp t0, t1, [s, #16] |
625 |
+ stp t2, t3, [d, #32] |
626 |
+ ldp t2, t3, [s, #32] |
627 |
+ stp t4, t5, [d, #48] |
628 |
+ ldp t4, t5, [s, #48] |
629 |
+ stp t6, t7, [d, #64]! |
630 |
+ ldp t6, t7, [s, #64]! |
631 |
+ subs count, count, #8 |
632 |
+ bhs fwd_copy_again |
633 |
+ |
634 |
+fwd_copy_drain: |
635 |
+ stp t0, t1, [d, #16] |
636 |
+ stp t2, t3, [d, #32] |
637 |
+ stp t4, t5, [d, #48] |
638 |
+ stp t6, t7, [d, #64]! |
639 |
+ |
640 |
+ // count is now -8..-1 for 0..7 words to copy |
641 |
+ adr t0, 0f |
642 |
+ add t0, t0, count, lsl #5 |
643 |
+ br t0 |
644 |
+ |
645 |
+ .align 5 |
646 |
+ ret // -8 == 0 words |
647 |
+ .align 5 |
648 |
+ ldr t0, [s, #16] // -7 == 1 word |
649 |
+ str t0, [d, #16] |
650 |
+ ret |
651 |
+ .align 5 |
652 |
+ ldp t0, t1, [s, #16] // -6 = 2 words |
653 |
+ stp t0, t1, [d, #16] |
654 |
+ ret |
655 |
+ .align 5 |
656 |
+ ldp t0, t1, [s, #16] // -5 = 3 words |
657 |
+ ldr t2, [s, #32] |
658 |
+ stp t0, t1, [d, #16] |
659 |
+ str t2, [d, #32] |
660 |
+ ret |
661 |
+ .align 5 |
662 |
+ ldp t0, t1, [s, #16] // -4 = 4 words |
663 |
+ ldp t2, t3, [s, #32] |
664 |
+ stp t0, t1, [d, #16] |
665 |
+ stp t2, t3, [d, #32] |
666 |
+ ret |
667 |
+ .align 5 |
668 |
+ ldp t0, t1, [s, #16] // -3 = 5 words |
669 |
+ ldp t2, t3, [s, #32] |
670 |
+ ldr t4, [s, #48] |
671 |
+ stp t0, t1, [d, #16] |
672 |
+ stp t2, t3, [d, #32] |
673 |
+ str t4, [d, #48] |
674 |
+ ret |
675 |
+ .align 5 |
676 |
+ ldp t0, t1, [s, #16] // -2 = 6 words |
677 |
+ ldp t2, t3, [s, #32] |
678 |
+ ldp t4, t5, [s, #48] |
679 |
+ stp t0, t1, [d, #16] |
680 |
+ stp t2, t3, [d, #32] |
681 |
+ stp t4, t5, [d, #48] |
682 |
+ ret |
683 |
+ .align 5 |
684 |
+ ldp t0, t1, [s, #16] // -1 = 7 words |
685 |
+ ldp t2, t3, [s, #32] |
686 |
+ ldp t4, t5, [s, #48] |
687 |
+ ldr t6, [s, #64] |
688 |
+ stp t0, t1, [d, #16] |
689 |
+ stp t2, t3, [d, #32] |
690 |
+ stp t4, t5, [d, #48] |
691 |
+ str t6, [d, #64] |
692 |
+ // Is always aligned here, code for 7 words is one instruction |
693 |
+ // too large so it just falls through. |
694 |
+ .align 5 |
695 |
+0: |
696 |
+ ret |
697 |
+ |
698 |
+ .align 6 |
699 |
+_Copy_conjoint_words: |
700 |
+ sub t0, d, s |
701 |
+ cmp t0, count, lsl #3 |
702 |
+ bhs _Copy_disjoint_words |
703 |
+ |
704 |
+ add s, s, count, lsl #3 |
705 |
+ add d, d, count, lsl #3 |
706 |
+ |
707 |
+ // Ensure 2 word aligned |
708 |
+ tbz s, #3, bwd_copy_aligned |
709 |
+ ldr t0, [s, #-8]! |
710 |
+ str t0, [d, #-8]! |
711 |
+ sub count, count, #1 |
712 |
+ |
713 |
+bwd_copy_aligned: |
714 |
+ ldp t0, t1, [s, #-16] |
715 |
+ ldp t2, t3, [s, #-32] |
716 |
+ ldp t4, t5, [s, #-48] |
717 |
+ ldp t6, t7, [s, #-64]! |
718 |
+ |
719 |
+ subs count, count, #16 |
720 |
+ blo bwd_copy_drain |
721 |
+ |
722 |
+bwd_copy_again: |
723 |
+ prfm pldl1keep, [s, #-256] |
724 |
+ stp t0, t1, [d, #-16] |
725 |
+ ldp t0, t1, [s, #-16] |
726 |
+ stp t2, t3, [d, #-32] |
727 |
+ ldp t2, t3, [s, #-32] |
728 |
+ stp t4, t5, [d, #-48] |
729 |
+ ldp t4, t5, [s, #-48] |
730 |
+ stp t6, t7, [d, #-64]! |
731 |
+ ldp t6, t7, [s, #-64]! |
732 |
+ subs count, count, #8 |
733 |
+ bhs bwd_copy_again |
734 |
+ |
735 |
+bwd_copy_drain: |
736 |
+ stp t0, t1, [d, #-16] |
737 |
+ stp t2, t3, [d, #-32] |
738 |
+ stp t4, t5, [d, #-48] |
739 |
+ stp t6, t7, [d, #-64]! |
740 |
+ |
741 |
+ // count is now -8..-1 for 0..7 words to copy |
742 |
+ adr t0, 0f |
743 |
+ add t0, t0, count, lsl #5 |
744 |
+ br t0 |
745 |
+ |
746 |
+ .align 5 |
747 |
+ ret // -8 == 0 words |
748 |
+ .align 5 |
749 |
+ ldr t0, [s, #-8] // -7 == 1 word |
750 |
+ str t0, [d, #-8] |
751 |
+ ret |
752 |
+ .align 5 |
753 |
+ ldp t0, t1, [s, #-16] // -6 = 2 words |
754 |
+ stp t0, t1, [d, #-16] |
755 |
+ ret |
756 |
+ .align 5 |
757 |
+ ldp t0, t1, [s, #-16] // -5 = 3 words |
758 |
+ ldr t2, [s, #-24] |
759 |
+ stp t0, t1, [d, #-16] |
760 |
+ str t2, [d, #-24] |
761 |
+ ret |
762 |
+ .align 5 |
763 |
+ ldp t0, t1, [s, #-16] // -4 = 4 words |
764 |
+ ldp t2, t3, [s, #-32] |
765 |
+ stp t0, t1, [d, #-16] |
766 |
+ stp t2, t3, [d, #-32] |
767 |
+ ret |
768 |
+ .align 5 |
769 |
+ ldp t0, t1, [s, #-16] // -3 = 5 words |
770 |
+ ldp t2, t3, [s, #-32] |
771 |
+ ldr t4, [s, #-40] |
772 |
+ stp t0, t1, [d, #-16] |
773 |
+ stp t2, t3, [d, #-32] |
774 |
+ str t4, [d, #-40] |
775 |
+ ret |
776 |
+ .align 5 |
777 |
+ ldp t0, t1, [s, #-16] // -2 = 6 words |
778 |
+ ldp t2, t3, [s, #-32] |
779 |
+ ldp t4, t5, [s, #-48] |
780 |
+ stp t0, t1, [d, #-16] |
781 |
+ stp t2, t3, [d, #-32] |
782 |
+ stp t4, t5, [d, #-48] |
783 |
+ ret |
784 |
+ .align 5 |
785 |
+ ldp t0, t1, [s, #-16] // -1 = 7 words |
786 |
+ ldp t2, t3, [s, #-32] |
787 |
+ ldp t4, t5, [s, #-48] |
788 |
+ ldr t6, [s, #-56] |
789 |
+ stp t0, t1, [d, #-16] |
790 |
+ stp t2, t3, [d, #-32] |
791 |
+ stp t4, t5, [d, #-48] |
792 |
+ str t6, [d, #-56] |
793 |
+ // Is always aligned here, code for 7 words is one instruction |
794 |
+ // too large so it just falls through. |
795 |
+ .align 5 |
796 |
+0: |
797 |
+ ret |
798 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/globals_bsd_aarch64.hpp b/src/hotspot/os_cpu/bsd_aarch64/globals_bsd_aarch64.hpp |
799 |
new file mode 100644 |
800 |
index 0000000000..360be743dd |
801 |
--- /dev/null |
802 |
+++ src/hotspot/os_cpu/bsd_aarch64/globals_bsd_aarch64.hpp |
803 |
@@ -0,0 +1,45 @@ |
804 |
+/* |
805 |
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. |
806 |
+ * Copyright (c) 2014, Red Hat Inc. All rights reserved. |
807 |
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
808 |
+ * |
809 |
+ * This code is free software; you can redistribute it and/or modify it |
810 |
+ * under the terms of the GNU General Public License version 2 only, as |
811 |
+ * published by the Free Software Foundation. |
812 |
+ * |
813 |
+ * This code is distributed in the hope that it will be useful, but WITHOUT |
814 |
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
815 |
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
816 |
+ * version 2 for more details (a copy is included in the LICENSE file that |
817 |
+ * accompanied this code). |
818 |
+ * |
819 |
+ * You should have received a copy of the GNU General Public License version |
820 |
+ * 2 along with this work; if not, write to the Free Software Foundation, |
821 |
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
822 |
+ * |
823 |
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
824 |
+ * or visit www.oracle.com if you need additional information or have any |
825 |
+ * questions. |
826 |
+ * |
827 |
+ */ |
828 |
+ |
829 |
+#ifndef OS_CPU_LINUX_AARCH64_VM_GLOBALS_LINUX_AARCH64_HPP |
830 |
+#define OS_CPU_LINUX_AARCH64_VM_GLOBALS_LINUX_AARCH64_HPP |
831 |
+ |
832 |
+// Sets the default values for platform dependent flags used by the runtime system. |
833 |
+// (see globals.hpp) |
834 |
+ |
835 |
+define_pd_global(bool, DontYieldALot, false); |
836 |
+define_pd_global(intx, ThreadStackSize, 2048); // 0 => use system default |
837 |
+define_pd_global(intx, VMThreadStackSize, 2048); |
838 |
+ |
839 |
+define_pd_global(intx, CompilerThreadStackSize, 2048); |
840 |
+ |
841 |
+define_pd_global(uintx,JVMInvokeMethodSlack, 8192); |
842 |
+ |
843 |
+// Used on 64 bit platforms for UseCompressedOops base address |
844 |
+define_pd_global(uintx,HeapBaseMinAddress, 2*G); |
845 |
+ |
846 |
+extern __thread Thread *aarch64_currentThread; |
847 |
+ |
848 |
+#endif // OS_CPU_LINUX_AARCH64_VM_GLOBALS_LINUX_AARCH64_HPP |
849 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/orderAccess_bsd_aarch64.hpp b/src/hotspot/os_cpu/bsd_aarch64/orderAccess_bsd_aarch64.hpp |
850 |
new file mode 100644 |
851 |
index 0000000000..b733db1957 |
852 |
--- /dev/null |
853 |
+++ src/hotspot/os_cpu/bsd_aarch64/orderAccess_bsd_aarch64.hpp |
854 |
@@ -0,0 +1,73 @@ |
855 |
+/* |
856 |
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. |
857 |
+ * Copyright (c) 2014, Red Hat Inc. All rights reserved. |
858 |
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
859 |
+ * |
860 |
+ * This code is free software; you can redistribute it and/or modify it |
861 |
+ * under the terms of the GNU General Public License version 2 only, as |
862 |
+ * published by the Free Software Foundation. |
863 |
+ * |
864 |
+ * This code is distributed in the hope that it will be useful, but WITHOUT |
865 |
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
866 |
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
867 |
+ * version 2 for more details (a copy is included in the LICENSE file that |
868 |
+ * accompanied this code). |
869 |
+ * |
870 |
+ * You should have received a copy of the GNU General Public License version |
871 |
+ * 2 along with this work; if not, write to the Free Software Foundation, |
872 |
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
873 |
+ * |
874 |
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
875 |
+ * or visit www.oracle.com if you need additional information or have any |
876 |
+ * questions. |
877 |
+ * |
878 |
+ */ |
879 |
+ |
880 |
+#ifndef OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_HPP |
881 |
+#define OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_HPP |
882 |
+ |
883 |
+// Included in orderAccess.hpp header file. |
884 |
+ |
885 |
+#include "vm_version_aarch64.hpp" |
886 |
+ |
887 |
+// Implementation of class OrderAccess. |
888 |
+ |
889 |
+inline void OrderAccess::loadload() { acquire(); } |
890 |
+inline void OrderAccess::storestore() { release(); } |
891 |
+inline void OrderAccess::loadstore() { acquire(); } |
892 |
+inline void OrderAccess::storeload() { fence(); } |
893 |
+ |
894 |
+inline void OrderAccess::acquire() { |
895 |
+ READ_MEM_BARRIER; |
896 |
+} |
897 |
+ |
898 |
+inline void OrderAccess::release() { |
899 |
+ WRITE_MEM_BARRIER; |
900 |
+} |
901 |
+ |
902 |
+inline void OrderAccess::fence() { |
903 |
+ FULL_MEM_BARRIER; |
904 |
+} |
905 |
+ |
906 |
+template<size_t byte_size> |
907 |
+struct OrderAccess::PlatformOrderedLoad<byte_size, X_ACQUIRE> |
908 |
+{ |
909 |
+ template <typename T> |
910 |
+ T operator()(const volatile T* p) const { T data; __atomic_load(p, &data, __ATOMIC_ACQUIRE); return data; } |
911 |
+}; |
912 |
+ |
913 |
+template<size_t byte_size> |
914 |
+struct OrderAccess::PlatformOrderedStore<byte_size, RELEASE_X> |
915 |
+{ |
916 |
+ template <typename T> |
917 |
+ void operator()(T v, volatile T* p) const { __atomic_store(p, &v, __ATOMIC_RELEASE); } |
918 |
+}; |
919 |
+ |
920 |
+template<size_t byte_size> |
921 |
+struct OrderAccess::PlatformOrderedStore<byte_size, RELEASE_X_FENCE> |
922 |
+{ |
923 |
+ template <typename T> |
924 |
+ void operator()(T v, volatile T* p) const { release_store(p, v); fence(); } |
925 |
+}; |
926 |
+ |
927 |
+#endif // OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_HPP |
928 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp b/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp |
929 |
new file mode 100644 |
930 |
index 0000000000..3c7b15086e |
931 |
--- /dev/null |
932 |
+++ src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp |
933 |
@@ -0,0 +1,733 @@ |
934 |
+/* |
935 |
+ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. |
936 |
+ * Copyright (c) 2014, Red Hat Inc. All rights reserved. |
937 |
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
938 |
+ * |
939 |
+ * This code is free software; you can redistribute it and/or modify it |
940 |
+ * under the terms of the GNU General Public License version 2 only, as |
941 |
+ * published by the Free Software Foundation. |
942 |
+ * |
943 |
+ * This code is distributed in the hope that it will be useful, but WITHOUT |
944 |
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
945 |
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
946 |
+ * version 2 for more details (a copy is included in the LICENSE file that |
947 |
+ * accompanied this code). |
948 |
+ * |
949 |
+ * You should have received a copy of the GNU General Public License version |
950 |
+ * 2 along with this work; if not, write to the Free Software Foundation, |
951 |
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
952 |
+ * |
953 |
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
954 |
+ * or visit www.oracle.com if you need additional information or have any |
955 |
+ * questions. |
956 |
+ * |
957 |
+ */ |
958 |
+ |
959 |
+// no precompiled headers |
960 |
+#include "jvm.h" |
961 |
+#include "asm/macroAssembler.hpp" |
962 |
+#include "classfile/classLoader.hpp" |
963 |
+#include "classfile/systemDictionary.hpp" |
964 |
+#include "classfile/vmSymbols.hpp" |
965 |
+#include "code/codeCache.hpp" |
966 |
+#include "code/icBuffer.hpp" |
967 |
+#include "code/vtableStubs.hpp" |
968 |
+#include "code/nativeInst.hpp" |
969 |
+#include "interpreter/interpreter.hpp" |
970 |
+#include "memory/allocation.inline.hpp" |
971 |
+#include "os_share_linux.hpp" |
972 |
+#include "prims/jniFastGetField.hpp" |
973 |
+#include "prims/jvm_misc.hpp" |
974 |
+#include "runtime/arguments.hpp" |
975 |
+#include "runtime/extendedPC.hpp" |
976 |
+#include "runtime/frame.inline.hpp" |
977 |
+#include "runtime/interfaceSupport.inline.hpp" |
978 |
+#include "runtime/java.hpp" |
979 |
+#include "runtime/javaCalls.hpp" |
980 |
+#include "runtime/mutexLocker.hpp" |
981 |
+#include "runtime/osThread.hpp" |
982 |
+#include "runtime/sharedRuntime.hpp" |
983 |
+#include "runtime/stubRoutines.hpp" |
984 |
+#include "runtime/thread.inline.hpp" |
985 |
+#include "runtime/timer.hpp" |
986 |
+#include "utilities/debug.hpp" |
987 |
+#include "utilities/events.hpp" |
988 |
+#include "utilities/vmError.hpp" |
989 |
+#ifdef BUILTIN_SIM |
990 |
+#include "../../../../../../simulator/simulator.hpp" |
991 |
+#endif |
992 |
+ |
993 |
+// put OS-includes here |
994 |
+# include <sys/types.h> |
995 |
+# include <sys/mman.h> |
996 |
+# include <pthread.h> |
997 |
+# include <signal.h> |
998 |
+# include <errno.h> |
999 |
+# include <dlfcn.h> |
1000 |
+# include <stdlib.h> |
1001 |
+# include <stdio.h> |
1002 |
+# include <unistd.h> |
1003 |
+# include <sys/resource.h> |
1004 |
+# include <pthread.h> |
1005 |
+# include <sys/stat.h> |
1006 |
+# include <sys/time.h> |
1007 |
+# include <sys/utsname.h> |
1008 |
+# include <sys/socket.h> |
1009 |
+# include <sys/wait.h> |
1010 |
+# include <pwd.h> |
1011 |
+# include <poll.h> |
1012 |
+# include <ucontext.h> |
1013 |
+# include <fpu_control.h> |
1014 |
+ |
1015 |
+#ifdef BUILTIN_SIM |
1016 |
+#define REG_SP REG_RSP |
1017 |
+#define REG_PC REG_RIP |
1018 |
+#define REG_FP REG_RBP |
1019 |
+#define SPELL_REG_SP "rsp" |
1020 |
+#define SPELL_REG_FP "rbp" |
1021 |
+#else |
1022 |
+#define REG_FP 29 |
1023 |
+#define REG_LR 30 |
1024 |
+ |
1025 |
+#define SPELL_REG_SP "sp" |
1026 |
+#define SPELL_REG_FP "x29" |
1027 |
+#endif |
1028 |
+ |
1029 |
+address os::current_stack_pointer() { |
1030 |
+ register void *esp __asm__ (SPELL_REG_SP); |
1031 |
+ return (address) esp; |
1032 |
+} |
1033 |
+ |
1034 |
+char* os::non_memory_address_word() { |
1035 |
+ // Must never look like an address returned by reserve_memory, |
1036 |
+ // even in its subfields (as defined by the CPU immediate fields, |
1037 |
+ // if the CPU splits constants across multiple instructions). |
1038 |
+ |
1039 |
+ return (char*) 0xffffffffffff; |
1040 |
+} |
1041 |
+ |
1042 |
+address os::Linux::ucontext_get_pc(const ucontext_t * uc) { |
1043 |
+#ifdef BUILTIN_SIM |
1044 |
+ return (address)uc->uc_mcontext.gregs[REG_PC]; |
1045 |
+#else |
1046 |
+ return (address)uc->uc_mcontext.pc; |
1047 |
+#endif |
1048 |
+} |
1049 |
+ |
1050 |
+void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) { |
1051 |
+#ifdef BUILTIN_SIM |
1052 |
+ uc->uc_mcontext.gregs[REG_PC] = (intptr_t)pc; |
1053 |
+#else |
1054 |
+ uc->uc_mcontext.pc = (intptr_t)pc; |
1055 |
+#endif |
1056 |
+} |
1057 |
+ |
1058 |
+intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) { |
1059 |
+#ifdef BUILTIN_SIM |
1060 |
+ return (intptr_t*)uc->uc_mcontext.gregs[REG_SP]; |
1061 |
+#else |
1062 |
+ return (intptr_t*)uc->uc_mcontext.sp; |
1063 |
+#endif |
1064 |
+} |
1065 |
+ |
1066 |
+intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) { |
1067 |
+#ifdef BUILTIN_SIM |
1068 |
+ return (intptr_t*)uc->uc_mcontext.gregs[REG_FP]; |
1069 |
+#else |
1070 |
+ return (intptr_t*)uc->uc_mcontext.regs[REG_FP]; |
1071 |
+#endif |
1072 |
+} |
1073 |
+ |
1074 |
+// For Forte Analyzer AsyncGetCallTrace profiling support - thread |
1075 |
+// is currently interrupted by SIGPROF. |
1076 |
+// os::Solaris::fetch_frame_from_ucontext() tries to skip nested signal |
1077 |
+// frames. Currently we don't do that on Linux, so it's the same as |
1078 |
+// os::fetch_frame_from_context(). |
1079 |
+ExtendedPC os::Linux::fetch_frame_from_ucontext(Thread* thread, |
1080 |
+ const ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) { |
1081 |
+ |
1082 |
+ assert(thread != NULL, "just checking"); |
1083 |
+ assert(ret_sp != NULL, "just checking"); |
1084 |
+ assert(ret_fp != NULL, "just checking"); |
1085 |
+ |
1086 |
+ return os::fetch_frame_from_context(uc, ret_sp, ret_fp); |
1087 |
+} |
1088 |
+ |
1089 |
+ExtendedPC os::fetch_frame_from_context(const void* ucVoid, |
1090 |
+ intptr_t** ret_sp, intptr_t** ret_fp) { |
1091 |
+ |
1092 |
+ ExtendedPC epc; |
1093 |
+ const ucontext_t* uc = (const ucontext_t*)ucVoid; |
1094 |
+ |
1095 |
+ if (uc != NULL) { |
1096 |
+ epc = ExtendedPC(os::Linux::ucontext_get_pc(uc)); |
1097 |
+ if (ret_sp) *ret_sp = os::Linux::ucontext_get_sp(uc); |
1098 |
+ if (ret_fp) *ret_fp = os::Linux::ucontext_get_fp(uc); |
1099 |
+ } else { |
1100 |
+ // construct empty ExtendedPC for return value checking |
1101 |
+ epc = ExtendedPC(NULL); |
1102 |
+ if (ret_sp) *ret_sp = (intptr_t *)NULL; |
1103 |
+ if (ret_fp) *ret_fp = (intptr_t *)NULL; |
1104 |
+ } |
1105 |
+ |
1106 |
+ return epc; |
1107 |
+} |
1108 |
+ |
1109 |
+frame os::fetch_frame_from_context(const void* ucVoid) { |
1110 |
+ intptr_t* sp; |
1111 |
+ intptr_t* fp; |
1112 |
+ ExtendedPC epc = fetch_frame_from_context(ucVoid, &sp, &fp); |
1113 |
+ return frame(sp, fp, epc.pc()); |
1114 |
+} |
1115 |
+ |
1116 |
+bool os::Linux::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr) { |
1117 |
+ address pc = (address) os::Linux::ucontext_get_pc(uc); |
1118 |
+ if (Interpreter::contains(pc)) { |
1119 |
+ // interpreter performs stack banging after the fixed frame header has |
1120 |
+ // been generated while the compilers perform it before. To maintain |
1121 |
+ // semantic consistency between interpreted and compiled frames, the |
1122 |
+ // method returns the Java sender of the current frame. |
1123 |
+ *fr = os::fetch_frame_from_context(uc); |
1124 |
+ if (!fr->is_first_java_frame()) { |
1125 |
+ assert(fr->safe_for_sender(thread), "Safety check"); |
1126 |
+ *fr = fr->java_sender(); |
1127 |
+ } |
1128 |
+ } else { |
1129 |
+ // more complex code with compiled code |
1130 |
+ assert(!Interpreter::contains(pc), "Interpreted methods should have been handled above"); |
1131 |
+ CodeBlob* cb = CodeCache::find_blob(pc); |
1132 |
+ if (cb == NULL || !cb->is_nmethod() || cb->is_frame_complete_at(pc)) { |
1133 |
+ // Not sure where the pc points to, fallback to default |
1134 |
+ // stack overflow handling |
1135 |
+ return false; |
1136 |
+ } else { |
1137 |
+ // In compiled code, the stack banging is performed before LR |
1138 |
+ // has been saved in the frame. LR is live, and SP and FP |
1139 |
+ // belong to the caller. |
1140 |
+ intptr_t* fp = os::Linux::ucontext_get_fp(uc); |
1141 |
+ intptr_t* sp = os::Linux::ucontext_get_sp(uc); |
1142 |
+ address pc = (address)(uc->uc_mcontext.regs[REG_LR] |
1143 |
+ - NativeInstruction::instruction_size); |
1144 |
+ *fr = frame(sp, fp, pc); |
1145 |
+ if (!fr->is_java_frame()) { |
1146 |
+ assert(fr->safe_for_sender(thread), "Safety check"); |
1147 |
+ assert(!fr->is_first_frame(), "Safety check"); |
1148 |
+ *fr = fr->java_sender(); |
1149 |
+ } |
1150 |
+ } |
1151 |
+ } |
1152 |
+ assert(fr->is_java_frame(), "Safety check"); |
1153 |
+ return true; |
1154 |
+} |
1155 |
+ |
1156 |
+// By default, gcc always saves frame pointer rfp on this stack. This |
1157 |
+// may get turned off by -fomit-frame-pointer. |
1158 |
+frame os::get_sender_for_C_frame(frame* fr) { |
1159 |
+#ifdef BUILTIN_SIM |
1160 |
+ return frame(fr->sender_sp(), fr->link(), fr->sender_pc()); |
1161 |
+#else |
1162 |
+ return frame(fr->link(), fr->link(), fr->sender_pc()); |
1163 |
+#endif |
1164 |
+} |
1165 |
+ |
1166 |
+intptr_t* _get_previous_fp() { |
1167 |
+ register intptr_t **fp __asm__ (SPELL_REG_FP); |
1168 |
+ |
1169 |
+ // fp is for this frame (_get_previous_fp). We want the fp for the |
1170 |
+ // caller of os::current_frame*(), so go up two frames. However, for |
1171 |
+ // optimized builds, _get_previous_fp() will be inlined, so only go |
1172 |
+ // up 1 frame in that case. |
1173 |
+ #ifdef _NMT_NOINLINE_ |
1174 |
+ return **(intptr_t***)fp; |
1175 |
+ #else |
1176 |
+ return *fp; |
1177 |
+ #endif |
1178 |
+} |
1179 |
+ |
1180 |
+ |
1181 |
+frame os::current_frame() { |
1182 |
+ intptr_t* fp = _get_previous_fp(); |
1183 |
+ frame myframe((intptr_t*)os::current_stack_pointer(), |
1184 |
+ (intptr_t*)fp, |
1185 |
+ CAST_FROM_FN_PTR(address, os::current_frame)); |
1186 |
+ if (os::is_first_C_frame(&myframe)) { |
1187 |
+ // stack is not walkable |
1188 |
+ return frame(); |
1189 |
+ } else { |
1190 |
+ return os::get_sender_for_C_frame(&myframe); |
1191 |
+ } |
1192 |
+} |
1193 |
+ |
1194 |
+// Utility functions |
1195 |
+ |
1196 |
+// From IA32 System Programming Guide |
1197 |
+enum { |
1198 |
+ trap_page_fault = 0xE |
1199 |
+}; |
1200 |
+ |
1201 |
+#ifdef BUILTIN_SIM |
1202 |
+extern "C" void Fetch32PFI () ; |
1203 |
+extern "C" void Fetch32Resume () ; |
1204 |
+extern "C" void FetchNPFI () ; |
1205 |
+extern "C" void FetchNResume () ; |
1206 |
+#endif |
1207 |
+ |
1208 |
+extern "C" JNIEXPORT int |
1209 |
+JVM_handle_linux_signal(int sig, |
1210 |
+ siginfo_t* info, |
1211 |
+ void* ucVoid, |
1212 |
+ int abort_if_unrecognized) { |
1213 |
+ ucontext_t* uc = (ucontext_t*) ucVoid; |
1214 |
+ |
1215 |
+ Thread* t = Thread::current_or_null_safe(); |
1216 |
+ |
1217 |
+ // Must do this before SignalHandlerMark, if crash protection installed we will longjmp away |
1218 |
+ // (no destructors can be run) |
1219 |
+ os::ThreadCrashProtection::check_crash_protection(sig, t); |
1220 |
+ |
1221 |
+ SignalHandlerMark shm(t); |
1222 |
+ |
1223 |
+ // Note: it's not uncommon that JNI code uses signal/sigset to install |
1224 |
+ // then restore certain signal handler (e.g. to temporarily block SIGPIPE, |
1225 |
+ // or have a SIGILL handler when detecting CPU type). When that happens, |
1226 |
+ // JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To |
1227 |
+ // avoid unnecessary crash when libjsig is not preloaded, try handle signals |
1228 |
+ // that do not require siginfo/ucontext first. |
1229 |
+ |
1230 |
+ if (sig == SIGPIPE || sig == SIGXFSZ) { |
1231 |
+ // allow chained handler to go first |
1232 |
+ if (os::Linux::chained_handler(sig, info, ucVoid)) { |
1233 |
+ return true; |
1234 |
+ } else { |
1235 |
+ // Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219 |
1236 |
+ return true; |
1237 |
+ } |
1238 |
+ } |
1239 |
+ |
1240 |
+#ifdef CAN_SHOW_REGISTERS_ON_ASSERT |
1241 |
+ if ((sig == SIGSEGV || sig == SIGBUS) && info != NULL && info->si_addr == g_assert_poison) { |
1242 |
+ handle_assert_poison_fault(ucVoid, info->si_addr); |
1243 |
+ return 1; |
1244 |
+ } |
1245 |
+#endif |
1246 |
+ |
1247 |
+ JavaThread* thread = NULL; |
1248 |
+ VMThread* vmthread = NULL; |
1249 |
+ if (os::Linux::signal_handlers_are_installed) { |
1250 |
+ if (t != NULL ){ |
1251 |
+ if(t->is_Java_thread()) { |
1252 |
+ thread = (JavaThread*)t; |
1253 |
+ } |
1254 |
+ else if(t->is_VM_thread()){ |
1255 |
+ vmthread = (VMThread *)t; |
1256 |
+ } |
1257 |
+ } |
1258 |
+ } |
1259 |
+/* |
1260 |
+ NOTE: does not seem to work on linux. |
1261 |
+ if (info == NULL || info->si_code <= 0 || info->si_code == SI_NOINFO) { |
1262 |
+ // can't decode this kind of signal |
1263 |
+ info = NULL; |
1264 |
+ } else { |
1265 |
+ assert(sig == info->si_signo, "bad siginfo"); |
1266 |
+ } |
1267 |
+*/ |
1268 |
+ // decide if this trap can be handled by a stub |
1269 |
+ address stub = NULL; |
1270 |
+ |
1271 |
+ address pc = NULL; |
1272 |
+ |
1273 |
+ //%note os_trap_1 |
1274 |
+ if (info != NULL && uc != NULL && thread != NULL) { |
1275 |
+ pc = (address) os::Linux::ucontext_get_pc(uc); |
1276 |
+ |
1277 |
+#ifdef BUILTIN_SIM |
1278 |
+ if (pc == (address) Fetch32PFI) { |
1279 |
+ uc->uc_mcontext.gregs[REG_PC] = intptr_t(Fetch32Resume) ; |
1280 |
+ return 1 ; |
1281 |
+ } |
1282 |
+ if (pc == (address) FetchNPFI) { |
1283 |
+ uc->uc_mcontext.gregs[REG_PC] = intptr_t (FetchNResume) ; |
1284 |
+ return 1 ; |
1285 |
+ } |
1286 |
+#else |
1287 |
+ if (StubRoutines::is_safefetch_fault(pc)) { |
1288 |
+ os::Linux::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc)); |
1289 |
+ return 1; |
1290 |
+ } |
1291 |
+#endif |
1292 |
+ |
1293 |
+ address addr = (address) info->si_addr; |
1294 |
+ |
1295 |
+ // Make sure the high order byte is sign extended, as it may be masked away by the hardware. |
1296 |
+ if ((uintptr_t(addr) & (uintptr_t(1) << 55)) != 0) { |
1297 |
+ addr = address(uintptr_t(addr) | (uintptr_t(0xFF) << 56)); |
1298 |
+ } |
1299 |
+ |
1300 |
+ // Handle ALL stack overflow variations here |
1301 |
+ if (sig == SIGSEGV) { |
1302 |
+ // check if fault address is within thread stack |
1303 |
+ if (thread->on_local_stack(addr)) { |
1304 |
+ // stack overflow |
1305 |
+ if (thread->in_stack_yellow_reserved_zone(addr)) { |
1306 |
+ if (thread->thread_state() == _thread_in_Java) { |
1307 |
+ if (thread->in_stack_reserved_zone(addr)) { |
1308 |
+ frame fr; |
1309 |
+ if (os::Linux::get_frame_at_stack_banging_point(thread, uc, &fr)) { |
1310 |
+ assert(fr.is_java_frame(), "Must be a Java frame"); |
1311 |
+ frame activation = |
1312 |
+ SharedRuntime::look_for_reserved_stack_annotated_method(thread, fr); |
1313 |
+ if (activation.sp() != NULL) { |
1314 |
+ thread->disable_stack_reserved_zone(); |
1315 |
+ if (activation.is_interpreted_frame()) { |
1316 |
+ thread->set_reserved_stack_activation((address)( |
1317 |
+ activation.fp() + frame::interpreter_frame_initial_sp_offset)); |
1318 |
+ } else { |
1319 |
+ thread->set_reserved_stack_activation((address)activation.unextended_sp()); |
1320 |
+ } |
1321 |
+ return 1; |
1322 |
+ } |
1323 |
+ } |
1324 |
+ } |
1325 |
+ // Throw a stack overflow exception. Guard pages will be reenabled |
1326 |
+ // while unwinding the stack. |
1327 |
+ thread->disable_stack_yellow_reserved_zone(); |
1328 |
+ stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::STACK_OVERFLOW); |
1329 |
+ } else { |
1330 |
+ // Thread was in the vm or native code. Return and try to finish. |
1331 |
+ thread->disable_stack_yellow_reserved_zone(); |
1332 |
+ return 1; |
1333 |
+ } |
1334 |
+ } else if (thread->in_stack_red_zone(addr)) { |
1335 |
+ // Fatal red zone violation. Disable the guard pages and fall through |
1336 |
+ // to handle_unexpected_exception way down below. |
1337 |
+ thread->disable_stack_red_zone(); |
1338 |
+ tty->print_raw_cr("An irrecoverable stack overflow has occurred."); |
1339 |
+ |
1340 |
+ // This is a likely cause, but hard to verify. Let's just print |
1341 |
+ // it as a hint. |
1342 |
+ tty->print_raw_cr("Please check if any of your loaded .so files has " |
1343 |
+ "enabled executable stack (see man page execstack(8))"); |
1344 |
+ } else { |
1345 |
+ // Accessing stack address below sp may cause SEGV if current |
1346 |
+ // thread has MAP_GROWSDOWN stack. This should only happen when |
1347 |
+ // current thread was created by user code with MAP_GROWSDOWN flag |
1348 |
+ // and then attached to VM. See notes in os_linux.cpp. |
1349 |
+ if (thread->osthread()->expanding_stack() == 0) { |
1350 |
+ thread->osthread()->set_expanding_stack(); |
1351 |
+ if (os::Linux::manually_expand_stack(thread, addr)) { |
1352 |
+ thread->osthread()->clear_expanding_stack(); |
1353 |
+ return 1; |
1354 |
+ } |
1355 |
+ thread->osthread()->clear_expanding_stack(); |
1356 |
+ } else { |
1357 |
+ fatal("recursive segv. expanding stack."); |
1358 |
+ } |
1359 |
+ } |
1360 |
+ } |
1361 |
+ } |
1362 |
+ |
1363 |
+ if (thread->thread_state() == _thread_in_Java) { |
1364 |
+ // Java thread running in Java code => find exception handler if any |
1365 |
+ // a fault inside compiled code, the interpreter, or a stub |
1366 |
+ |
1367 |
+ // Handle signal from NativeJump::patch_verified_entry(). |
1368 |
+ if ((sig == SIGILL || sig == SIGTRAP) |
1369 |
+ && nativeInstruction_at(pc)->is_sigill_zombie_not_entrant()) { |
1370 |
+ if (TraceTraps) { |
1371 |
+ tty->print_cr("trap: zombie_not_entrant (%s)", (sig == SIGTRAP) ? "SIGTRAP" : "SIGILL"); |
1372 |
+ } |
1373 |
+ stub = SharedRuntime::get_handle_wrong_method_stub(); |
1374 |
+ } else if (sig == SIGSEGV && os::is_poll_address((address)info->si_addr)) { |
1375 |
+ stub = SharedRuntime::get_poll_stub(pc); |
1376 |
+ } else if (sig == SIGBUS /* && info->si_code == BUS_OBJERR */) { |
1377 |
+ // BugId 4454115: A read from a MappedByteBuffer can fault |
1378 |
+ // here if the underlying file has been truncated. |
1379 |
+ // Do not crash the VM in such a case. |
1380 |
+ CodeBlob* cb = CodeCache::find_blob_unsafe(pc); |
1381 |
+ CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL; |
1382 |
+ if (nm != NULL && nm->has_unsafe_access()) { |
1383 |
+ address next_pc = pc + NativeCall::instruction_size; |
1384 |
+ stub = SharedRuntime::handle_unsafe_access(thread, next_pc); |
1385 |
+ } |
1386 |
+ } |
1387 |
+ else |
1388 |
+ |
1389 |
+ if (sig == SIGFPE && |
1390 |
+ (info->si_code == FPE_INTDIV || info->si_code == FPE_FLTDIV)) { |
1391 |
+ stub = |
1392 |
+ SharedRuntime:: |
1393 |
+ continuation_for_implicit_exception(thread, |
1394 |
+ pc, |
1395 |
+ SharedRuntime:: |
1396 |
+ IMPLICIT_DIVIDE_BY_ZERO); |
1397 |
+ } else if (sig == SIGSEGV && |
1398 |
+ !MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) { |
1399 |
+ // Determination of interpreter/vtable stub/compiled code null exception |
1400 |
+ stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL); |
1401 |
+ } |
1402 |
+ } else if (thread->thread_state() == _thread_in_vm && |
1403 |
+ sig == SIGBUS && /* info->si_code == BUS_OBJERR && */ |
1404 |
+ thread->doing_unsafe_access()) { |
1405 |
+ address next_pc = pc + NativeCall::instruction_size; |
1406 |
+ stub = SharedRuntime::handle_unsafe_access(thread, next_pc); |
1407 |
+ } |
1408 |
+ |
1409 |
+ // jni_fast_Get<Primitive>Field can trap at certain pc's if a GC kicks in |
1410 |
+ // and the heap gets shrunk before the field access. |
1411 |
+ if ((sig == SIGSEGV) || (sig == SIGBUS)) { |
1412 |
+ address addr = JNI_FastGetField::find_slowcase_pc(pc); |
1413 |
+ if (addr != (address)-1) { |
1414 |
+ stub = addr; |
1415 |
+ } |
1416 |
+ } |
1417 |
+ } |
1418 |
+ |
1419 |
+ if (stub != NULL) { |
1420 |
+ // save all thread context in case we need to restore it |
1421 |
+ if (thread != NULL) thread->set_saved_exception_pc(pc); |
1422 |
+ |
1423 |
+ os::Linux::ucontext_set_pc(uc, stub); |
1424 |
+ return true; |
1425 |
+ } |
1426 |
+ |
1427 |
+ // signal-chaining |
1428 |
+ if (os::Linux::chained_handler(sig, info, ucVoid)) { |
1429 |
+ return true; |
1430 |
+ } |
1431 |
+ |
1432 |
+ if (!abort_if_unrecognized) { |
1433 |
+ // caller wants another chance, so give it to him |
1434 |
+ return false; |
1435 |
+ } |
1436 |
+ |
1437 |
+ if (pc == NULL && uc != NULL) { |
1438 |
+ pc = os::Linux::ucontext_get_pc(uc); |
1439 |
+ } |
1440 |
+ |
1441 |
+ // unmask current signal |
1442 |
+ sigset_t newset; |
1443 |
+ sigemptyset(&newset); |
1444 |
+ sigaddset(&newset, sig); |
1445 |
+ sigprocmask(SIG_UNBLOCK, &newset, NULL); |
1446 |
+ |
1447 |
+ VMError::report_and_die(t, sig, pc, info, ucVoid); |
1448 |
+ |
1449 |
+ ShouldNotReachHere(); |
1450 |
+ return true; // Mute compiler |
1451 |
+} |
1452 |
+ |
1453 |
+void os::Linux::init_thread_fpu_state(void) { |
1454 |
+} |
1455 |
+ |
1456 |
+int os::Linux::get_fpu_control_word(void) { |
1457 |
+ return 0; |
1458 |
+} |
1459 |
+ |
1460 |
+void os::Linux::set_fpu_control_word(int fpu_control) { |
1461 |
+} |
1462 |
+ |
1463 |
+// Check that the linux kernel version is 2.4 or higher since earlier |
1464 |
+// versions do not support SSE without patches. |
1465 |
+bool os::supports_sse() { |
1466 |
+ return true; |
1467 |
+} |
1468 |
+ |
1469 |
+bool os::is_allocatable(size_t bytes) { |
1470 |
+ return true; |
1471 |
+} |
1472 |
+ |
1473 |
+//////////////////////////////////////////////////////////////////////////////// |
1474 |
+// thread stack |
1475 |
+ |
1476 |
+// Minimum usable stack sizes required to get to user code. Space for |
1477 |
+// HotSpot guard pages is added later. |
1478 |
+size_t os::Posix::_compiler_thread_min_stack_allowed = 72 * K; |
1479 |
+size_t os::Posix::_java_thread_min_stack_allowed = 72 * K; |
1480 |
+size_t os::Posix::_vm_internal_thread_min_stack_allowed = 72 * K; |
1481 |
+ |
1482 |
+// return default stack size for thr_type |
1483 |
+size_t os::Posix::default_stack_size(os::ThreadType thr_type) { |
1484 |
+ // default stack size (compiler thread needs larger stack) |
1485 |
+ size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M); |
1486 |
+ return s; |
1487 |
+} |
1488 |
+ |
1489 |
+///////////////////////////////////////////////////////////////////////////// |
1490 |
+// helper functions for fatal error handler |
1491 |
+ |
1492 |
+void os::print_context(outputStream *st, const void *context) { |
1493 |
+ if (context == NULL) return; |
1494 |
+ |
1495 |
+ const ucontext_t *uc = (const ucontext_t*)context; |
1496 |
+ st->print_cr("Registers:"); |
1497 |
+#ifdef BUILTIN_SIM |
1498 |
+ st->print( "RAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RAX]); |
1499 |
+ st->print(", RBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBX]); |
1500 |
+ st->print(", RCX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RCX]); |
1501 |
+ st->print(", RDX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RDX]); |
1502 |
+ st->cr(); |
1503 |
+ st->print( "RSP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RSP]); |
1504 |
+ st->print(", RBP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBP]); |
1505 |
+ st->print(", RSI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RSI]); |
1506 |
+ st->print(", RDI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RDI]); |
1507 |
+ st->cr(); |
1508 |
+ st->print( "R8 =" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R8]); |
1509 |
+ st->print(", R9 =" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R9]); |
1510 |
+ st->print(", R10=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R10]); |
1511 |
+ st->print(", R11=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R11]); |
1512 |
+ st->cr(); |
1513 |
+ st->print( "R12=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R12]); |
1514 |
+ st->print(", R13=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R13]); |
1515 |
+ st->print(", R14=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R14]); |
1516 |
+ st->print(", R15=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R15]); |
1517 |
+ st->cr(); |
1518 |
+ st->print( "RIP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RIP]); |
1519 |
+ st->print(", EFLAGS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EFL]); |
1520 |
+ st->print(", CSGSFS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_CSGSFS]); |
1521 |
+ st->print(", ERR=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ERR]); |
1522 |
+ st->cr(); |
1523 |
+ st->print(" TRAPNO=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_TRAPNO]); |
1524 |
+ st->cr(); |
1525 |
+#else |
1526 |
+ for (int r = 0; r < 31; r++) { |
1527 |
+ st->print("R%-2d=", r); |
1528 |
+ print_location(st, uc->uc_mcontext.regs[r]); |
1529 |
+ } |
1530 |
+#endif |
1531 |
+ st->cr(); |
1532 |
+ |
1533 |
+ intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc); |
1534 |
+ st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp)); |
1535 |
+ print_hex_dump(st, (address)sp, (address)(sp + 8*sizeof(intptr_t)), sizeof(intptr_t)); |
1536 |
+ st->cr(); |
1537 |
+ |
1538 |
+ // Note: it may be unsafe to inspect memory near pc. For example, pc may |
1539 |
+ // point to garbage if entry point in an nmethod is corrupted. Leave |
1540 |
+ // this at the end, and hope for the best. |
1541 |
+ address pc = os::Linux::ucontext_get_pc(uc); |
1542 |
+ st->print_cr("Instructions: (pc=" PTR_FORMAT ")", p2i(pc)); |
1543 |
+ print_hex_dump(st, pc - 32, pc + 32, sizeof(char)); |
1544 |
+} |
1545 |
+ |
1546 |
+void os::print_register_info(outputStream *st, const void *context) { |
1547 |
+ if (context == NULL) return; |
1548 |
+ |
1549 |
+ const ucontext_t *uc = (const ucontext_t*)context; |
1550 |
+ |
1551 |
+ st->print_cr("Register to memory mapping:"); |
1552 |
+ st->cr(); |
1553 |
+ |
1554 |
+ // this is horrendously verbose but the layout of the registers in the |
1555 |
+ // context does not match how we defined our abstract Register set, so |
1556 |
+ // we can't just iterate through the gregs area |
1557 |
+ |
1558 |
+ // this is only for the "general purpose" registers |
1559 |
+ |
1560 |
+#ifdef BUILTIN_SIM |
1561 |
+ st->print("RAX="); print_location(st, uc->uc_mcontext.gregs[REG_RAX]); |
1562 |
+ st->print("RBX="); print_location(st, uc->uc_mcontext.gregs[REG_RBX]); |
1563 |
+ st->print("RCX="); print_location(st, uc->uc_mcontext.gregs[REG_RCX]); |
1564 |
+ st->print("RDX="); print_location(st, uc->uc_mcontext.gregs[REG_RDX]); |
1565 |
+ st->print("RSP="); print_location(st, uc->uc_mcontext.gregs[REG_RSP]); |
1566 |
+ st->print("RBP="); print_location(st, uc->uc_mcontext.gregs[REG_RBP]); |
1567 |
+ st->print("RSI="); print_location(st, uc->uc_mcontext.gregs[REG_RSI]); |
1568 |
+ st->print("RDI="); print_location(st, uc->uc_mcontext.gregs[REG_RDI]); |
1569 |
+ st->print("R8 ="); print_location(st, uc->uc_mcontext.gregs[REG_R8]); |
1570 |
+ st->print("R9 ="); print_location(st, uc->uc_mcontext.gregs[REG_R9]); |
1571 |
+ st->print("R10="); print_location(st, uc->uc_mcontext.gregs[REG_R10]); |
1572 |
+ st->print("R11="); print_location(st, uc->uc_mcontext.gregs[REG_R11]); |
1573 |
+ st->print("R12="); print_location(st, uc->uc_mcontext.gregs[REG_R12]); |
1574 |
+ st->print("R13="); print_location(st, uc->uc_mcontext.gregs[REG_R13]); |
1575 |
+ st->print("R14="); print_location(st, uc->uc_mcontext.gregs[REG_R14]); |
1576 |
+ st->print("R15="); print_location(st, uc->uc_mcontext.gregs[REG_R15]); |
1577 |
+#else |
1578 |
+ for (int r = 0; r < 31; r++) |
1579 |
+ st->print_cr( "R%d=" INTPTR_FORMAT, r, (uintptr_t)uc->uc_mcontext.regs[r]); |
1580 |
+#endif |
1581 |
+ st->cr(); |
1582 |
+} |
1583 |
+ |
1584 |
+void os::setup_fpu() { |
1585 |
+} |
1586 |
+ |
1587 |
+#ifndef PRODUCT |
1588 |
+void os::verify_stack_alignment() { |
1589 |
+ assert(((intptr_t)os::current_stack_pointer() & (StackAlignmentInBytes-1)) == 0, "incorrect stack alignment"); |
1590 |
+} |
1591 |
+#endif |
1592 |
+ |
1593 |
+int os::extra_bang_size_in_bytes() { |
1594 |
+ // AArch64 does not require the additional stack bang. |
1595 |
+ return 0; |
1596 |
+} |
1597 |
+ |
1598 |
+extern "C" { |
1599 |
+ int SpinPause() { |
1600 |
+ return 0; |
1601 |
+ } |
1602 |
+ |
1603 |
+ void _Copy_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) { |
1604 |
+ if (from > to) { |
1605 |
+ jshort *end = from + count; |
1606 |
+ while (from < end) |
1607 |
+ *(to++) = *(from++); |
1608 |
+ } |
1609 |
+ else if (from < to) { |
1610 |
+ jshort *end = from; |
1611 |
+ from += count - 1; |
1612 |
+ to += count - 1; |
1613 |
+ while (from >= end) |
1614 |
+ *(to--) = *(from--); |
1615 |
+ } |
1616 |
+ } |
1617 |
+ void _Copy_conjoint_jints_atomic(jint* from, jint* to, size_t count) { |
1618 |
+ if (from > to) { |
1619 |
+ jint *end = from + count; |
1620 |
+ while (from < end) |
1621 |
+ *(to++) = *(from++); |
1622 |
+ } |
1623 |
+ else if (from < to) { |
1624 |
+ jint *end = from; |
1625 |
+ from += count - 1; |
1626 |
+ to += count - 1; |
1627 |
+ while (from >= end) |
1628 |
+ *(to--) = *(from--); |
1629 |
+ } |
1630 |
+ } |
1631 |
+ void _Copy_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) { |
1632 |
+ if (from > to) { |
1633 |
+ jlong *end = from + count; |
1634 |
+ while (from < end) |
1635 |
+ os::atomic_copy64(from++, to++); |
1636 |
+ } |
1637 |
+ else if (from < to) { |
1638 |
+ jlong *end = from; |
1639 |
+ from += count - 1; |
1640 |
+ to += count - 1; |
1641 |
+ while (from >= end) |
1642 |
+ os::atomic_copy64(from--, to--); |
1643 |
+ } |
1644 |
+ } |
1645 |
+ |
1646 |
+ void _Copy_arrayof_conjoint_bytes(HeapWord* from, |
1647 |
+ HeapWord* to, |
1648 |
+ size_t count) { |
1649 |
+ memmove(to, from, count); |
1650 |
+ } |
1651 |
+ void _Copy_arrayof_conjoint_jshorts(HeapWord* from, |
1652 |
+ HeapWord* to, |
1653 |
+ size_t count) { |
1654 |
+ memmove(to, from, count * 2); |
1655 |
+ } |
1656 |
+ void _Copy_arrayof_conjoint_jints(HeapWord* from, |
1657 |
+ HeapWord* to, |
1658 |
+ size_t count) { |
1659 |
+ memmove(to, from, count * 4); |
1660 |
+ } |
1661 |
+ void _Copy_arrayof_conjoint_jlongs(HeapWord* from, |
1662 |
+ HeapWord* to, |
1663 |
+ size_t count) { |
1664 |
+ memmove(to, from, count * 8); |
1665 |
+ } |
1666 |
+}; |
1667 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.hpp b/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.hpp |
1668 |
new file mode 100644 |
1669 |
index 0000000000..d2d02efc54 |
1670 |
--- /dev/null |
1671 |
+++ src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.hpp |
1672 |
@@ -0,0 +1,45 @@ |
1673 |
+/* |
1674 |
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. |
1675 |
+ * Copyright (c) 2014, Red Hat Inc. All rights reserved. |
1676 |
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
1677 |
+ * |
1678 |
+ * This code is free software; you can redistribute it and/or modify it |
1679 |
+ * under the terms of the GNU General Public License version 2 only, as |
1680 |
+ * published by the Free Software Foundation. |
1681 |
+ * |
1682 |
+ * This code is distributed in the hope that it will be useful, but WITHOUT |
1683 |
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
1684 |
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
1685 |
+ * version 2 for more details (a copy is included in the LICENSE file that |
1686 |
+ * accompanied this code). |
1687 |
+ * |
1688 |
+ * You should have received a copy of the GNU General Public License version |
1689 |
+ * 2 along with this work; if not, write to the Free Software Foundation, |
1690 |
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
1691 |
+ * |
1692 |
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
1693 |
+ * or visit www.oracle.com if you need additional information or have any |
1694 |
+ * questions. |
1695 |
+ * |
1696 |
+ */ |
1697 |
+ |
1698 |
+#ifndef OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_HPP |
1699 |
+#define OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_HPP |
1700 |
+ |
1701 |
+ static void setup_fpu(); |
1702 |
+ static bool supports_sse(); |
1703 |
+ |
1704 |
+ static jlong rdtsc(); |
1705 |
+ |
1706 |
+ static bool is_allocatable(size_t bytes); |
1707 |
+ |
1708 |
+ // Used to register dynamic code cache area with the OS |
1709 |
+ // Note: Currently only used in 64 bit Windows implementations |
1710 |
+ static bool register_code_area(char *low, char *high) { return true; } |
1711 |
+ |
1712 |
+ // Atomically copy 64 bits of data |
1713 |
+ static void atomic_copy64(const volatile void *src, volatile void *dst) { |
1714 |
+ *(jlong *) dst = *(const jlong *) src; |
1715 |
+ } |
1716 |
+ |
1717 |
+#endif // OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_HPP |
1718 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.inline.hpp b/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.inline.hpp |
1719 |
new file mode 100644 |
1720 |
index 0000000000..2402d13540 |
1721 |
--- /dev/null |
1722 |
+++ src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.inline.hpp |
1723 |
@@ -0,0 +1,40 @@ |
1724 |
+/* |
1725 |
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
1726 |
+ * Copyright (c) 2014, Red Hat Inc. All rights reserved. |
1727 |
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
1728 |
+ * |
1729 |
+ * This code is free software; you can redistribute it and/or modify it |
1730 |
+ * under the terms of the GNU General Public License version 2 only, as |
1731 |
+ * published by the Free Software Foundation. |
1732 |
+ * |
1733 |
+ * This code is distributed in the hope that it will be useful, but WITHOUT |
1734 |
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
1735 |
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
1736 |
+ * version 2 for more details (a copy is included in the LICENSE file that |
1737 |
+ * accompanied this code). |
1738 |
+ * |
1739 |
+ * You should have received a copy of the GNU General Public License version |
1740 |
+ * 2 along with this work; if not, write to the Free Software Foundation, |
1741 |
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
1742 |
+ * |
1743 |
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
1744 |
+ * or visit www.oracle.com if you need additional information or have any |
1745 |
+ * questions. |
1746 |
+ * |
1747 |
+ */ |
1748 |
+ |
1749 |
+#ifndef OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_INLINE_HPP |
1750 |
+#define OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_INLINE_HPP |
1751 |
+ |
1752 |
+#include "runtime/os.hpp" |
1753 |
+ |
1754 |
+// See http://www.technovelty.org/code/c/reading-rdtsc.htl for details |
1755 |
+inline jlong os::rdtsc() { |
1756 |
+ uint64_t res; |
1757 |
+ uint32_t ts1, ts2; |
1758 |
+ __asm__ __volatile__ ("rdtsc" : "=a" (ts1), "=d" (ts2)); |
1759 |
+ res = ((uint64_t)ts1 | (uint64_t)ts2 << 32); |
1760 |
+ return (jlong)res; |
1761 |
+} |
1762 |
+ |
1763 |
+#endif // OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_INLINE_HPP |
1764 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/prefetch_bsd_aarch64.inline.hpp b/src/hotspot/os_cpu/bsd_aarch64/prefetch_bsd_aarch64.inline.hpp |
1765 |
new file mode 100644 |
1766 |
index 0000000000..687eb50bab |
1767 |
--- /dev/null |
1768 |
+++ src/hotspot/os_cpu/bsd_aarch64/prefetch_bsd_aarch64.inline.hpp |
1769 |
@@ -0,0 +1,46 @@ |
1770 |
+/* |
1771 |
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. |
1772 |
+ * Copyright (c) 2014, Red Hat Inc. All rights reserved. |
1773 |
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
1774 |
+ * |
1775 |
+ * This code is free software; you can redistribute it and/or modify it |
1776 |
+ * under the terms of the GNU General Public License version 2 only, as |
1777 |
+ * published by the Free Software Foundation. |
1778 |
+ * |
1779 |
+ * This code is distributed in the hope that it will be useful, but WITHOUT |
1780 |
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
1781 |
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
1782 |
+ * version 2 for more details (a copy is included in the LICENSE file that |
1783 |
+ * accompanied this code). |
1784 |
+ * |
1785 |
+ * You should have received a copy of the GNU General Public License version |
1786 |
+ * 2 along with this work; if not, write to the Free Software Foundation, |
1787 |
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
1788 |
+ * |
1789 |
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
1790 |
+ * or visit www.oracle.com if you need additional information or have any |
1791 |
+ * questions. |
1792 |
+ * |
1793 |
+ */ |
1794 |
+ |
1795 |
+#ifndef OS_CPU_LINUX_AARCH64_VM_PREFETCH_LINUX_AARCH64_INLINE_HPP |
1796 |
+#define OS_CPU_LINUX_AARCH64_VM_PREFETCH_LINUX_AARCH64_INLINE_HPP |
1797 |
+ |
1798 |
+#include "runtime/prefetch.hpp" |
1799 |
+ |
1800 |
+ |
1801 |
+inline void Prefetch::read (void *loc, intx interval) { |
1802 |
+#ifndef BUILTIN_SIM |
1803 |
+ if (interval >= 0) |
1804 |
+ asm("prfm PLDL1KEEP, [%0, %1]" : : "r"(loc), "r"(interval)); |
1805 |
+#endif |
1806 |
+} |
1807 |
+ |
1808 |
+inline void Prefetch::write(void *loc, intx interval) { |
1809 |
+#ifndef BUILTIN_SIM |
1810 |
+ if (interval >= 0) |
1811 |
+ asm("prfm PSTL1KEEP, [%0, %1]" : : "r"(loc), "r"(interval)); |
1812 |
+#endif |
1813 |
+} |
1814 |
+ |
1815 |
+#endif // OS_CPU_LINUX_AARCH64_VM_PREFETCH_LINUX_AARCH64_INLINE_HPP |
1816 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/threadLS_bsd_aarch64.s b/src/hotspot/os_cpu/bsd_aarch64/threadLS_bsd_aarch64.s |
1817 |
new file mode 100644 |
1818 |
index 0000000000..f541844b9d |
1819 |
--- /dev/null |
1820 |
+++ src/hotspot/os_cpu/bsd_aarch64/threadLS_bsd_aarch64.s |
1821 |
@@ -0,0 +1,44 @@ |
1822 |
+// Copyright (c) 2015, Red Hat Inc. All rights reserved. |
1823 |
+// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
1824 |
+// |
1825 |
+// This code is free software; you can redistribute it and/or modify it |
1826 |
+// under the terms of the GNU General Public License version 2 only, as |
1827 |
+// published by the Free Software Foundation. |
1828 |
+// |
1829 |
+// This code is distributed in the hope that it will be useful, but WITHOUT |
1830 |
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
1831 |
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
1832 |
+// version 2 for more details (a copy is included in the LICENSE file that |
1833 |
+// accompanied this code). |
1834 |
+// |
1835 |
+// You should have received a copy of the GNU General Public License version |
1836 |
+// 2 along with this work; if not, write to the Free Software Foundation, |
1837 |
+// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
1838 |
+// |
1839 |
+// Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
1840 |
+// or visit www.oracle.com if you need additional information or have any |
1841 |
+// questions. |
1842 |
+ |
1843 |
+ // JavaThread::aarch64_get_thread_helper() |
1844 |
+ // |
1845 |
+ // Return the current thread pointer in x0. |
1846 |
+ // Clobber x1, flags. |
1847 |
+ // All other registers are preserved, |
1848 |
+ |
1849 |
+ .global _ZN10JavaThread25aarch64_get_thread_helperEv |
1850 |
+ .type _ZN10JavaThread25aarch64_get_thread_helperEv, %function |
1851 |
+ |
1852 |
+_ZN10JavaThread25aarch64_get_thread_helperEv: |
1853 |
+ stp x29, x30, [sp, -16]! |
1854 |
+ adrp x0, :tlsdesc:_ZN6Thread12_thr_currentE |
1855 |
+ ldr x1, [x0, #:tlsdesc_lo12:_ZN6Thread12_thr_currentE] |
1856 |
+ add x0, x0, :tlsdesc_lo12:_ZN6Thread12_thr_currentE |
1857 |
+ .tlsdesccall _ZN6Thread12_thr_currentE |
1858 |
+ blr x1 |
1859 |
+ mrs x1, tpidr_el0 |
1860 |
+ add x0, x1, x0 |
1861 |
+ ldr x0, [x0] |
1862 |
+ ldp x29, x30, [sp], 16 |
1863 |
+ ret |
1864 |
+ |
1865 |
+ .size _ZN10JavaThread25aarch64_get_thread_helperEv, .-_ZN10JavaThread25aarch64_get_thread_helperEv |
1866 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.cpp b/src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.cpp |
1867 |
new file mode 100644 |
1868 |
index 0000000000..9084daeaa2 |
1869 |
--- /dev/null |
1870 |
+++ src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.cpp |
1871 |
@@ -0,0 +1,104 @@ |
1872 |
+/* |
1873 |
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. |
1874 |
+ * Copyright (c) 2014, Red Hat Inc. All rights reserved. |
1875 |
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
1876 |
+ * |
1877 |
+ * This code is free software; you can redistribute it and/or modify it |
1878 |
+ * under the terms of the GNU General Public License version 2 only, as |
1879 |
+ * published by the Free Software Foundation. |
1880 |
+ * |
1881 |
+ * This code is distributed in the hope that it will be useful, but WITHOUT |
1882 |
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
1883 |
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
1884 |
+ * version 2 for more details (a copy is included in the LICENSE file that |
1885 |
+ * accompanied this code). |
1886 |
+ * |
1887 |
+ * You should have received a copy of the GNU General Public License version |
1888 |
+ * 2 along with this work; if not, write to the Free Software Foundation, |
1889 |
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
1890 |
+ * |
1891 |
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
1892 |
+ * or visit www.oracle.com if you need additional information or have any |
1893 |
+ * questions. |
1894 |
+ * |
1895 |
+ */ |
1896 |
+ |
1897 |
+#include "precompiled.hpp" |
1898 |
+#include "memory/metaspaceShared.hpp" |
1899 |
+#include "runtime/frame.inline.hpp" |
1900 |
+#include "runtime/thread.inline.hpp" |
1901 |
+ |
1902 |
+frame JavaThread::pd_last_frame() { |
1903 |
+ assert(has_last_Java_frame(), "must have last_Java_sp() when suspended"); |
1904 |
+ return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc()); |
1905 |
+} |
1906 |
+ |
1907 |
+// For Forte Analyzer AsyncGetCallTrace profiling support - thread is |
1908 |
+// currently interrupted by SIGPROF |
1909 |
+bool JavaThread::pd_get_top_frame_for_signal_handler(frame* fr_addr, |
1910 |
+ void* ucontext, bool isInJava) { |
1911 |
+ |
1912 |
+ assert(Thread::current() == this, "caller must be current thread"); |
1913 |
+ return pd_get_top_frame(fr_addr, ucontext, isInJava); |
1914 |
+} |
1915 |
+ |
1916 |
+bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava) { |
1917 |
+ return pd_get_top_frame(fr_addr, ucontext, isInJava); |
1918 |
+} |
1919 |
+ |
1920 |
+bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava) { |
1921 |
+ assert(this->is_Java_thread(), "must be JavaThread"); |
1922 |
+ JavaThread* jt = (JavaThread *)this; |
1923 |
+ |
1924 |
+ // If we have a last_Java_frame, then we should use it even if |
1925 |
+ // isInJava == true. It should be more reliable than ucontext info. |
1926 |
+ if (jt->has_last_Java_frame() && jt->frame_anchor()->walkable()) { |
1927 |
+ *fr_addr = jt->pd_last_frame(); |
1928 |
+ return true; |
1929 |
+ } |
1930 |
+ |
1931 |
+ // At this point, we don't have a last_Java_frame, so |
1932 |
+ // we try to glean some information out of the ucontext |
1933 |
+ // if we were running Java code when SIGPROF came in. |
1934 |
+ if (isInJava) { |
1935 |
+ ucontext_t* uc = (ucontext_t*) ucontext; |
1936 |
+ |
1937 |
+ intptr_t* ret_fp; |
1938 |
+ intptr_t* ret_sp; |
1939 |
+ ExtendedPC addr = os::Linux::fetch_frame_from_ucontext(this, uc, |
1940 |
+ &ret_sp, &ret_fp); |
1941 |
+ if (addr.pc() == NULL || ret_sp == NULL ) { |
1942 |
+ // ucontext wasn't useful |
1943 |
+ return false; |
1944 |
+ } |
1945 |
+ |
1946 |
+ if (MetaspaceShared::is_in_trampoline_frame(addr.pc())) { |
1947 |
+ // In the middle of a trampoline call. Bail out for safety. |
1948 |
+ // This happens rarely so shouldn't affect profiling. |
1949 |
+ return false; |
1950 |
+ } |
1951 |
+ |
1952 |
+ frame ret_frame(ret_sp, ret_fp, addr.pc()); |
1953 |
+ if (!ret_frame.safe_for_sender(jt)) { |
1954 |
+#ifdef COMPILER2 |
1955 |
+ frame ret_frame2(ret_sp, NULL, addr.pc()); |
1956 |
+ if (!ret_frame2.safe_for_sender(jt)) { |
1957 |
+ // nothing else to try if the frame isn't good |
1958 |
+ return false; |
1959 |
+ } |
1960 |
+ ret_frame = ret_frame2; |
1961 |
+#else |
1962 |
+ // nothing else to try if the frame isn't good |
1963 |
+ return false; |
1964 |
+#endif /* COMPILER2 */ |
1965 |
+ } |
1966 |
+ *fr_addr = ret_frame; |
1967 |
+ return true; |
1968 |
+ } |
1969 |
+ |
1970 |
+ // nothing else to try |
1971 |
+ return false; |
1972 |
+} |
1973 |
+ |
1974 |
+void JavaThread::cache_global_variables() { } |
1975 |
+ |
1976 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.hpp b/src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.hpp |
1977 |
new file mode 100644 |
1978 |
index 0000000000..a2261b1906 |
1979 |
--- /dev/null |
1980 |
+++ src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.hpp |
1981 |
@@ -0,0 +1,80 @@ |
1982 |
+/* |
1983 |
+ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. |
1984 |
+ * Copyright (c) 2014, Red Hat Inc. All rights reserved. |
1985 |
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
1986 |
+ * |
1987 |
+ * This code is free software; you can redistribute it and/or modify it |
1988 |
+ * under the terms of the GNU General Public License version 2 only, as |
1989 |
+ * published by the Free Software Foundation. |
1990 |
+ * |
1991 |
+ * This code is distributed in the hope that it will be useful, but WITHOUT |
1992 |
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
1993 |
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
1994 |
+ * version 2 for more details (a copy is included in the LICENSE file that |
1995 |
+ * accompanied this code). |
1996 |
+ * |
1997 |
+ * You should have received a copy of the GNU General Public License version |
1998 |
+ * 2 along with this work; if not, write to the Free Software Foundation, |
1999 |
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
2000 |
+ * |
2001 |
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
2002 |
+ * or visit www.oracle.com if you need additional information or have any |
2003 |
+ * questions. |
2004 |
+ * |
2005 |
+ */ |
2006 |
+ |
2007 |
+#ifndef OS_CPU_LINUX_AARCH64_VM_THREAD_LINUX_AARCH64_HPP |
2008 |
+#define OS_CPU_LINUX_AARCH64_VM_THREAD_LINUX_AARCH64_HPP |
2009 |
+ |
2010 |
+ private: |
2011 |
+#ifdef ASSERT |
2012 |
+ // spill stack holds N callee-save registers at each Java call and |
2013 |
+ // grows downwards towards limit |
2014 |
+ // we need limit to check we have space for a spill and base so we |
2015 |
+ // can identify all live spill frames at GC (eventually) |
2016 |
+ address _spill_stack; |
2017 |
+ address _spill_stack_base; |
2018 |
+ address _spill_stack_limit; |
2019 |
+#endif // ASSERT |
2020 |
+ |
2021 |
+ void pd_initialize() { |
2022 |
+ _anchor.clear(); |
2023 |
+ } |
2024 |
+ |
2025 |
+ frame pd_last_frame(); |
2026 |
+ |
2027 |
+ public: |
2028 |
+ // Mutators are highly dangerous.... |
2029 |
+ intptr_t* last_Java_fp() { return _anchor.last_Java_fp(); } |
2030 |
+ void set_last_Java_fp(intptr_t* fp) { _anchor.set_last_Java_fp(fp); } |
2031 |
+ |
2032 |
+ void set_base_of_stack_pointer(intptr_t* base_sp) { |
2033 |
+ } |
2034 |
+ |
2035 |
+ static ByteSize last_Java_fp_offset() { |
2036 |
+ return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_fp_offset(); |
2037 |
+ } |
2038 |
+ |
2039 |
+ intptr_t* base_of_stack_pointer() { |
2040 |
+ return NULL; |
2041 |
+ } |
2042 |
+ void record_base_of_stack_pointer() { |
2043 |
+ } |
2044 |
+ |
2045 |
+ bool pd_get_top_frame_for_signal_handler(frame* fr_addr, void* ucontext, |
2046 |
+ bool isInJava); |
2047 |
+ |
2048 |
+ bool pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava); |
2049 |
+private: |
2050 |
+ bool pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava); |
2051 |
+public: |
2052 |
+ |
2053 |
+ static Thread *aarch64_get_thread_helper(); |
2054 |
+ |
2055 |
+ // These routines are only used on cpu architectures that |
2056 |
+ // have separate register stacks (Itanium). |
2057 |
+ static bool register_stack_overflow() { return false; } |
2058 |
+ static void enable_register_stack_guard() {} |
2059 |
+ static void disable_register_stack_guard() {} |
2060 |
+ |
2061 |
+#endif // OS_CPU_LINUX_AARCH64_VM_THREAD_LINUX_AARCH64_HPP |
2062 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/vmStructs_bsd_aarch64.hpp b/src/hotspot/os_cpu/bsd_aarch64/vmStructs_bsd_aarch64.hpp |
2063 |
new file mode 100644 |
2064 |
index 0000000000..fa5885ca62 |
2065 |
--- /dev/null |
2066 |
+++ src/hotspot/os_cpu/bsd_aarch64/vmStructs_bsd_aarch64.hpp |
2067 |
@@ -0,0 +1,55 @@ |
2068 |
+/* |
2069 |
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. |
2070 |
+ * Copyright (c) 2014, Red Hat Inc. All rights reserved. |
2071 |
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
2072 |
+ * |
2073 |
+ * This code is free software; you can redistribute it and/or modify it |
2074 |
+ * under the terms of the GNU General Public License version 2 only, as |
2075 |
+ * published by the Free Software Foundation. |
2076 |
+ * |
2077 |
+ * This code is distributed in the hope that it will be useful, but WITHOUT |
2078 |
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2079 |
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
2080 |
+ * version 2 for more details (a copy is included in the LICENSE file that |
2081 |
+ * accompanied this code). |
2082 |
+ * |
2083 |
+ * You should have received a copy of the GNU General Public License version |
2084 |
+ * 2 along with this work; if not, write to the Free Software Foundation, |
2085 |
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
2086 |
+ * |
2087 |
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
2088 |
+ * or visit www.oracle.com if you need additional information or have any |
2089 |
+ * questions. |
2090 |
+ * |
2091 |
+ */ |
2092 |
+ |
2093 |
+#ifndef OS_CPU_LINUX_AARCH64_VM_VMSTRUCTS_LINUX_AARCH64_HPP |
2094 |
+#define OS_CPU_LINUX_AARCH64_VM_VMSTRUCTS_LINUX_AARCH64_HPP |
2095 |
+ |
2096 |
+// These are the OS and CPU-specific fields, types and integer |
2097 |
+// constants required by the Serviceability Agent. This file is |
2098 |
+// referenced by vmStructs.cpp. |
2099 |
+ |
2100 |
+#define VM_STRUCTS_OS_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) \ |
2101 |
+ \ |
2102 |
+ /******************************/ \ |
2103 |
+ /* Threads (NOTE: incomplete) */ \ |
2104 |
+ /******************************/ \ |
2105 |
+ nonstatic_field(OSThread, _thread_id, OSThread::thread_id_t) \ |
2106 |
+ nonstatic_field(OSThread, _pthread_id, pthread_t) |
2107 |
+ |
2108 |
+ |
2109 |
+#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type) \ |
2110 |
+ \ |
2111 |
+ /**********************/ \ |
2112 |
+ /* Posix Thread IDs */ \ |
2113 |
+ /**********************/ \ |
2114 |
+ \ |
2115 |
+ declare_integer_type(OSThread::thread_id_t) \ |
2116 |
+ declare_unsigned_integer_type(pthread_t) |
2117 |
+ |
2118 |
+#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) |
2119 |
+ |
2120 |
+#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) |
2121 |
+ |
2122 |
+#endif // OS_CPU_LINUX_AARCH64_VM_VMSTRUCTS_LINUX_AARCH64_HPP |
2123 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/vm_version_bsd_aarch64.cpp b/src/hotspot/os_cpu/bsd_aarch64/vm_version_bsd_aarch64.cpp |
2124 |
new file mode 100644 |
2125 |
index 0000000000..51089d12ef |
2126 |
--- /dev/null |
2127 |
+++ src/hotspot/os_cpu/bsd_aarch64/vm_version_bsd_aarch64.cpp |
2128 |
@@ -0,0 +1,29 @@ |
2129 |
+/* |
2130 |
+ * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. |
2131 |
+ * Copyright (c) 2014, Red Hat Inc. All rights reserved. |
2132 |
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
2133 |
+ * |
2134 |
+ * This code is free software; you can redistribute it and/or modify it |
2135 |
+ * under the terms of the GNU General Public License version 2 only, as |
2136 |
+ * published by the Free Software Foundation. |
2137 |
+ * |
2138 |
+ * This code is distributed in the hope that it will be useful, but WITHOUT |
2139 |
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2140 |
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
2141 |
+ * version 2 for more details (a copy is included in the LICENSE file that |
2142 |
+ * accompanied this code). |
2143 |
+ * |
2144 |
+ * You should have received a copy of the GNU General Public License version |
2145 |
+ * 2 along with this work; if not, write to the Free Software Foundation, |
2146 |
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
2147 |
+ * |
2148 |
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
2149 |
+ * or visit www.oracle.com if you need additional information or have any |
2150 |
+ * questions. |
2151 |
+ * |
2152 |
+ */ |
2153 |
+ |
2154 |
+#include "precompiled.hpp" |
2155 |
+#include "runtime/os.hpp" |
2156 |
+#include "vm_version_aarch64.hpp" |
2157 |
+ |
2158 |
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java |
2159 |
new file mode 100644 |
2160 |
index 0000000000..28e36759a5 |
2161 |
--- /dev/null |
2162 |
+++ src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java |
2163 |
@@ -0,0 +1,86 @@ |
2164 |
+/* |
2165 |
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. |
2166 |
+ * Copyright (c) 2015, Red Hat Inc. |
2167 |
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
2168 |
+ * |
2169 |
+ * This code is free software; you can redistribute it and/or modify it |
2170 |
+ * under the terms of the GNU General Public License version 2 only, as |
2171 |
+ * published by the Free Software Foundation. |
2172 |
+ * |
2173 |
+ * This code is distributed in the hope that it will be useful, but WITHOUT |
2174 |
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2175 |
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
2176 |
+ * version 2 for more details (a copy is included in the LICENSE file that |
2177 |
+ * accompanied this code). |
2178 |
+ * |
2179 |
+ * You should have received a copy of the GNU General Public License version |
2180 |
+ * 2 along with this work; if not, write to the Free Software Foundation, |
2181 |
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
2182 |
+ * |
2183 |
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
2184 |
+ * or visit www.oracle.com if you need additional information or have any |
2185 |
+ * questions. |
2186 |
+ * |
2187 |
+ */ |
2188 |
+ |
2189 |
+package sun.jvm.hotspot.debugger.linux.aarch64; |
2190 |
+ |
2191 |
+import sun.jvm.hotspot.debugger.*; |
2192 |
+import sun.jvm.hotspot.debugger.aarch64.*; |
2193 |
+import sun.jvm.hotspot.debugger.linux.*; |
2194 |
+import sun.jvm.hotspot.debugger.cdbg.*; |
2195 |
+import sun.jvm.hotspot.debugger.cdbg.basic.*; |
2196 |
+ |
2197 |
+final public class LinuxAARCH64CFrame extends BasicCFrame { |
2198 |
+ public LinuxAARCH64CFrame(LinuxDebugger dbg, Address fp, Address pc) { |
2199 |
+ super(dbg.getCDebugger()); |
2200 |
+ this.fp = fp; |
2201 |
+ this.pc = pc; |
2202 |
+ this.dbg = dbg; |
2203 |
+ } |
2204 |
+ |
2205 |
+ // override base class impl to avoid ELF parsing |
2206 |
+ public ClosestSymbol closestSymbolToPC() { |
2207 |
+ // try native lookup in debugger. |
2208 |
+ return dbg.lookup(dbg.getAddressValue(pc())); |
2209 |
+ } |
2210 |
+ |
2211 |
+ public Address pc() { |
2212 |
+ return pc; |
2213 |
+ } |
2214 |
+ |
2215 |
+ public Address localVariableBase() { |
2216 |
+ return fp; |
2217 |
+ } |
2218 |
+ |
2219 |
+ public CFrame sender(ThreadProxy thread) { |
2220 |
+ AARCH64ThreadContext context = (AARCH64ThreadContext) thread.getContext(); |
2221 |
+ Address rsp = context.getRegisterAsAddress(AARCH64ThreadContext.SP); |
2222 |
+ |
2223 |
+ if ((fp == null) || fp.lessThan(rsp)) { |
2224 |
+ return null; |
2225 |
+ } |
2226 |
+ |
2227 |
+ // Check alignment of fp |
2228 |
+ if (dbg.getAddressValue(fp) % (2 * ADDRESS_SIZE) != 0) { |
2229 |
+ return null; |
2230 |
+ } |
2231 |
+ |
2232 |
+ Address nextFP = fp.getAddressAt(0 * ADDRESS_SIZE); |
2233 |
+ if (nextFP == null || nextFP.lessThanOrEqual(fp)) { |
2234 |
+ return null; |
2235 |
+ } |
2236 |
+ Address nextPC = fp.getAddressAt(1 * ADDRESS_SIZE); |
2237 |
+ if (nextPC == null) { |
2238 |
+ return null; |
2239 |
+ } |
2240 |
+ return new LinuxAARCH64CFrame(dbg, nextFP, nextPC); |
2241 |
+ } |
2242 |
+ |
2243 |
+ // package/class internals only |
2244 |
+ private static final int ADDRESS_SIZE = 8; |
2245 |
+ private Address pc; |
2246 |
+ private Address sp; |
2247 |
+ private Address fp; |
2248 |
+ private LinuxDebugger dbg; |
2249 |
+} |
2250 |
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64ThreadContext.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64ThreadContext.java |
2251 |
new file mode 100644 |
2252 |
index 0000000000..7700316867 |
2253 |
--- /dev/null |
2254 |
+++ src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64ThreadContext.java |
2255 |
@@ -0,0 +1,47 @@ |
2256 |
+/* |
2257 |
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. |
2258 |
+ * Copyright (c) 2015, Red Hat Inc. |
2259 |
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
2260 |
+ * |
2261 |
+ * This code is free software; you can redistribute it and/or modify it |
2262 |
+ * under the terms of the GNU General Public License version 2 only, as |
2263 |
+ * published by the Free Software Foundation. |
2264 |
+ * |
2265 |
+ * This code is distributed in the hope that it will be useful, but WITHOUT |
2266 |
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2267 |
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
2268 |
+ * version 2 for more details (a copy is included in the LICENSE file that |
2269 |
+ * accompanied this code). |
2270 |
+ * |
2271 |
+ * You should have received a copy of the GNU General Public License version |
2272 |
+ * 2 along with this work; if not, write to the Free Software Foundation, |
2273 |
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
2274 |
+ * |
2275 |
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
2276 |
+ * or visit www.oracle.com if you need additional information or have any |
2277 |
+ * questions. |
2278 |
+ * |
2279 |
+ */ |
2280 |
+ |
2281 |
+package sun.jvm.hotspot.debugger.linux.aarch64; |
2282 |
+ |
2283 |
+import sun.jvm.hotspot.debugger.*; |
2284 |
+import sun.jvm.hotspot.debugger.aarch64.*; |
2285 |
+import sun.jvm.hotspot.debugger.linux.*; |
2286 |
+ |
2287 |
+public class LinuxAARCH64ThreadContext extends AARCH64ThreadContext { |
2288 |
+ private LinuxDebugger debugger; |
2289 |
+ |
2290 |
+ public LinuxAARCH64ThreadContext(LinuxDebugger debugger) { |
2291 |
+ super(); |
2292 |
+ this.debugger = debugger; |
2293 |
+ } |
2294 |
+ |
2295 |
+ public void setRegisterAsAddress(int index, Address value) { |
2296 |
+ setRegister(index, debugger.getAddressValue(value)); |
2297 |
+ } |
2298 |
+ |
2299 |
+ public Address getRegisterAsAddress(int index) { |
2300 |
+ return debugger.newAddress(getRegister(index)); |
2301 |
+ } |
2302 |
+} |
2303 |
|
2304 |
From a802e4bfd9de13e7373890328fd7ad6725cbcde2 Mon Sep 17 00:00:00 2001 |
2305 |
From: miki <mikael.urankar@gmail.com> |
2306 |
Date: Thu, 11 Apr 2019 20:11:26 +0200 |
2307 |
Subject: [PATCH 02/17] Mechanically convert linux -> bsd |
2308 |
|
2309 |
for file in $(ls src/hotspot/os_cpu/bsd_aarch64/*) \ |
2310 |
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java \ |
2311 |
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64ThreadContext.java |
2312 |
do |
2313 |
sed -i '' 's/linux/bsd/g' ${file} |
2314 |
sed -i '' 's/Linux/Bsd/g' ${file} |
2315 |
sed -i '' 's/LINUX/BSD/g' ${file} |
2316 |
done |
2317 |
--- |
2318 |
.../os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp | 6 +- |
2319 |
src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.ad | 2 +- |
2320 |
.../bsd_aarch64/bytes_bsd_aarch64.inline.hpp | 6 +- |
2321 |
.../bsd_aarch64/copy_bsd_aarch64.inline.hpp | 6 +- |
2322 |
.../bsd_aarch64/globals_bsd_aarch64.hpp | 6 +- |
2323 |
.../bsd_aarch64/orderAccess_bsd_aarch64.hpp | 6 +- |
2324 |
.../os_cpu/bsd_aarch64/os_bsd_aarch64.cpp | 66 +++++++++---------- |
2325 |
.../os_cpu/bsd_aarch64/os_bsd_aarch64.hpp | 6 +- |
2326 |
.../bsd_aarch64/os_bsd_aarch64.inline.hpp | 6 +- |
2327 |
.../prefetch_bsd_aarch64.inline.hpp | 6 +- |
2328 |
.../os_cpu/bsd_aarch64/thread_bsd_aarch64.cpp | 2 +- |
2329 |
.../os_cpu/bsd_aarch64/thread_bsd_aarch64.hpp | 6 +- |
2330 |
.../bsd_aarch64/vmStructs_bsd_aarch64.hpp | 6 +- |
2331 |
.../bsd/aarch64/BsdAARCH64CFrame.java | 12 ++-- |
2332 |
.../bsd/aarch64/BsdAARCH64ThreadContext.java | 10 +-- |
2333 |
15 files changed, 76 insertions(+), 76 deletions(-) |
2334 |
|
2335 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp b/src/hotspot/os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp |
2336 |
index e1f59bb43e..2c8dd82eac 100644 |
2337 |
--- /src/hotspot/os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp |
2338 |
+++ src/hotspot/os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp |
2339 |
@@ -23,8 +23,8 @@ |
2340 |
* |
2341 |
*/ |
2342 |
|
2343 |
-#ifndef OS_CPU_LINUX_AARCH64_VM_ATOMIC_LINUX_AARCH64_HPP |
2344 |
-#define OS_CPU_LINUX_AARCH64_VM_ATOMIC_LINUX_AARCH64_HPP |
2345 |
+#ifndef OS_CPU_BSD_AARCH64_VM_ATOMIC_BSD_AARCH64_HPP |
2346 |
+#define OS_CPU_BSD_AARCH64_VM_ATOMIC_BSD_AARCH64_HPP |
2347 |
|
2348 |
#include "vm_version_aarch64.hpp" |
2349 |
|
2350 |
@@ -72,4 +72,4 @@ inline T Atomic::PlatformCmpxchg<byte_size>::operator()(T exchange_value, |
2351 |
} |
2352 |
} |
2353 |
|
2354 |
-#endif // OS_CPU_LINUX_AARCH64_VM_ATOMIC_LINUX_AARCH64_HPP |
2355 |
+#endif // OS_CPU_BSD_AARCH64_VM_ATOMIC_BSD_AARCH64_HPP |
2356 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.ad b/src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.ad |
2357 |
index c3b8cd2c45..01b5ca0bc0 100644 |
2358 |
--- /src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.ad |
2359 |
+++ src/hotspot/os_cpu/bsd_aarch64/bsd_aarch64.ad |
2360 |
@@ -23,7 +23,7 @@ |
2361 |
// |
2362 |
// |
2363 |
|
2364 |
-// AArch64 Linux Architecture Description File |
2365 |
+// AArch64 Bsd Architecture Description File |
2366 |
|
2367 |
//----------OS-DEPENDENT ENCODING BLOCK---------------------------------------- |
2368 |
// This block specifies the encoding classes used by the compiler to |
2369 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp b/src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp |
2370 |
index e283f86d10..1ed80c3024 100644 |
2371 |
--- /src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp |
2372 |
+++ src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp |
2373 |
@@ -23,8 +23,8 @@ |
2374 |
* |
2375 |
*/ |
2376 |
|
2377 |
-#ifndef OS_CPU_LINUX_AARCH64_VM_BYTES_LINUX_AARCH64_INLINE_HPP |
2378 |
-#define OS_CPU_LINUX_AARCH64_VM_BYTES_LINUX_AARCH64_INLINE_HPP |
2379 |
+#ifndef OS_CPU_BSD_AARCH64_VM_BYTES_BSD_AARCH64_INLINE_HPP |
2380 |
+#define OS_CPU_BSD_AARCH64_VM_BYTES_BSD_AARCH64_INLINE_HPP |
2381 |
|
2382 |
#include <byteswap.h> |
2383 |
|
2384 |
@@ -42,4 +42,4 @@ inline u8 Bytes::swap_u8(u8 x) { |
2385 |
return bswap_64(x); |
2386 |
} |
2387 |
|
2388 |
-#endif // OS_CPU_LINUX_AARCH64_VM_BYTES_LINUX_AARCH64_INLINE_HPP |
2389 |
+#endif // OS_CPU_BSD_AARCH64_VM_BYTES_BSD_AARCH64_INLINE_HPP |
2390 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.inline.hpp b/src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.inline.hpp |
2391 |
index 794ab349b0..775997a4bf 100644 |
2392 |
--- /src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.inline.hpp |
2393 |
+++ src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.inline.hpp |
2394 |
@@ -23,8 +23,8 @@ |
2395 |
* |
2396 |
*/ |
2397 |
|
2398 |
-#ifndef OS_CPU_LINUX_AARCH64_VM_COPY_LINUX_AARCH64_INLINE_HPP |
2399 |
-#define OS_CPU_LINUX_AARCH64_VM_COPY_LINUX_AARCH64_INLINE_HPP |
2400 |
+#ifndef OS_CPU_BSD_AARCH64_VM_COPY_BSD_AARCH64_INLINE_HPP |
2401 |
+#define OS_CPU_BSD_AARCH64_VM_COPY_BSD_AARCH64_INLINE_HPP |
2402 |
|
2403 |
#define COPY_SMALL(from, to, count) \ |
2404 |
{ \ |
2405 |
@@ -185,4 +185,4 @@ static void pd_arrayof_conjoint_oops(const HeapWord* from, HeapWord* to, size_t |
2406 |
_Copy_arrayof_conjoint_jlongs(from, to, count); |
2407 |
} |
2408 |
|
2409 |
-#endif // OS_CPU_LINUX_AARCH64_VM_COPY_LINUX_AARCH64_INLINE_HPP |
2410 |
+#endif // OS_CPU_BSD_AARCH64_VM_COPY_BSD_AARCH64_INLINE_HPP |
2411 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/globals_bsd_aarch64.hpp b/src/hotspot/os_cpu/bsd_aarch64/globals_bsd_aarch64.hpp |
2412 |
index 360be743dd..7fec3eb604 100644 |
2413 |
--- /src/hotspot/os_cpu/bsd_aarch64/globals_bsd_aarch64.hpp |
2414 |
+++ src/hotspot/os_cpu/bsd_aarch64/globals_bsd_aarch64.hpp |
2415 |
@@ -23,8 +23,8 @@ |
2416 |
* |
2417 |
*/ |
2418 |
|
2419 |
-#ifndef OS_CPU_LINUX_AARCH64_VM_GLOBALS_LINUX_AARCH64_HPP |
2420 |
-#define OS_CPU_LINUX_AARCH64_VM_GLOBALS_LINUX_AARCH64_HPP |
2421 |
+#ifndef OS_CPU_BSD_AARCH64_VM_GLOBALS_BSD_AARCH64_HPP |
2422 |
+#define OS_CPU_BSD_AARCH64_VM_GLOBALS_BSD_AARCH64_HPP |
2423 |
|
2424 |
// Sets the default values for platform dependent flags used by the runtime system. |
2425 |
// (see globals.hpp) |
2426 |
@@ -42,4 +42,4 @@ define_pd_global(uintx,HeapBaseMinAddress, 2*G); |
2427 |
|
2428 |
extern __thread Thread *aarch64_currentThread; |
2429 |
|
2430 |
-#endif // OS_CPU_LINUX_AARCH64_VM_GLOBALS_LINUX_AARCH64_HPP |
2431 |
+#endif // OS_CPU_BSD_AARCH64_VM_GLOBALS_BSD_AARCH64_HPP |
2432 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/orderAccess_bsd_aarch64.hpp b/src/hotspot/os_cpu/bsd_aarch64/orderAccess_bsd_aarch64.hpp |
2433 |
index b733db1957..120ed22728 100644 |
2434 |
--- /src/hotspot/os_cpu/bsd_aarch64/orderAccess_bsd_aarch64.hpp |
2435 |
+++ src/hotspot/os_cpu/bsd_aarch64/orderAccess_bsd_aarch64.hpp |
2436 |
@@ -23,8 +23,8 @@ |
2437 |
* |
2438 |
*/ |
2439 |
|
2440 |
-#ifndef OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_HPP |
2441 |
-#define OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_HPP |
2442 |
+#ifndef OS_CPU_BSD_AARCH64_VM_ORDERACCESS_BSD_AARCH64_HPP |
2443 |
+#define OS_CPU_BSD_AARCH64_VM_ORDERACCESS_BSD_AARCH64_HPP |
2444 |
|
2445 |
// Included in orderAccess.hpp header file. |
2446 |
|
2447 |
@@ -70,4 +70,4 @@ struct OrderAccess::PlatformOrderedStore<byte_size, RELEASE_X_FENCE> |
2448 |
void operator()(T v, volatile T* p) const { release_store(p, v); fence(); } |
2449 |
}; |
2450 |
|
2451 |
-#endif // OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_HPP |
2452 |
+#endif // OS_CPU_BSD_AARCH64_VM_ORDERACCESS_BSD_AARCH64_HPP |
2453 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp b/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp |
2454 |
index 3c7b15086e..82bf1e84b2 100644 |
2455 |
--- /src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp |
2456 |
+++ src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp |
2457 |
@@ -35,7 +35,7 @@ |
2458 |
#include "code/nativeInst.hpp" |
2459 |
#include "interpreter/interpreter.hpp" |
2460 |
#include "memory/allocation.inline.hpp" |
2461 |
-#include "os_share_linux.hpp" |
2462 |
+#include "os_share_bsd.hpp" |
2463 |
#include "prims/jniFastGetField.hpp" |
2464 |
#include "prims/jvm_misc.hpp" |
2465 |
#include "runtime/arguments.hpp" |
2466 |
@@ -106,7 +106,7 @@ char* os::non_memory_address_word() { |
2467 |
return (char*) 0xffffffffffff; |
2468 |
} |
2469 |
|
2470 |
-address os::Linux::ucontext_get_pc(const ucontext_t * uc) { |
2471 |
+address os::Bsd::ucontext_get_pc(const ucontext_t * uc) { |
2472 |
#ifdef BUILTIN_SIM |
2473 |
return (address)uc->uc_mcontext.gregs[REG_PC]; |
2474 |
#else |
2475 |
@@ -114,7 +114,7 @@ address os::Linux::ucontext_get_pc(const ucontext_t * uc) { |
2476 |
#endif |
2477 |
} |
2478 |
|
2479 |
-void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) { |
2480 |
+void os::Bsd::ucontext_set_pc(ucontext_t * uc, address pc) { |
2481 |
#ifdef BUILTIN_SIM |
2482 |
uc->uc_mcontext.gregs[REG_PC] = (intptr_t)pc; |
2483 |
#else |
2484 |
@@ -122,7 +122,7 @@ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) { |
2485 |
#endif |
2486 |
} |
2487 |
|
2488 |
-intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) { |
2489 |
+intptr_t* os::Bsd::ucontext_get_sp(const ucontext_t * uc) { |
2490 |
#ifdef BUILTIN_SIM |
2491 |
return (intptr_t*)uc->uc_mcontext.gregs[REG_SP]; |
2492 |
#else |
2493 |
@@ -130,7 +130,7 @@ intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) { |
2494 |
#endif |
2495 |
} |
2496 |
|
2497 |
-intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) { |
2498 |
+intptr_t* os::Bsd::ucontext_get_fp(const ucontext_t * uc) { |
2499 |
#ifdef BUILTIN_SIM |
2500 |
return (intptr_t*)uc->uc_mcontext.gregs[REG_FP]; |
2501 |
#else |
2502 |
@@ -141,9 +141,9 @@ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) { |
2503 |
// For Forte Analyzer AsyncGetCallTrace profiling support - thread |
2504 |
// is currently interrupted by SIGPROF. |
2505 |
// os::Solaris::fetch_frame_from_ucontext() tries to skip nested signal |
2506 |
-// frames. Currently we don't do that on Linux, so it's the same as |
2507 |
+// frames. Currently we don't do that on Bsd, so it's the same as |
2508 |
// os::fetch_frame_from_context(). |
2509 |
-ExtendedPC os::Linux::fetch_frame_from_ucontext(Thread* thread, |
2510 |
+ExtendedPC os::Bsd::fetch_frame_from_ucontext(Thread* thread, |
2511 |
const ucontext_t* uc, intptr_t** ret_sp, intptr_t** ret_fp) { |
2512 |
|
2513 |
assert(thread != NULL, "just checking"); |
2514 |
@@ -160,9 +160,9 @@ ExtendedPC os::fetch_frame_from_context(const void* ucVoid, |
2515 |
const ucontext_t* uc = (const ucontext_t*)ucVoid; |
2516 |
|
2517 |
if (uc != NULL) { |
2518 |
- epc = ExtendedPC(os::Linux::ucontext_get_pc(uc)); |
2519 |
- if (ret_sp) *ret_sp = os::Linux::ucontext_get_sp(uc); |
2520 |
- if (ret_fp) *ret_fp = os::Linux::ucontext_get_fp(uc); |
2521 |
+ epc = ExtendedPC(os::Bsd::ucontext_get_pc(uc)); |
2522 |
+ if (ret_sp) *ret_sp = os::Bsd::ucontext_get_sp(uc); |
2523 |
+ if (ret_fp) *ret_fp = os::Bsd::ucontext_get_fp(uc); |
2524 |
} else { |
2525 |
// construct empty ExtendedPC for return value checking |
2526 |
epc = ExtendedPC(NULL); |
2527 |
@@ -180,8 +180,8 @@ frame os::fetch_frame_from_context(const void* ucVoid) { |
2528 |
return frame(sp, fp, epc.pc()); |
2529 |
} |
2530 |
|
2531 |
-bool os::Linux::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr) { |
2532 |
- address pc = (address) os::Linux::ucontext_get_pc(uc); |
2533 |
+bool os::Bsd::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* uc, frame* fr) { |
2534 |
+ address pc = (address) os::Bsd::ucontext_get_pc(uc); |
2535 |
if (Interpreter::contains(pc)) { |
2536 |
// interpreter performs stack banging after the fixed frame header has |
2537 |
// been generated while the compilers perform it before. To maintain |
2538 |
@@ -204,8 +204,8 @@ bool os::Linux::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* |
2539 |
// In compiled code, the stack banging is performed before LR |
2540 |
// has been saved in the frame. LR is live, and SP and FP |
2541 |
// belong to the caller. |
2542 |
- intptr_t* fp = os::Linux::ucontext_get_fp(uc); |
2543 |
- intptr_t* sp = os::Linux::ucontext_get_sp(uc); |
2544 |
+ intptr_t* fp = os::Bsd::ucontext_get_fp(uc); |
2545 |
+ intptr_t* sp = os::Bsd::ucontext_get_sp(uc); |
2546 |
address pc = (address)(uc->uc_mcontext.regs[REG_LR] |
2547 |
- NativeInstruction::instruction_size); |
2548 |
*fr = frame(sp, fp, pc); |
2549 |
@@ -273,7 +273,7 @@ extern "C" void FetchNResume () ; |
2550 |
#endif |
2551 |
|
2552 |
extern "C" JNIEXPORT int |
2553 |
-JVM_handle_linux_signal(int sig, |
2554 |
+JVM_handle_bsd_signal(int sig, |
2555 |
siginfo_t* info, |
2556 |
void* ucVoid, |
2557 |
int abort_if_unrecognized) { |
2558 |
@@ -290,13 +290,13 @@ JVM_handle_linux_signal(int sig, |
2559 |
// Note: it's not uncommon that JNI code uses signal/sigset to install |
2560 |
// then restore certain signal handler (e.g. to temporarily block SIGPIPE, |
2561 |
// or have a SIGILL handler when detecting CPU type). When that happens, |
2562 |
- // JVM_handle_linux_signal() might be invoked with junk info/ucVoid. To |
2563 |
+ // JVM_handle_bsd_signal() might be invoked with junk info/ucVoid. To |
2564 |
// avoid unnecessary crash when libjsig is not preloaded, try handle signals |
2565 |
// that do not require siginfo/ucontext first. |
2566 |
|
2567 |
if (sig == SIGPIPE || sig == SIGXFSZ) { |
2568 |
// allow chained handler to go first |
2569 |
- if (os::Linux::chained_handler(sig, info, ucVoid)) { |
2570 |
+ if (os::Bsd::chained_handler(sig, info, ucVoid)) { |
2571 |
return true; |
2572 |
} else { |
2573 |
// Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219 |
2574 |
@@ -313,7 +313,7 @@ JVM_handle_linux_signal(int sig, |
2575 |
|
2576 |
JavaThread* thread = NULL; |
2577 |
VMThread* vmthread = NULL; |
2578 |
- if (os::Linux::signal_handlers_are_installed) { |
2579 |
+ if (os::Bsd::signal_handlers_are_installed) { |
2580 |
if (t != NULL ){ |
2581 |
if(t->is_Java_thread()) { |
2582 |
thread = (JavaThread*)t; |
2583 |
@@ -324,7 +324,7 @@ JVM_handle_linux_signal(int sig, |
2584 |
} |
2585 |
} |
2586 |
/* |
2587 |
- NOTE: does not seem to work on linux. |
2588 |
+ NOTE: does not seem to work on bsd. |
2589 |
if (info == NULL || info->si_code <= 0 || info->si_code == SI_NOINFO) { |
2590 |
// can't decode this kind of signal |
2591 |
info = NULL; |
2592 |
@@ -339,7 +339,7 @@ JVM_handle_linux_signal(int sig, |
2593 |
|
2594 |
//%note os_trap_1 |
2595 |
if (info != NULL && uc != NULL && thread != NULL) { |
2596 |
- pc = (address) os::Linux::ucontext_get_pc(uc); |
2597 |
+ pc = (address) os::Bsd::ucontext_get_pc(uc); |
2598 |
|
2599 |
#ifdef BUILTIN_SIM |
2600 |
if (pc == (address) Fetch32PFI) { |
2601 |
@@ -352,7 +352,7 @@ JVM_handle_linux_signal(int sig, |
2602 |
} |
2603 |
#else |
2604 |
if (StubRoutines::is_safefetch_fault(pc)) { |
2605 |
- os::Linux::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc)); |
2606 |
+ os::Bsd::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc)); |
2607 |
return 1; |
2608 |
} |
2609 |
#endif |
2610 |
@@ -373,7 +373,7 @@ JVM_handle_linux_signal(int sig, |
2611 |
if (thread->thread_state() == _thread_in_Java) { |
2612 |
if (thread->in_stack_reserved_zone(addr)) { |
2613 |
frame fr; |
2614 |
- if (os::Linux::get_frame_at_stack_banging_point(thread, uc, &fr)) { |
2615 |
+ if (os::Bsd::get_frame_at_stack_banging_point(thread, uc, &fr)) { |
2616 |
assert(fr.is_java_frame(), "Must be a Java frame"); |
2617 |
frame activation = |
2618 |
SharedRuntime::look_for_reserved_stack_annotated_method(thread, fr); |
2619 |
@@ -412,10 +412,10 @@ JVM_handle_linux_signal(int sig, |
2620 |
// Accessing stack address below sp may cause SEGV if current |
2621 |
// thread has MAP_GROWSDOWN stack. This should only happen when |
2622 |
// current thread was created by user code with MAP_GROWSDOWN flag |
2623 |
- // and then attached to VM. See notes in os_linux.cpp. |
2624 |
+ // and then attached to VM. See notes in os_bsd.cpp. |
2625 |
if (thread->osthread()->expanding_stack() == 0) { |
2626 |
thread->osthread()->set_expanding_stack(); |
2627 |
- if (os::Linux::manually_expand_stack(thread, addr)) { |
2628 |
+ if (os::Bsd::manually_expand_stack(thread, addr)) { |
2629 |
thread->osthread()->clear_expanding_stack(); |
2630 |
return 1; |
2631 |
} |
2632 |
@@ -487,12 +487,12 @@ JVM_handle_linux_signal(int sig, |
2633 |
// save all thread context in case we need to restore it |
2634 |
if (thread != NULL) thread->set_saved_exception_pc(pc); |
2635 |
|
2636 |
- os::Linux::ucontext_set_pc(uc, stub); |
2637 |
+ os::Bsd::ucontext_set_pc(uc, stub); |
2638 |
return true; |
2639 |
} |
2640 |
|
2641 |
// signal-chaining |
2642 |
- if (os::Linux::chained_handler(sig, info, ucVoid)) { |
2643 |
+ if (os::Bsd::chained_handler(sig, info, ucVoid)) { |
2644 |
return true; |
2645 |
} |
2646 |
|
2647 |
@@ -502,7 +502,7 @@ JVM_handle_linux_signal(int sig, |
2648 |
} |
2649 |
|
2650 |
if (pc == NULL && uc != NULL) { |
2651 |
- pc = os::Linux::ucontext_get_pc(uc); |
2652 |
+ pc = os::Bsd::ucontext_get_pc(uc); |
2653 |
} |
2654 |
|
2655 |
// unmask current signal |
2656 |
@@ -517,17 +517,17 @@ JVM_handle_linux_signal(int sig, |
2657 |
return true; // Mute compiler |
2658 |
} |
2659 |
|
2660 |
-void os::Linux::init_thread_fpu_state(void) { |
2661 |
+void os::Bsd::init_thread_fpu_state(void) { |
2662 |
} |
2663 |
|
2664 |
-int os::Linux::get_fpu_control_word(void) { |
2665 |
+int os::Bsd::get_fpu_control_word(void) { |
2666 |
return 0; |
2667 |
} |
2668 |
|
2669 |
-void os::Linux::set_fpu_control_word(int fpu_control) { |
2670 |
+void os::Bsd::set_fpu_control_word(int fpu_control) { |
2671 |
} |
2672 |
|
2673 |
-// Check that the linux kernel version is 2.4 or higher since earlier |
2674 |
+// Check that the bsd kernel version is 2.4 or higher since earlier |
2675 |
// versions do not support SSE without patches. |
2676 |
bool os::supports_sse() { |
2677 |
return true; |
2678 |
@@ -597,7 +597,7 @@ void os::print_context(outputStream *st, const void *context) { |
2679 |
#endif |
2680 |
st->cr(); |
2681 |
|
2682 |
- intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc); |
2683 |
+ intptr_t *sp = (intptr_t *)os::Bsd::ucontext_get_sp(uc); |
2684 |
st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp)); |
2685 |
print_hex_dump(st, (address)sp, (address)(sp + 8*sizeof(intptr_t)), sizeof(intptr_t)); |
2686 |
st->cr(); |
2687 |
@@ -605,7 +605,7 @@ void os::print_context(outputStream *st, const void *context) { |
2688 |
// Note: it may be unsafe to inspect memory near pc. For example, pc may |
2689 |
// point to garbage if entry point in an nmethod is corrupted. Leave |
2690 |
// this at the end, and hope for the best. |
2691 |
- address pc = os::Linux::ucontext_get_pc(uc); |
2692 |
+ address pc = os::Bsd::ucontext_get_pc(uc); |
2693 |
st->print_cr("Instructions: (pc=" PTR_FORMAT ")", p2i(pc)); |
2694 |
print_hex_dump(st, pc - 32, pc + 32, sizeof(char)); |
2695 |
} |
2696 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.hpp b/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.hpp |
2697 |
index d2d02efc54..5412827eab 100644 |
2698 |
--- /src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.hpp |
2699 |
+++ src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.hpp |
2700 |
@@ -23,8 +23,8 @@ |
2701 |
* |
2702 |
*/ |
2703 |
|
2704 |
-#ifndef OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_HPP |
2705 |
-#define OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_HPP |
2706 |
+#ifndef OS_CPU_BSD_AARCH64_VM_OS_BSD_AARCH64_HPP |
2707 |
+#define OS_CPU_BSD_AARCH64_VM_OS_BSD_AARCH64_HPP |
2708 |
|
2709 |
static void setup_fpu(); |
2710 |
static bool supports_sse(); |
2711 |
@@ -42,4 +42,4 @@ |
2712 |
*(jlong *) dst = *(const jlong *) src; |
2713 |
} |
2714 |
|
2715 |
-#endif // OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_HPP |
2716 |
+#endif // OS_CPU_BSD_AARCH64_VM_OS_BSD_AARCH64_HPP |
2717 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.inline.hpp b/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.inline.hpp |
2718 |
index 2402d13540..c2df460da6 100644 |
2719 |
--- /src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.inline.hpp |
2720 |
+++ src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.inline.hpp |
2721 |
@@ -23,8 +23,8 @@ |
2722 |
* |
2723 |
*/ |
2724 |
|
2725 |
-#ifndef OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_INLINE_HPP |
2726 |
-#define OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_INLINE_HPP |
2727 |
+#ifndef OS_CPU_BSD_AARCH64_VM_OS_BSD_AARCH64_INLINE_HPP |
2728 |
+#define OS_CPU_BSD_AARCH64_VM_OS_BSD_AARCH64_INLINE_HPP |
2729 |
|
2730 |
#include "runtime/os.hpp" |
2731 |
|
2732 |
@@ -37,4 +37,4 @@ inline jlong os::rdtsc() { |
2733 |
return (jlong)res; |
2734 |
} |
2735 |
|
2736 |
-#endif // OS_CPU_LINUX_AARCH64_VM_OS_LINUX_AARCH64_INLINE_HPP |
2737 |
+#endif // OS_CPU_BSD_AARCH64_VM_OS_BSD_AARCH64_INLINE_HPP |
2738 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/prefetch_bsd_aarch64.inline.hpp b/src/hotspot/os_cpu/bsd_aarch64/prefetch_bsd_aarch64.inline.hpp |
2739 |
index 687eb50bab..ad916d647e 100644 |
2740 |
--- /src/hotspot/os_cpu/bsd_aarch64/prefetch_bsd_aarch64.inline.hpp |
2741 |
+++ src/hotspot/os_cpu/bsd_aarch64/prefetch_bsd_aarch64.inline.hpp |
2742 |
@@ -23,8 +23,8 @@ |
2743 |
* |
2744 |
*/ |
2745 |
|
2746 |
-#ifndef OS_CPU_LINUX_AARCH64_VM_PREFETCH_LINUX_AARCH64_INLINE_HPP |
2747 |
-#define OS_CPU_LINUX_AARCH64_VM_PREFETCH_LINUX_AARCH64_INLINE_HPP |
2748 |
+#ifndef OS_CPU_BSD_AARCH64_VM_PREFETCH_BSD_AARCH64_INLINE_HPP |
2749 |
+#define OS_CPU_BSD_AARCH64_VM_PREFETCH_BSD_AARCH64_INLINE_HPP |
2750 |
|
2751 |
#include "runtime/prefetch.hpp" |
2752 |
|
2753 |
@@ -43,4 +43,4 @@ inline void Prefetch::write(void *loc, intx interval) { |
2754 |
#endif |
2755 |
} |
2756 |
|
2757 |
-#endif // OS_CPU_LINUX_AARCH64_VM_PREFETCH_LINUX_AARCH64_INLINE_HPP |
2758 |
+#endif // OS_CPU_BSD_AARCH64_VM_PREFETCH_BSD_AARCH64_INLINE_HPP |
2759 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.cpp b/src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.cpp |
2760 |
index 9084daeaa2..dc423ebb25 100644 |
2761 |
--- /src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.cpp |
2762 |
+++ src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.cpp |
2763 |
@@ -65,7 +65,7 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava) |
2764 |
|
2765 |
intptr_t* ret_fp; |
2766 |
intptr_t* ret_sp; |
2767 |
- ExtendedPC addr = os::Linux::fetch_frame_from_ucontext(this, uc, |
2768 |
+ ExtendedPC addr = os::Bsd::fetch_frame_from_ucontext(this, uc, |
2769 |
&ret_sp, &ret_fp); |
2770 |
if (addr.pc() == NULL || ret_sp == NULL ) { |
2771 |
// ucontext wasn't useful |
2772 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.hpp b/src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.hpp |
2773 |
index a2261b1906..400f32da2e 100644 |
2774 |
--- /src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.hpp |
2775 |
+++ src/hotspot/os_cpu/bsd_aarch64/thread_bsd_aarch64.hpp |
2776 |
@@ -23,8 +23,8 @@ |
2777 |
* |
2778 |
*/ |
2779 |
|
2780 |
-#ifndef OS_CPU_LINUX_AARCH64_VM_THREAD_LINUX_AARCH64_HPP |
2781 |
-#define OS_CPU_LINUX_AARCH64_VM_THREAD_LINUX_AARCH64_HPP |
2782 |
+#ifndef OS_CPU_BSD_AARCH64_VM_THREAD_BSD_AARCH64_HPP |
2783 |
+#define OS_CPU_BSD_AARCH64_VM_THREAD_BSD_AARCH64_HPP |
2784 |
|
2785 |
private: |
2786 |
#ifdef ASSERT |
2787 |
@@ -77,4 +77,4 @@ |
2788 |
static void enable_register_stack_guard() {} |
2789 |
static void disable_register_stack_guard() {} |
2790 |
|
2791 |
-#endif // OS_CPU_LINUX_AARCH64_VM_THREAD_LINUX_AARCH64_HPP |
2792 |
+#endif // OS_CPU_BSD_AARCH64_VM_THREAD_BSD_AARCH64_HPP |
2793 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/vmStructs_bsd_aarch64.hpp b/src/hotspot/os_cpu/bsd_aarch64/vmStructs_bsd_aarch64.hpp |
2794 |
index fa5885ca62..1296661135 100644 |
2795 |
--- /src/hotspot/os_cpu/bsd_aarch64/vmStructs_bsd_aarch64.hpp |
2796 |
+++ src/hotspot/os_cpu/bsd_aarch64/vmStructs_bsd_aarch64.hpp |
2797 |
@@ -23,8 +23,8 @@ |
2798 |
* |
2799 |
*/ |
2800 |
|
2801 |
-#ifndef OS_CPU_LINUX_AARCH64_VM_VMSTRUCTS_LINUX_AARCH64_HPP |
2802 |
-#define OS_CPU_LINUX_AARCH64_VM_VMSTRUCTS_LINUX_AARCH64_HPP |
2803 |
+#ifndef OS_CPU_BSD_AARCH64_VM_VMSTRUCTS_BSD_AARCH64_HPP |
2804 |
+#define OS_CPU_BSD_AARCH64_VM_VMSTRUCTS_BSD_AARCH64_HPP |
2805 |
|
2806 |
// These are the OS and CPU-specific fields, types and integer |
2807 |
// constants required by the Serviceability Agent. This file is |
2808 |
@@ -52,4 +52,4 @@ |
2809 |
|
2810 |
#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) |
2811 |
|
2812 |
-#endif // OS_CPU_LINUX_AARCH64_VM_VMSTRUCTS_LINUX_AARCH64_HPP |
2813 |
+#endif // OS_CPU_BSD_AARCH64_VM_VMSTRUCTS_BSD_AARCH64_HPP |
2814 |
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java |
2815 |
index 28e36759a5..1f1df50726 100644 |
2816 |
--- /src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java |
2817 |
+++ src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java |
2818 |
@@ -23,16 +23,16 @@ |
2819 |
* |
2820 |
*/ |
2821 |
|
2822 |
-package sun.jvm.hotspot.debugger.linux.aarch64; |
2823 |
+package sun.jvm.hotspot.debugger.bsd.aarch64; |
2824 |
|
2825 |
import sun.jvm.hotspot.debugger.*; |
2826 |
import sun.jvm.hotspot.debugger.aarch64.*; |
2827 |
-import sun.jvm.hotspot.debugger.linux.*; |
2828 |
+import sun.jvm.hotspot.debugger.bsd.*; |
2829 |
import sun.jvm.hotspot.debugger.cdbg.*; |
2830 |
import sun.jvm.hotspot.debugger.cdbg.basic.*; |
2831 |
|
2832 |
-final public class LinuxAARCH64CFrame extends BasicCFrame { |
2833 |
- public LinuxAARCH64CFrame(LinuxDebugger dbg, Address fp, Address pc) { |
2834 |
+final public class BsdAARCH64CFrame extends BasicCFrame { |
2835 |
+ public BsdAARCH64CFrame(BsdDebugger dbg, Address fp, Address pc) { |
2836 |
super(dbg.getCDebugger()); |
2837 |
this.fp = fp; |
2838 |
this.pc = pc; |
2839 |
@@ -74,7 +74,7 @@ public CFrame sender(ThreadProxy thread) { |
2840 |
if (nextPC == null) { |
2841 |
return null; |
2842 |
} |
2843 |
- return new LinuxAARCH64CFrame(dbg, nextFP, nextPC); |
2844 |
+ return new BsdAARCH64CFrame(dbg, nextFP, nextPC); |
2845 |
} |
2846 |
|
2847 |
// package/class internals only |
2848 |
@@ -82,5 +82,5 @@ public CFrame sender(ThreadProxy thread) { |
2849 |
private Address pc; |
2850 |
private Address sp; |
2851 |
private Address fp; |
2852 |
- private LinuxDebugger dbg; |
2853 |
+ private BsdDebugger dbg; |
2854 |
} |
2855 |
diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64ThreadContext.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64ThreadContext.java |
2856 |
index 7700316867..49d09bcfe0 100644 |
2857 |
--- /src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64ThreadContext.java |
2858 |
+++ src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64ThreadContext.java |
2859 |
@@ -23,16 +23,16 @@ |
2860 |
* |
2861 |
*/ |
2862 |
|
2863 |
-package sun.jvm.hotspot.debugger.linux.aarch64; |
2864 |
+package sun.jvm.hotspot.debugger.bsd.aarch64; |
2865 |
|
2866 |
import sun.jvm.hotspot.debugger.*; |
2867 |
import sun.jvm.hotspot.debugger.aarch64.*; |
2868 |
-import sun.jvm.hotspot.debugger.linux.*; |
2869 |
+import sun.jvm.hotspot.debugger.bsd.*; |
2870 |
|
2871 |
-public class LinuxAARCH64ThreadContext extends AARCH64ThreadContext { |
2872 |
- private LinuxDebugger debugger; |
2873 |
+public class BsdAARCH64ThreadContext extends AARCH64ThreadContext { |
2874 |
+ private BsdDebugger debugger; |
2875 |
|
2876 |
- public LinuxAARCH64ThreadContext(LinuxDebugger debugger) { |
2877 |
+ public BsdAARCH64ThreadContext(BsdDebugger debugger) { |
2878 |
super(); |
2879 |
this.debugger = debugger; |
2880 |
} |
2881 |
|
2882 |
From a4eea8c1921e982c70e36c95198937e305fd0c2f Mon Sep 17 00:00:00 2001 |
2883 |
From: miki <mikael.urankar@gmail.com> |
2884 |
Date: Thu, 11 Apr 2019 20:12:10 +0200 |
2885 |
Subject: [PATCH 03/17] Fix byteswap on FreeBSD |
2886 |
|
2887 |
--- |
2888 |
src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp | 4 +++- |
2889 |
1 file changed, 3 insertions(+), 1 deletion(-) |
2890 |
|
2891 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp b/src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp |
2892 |
index 1ed80c3024..4094b4fa84 100644 |
2893 |
--- /src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp |
2894 |
+++ src/hotspot/os_cpu/bsd_aarch64/bytes_bsd_aarch64.inline.hpp |
2895 |
@@ -26,7 +26,9 @@ |
2896 |
#ifndef OS_CPU_BSD_AARCH64_VM_BYTES_BSD_AARCH64_INLINE_HPP |
2897 |
#define OS_CPU_BSD_AARCH64_VM_BYTES_BSD_AARCH64_INLINE_HPP |
2898 |
|
2899 |
-#include <byteswap.h> |
2900 |
+#define bswap_16(x) __bswap16(x) |
2901 |
+#define bswap_32(x) __bswap32(x) |
2902 |
+#define bswap_64(x) __bswap64(x) |
2903 |
|
2904 |
// Efficient swapping of data bytes from Java byte |
2905 |
// ordering to native byte ordering and vice versa. |
2906 |
|
2907 |
From 9923d1edee733bde5c1d061fe962b05e90851326 Mon Sep 17 00:00:00 2001 |
2908 |
From: miki <mikael.urankar@gmail.com> |
2909 |
Date: Thu, 11 Apr 2019 20:12:38 +0200 |
2910 |
Subject: [PATCH 04/17] Fix prfm assembly clang chokes on this syntax, gcc8 |
2911 |
translates prfm to prfum |
2912 |
|
2913 |
<inline asm>:1:26: error: index must be a multiple of 8 in range [0, 32760]. |
2914 |
prfm pldl1keep, [x0, #-256] |
2915 |
--- |
2916 |
src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.s | 2 +- |
2917 |
1 file changed, 1 insertion(+), 1 deletion(-) |
2918 |
|
2919 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.s b/src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.s |
2920 |
index 25e3b054f7..bf2805b1b2 100644 |
2921 |
--- /src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.s |
2922 |
+++ src/hotspot/os_cpu/bsd_aarch64/copy_bsd_aarch64.s |
2923 |
@@ -159,7 +159,7 @@ bwd_copy_aligned: |
2924 |
blo bwd_copy_drain |
2925 |
|
2926 |
bwd_copy_again: |
2927 |
- prfm pldl1keep, [s, #-256] |
2928 |
+ prfum pldl1keep, [s, #-256] |
2929 |
stp t0, t1, [d, #-16] |
2930 |
ldp t0, t1, [s, #-16] |
2931 |
stp t2, t3, [d, #-32] |
2932 |
|
2933 |
From 9a66524d98096a147d05d632e23600b8f5cc5616 Mon Sep 17 00:00:00 2001 |
2934 |
From: miki <mikael.urankar@gmail.com> |
2935 |
Date: Thu, 11 Apr 2019 20:13:12 +0200 |
2936 |
Subject: [PATCH 05/17] Remove bogus 'd' constant qualifiers |
2937 |
|
2938 |
--- |
2939 |
src/hotspot/cpu/aarch64/aarch64.ad | 8 ++--- |
2940 |
.../aarch64/macroAssembler_aarch64_log.cpp | 4 +-- |
2941 |
.../aarch64/macroAssembler_aarch64_trig.cpp | 30 +++++++++---------- |
2942 |
3 files changed, 21 insertions(+), 21 deletions(-) |
2943 |
|
2944 |
diff --git a/src/hotspot/cpu/aarch64/aarch64.ad b/src/hotspot/cpu/aarch64/aarch64.ad |
2945 |
index ed575070c4..e7d66b87d4 100644 |
2946 |
--- /src/hotspot/cpu/aarch64/aarch64.ad |
2947 |
+++ src/hotspot/cpu/aarch64/aarch64.ad |
2948 |
@@ -13910,7 +13910,7 @@ instruct compF_reg_zero(rFlagsReg cr, vRegF src1, immF0 src2) |
2949 |
format %{ "fcmps $src1, 0.0" %} |
2950 |
|
2951 |
ins_encode %{ |
2952 |
- __ fcmps(as_FloatRegister($src1$$reg), 0.0D); |
2953 |
+ __ fcmps(as_FloatRegister($src1$$reg), 0.0); |
2954 |
%} |
2955 |
|
2956 |
ins_pipe(pipe_class_compare); |
2957 |
@@ -13939,7 +13939,7 @@ instruct compD_reg_zero(rFlagsReg cr, vRegD src1, immD0 src2) |
2958 |
format %{ "fcmpd $src1, 0.0" %} |
2959 |
|
2960 |
ins_encode %{ |
2961 |
- __ fcmpd(as_FloatRegister($src1$$reg), 0.0D); |
2962 |
+ __ fcmpd(as_FloatRegister($src1$$reg), 0.0); |
2963 |
%} |
2964 |
|
2965 |
ins_pipe(pipe_class_compare); |
2966 |
@@ -14015,7 +14015,7 @@ instruct compF3_reg_immF0(iRegINoSp dst, vRegF src1, immF0 zero, rFlagsReg cr) |
2967 |
Label done; |
2968 |
FloatRegister s1 = as_FloatRegister($src1$$reg); |
2969 |
Register d = as_Register($dst$$reg); |
2970 |
- __ fcmps(s1, 0.0D); |
2971 |
+ __ fcmps(s1, 0.0); |
2972 |
// installs 0 if EQ else -1 |
2973 |
__ csinvw(d, zr, zr, Assembler::EQ); |
2974 |
// keeps -1 if less or unordered else installs 1 |
2975 |
@@ -14042,7 +14042,7 @@ instruct compD3_reg_immD0(iRegINoSp dst, vRegD src1, immD0 zero, rFlagsReg cr) |
2976 |
Label done; |
2977 |
FloatRegister s1 = as_FloatRegister($src1$$reg); |
2978 |
Register d = as_Register($dst$$reg); |
2979 |
- __ fcmpd(s1, 0.0D); |
2980 |
+ __ fcmpd(s1, 0.0); |
2981 |
// installs 0 if EQ else -1 |
2982 |
__ csinvw(d, zr, zr, Assembler::EQ); |
2983 |
// keeps -1 if less or unordered else installs 1 |
2984 |
diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64_log.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64_log.cpp |
2985 |
index 64957e1440..5b2daf963b 100644 |
2986 |
--- /src/hotspot/cpu/aarch64/macroAssembler_aarch64_log.cpp |
2987 |
+++ src/hotspot/cpu/aarch64/macroAssembler_aarch64_log.cpp |
2988 |
@@ -286,7 +286,7 @@ void MacroAssembler::fast_log(FloatRegister vtmp0, FloatRegister vtmp1, |
2989 |
frecpe(vtmp5, vtmp5, S); // vtmp5 ~= 1/vtmp5 |
2990 |
lsr(tmp2, rscratch1, 48); |
2991 |
movz(tmp4, 0x77f0, 48); |
2992 |
- fmovd(vtmp4, 1.0d); |
2993 |
+ fmovd(vtmp4, 1.0); |
2994 |
movz(tmp1, INF_OR_NAN_PREFIX, 48); |
2995 |
bfm(tmp4, rscratch1, 0, 51); // tmp4 = 0x77F0 << 48 | mantissa(X) |
2996 |
// vtmp1 = AS_DOUBLE_BITS(0x77F0 << 48 | mantissa(X)) == mx |
2997 |
@@ -358,7 +358,7 @@ void MacroAssembler::fast_log(FloatRegister vtmp0, FloatRegister vtmp1, |
2998 |
br(GE, DONE); |
2999 |
cmp(rscratch1, tmp2); |
3000 |
br(NE, CHECKED_CORNER_CASES); |
3001 |
- fmovd(v0, 0.0d); |
3002 |
+ fmovd(v0, 0.0); |
3003 |
} |
3004 |
bind(DONE); |
3005 |
ret(lr); |
3006 |
diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp |
3007 |
index 47e17985b9..a672198ce7 100644 |
3008 |
--- /src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp |
3009 |
+++ src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp |
3010 |
@@ -381,11 +381,11 @@ void MacroAssembler::generate__ieee754_rem_pio2(address npio2_hw, |
3011 |
} |
3012 |
|
3013 |
block_comment("nx calculation with unrolled while(tx[nx-1]==zeroA) nx--;"); { |
3014 |
- fcmpd(v26, 0.0d); // if NE then jx == 2. else it's 1 or 0 |
3015 |
+ fcmpd(v26, 0.0); // if NE then jx == 2. else it's 1 or 0 |
3016 |
add(iqBase, sp, 480); // base of iq[] |
3017 |
fmuld(v3, v26, v10); |
3018 |
br(NE, NX_SET); |
3019 |
- fcmpd(v7, 0.0d); // v7 == 0 => jx = 0. Else jx = 1 |
3020 |
+ fcmpd(v7, 0.0); // v7 == 0 => jx = 0. Else jx = 1 |
3021 |
csetw(jx, NE); |
3022 |
} |
3023 |
bind(NX_SET); |
3024 |
@@ -696,7 +696,7 @@ void MacroAssembler::generate__kernel_rem_pio2(address two_over_pi, address pio2 |
3025 |
cmpw(jv, zr); |
3026 |
addw(tmp4, jx, 4); // tmp4 = m = jx + jk = jx + 4. jx is in {0,1,2} so m is in [4,5,6] |
3027 |
cselw(jv, jv, zr, GE); |
3028 |
- fmovd(v26, 0.0d); |
3029 |
+ fmovd(v26, 0.0); |
3030 |
addw(tmp5, jv, 1); // jv+1 |
3031 |
subsw(j, jv, jx); |
3032 |
add(qBase, sp, 320); // base of q[] |
3033 |
@@ -819,8 +819,8 @@ void MacroAssembler::generate__kernel_rem_pio2(address two_over_pi, address pio2 |
3034 |
movw(jz, 4); |
3035 |
fmovd(v17, i); // v17 = twon24 |
3036 |
fmovd(v30, tmp5); // 2^q0 |
3037 |
- fmovd(v21, 0.125d); |
3038 |
- fmovd(v20, 8.0d); |
3039 |
+ fmovd(v21, 0.125); |
3040 |
+ fmovd(v20, 8.0); |
3041 |
fmovd(v22, tmp4); // 2^-q0 |
3042 |
|
3043 |
block_comment("recompute loop"); { |
3044 |
@@ -877,7 +877,7 @@ void MacroAssembler::generate__kernel_rem_pio2(address two_over_pi, address pio2 |
3045 |
lsr(ih, tmp2, 23); // ih = iq[z-1] >> 23 |
3046 |
b(Q0_ZERO_CMP_DONE); |
3047 |
bind(Q0_ZERO_CMP_LT); |
3048 |
- fmovd(v4, 0.5d); |
3049 |
+ fmovd(v4, 0.5); |
3050 |
fcmpd(v18, v4); |
3051 |
cselw(ih, zr, ih, LT); // if (z<0.5) ih = 0 |
3052 |
} |
3053 |
@@ -924,7 +924,7 @@ void MacroAssembler::generate__kernel_rem_pio2(address two_over_pi, address pio2 |
3054 |
br(NE, IH_HANDLED); |
3055 |
|
3056 |
block_comment("if(ih==2) {"); { |
3057 |
- fmovd(v25, 1.0d); |
3058 |
+ fmovd(v25, 1.0); |
3059 |
fsubd(v18, v25, v18); // z = one - z; |
3060 |
cbzw(rscratch2, IH_HANDLED); |
3061 |
fsubd(v18, v18, v30); // z -= scalbnA(one,q0); |
3062 |
@@ -932,7 +932,7 @@ void MacroAssembler::generate__kernel_rem_pio2(address two_over_pi, address pio2 |
3063 |
} |
3064 |
bind(IH_HANDLED); |
3065 |
// check if recomputation is needed |
3066 |
- fcmpd(v18, 0.0d); |
3067 |
+ fcmpd(v18, 0.0); |
3068 |
br(NE, RECOMP_CHECK_DONE_NOT_ZERO); |
3069 |
|
3070 |
block_comment("if(z==zeroB) {"); { |
3071 |
@@ -994,7 +994,7 @@ void MacroAssembler::generate__kernel_rem_pio2(address two_over_pi, address pio2 |
3072 |
} |
3073 |
bind(RECOMP_CHECK_DONE); |
3074 |
// chop off zero terms |
3075 |
- fcmpd(v18, 0.0d); |
3076 |
+ fcmpd(v18, 0.0); |
3077 |
br(EQ, Z_IS_ZERO); |
3078 |
|
3079 |
block_comment("else block of if(z==0.0) {"); { |
3080 |
@@ -1053,7 +1053,7 @@ void MacroAssembler::generate__kernel_rem_pio2(address two_over_pi, address pio2 |
3081 |
movw(tmp2, zr); // tmp2 will keep jz - i == 0 at start |
3082 |
bind(COMP_FOR); |
3083 |
// for(fw=0.0,k=0;k<=jp&&k<=jz-i;k++) fw += PIo2[k]*q[i+k]; |
3084 |
- fmovd(v30, 0.0d); |
3085 |
+ fmovd(v30, 0.0); |
3086 |
add(tmp5, qBase, i, LSL, 3); // address of q[i+k] for k==0 |
3087 |
movw(tmp3, 4); |
3088 |
movw(tmp4, zr); // used as k |
3089 |
@@ -1081,7 +1081,7 @@ void MacroAssembler::generate__kernel_rem_pio2(address two_over_pi, address pio2 |
3090 |
// remember prec == 2 |
3091 |
|
3092 |
block_comment("for (i=jz;i>=0;i--) fw += fq[i];"); { |
3093 |
- fmovd(v4, 0.0d); |
3094 |
+ fmovd(v4, 0.0); |
3095 |
mov(i, jz); |
3096 |
bind(FW_FOR1); |
3097 |
ldrd(v1, Address(rscratch2, i, Address::lsl(3))); |
3098 |
@@ -1319,7 +1319,7 @@ void MacroAssembler::generate_kernel_cos(FloatRegister x, address dcos_coef) { |
3099 |
ld1(C1, C2, C3, C4, T1D, Address(rscratch2)); // load C1..C3\4 |
3100 |
block_comment("calculate r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6)))))"); { |
3101 |
fmaddd(r, z, C6, C5); |
3102 |
- fmovd(half, 0.5d); |
3103 |
+ fmovd(half, 0.5); |
3104 |
fmaddd(r, z, r, C4); |
3105 |
fmuld(y, x, y); |
3106 |
fmaddd(r, z, r, C3); |
3107 |
@@ -1329,7 +1329,7 @@ void MacroAssembler::generate_kernel_cos(FloatRegister x, address dcos_coef) { |
3108 |
fmaddd(r, z, r, C1); // r = C1+z(C2+z(C4+z(C5+z*C6))) |
3109 |
} |
3110 |
// need to multiply r by z to have "final" r value |
3111 |
- fmovd(one, 1.0d); |
3112 |
+ fmovd(one, 1.0); |
3113 |
cmp(ix, rscratch1); |
3114 |
br(GT, IX_IS_LARGE); |
3115 |
block_comment("if(ix < 0x3FD33333) return one - (0.5*z - (z*r - x*y))"); { |
3116 |
@@ -1352,7 +1352,7 @@ void MacroAssembler::generate_kernel_cos(FloatRegister x, address dcos_coef) { |
3117 |
b(QX_SET); |
3118 |
bind(SET_QX_CONST); |
3119 |
block_comment("if(ix > 0x3fe90000) qx = 0.28125;"); { |
3120 |
- fmovd(qx, 0.28125d); |
3121 |
+ fmovd(qx, 0.28125); |
3122 |
} |
3123 |
bind(QX_SET); |
3124 |
fnmsub(C6, x, r, y); // z*r - xy |
3125 |
@@ -1443,7 +1443,7 @@ void MacroAssembler::generate_dsin_dcos(bool isCos, address npio2_hw, |
3126 |
block_comment("kernel_sin/kernel_cos: if(ix<0x3e400000) {<fast return>}"); { |
3127 |
bind(TINY_X); |
3128 |
if (isCos) { |
3129 |
- fmovd(v0, 1.0d); |
3130 |
+ fmovd(v0, 1.0); |
3131 |
} |
3132 |
ret(lr); |
3133 |
} |
3134 |
|
3135 |
From ba377e7ac2644beabffc494e4562d5f3fa4888a4 Mon Sep 17 00:00:00 2001 |
3136 |
From: miki <mikael.urankar@gmail.com> |
3137 |
Date: Thu, 11 Apr 2019 20:13:35 +0200 |
3138 |
Subject: [PATCH 06/17] arg is a boolean |
3139 |
|
3140 |
--- |
3141 |
src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp | 2 +- |
3142 |
1 file changed, 1 insertion(+), 1 deletion(-) |
3143 |
|
3144 |
diff --git a/src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp |
3145 |
index 19c9ea688f..b8a9d747f3 100644 |
3146 |
--- /src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp |
3147 |
+++ src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp |
3148 |
@@ -426,7 +426,7 @@ void LIRGenerator::do_ArithmeticOp_FPU(ArithmeticOp* x) { |
3149 |
tmp = new_register(T_DOUBLE); |
3150 |
} |
3151 |
|
3152 |
- arithmetic_op_fpu(x->op(), reg, left.result(), right.result(), NULL); |
3153 |
+ arithmetic_op_fpu(x->op(), reg, left.result(), right.result(), false); |
3154 |
|
3155 |
set_result(x, round_item(reg)); |
3156 |
} |
3157 |
|
3158 |
From 95dbdedc55ed1762d417e50fed1b3a08c03e8f65 Mon Sep 17 00:00:00 2001 |
3159 |
From: miki <mikael.urankar@gmail.com> |
3160 |
Date: Thu, 11 Apr 2019 20:13:58 +0200 |
3161 |
Subject: [PATCH 07/17] Remove duplicate definition |
3162 |
|
3163 |
--- |
3164 |
src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp | 4 ---- |
3165 |
1 file changed, 4 deletions(-) |
3166 |
|
3167 |
diff --git a/src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp b/src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp |
3168 |
index 1143f6b3c7..3bec989e88 100644 |
3169 |
--- /src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp |
3170 |
+++ src/hotspot/cpu/aarch64/interp_masm_aarch64.hpp |
3171 |
@@ -36,10 +36,6 @@ typedef ByteSize (*OffsetFunction)(uint); |
3172 |
|
3173 |
class InterpreterMacroAssembler: public MacroAssembler { |
3174 |
protected: |
3175 |
- |
3176 |
- protected: |
3177 |
- using MacroAssembler::call_VM_leaf_base; |
3178 |
- |
3179 |
// Interpreter specific version of call_VM_base |
3180 |
using MacroAssembler::call_VM_leaf_base; |
3181 |
|
3182 |
|
3183 |
diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp |
3184 |
index fbc6d41a32..72089265a1 100644 |
3185 |
--- /src/hotspot/os/bsd/os_bsd.cpp |
3186 |
+++ src/hotspot/os/bsd/os_bsd.cpp |
3187 |
@@ -243,6 +243,8 @@ static char cpu_arch[] = "sparcv9"; |
3188 |
#else |
3189 |
static char cpu_arch[] = "sparc"; |
3190 |
#endif |
3191 |
+#elif defined(AARCH64) |
3192 |
+static char cpu_arch[] = "aarch64"; |
3193 |
#else |
3194 |
#error Add appropriate cpu_arch setting |
3195 |
#endif |
3196 |
|
3197 |
From 5b69bb3b031a2bbaf8fc7f448f8dfe4e3c45b701 Mon Sep 17 00:00:00 2001 |
3198 |
From: miki <mikael.urankar@gmail.com> |
3199 |
Date: Thu, 11 Apr 2019 20:15:08 +0200 |
3200 |
Subject: [PATCH 10/17] Implement hwcap on FreeBSD |
3201 |
|
3202 |
--- |
3203 |
src/hotspot/cpu/aarch64/freebsd_aarch64.hpp | 119 ++++++++++++++++++ |
3204 |
.../cpu/aarch64/vm_version_aarch64.cpp | 90 +++++++++++++ |
3205 |
2 files changed, 209 insertions(+) |
3206 |
create mode 100644 src/hotspot/cpu/aarch64/freebsd_aarch64.hpp |
3207 |
|
3208 |
diff --git a/src/hotspot/cpu/aarch64/freebsd_aarch64.hpp b/src/hotspot/cpu/aarch64/freebsd_aarch64.hpp |
3209 |
new file mode 100644 |
3210 |
index 0000000000..cc187ab2e1 |
3211 |
--- /dev/null |
3212 |
+++ src/hotspot/cpu/aarch64/freebsd_aarch64.hpp |
3213 |
@@ -0,0 +1,119 @@ |
3214 |
+#ifndef CPU_AARCH64_VM_FREEBSD_AARCH64_HPP |
3215 |
+#define CPU_AARCH64_VM_FREEBSD_AARCH64_HPP |
3216 |
+ |
3217 |
+// for FreeBSD-11.2 |
3218 |
+#ifndef ID_AA64PFR0_ADV_SIMD_HP |
3219 |
+#define ID_AA64PFR0_ADV_SIMD_HP (0x1 << ID_AA64PFR0_ADV_SIMD_SHIFT) |
3220 |
+#endif |
3221 |
+ |
3222 |
+#define CPU_IMPL_ARM 0x41 |
3223 |
+#define CPU_IMPL_BROADCOM 0x42 |
3224 |
+#define CPU_IMPL_CAVIUM 0x43 |
3225 |
+#define CPU_IMPL_DEC 0x44 |
3226 |
+#define CPU_IMPL_INFINEON 0x49 |
3227 |
+#define CPU_IMPL_FREESCALE 0x4D |
3228 |
+#define CPU_IMPL_NVIDIA 0x4E |
3229 |
+#define CPU_IMPL_APM 0x50 |
3230 |
+#define CPU_IMPL_QUALCOMM 0x51 |
3231 |
+#define CPU_IMPL_MARVELL 0x56 |
3232 |
+#define CPU_IMPL_INTEL 0x69 |
3233 |
+ |
3234 |
+/* ARM Part numbers */ |
3235 |
+#define CPU_PART_FOUNDATION 0xD00 |
3236 |
+#define CPU_PART_CORTEX_A35 0xD04 |
3237 |
+#define CPU_PART_CORTEX_A53 0xD03 |
3238 |
+#define CPU_PART_CORTEX_A55 0xD05 |
3239 |
+#define CPU_PART_CORTEX_A57 0xD07 |
3240 |
+#define CPU_PART_CORTEX_A72 0xD08 |
3241 |
+#define CPU_PART_CORTEX_A73 0xD09 |
3242 |
+#define CPU_PART_CORTEX_A75 0xD0A |
3243 |
+ |
3244 |
+/* Cavium Part numbers */ |
3245 |
+#define CPU_PART_THUNDERX 0x0A1 |
3246 |
+#define CPU_PART_THUNDERX_81XX 0x0A2 |
3247 |
+#define CPU_PART_THUNDERX_83XX 0x0A3 |
3248 |
+#define CPU_PART_THUNDERX2 0x0AF |
3249 |
+ |
3250 |
+#define CPU_REV_THUNDERX_1_0 0x00 |
3251 |
+#define CPU_REV_THUNDERX_1_1 0x01 |
3252 |
+ |
3253 |
+#define CPU_REV_THUNDERX2_0 0x00 |
3254 |
+ |
3255 |
+#define CPU_IMPL(midr) (((midr) >> 24) & 0xff) |
3256 |
+#define CPU_PART(midr) (((midr) >> 4) & 0xfff) |
3257 |
+#define CPU_VAR(midr) (((midr) >> 20) & 0xf) |
3258 |
+#define CPU_REV(midr) (((midr) >> 0) & 0xf) |
3259 |
+ |
3260 |
+ |
3261 |
+struct cpu_desc { |
3262 |
+ u_int cpu_impl; |
3263 |
+ u_int cpu_part_num; |
3264 |
+ u_int cpu_variant; |
3265 |
+ u_int cpu_revision; |
3266 |
+ const char *cpu_impl_name; |
3267 |
+ const char *cpu_part_name; |
3268 |
+}; |
3269 |
+ |
3270 |
+struct cpu_parts { |
3271 |
+ u_int part_id; |
3272 |
+ const char *part_name; |
3273 |
+}; |
3274 |
+#define CPU_PART_NONE { 0, "Unknown Processor" } |
3275 |
+ |
3276 |
+struct cpu_implementers { |
3277 |
+ u_int impl_id; |
3278 |
+ const char *impl_name; |
3279 |
+ /* |
3280 |
+ * Part number is implementation defined |
3281 |
+ * so each vendor will have its own set of values and names. |
3282 |
+ */ |
3283 |
+ const struct cpu_parts *cpu_parts; |
3284 |
+}; |
3285 |
+#define CPU_IMPLEMENTER_NONE { 0, "Unknown Implementer", cpu_parts_none } |
3286 |
+ |
3287 |
+/* |
3288 |
+ * Per-implementer table of (PartNum, CPU Name) pairs. |
3289 |
+ */ |
3290 |
+/* ARM Ltd. */ |
3291 |
+static const struct cpu_parts cpu_parts_arm[] = { |
3292 |
+ { CPU_PART_FOUNDATION, "Foundation-Model" }, |
3293 |
+ { CPU_PART_CORTEX_A35, "Cortex-A35" }, |
3294 |
+ { CPU_PART_CORTEX_A53, "Cortex-A53" }, |
3295 |
+ { CPU_PART_CORTEX_A55, "Cortex-A55" }, |
3296 |
+ { CPU_PART_CORTEX_A57, "Cortex-A57" }, |
3297 |
+ { CPU_PART_CORTEX_A72, "Cortex-A72" }, |
3298 |
+ { CPU_PART_CORTEX_A73, "Cortex-A73" }, |
3299 |
+ { CPU_PART_CORTEX_A75, "Cortex-A75" }, |
3300 |
+ CPU_PART_NONE, |
3301 |
+}; |
3302 |
+/* Cavium */ |
3303 |
+static const struct cpu_parts cpu_parts_cavium[] = { |
3304 |
+ { CPU_PART_THUNDERX, "ThunderX" }, |
3305 |
+ { CPU_PART_THUNDERX2, "ThunderX2" }, |
3306 |
+ CPU_PART_NONE, |
3307 |
+}; |
3308 |
+ |
3309 |
+/* Unknown */ |
3310 |
+static const struct cpu_parts cpu_parts_none[] = { |
3311 |
+ CPU_PART_NONE, |
3312 |
+}; |
3313 |
+ |
3314 |
+/* |
3315 |
+ * Implementers table. |
3316 |
+ */ |
3317 |
+const struct cpu_implementers cpu_implementers[] = { |
3318 |
+ { CPU_IMPL_ARM, "ARM", cpu_parts_arm }, |
3319 |
+ { CPU_IMPL_BROADCOM, "Broadcom", cpu_parts_none }, |
3320 |
+ { CPU_IMPL_CAVIUM, "Cavium", cpu_parts_cavium }, |
3321 |
+ { CPU_IMPL_DEC, "DEC", cpu_parts_none }, |
3322 |
+ { CPU_IMPL_INFINEON, "IFX", cpu_parts_none }, |
3323 |
+ { CPU_IMPL_FREESCALE, "Freescale", cpu_parts_none }, |
3324 |
+ { CPU_IMPL_NVIDIA, "NVIDIA", cpu_parts_none }, |
3325 |
+ { CPU_IMPL_APM, "APM", cpu_parts_none }, |
3326 |
+ { CPU_IMPL_QUALCOMM, "Qualcomm", cpu_parts_none }, |
3327 |
+ { CPU_IMPL_MARVELL, "Marvell", cpu_parts_none }, |
3328 |
+ { CPU_IMPL_INTEL, "Intel", cpu_parts_none }, |
3329 |
+ CPU_IMPLEMENTER_NONE, |
3330 |
+}; |
3331 |
+ |
3332 |
+#endif |
3333 |
diff --git a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp |
3334 |
index 9962617d03..c8308b1080 100644 |
3335 |
--- /src/hotspot/cpu/aarch64/vm_version_aarch64.cpp |
3336 |
+++ src/hotspot/cpu/aarch64/vm_version_aarch64.cpp |
3337 |
@@ -35,12 +35,23 @@ |
3338 |
#include OS_HEADER_INLINE(os) |
3339 |
|
3340 |
#ifndef BUILTIN_SIM |
3341 |
+#if defined (__linux__) |
3342 |
#include <sys/auxv.h> |
3343 |
#include <asm/hwcap.h> |
3344 |
+#endif |
3345 |
#else |
3346 |
#define getauxval(hwcap) 0 |
3347 |
#endif |
3348 |
|
3349 |
+#if defined (__FreeBSD__) |
3350 |
+#include <machine/armreg.h> |
3351 |
+#include "freebsd_aarch64.hpp" |
3352 |
+#endif |
3353 |
+ |
3354 |
+#ifndef HWCAP_ASIMD |
3355 |
+#define HWCAP_ASIMD (1 << 1) |
3356 |
+#endif |
3357 |
+ |
3358 |
#ifndef HWCAP_AES |
3359 |
#define HWCAP_AES (1<<3) |
3360 |
#endif |
3361 |
@@ -164,6 +175,7 @@ void VM_Version::get_processor_features() { |
3362 |
SoftwarePrefetchHintDistance &= ~7; |
3363 |
} |
3364 |
|
3365 |
+#if defined(__linux__) |
3366 |
unsigned long auxv = getauxval(AT_HWCAP); |
3367 |
|
3368 |
char buf[512]; |
3369 |
@@ -191,6 +203,51 @@ void VM_Version::get_processor_features() { |
3370 |
} |
3371 |
fclose(f); |
3372 |
} |
3373 |
+#elif defined(__FreeBSD__) |
3374 |
+struct cpu_desc cpu_desc[1]; |
3375 |
+struct cpu_desc user_cpu_desc; |
3376 |
+char buf[512]; |
3377 |
+int cpu_lines = 0; |
3378 |
+ |
3379 |
+uint32_t midr; |
3380 |
+uint32_t impl_id; |
3381 |
+uint32_t part_id; |
3382 |
+uint32_t cpu = 0; |
3383 |
+size_t i; |
3384 |
+const struct cpu_parts *cpu_partsp = NULL; |
3385 |
+ |
3386 |
+midr = READ_SPECIALREG(midr_el1); |
3387 |
+ |
3388 |
+impl_id = CPU_IMPL(midr); |
3389 |
+for (i = 0; i < nitems(cpu_implementers); i++) { |
3390 |
+ if (impl_id == cpu_implementers[i].impl_id || |
3391 |
+ cpu_implementers[i].impl_id == 0) { |
3392 |
+ cpu_desc[cpu].cpu_impl = impl_id; |
3393 |
+ cpu_desc[cpu].cpu_impl_name = cpu_implementers[i].impl_name; |
3394 |
+ cpu_partsp = cpu_implementers[i].cpu_parts; |
3395 |
+ break; |
3396 |
+ } |
3397 |
+} |
3398 |
+ |
3399 |
+part_id = CPU_PART(midr); |
3400 |
+for (i = 0; &cpu_partsp[i] != NULL; i++) { |
3401 |
+ if (part_id == cpu_partsp[i].part_id || |
3402 |
+ cpu_partsp[i].part_id == 0) { |
3403 |
+ cpu_desc[cpu].cpu_part_num = part_id; |
3404 |
+ cpu_desc[cpu].cpu_part_name = cpu_partsp[i].part_name; |
3405 |
+ break; |
3406 |
+ } |
3407 |
+} |
3408 |
+ |
3409 |
+cpu_desc[cpu].cpu_revision = CPU_REV(midr); |
3410 |
+cpu_desc[cpu].cpu_variant = CPU_VAR(midr); |
3411 |
+ |
3412 |
+_cpu = cpu_desc[cpu].cpu_impl; |
3413 |
+_variant = cpu_desc[cpu].cpu_variant; |
3414 |
+_model = cpu_desc[cpu].cpu_part_num; |
3415 |
+_revision = cpu_desc[cpu].cpu_revision; |
3416 |
+ |
3417 |
+#endif |
3418 |
|
3419 |
// Enable vendor specific features |
3420 |
|
3421 |
@@ -245,6 +302,39 @@ void VM_Version::get_processor_features() { |
3422 |
if (_cpu == CPU_ARM && cpu_lines == 1 && _model == 0xd07) _features |= CPU_A53MAC; |
3423 |
|
3424 |
sprintf(buf, "0x%02x:0x%x:0x%03x:%d", _cpu, _variant, _model, _revision); |
3425 |
+#if defined (__FreeBSD__) |
3426 |
+ unsigned long auxv = 0; |
3427 |
+ uint64_t id_aa64isar0, id_aa64pfr0; |
3428 |
+ |
3429 |
+ id_aa64isar0 = READ_SPECIALREG(ID_AA64ISAR0_EL1); |
3430 |
+ id_aa64pfr0 = READ_SPECIALREG(ID_AA64PFR0_EL1); |
3431 |
+ |
3432 |
+ if (ID_AA64ISAR0_AES(id_aa64isar0) == ID_AA64ISAR0_AES_BASE) { |
3433 |
+ auxv = auxv | HWCAP_AES; |
3434 |
+ } |
3435 |
+ |
3436 |
+ if (ID_AA64ISAR0_AES(id_aa64isar0) == ID_AA64ISAR0_AES_PMULL) { |
3437 |
+ auxv = auxv | HWCAP_PMULL; |
3438 |
+ } |
3439 |
+ |
3440 |
+ if (ID_AA64ISAR0_SHA1(id_aa64isar0) == ID_AA64ISAR0_SHA1_BASE) { |
3441 |
+ auxv = auxv | HWCAP_SHA1; |
3442 |
+ } |
3443 |
+ |
3444 |
+ if (ID_AA64ISAR0_SHA2(id_aa64isar0) == ID_AA64ISAR0_SHA2_BASE) { |
3445 |
+ auxv = auxv | HWCAP_SHA2; |
3446 |
+ } |
3447 |
+ |
3448 |
+ if (ID_AA64ISAR0_CRC32(id_aa64isar0) == ID_AA64ISAR0_CRC32_BASE) { |
3449 |
+ auxv = auxv | HWCAP_CRC32; |
3450 |
+ } |
3451 |
+ |
3452 |
+ if (ID_AA64PFR0_ADV_SIMD(id_aa64pfr0) == ID_AA64PFR0_ADV_SIMD_IMPL || \ |
3453 |
+ ID_AA64PFR0_ADV_SIMD(id_aa64pfr0) == ID_AA64PFR0_ADV_SIMD_HP ) { |
3454 |
+ auxv = auxv | HWCAP_ASIMD; |
3455 |
+ } |
3456 |
+#endif |
3457 |
+ |
3458 |
if (_model2) sprintf(buf+strlen(buf), "(0x%03x)", _model2); |
3459 |
if (auxv & HWCAP_ASIMD) strcat(buf, ", simd"); |
3460 |
if (auxv & HWCAP_CRC32) strcat(buf, ", crc"); |
3461 |
|
3462 |
From ec511f86a6c7b28f235c64f36e49d7b03c681518 Mon Sep 17 00:00:00 2001 |
3463 |
From: miki <mikael.urankar@gmail.com> |
3464 |
Date: Thu, 11 Apr 2019 20:15:26 +0200 |
3465 |
Subject: [PATCH 11/17] try to fix the following error with clang (gcc8 doesn't |
3466 |
complain) |
3467 |
|
3468 |
src/hotspot/os_cpu/bsd_aarch64/atomic_bsd_aarch64.hpp:43:39: error: cannot initialize a parameter of type 'char *' with an lvalue of type 'unsigned long' |
3469 |
return __sync_add_and_fetch(dest, add_value); |
3470 |
^~~~~~~~~ |
3471 |
src/hotspot/share/runtime/atomic.hpp:682:45: note: in instantiation of function template specialization 'Atomic::PlatformAdd<8>::add_and_fetch<unsigned long, char *>' requested here |
3472 |
return static_cast<const Derived*>(this)->add_and_fetch(add_value, dest, order); |
3473 |
^ |
3474 |
src/hotspot/share/runtime/atomic.hpp:634:12: note: in instantiation of function template specialization 'Atomic::AddAndFetch<Atomic::PlatformAdd<8> >::operator()<unsigned long, char *>' requested here |
3475 |
return PlatformAdd<sizeof(P*)>()(addend, dest, order); |
3476 |
^ |
3477 |
hotspot/share/runtime/atomic.hpp:605:10: note: in instantiation of member function 'Atomic::AddImpl<unsigned long, char *, void>::operator()' requested here |
3478 |
return AddImpl<I, D>()(add_value, dest, order); |
3479 |
^ |
3480 |
src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp:248:34: note: in instantiation of function template specialization 'Atomic::add<unsigned long, char *>' requested here |
3481 |
char* touch_addr = Atomic::add(actual_chunk_size, &_cur_addr) - actual_chunk_size; |
3482 |
--- |
3483 |
src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp | 3 ++- |
3484 |
1 file changed, 2 insertions(+), 1 deletion(-) |
3485 |
|
3486 |
diff --git a/src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp b/src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp |
3487 |
index fc30400f28..fb4a2fd62f 100644 |
3488 |
--- /src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp |
3489 |
+++ src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp |
3490 |
@@ -256,7 +256,8 @@ class G1PretouchTask : public AbstractGangTask { |
3491 |
virtual void work(uint worker_id) { |
3492 |
size_t const actual_chunk_size = MAX2(chunk_size(), _page_size); |
3493 |
while (true) { |
3494 |
- char* touch_addr = Atomic::add(actual_chunk_size, &_cur_addr) - actual_chunk_size; |
3495 |
+ volatile size_t _cur_addr_a = (size_t)_cur_addr; |
3496 |
+ char* touch_addr = (char *)(Atomic::add(actual_chunk_size, &_cur_addr_a) - actual_chunk_size); |
3497 |
if (touch_addr < _start_addr || touch_addr >= _end_addr) { |
3498 |
break; |
3499 |
} |
3500 |
|
3501 |
From 5ae18f2854aea04c0bf1d5da87160add0ac55f5c Mon Sep 17 00:00:00 2001 |
3502 |
From: miki <mikael.urankar@gmail.com> |
3503 |
Date: Thu, 11 Apr 2019 20:16:11 +0200 |
3504 |
Subject: [PATCH 12/17] Fix undefined behavior |
3505 |
src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp:2677:17: warning: shifting |
3506 |
a negative signed value is undefined [-Wshift-negative-value] offset &= |
3507 |
-1<<12; ~~^ |
3508 |
|
3509 |
--- |
3510 |
src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp | 2 +- |
3511 |
1 file changed, 1 insertion(+), 1 deletion(-) |
3512 |
|
3513 |
diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp |
3514 |
index c32394a95b..7931614c6d 100644 |
3515 |
--- /src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp |
3516 |
+++ src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp |
3517 |
@@ -2674,7 +2674,7 @@ Address MacroAssembler::spill_address(int size, int offset, Register tmp) |
3518 |
if ((offset & (size-1)) && offset >= (1<<8)) { |
3519 |
add(tmp, base, offset & ((1<<12)-1)); |
3520 |
base = tmp; |
3521 |
- offset &= -1<<12; |
3522 |
+ offset &= -(1<<12); |
3523 |
} |
3524 |
|
3525 |
if (offset >= (1<<12) * size) { |
3526 |
|
3527 |
From f2acf7a95128229187bfdc21d35279eb0edd5362 Mon Sep 17 00:00:00 2001 |
3528 |
From: miki <mikael.urankar@gmail.com> |
3529 |
Date: Thu, 11 Apr 2019 20:18:31 +0200 |
3530 |
Subject: [PATCH 13/17] Fix warning: |
3531 |
src/hotspot/cpu/aarch64/assembler_aarch64.hpp:279:22: warning: & has lower |
3532 |
precedence than ==; == will be evaluated first [-Wparentheses] |
3533 |
assert_cond(bits & mask == mask); ^ ~~~~~~~~~~~~ |
3534 |
|
3535 |
--- |
3536 |
src/hotspot/cpu/aarch64/assembler_aarch64.hpp | 2 +- |
3537 |
1 file changed, 1 insertion(+), 1 deletion(-) |
3538 |
|
3539 |
diff --git a/src/hotspot/cpu/aarch64/assembler_aarch64.hpp b/src/hotspot/cpu/aarch64/assembler_aarch64.hpp |
3540 |
index 09c7cd240f..c9f33cb732 100644 |
3541 |
--- /src/hotspot/cpu/aarch64/assembler_aarch64.hpp |
3542 |
+++ src/hotspot/cpu/aarch64/assembler_aarch64.hpp |
3543 |
@@ -276,7 +276,7 @@ class Instruction_aarch64 { |
3544 |
unsigned get(int msb = 31, int lsb = 0) { |
3545 |
int nbits = msb - lsb + 1; |
3546 |
unsigned mask = ((1U << nbits) - 1) << lsb; |
3547 |
- assert_cond(bits & mask == mask); |
3548 |
+ assert_cond((bits & mask) == mask); |
3549 |
return (insn & mask) >> lsb; |
3550 |
} |
3551 |
|
3552 |
|
3553 |
From cf325c325230b09ca20e505b37b32052dfcdb0dc Mon Sep 17 00:00:00 2001 |
3554 |
From: miki <mikael.urankar@gmail.com> |
3555 |
Date: Thu, 11 Apr 2019 20:18:55 +0200 |
3556 |
Subject: [PATCH 14/17] Fix warning: |
3557 |
src/hotspot/cpu/aarch64/assembler_aarch64.hpp:2564:34: warning: '&' within |
3558 |
'|' [-Wbitwise-op-parentheses] _rbit(Vd, SIMD_Arrangement(T & 1 | 0b010), |
3559 |
Vn); ~~^~~ ~ |
3560 |
/usr/ports/java/openjdk11/work/openjdk-jdk11u-jdk-11.0.2-9-4/src/hotspot/cpu/aarch64/assembler_aarch64.hpp:2564:34: |
3561 |
note: place parentheses around the '&' expression to silence this warning |
3562 |
_rbit(Vd, SIMD_Arrangement(T & 1 | 0b010), Vn); |
3563 |
^ ( ) |
3564 |
|
3565 |
--- |
3566 |
src/hotspot/cpu/aarch64/assembler_aarch64.hpp | 2 +- |
3567 |
1 file changed, 1 insertion(+), 1 deletion(-) |
3568 |
|
3569 |
diff --git a/src/hotspot/cpu/aarch64/assembler_aarch64.hpp b/src/hotspot/cpu/aarch64/assembler_aarch64.hpp |
3570 |
index c9f33cb732..c7cdc428d0 100644 |
3571 |
--- /src/hotspot/cpu/aarch64/assembler_aarch64.hpp |
3572 |
+++ src/hotspot/cpu/aarch64/assembler_aarch64.hpp |
3573 |
@@ -2560,7 +2560,7 @@ void mvnw(Register Rd, Register Rm, |
3574 |
// RBIT only allows T8B and T16B but encodes them oddly. Argh... |
3575 |
void rbit(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn) { |
3576 |
assert((ASSERTION), MSG); |
3577 |
- _rbit(Vd, SIMD_Arrangement(T & 1 | 0b010), Vn); |
3578 |
+ _rbit(Vd, SIMD_Arrangement((T & 1) | 0b010), Vn); |
3579 |
} |
3580 |
#undef ASSERTION |
3581 |
|
3582 |
|
3583 |
From 5835ba49d1df33231d09bff43606d6bcb29f732a Mon Sep 17 00:00:00 2001 |
3584 |
From: miki <mikael.urankar@gmail.com> |
3585 |
Date: Thu, 11 Apr 2019 20:19:33 +0200 |
3586 |
Subject: [PATCH 15/17] Fix warning: |
3587 |
src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp:1073:24: warning: '&&' |
3588 |
within '||' [-Wlogical-op-parentheses] if (is_unordered && op->cond() |
3589 |
== lir_cond_equal ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
3590 |
src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp:1073:24: note: place |
3591 |
parentheses around the '&&' expression to silence this warning if |
3592 |
(is_unordered && op->cond() == lir_cond_equal ^ |
3593 |
( ) |
3594 |
src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp:1074:28: warning: '&&' |
3595 |
within '||' [-Wlogical-op-parentheses] || !is_unordered && |
3596 |
op->cond() == lir_cond_notEqual) ~~ |
3597 |
~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
3598 |
src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp:1074:28: note: place |
3599 |
parentheses around the '&&' expression to silence this warning || |
3600 |
!is_unordered && op->cond() == lir_cond_notEqual) |
3601 |
^ ( ) |
3602 |
|
3603 |
--- |
3604 |
src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp | 4 ++-- |
3605 |
1 file changed, 2 insertions(+), 2 deletions(-) |
3606 |
|
3607 |
diff --git a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp |
3608 |
index 17480052d4..37f833d7c4 100644 |
3609 |
--- /src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp |
3610 |
+++ src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp |
3611 |
@@ -1070,8 +1070,8 @@ void LIR_Assembler::emit_opBranch(LIR_OpBranch* op) { |
3612 |
// Assembler::EQ does not permit unordered branches, so we add |
3613 |
// another branch here. Likewise, Assembler::NE does not permit |
3614 |
// ordered branches. |
3615 |
- if (is_unordered && op->cond() == lir_cond_equal |
3616 |
- || !is_unordered && op->cond() == lir_cond_notEqual) |
3617 |
+ if ((is_unordered && op->cond() == lir_cond_equal) |
3618 |
+ || (!is_unordered && op->cond() == lir_cond_notEqual)) |
3619 |
__ br(Assembler::VS, *(op->ublock()->label())); |
3620 |
switch(op->cond()) { |
3621 |
case lir_cond_equal: acond = Assembler::EQ; break; |
3622 |
|
3623 |
From ede55013b1fa349a90abc13ea8748607db74a99d Mon Sep 17 00:00:00 2001 |
3624 |
From: miki <mikael.urankar@gmail.com> |
3625 |
Date: Thu, 11 Apr 2019 20:20:07 +0200 |
3626 |
Subject: [PATCH 16/17] The libjvm crashes if memnode.cpp is not compiled at O0 |
3627 |
It's only a problem with clang. |
3628 |
|
3629 |
--- |
3630 |
make/hotspot/lib/JvmOverrideFiles.gmk | 7 +++++++ |
3631 |
1 file changed, 7 insertions(+) |
3632 |
|
3633 |
diff --git a/make/hotspot/lib/JvmOverrideFiles.gmk b/make/hotspot/lib/JvmOverrideFiles.gmk |
3634 |
index d62ba67e10..e5795efcf2 100644 |
3635 |
--- /make/hotspot/lib/JvmOverrideFiles.gmk |
3636 |
+++ make/hotspot/lib/JvmOverrideFiles.gmk |
3637 |
@@ -227,6 +227,13 @@ else ifeq ($(OPENJDK_TARGET_OS), bsd) |
3638 |
loopTransform.cpp \ |
3639 |
unsafe.cpp |
3640 |
# |
3641 |
+ |
3642 |
+ ifeq ($(OPENJDK_TARGET_CPU), aarch64) |
3643 |
+ JVM_PRECOMPILED_HEADER_EXCLUDE += \ |
3644 |
+ memnode.cpp |
3645 |
+ # |
3646 |
+ BUILD_LIBJVM_memnode.cpp_CXXFLAGS := -O0 |
3647 |
+ endif |
3648 |
endif |
3649 |
|
3650 |
endif |
3651 |
|
3652 |
From a251c1ab6a6fcb6770969270b0085779b8a95de8 Mon Sep 17 00:00:00 2001 |
3653 |
From: miki <mikael.urankar@gmail.com> |
3654 |
Date: Thu, 11 Apr 2019 20:20:47 +0200 |
3655 |
Subject: [PATCH 17/17] Fix ucontext on FreeBSD Fix build with clang Use |
3656 |
correct type for _Copy_* |
3657 |
|
3658 |
--- |
3659 |
.../os_cpu/bsd_aarch64/os_bsd_aarch64.cpp | 77 ++++++++----------- |
3660 |
1 file changed, 32 insertions(+), 45 deletions(-) |
3661 |
|
3662 |
diff --git a/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp b/src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp |
3663 |
index 82bf1e84b2..7b973628f7 100644 |
3664 |
--- /src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp |
3665 |
+++ src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp |
3666 |
@@ -77,7 +77,6 @@ |
3667 |
# include <pwd.h> |
3668 |
# include <poll.h> |
3669 |
# include <ucontext.h> |
3670 |
-# include <fpu_control.h> |
3671 |
|
3672 |
#ifdef BUILTIN_SIM |
3673 |
#define REG_SP REG_RSP |
3674 |
@@ -94,7 +93,12 @@ |
3675 |
#endif |
3676 |
|
3677 |
address os::current_stack_pointer() { |
3678 |
+#if defined(__clang__) || defined(__llvm__) |
3679 |
+ register void *esp; |
3680 |
+ __asm__ ("mov %0, " SPELL_REG_SP :"=r"(esp):); |
3681 |
+#else |
3682 |
register void *esp __asm__ (SPELL_REG_SP); |
3683 |
+#endif |
3684 |
return (address) esp; |
3685 |
} |
3686 |
|
3687 |
@@ -110,7 +114,7 @@ address os::Bsd::ucontext_get_pc(const ucontext_t * uc) { |
3688 |
#ifdef BUILTIN_SIM |
3689 |
return (address)uc->uc_mcontext.gregs[REG_PC]; |
3690 |
#else |
3691 |
- return (address)uc->uc_mcontext.pc; |
3692 |
+ return (address)uc->uc_mcontext.mc_gpregs.gp_elr; |
3693 |
#endif |
3694 |
} |
3695 |
|
3696 |
@@ -118,7 +122,7 @@ void os::Bsd::ucontext_set_pc(ucontext_t * uc, address pc) { |
3697 |
#ifdef BUILTIN_SIM |
3698 |
uc->uc_mcontext.gregs[REG_PC] = (intptr_t)pc; |
3699 |
#else |
3700 |
- uc->uc_mcontext.pc = (intptr_t)pc; |
3701 |
+ uc->uc_mcontext.mc_gpregs.gp_elr = (intptr_t)pc; |
3702 |
#endif |
3703 |
} |
3704 |
|
3705 |
@@ -126,7 +130,7 @@ intptr_t* os::Bsd::ucontext_get_sp(const ucontext_t * uc) { |
3706 |
#ifdef BUILTIN_SIM |
3707 |
return (intptr_t*)uc->uc_mcontext.gregs[REG_SP]; |
3708 |
#else |
3709 |
- return (intptr_t*)uc->uc_mcontext.sp; |
3710 |
+ return (intptr_t*)uc->uc_mcontext.mc_gpregs.gp_sp; |
3711 |
#endif |
3712 |
} |
3713 |
|
3714 |
@@ -134,7 +138,7 @@ intptr_t* os::Bsd::ucontext_get_fp(const ucontext_t * uc) { |
3715 |
#ifdef BUILTIN_SIM |
3716 |
return (intptr_t*)uc->uc_mcontext.gregs[REG_FP]; |
3717 |
#else |
3718 |
- return (intptr_t*)uc->uc_mcontext.regs[REG_FP]; |
3719 |
+ return (intptr_t*)uc->uc_mcontext.mc_gpregs.gp_x[REG_FP]; |
3720 |
#endif |
3721 |
} |
3722 |
|
3723 |
@@ -206,7 +210,7 @@ bool os::Bsd::get_frame_at_stack_banging_point(JavaThread* thread, ucontext_t* u |
3724 |
// belong to the caller. |
3725 |
intptr_t* fp = os::Bsd::ucontext_get_fp(uc); |
3726 |
intptr_t* sp = os::Bsd::ucontext_get_sp(uc); |
3727 |
- address pc = (address)(uc->uc_mcontext.regs[REG_LR] |
3728 |
+ address pc = (address)(uc->uc_mcontext.mc_gpregs.gp_lr |
3729 |
- NativeInstruction::instruction_size); |
3730 |
*fr = frame(sp, fp, pc); |
3731 |
if (!fr->is_java_frame()) { |
3732 |
@@ -231,7 +235,12 @@ frame os::get_sender_for_C_frame(frame* fr) { |
3733 |
} |
3734 |
|
3735 |
intptr_t* _get_previous_fp() { |
3736 |
+#if defined(__clang__) || defined(__llvm__) |
3737 |
+ register intptr_t **fp; |
3738 |
+ __asm__("mov %0, " SPELL_REG_FP :"=r"(fp)); |
3739 |
+#else |
3740 |
register intptr_t **fp __asm__ (SPELL_REG_FP); |
3741 |
+#endif |
3742 |
|
3743 |
// fp is for this frame (_get_previous_fp). We want the fp for the |
3744 |
// caller of os::current_frame*(), so go up two frames. However, for |
3745 |
@@ -343,11 +352,11 @@ JVM_handle_bsd_signal(int sig, |
3746 |
|
3747 |
#ifdef BUILTIN_SIM |
3748 |
if (pc == (address) Fetch32PFI) { |
3749 |
- uc->uc_mcontext.gregs[REG_PC] = intptr_t(Fetch32Resume) ; |
3750 |
+ uc->uc_mcontext.mc_gpregs.gp_elr = intptr_t(Fetch32Resume) ; |
3751 |
return 1 ; |
3752 |
} |
3753 |
if (pc == (address) FetchNPFI) { |
3754 |
- uc->uc_mcontext.gregs[REG_PC] = intptr_t (FetchNResume) ; |
3755 |
+ uc->uc_mcontext.mc_gpregs.gp_elr = intptr_t (FetchNResume) ; |
3756 |
return 1 ; |
3757 |
} |
3758 |
#else |
3759 |
@@ -408,21 +417,6 @@ JVM_handle_bsd_signal(int sig, |
3760 |
// it as a hint. |
3761 |
tty->print_raw_cr("Please check if any of your loaded .so files has " |
3762 |
"enabled executable stack (see man page execstack(8))"); |
3763 |
- } else { |
3764 |
- // Accessing stack address below sp may cause SEGV if current |
3765 |
- // thread has MAP_GROWSDOWN stack. This should only happen when |
3766 |
- // current thread was created by user code with MAP_GROWSDOWN flag |
3767 |
- // and then attached to VM. See notes in os_bsd.cpp. |
3768 |
- if (thread->osthread()->expanding_stack() == 0) { |
3769 |
- thread->osthread()->set_expanding_stack(); |
3770 |
- if (os::Bsd::manually_expand_stack(thread, addr)) { |
3771 |
- thread->osthread()->clear_expanding_stack(); |
3772 |
- return 1; |
3773 |
- } |
3774 |
- thread->osthread()->clear_expanding_stack(); |
3775 |
- } else { |
3776 |
- fatal("recursive segv. expanding stack."); |
3777 |
- } |
3778 |
} |
3779 |
} |
3780 |
} |
3781 |
@@ -520,13 +514,6 @@ JVM_handle_bsd_signal(int sig, |
3782 |
void os::Bsd::init_thread_fpu_state(void) { |
3783 |
} |
3784 |
|
3785 |
-int os::Bsd::get_fpu_control_word(void) { |
3786 |
- return 0; |
3787 |
-} |
3788 |
- |
3789 |
-void os::Bsd::set_fpu_control_word(int fpu_control) { |
3790 |
-} |
3791 |
- |
3792 |
// Check that the bsd kernel version is 2.4 or higher since earlier |
3793 |
// versions do not support SSE without patches. |
3794 |
bool os::supports_sse() { |
3795 |
@@ -592,7 +579,7 @@ void os::print_context(outputStream *st, const void *context) { |
3796 |
#else |
3797 |
for (int r = 0; r < 31; r++) { |
3798 |
st->print("R%-2d=", r); |
3799 |
- print_location(st, uc->uc_mcontext.regs[r]); |
3800 |
+ print_location(st, uc->uc_mcontext.mc_gpregs.gp_x[r]); |
3801 |
} |
3802 |
#endif |
3803 |
st->cr(); |
3804 |
@@ -643,7 +630,7 @@ void os::print_register_info(outputStream *st, const void *context) { |
3805 |
st->print("R15="); print_location(st, uc->uc_mcontext.gregs[REG_R15]); |
3806 |
#else |
3807 |
for (int r = 0; r < 31; r++) |
3808 |
- st->print_cr( "R%d=" INTPTR_FORMAT, r, (uintptr_t)uc->uc_mcontext.regs[r]); |
3809 |
+ st->print_cr( "R%d=" INTPTR_FORMAT, r, (uintptr_t)uc->uc_mcontext.mc_gpregs.gp_x[r]); |
3810 |
#endif |
3811 |
st->cr(); |
3812 |
} |
3813 |
@@ -667,42 +654,42 @@ extern "C" { |
3814 |
return 0; |
3815 |
} |
3816 |
|
3817 |
- void _Copy_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) { |
3818 |
+ void _Copy_conjoint_jshorts_atomic(const jshort* from, jshort* to, size_t count) { |
3819 |
if (from > to) { |
3820 |
- jshort *end = from + count; |
3821 |
+ const jshort *end = from + count; |
3822 |
while (from < end) |
3823 |
*(to++) = *(from++); |
3824 |
} |
3825 |
else if (from < to) { |
3826 |
- jshort *end = from; |
3827 |
+ const jshort *end = from; |
3828 |
from += count - 1; |
3829 |
to += count - 1; |
3830 |
while (from >= end) |
3831 |
*(to--) = *(from--); |
3832 |
} |
3833 |
} |
3834 |
- void _Copy_conjoint_jints_atomic(jint* from, jint* to, size_t count) { |
3835 |
+ void _Copy_conjoint_jints_atomic(const jint* from, jint* to, size_t count) { |
3836 |
if (from > to) { |
3837 |
- jint *end = from + count; |
3838 |
+ const jint *end = from + count; |
3839 |
while (from < end) |
3840 |
*(to++) = *(from++); |
3841 |
} |
3842 |
else if (from < to) { |
3843 |
- jint *end = from; |
3844 |
+ const jint *end = from; |
3845 |
from += count - 1; |
3846 |
to += count - 1; |
3847 |
while (from >= end) |
3848 |
*(to--) = *(from--); |
3849 |
} |
3850 |
} |
3851 |
- void _Copy_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) { |
3852 |
+ void _Copy_conjoint_jlongs_atomic(const jlong* from, jlong* to, size_t count) { |
3853 |
if (from > to) { |
3854 |
- jlong *end = from + count; |
3855 |
+ const jlong *end = from + count; |
3856 |
while (from < end) |
3857 |
os::atomic_copy64(from++, to++); |
3858 |
} |
3859 |
else if (from < to) { |
3860 |
- jlong *end = from; |
3861 |
+ const jlong *end = from; |
3862 |
from += count - 1; |
3863 |
to += count - 1; |
3864 |
while (from >= end) |
3865 |
@@ -710,22 +697,22 @@ extern "C" { |
3866 |
} |
3867 |
} |
3868 |
|
3869 |
- void _Copy_arrayof_conjoint_bytes(HeapWord* from, |
3870 |
+ void _Copy_arrayof_conjoint_bytes(const HeapWord* from, |
3871 |
HeapWord* to, |
3872 |
size_t count) { |
3873 |
memmove(to, from, count); |
3874 |
} |
3875 |
- void _Copy_arrayof_conjoint_jshorts(HeapWord* from, |
3876 |
+ void _Copy_arrayof_conjoint_jshorts(const HeapWord* from, |
3877 |
HeapWord* to, |
3878 |
size_t count) { |
3879 |
memmove(to, from, count * 2); |
3880 |
} |
3881 |
- void _Copy_arrayof_conjoint_jints(HeapWord* from, |
3882 |
+ void _Copy_arrayof_conjoint_jints(const HeapWord* from, |
3883 |
HeapWord* to, |
3884 |
size_t count) { |
3885 |
memmove(to, from, count * 4); |
3886 |
} |
3887 |
- void _Copy_arrayof_conjoint_jlongs(HeapWord* from, |
3888 |
+ void _Copy_arrayof_conjoint_jlongs(const HeapWord* from, |
3889 |
HeapWord* to, |
3890 |
size_t count) { |
3891 |
memmove(to, from, count * 8); |
3892 |
--- src/jdk.hotspot.agent/bsd/native/libsaproc/BsdDebuggerLocal.c.orig 2019-07-16 09:59:43.558151000 +0200 |
3893 |
+++ src/jdk.hotspot.agent/bsd/native/libsaproc/BsdDebuggerLocal.c 2019-07-16 09:59:53.542593000 +0200 |
3894 |
@@ -46,6 +46,10 @@ |
3895 |
#include "sun_jvm_hotspot_debugger_sparc_SPARCThreadContext.h" |
3896 |
#endif |
3897 |
|
3898 |
+#ifdef aarch64 |
3899 |
+#include "sun_jvm_hotspot_debugger_aarch64_AARCH64ThreadContext.h" |
3900 |
+#endif |
3901 |
+ |
3902 |
static jfieldID p_ps_prochandle_ID = 0; |
3903 |
static jfieldID threadList_ID = 0; |
3904 |
static jfieldID loadObjectList_ID = 0; |
3905 |
@@ -311,6 +315,9 @@ JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debu |
3906 |
#ifdef ppc64 |
3907 |
#define NPRGREG sun_jvm_hotspot_debugger_ppc64_PPC64ThreadContext_NPRGREG |
3908 |
#endif |
3909 |
+#ifdef aarch64 |
3910 |
+#define NPRGREG sun_jvm_hotspot_debugger_aarch64_AARCH64ThreadContext_NPRGREG |
3911 |
+#endif |
3912 |
|
3913 |
array = (*env)->NewLongArray(env, NPRGREG); |
3914 |
CHECK_EXCEPTION_(0); |
3915 |
@@ -441,6 +448,19 @@ JNIEXPORT jlongArray JNICALL Java_sun_jvm_hotspot_debu |
3916 |
regs[REG_INDEX(R31)] = gregs.fixreg[31]; |
3917 |
|
3918 |
#endif |
3919 |
+ |
3920 |
+#if defined(aarch64) |
3921 |
+ |
3922 |
+#define REG_INDEX(reg) sun_jvm_hotspot_debugger_aarch64_AARCH64ThreadContext_##reg |
3923 |
+ |
3924 |
+ { |
3925 |
+ int i; |
3926 |
+ for (i = 0; i < 31; i++) |
3927 |
+ regs[i] = gregs.x[i]; |
3928 |
+ regs[REG_INDEX(SP)] = gregs.sp; |
3929 |
+ regs[REG_INDEX(PC)] = gregs.elr; |
3930 |
+ } |
3931 |
+#endif /* aarch64 */ |
3932 |
|
3933 |
|
3934 |
(*env)->ReleaseLongArrayElements(env, array, regs, JNI_COMMIT); |