1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
| | From a0a919603c1546ce86fe659df3636b5a24b9caeb Mon Sep 17 00:00:00 2001
From: Nick Gasson <ngasson@openjdk.org>
Date: Mon, 17 Jun 2019 15:31:49 +0800
Subject: [PATCH] 8224851: AArch64: fix warnings and errors with Clang and GCC
8.3
Reviewed-by: aph, kbarrett
---
hotspot/src/cpu/aarch64/vm/aarch64.ad | 8 +--
hotspot/src/cpu/aarch64/vm/assembler_aarch64.hpp | 4 +-
.../cpu/aarch64/c1_LIRAssembler_aarch64.cpp | 12 ++--
.../cpu/aarch64/c1_LIRGenerator_aarch64.cpp | 4 +-
hotspot/src/cpu/aarch64/vm/frame_aarch64.cpp | 10 +--
.../cpu/aarch64/interp_masm_aarch64.hpp | 2 -
.../cpu/aarch64/macroAssembler_aarch64.cpp | 2 +-
.../aarch64/macroAssembler_aarch64_log.cpp | 4 +-
.../aarch64/macroAssembler_aarch64_trig.cpp | 30 ++++-----
.../cpu/aarch64/vm_version_aarch64.cpp | 2 +-
.../linux_aarch64/atomic_linux_aarch64.hpp | 4 +-
.../os_cpu/linux_aarch64/copy_linux_aarch64.s | 2 +-
.../os_cpu/linux_aarch64/os_linux_aarch64.cpp | 61 ++++++-------------
13 files changed, 62 insertions(+), 83 deletions(-)
diff --git a/hotspot/src/cpu/aarch64/vm/aarch64.ad b/hotspot/src/cpu/aarch64/vm/aarch64.ad
index e6a1bc8bba98..a5afb2a08fef 100644
--- a/hotspot/src/cpu/aarch64/vm/aarch64.ad
+++ b/hotspot/src/cpu/aarch64/vm/aarch64.ad
@@ -14255,7 +14255,7 @@ instruct compF_reg_zero(rFlagsReg cr, vRegF src1, immF0 src2)
format %{ "fcmps $src1, 0.0" %}
ins_encode %{
- __ fcmps(as_FloatRegister($src1$$reg), 0.0D);
+ __ fcmps(as_FloatRegister($src1$$reg), 0.0);
%}
ins_pipe(pipe_class_compare);
@@ -14284,7 +14284,7 @@ instruct compD_reg_zero(rFlagsReg cr, vRegD src1, immD0 src2)
format %{ "fcmpd $src1, 0.0" %}
ins_encode %{
- __ fcmpd(as_FloatRegister($src1$$reg), 0.0D);
+ __ fcmpd(as_FloatRegister($src1$$reg), 0.0);
%}
ins_pipe(pipe_class_compare);
@@ -14360,7 +14360,7 @@ instruct compF3_reg_immF0(iRegINoSp dst, vRegF src1, immF0 zero, rFlagsReg cr)
Label done;
FloatRegister s1 = as_FloatRegister($src1$$reg);
Register d = as_Register($dst$$reg);
- __ fcmps(s1, 0.0D);
+ __ fcmps(s1, 0.0);
// installs 0 if EQ else -1
__ csinvw(d, zr, zr, Assembler::EQ);
// keeps -1 if less or unordered else installs 1
@@ -14387,7 +14387,7 @@ instruct compD3_reg_immD0(iRegINoSp dst, vRegD src1, immD0 zero, rFlagsReg cr)
Label done;
FloatRegister s1 = as_FloatRegister($src1$$reg);
Register d = as_Register($dst$$reg);
- __ fcmpd(s1, 0.0D);
+ __ fcmpd(s1, 0.0);
// installs 0 if EQ else -1
__ csinvw(d, zr, zr, Assembler::EQ);
// keeps -1 if less or unordered else installs 1
diff --git a/hotspot/src/cpu/aarch64/vm/assembler_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/assembler_aarch64.hpp
index 3bb620d52e0a..a95417a467a9 100644
--- a/hotspot/src/cpu/aarch64/vm/assembler_aarch64.hpp
+++ b/hotspot/src/cpu/aarch64/vm/assembler_aarch64.hpp
@@ -276,7 +276,7 @@ class Instruction_aarch64 {
unsigned get(int msb = 31, int lsb = 0) {
int nbits = msb - lsb + 1;
unsigned mask = ((1U << nbits) - 1) << lsb;
- assert_cond(bits & mask == mask);
+ assert_cond((bits & mask) == mask);
return (insn & mask) >> lsb;
}
@@ -2644,7 +2644,7 @@ void mvnw(Register Rd, Register Rm,
// RBIT only allows T8B and T16B but encodes them oddly. Argh...
void rbit(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn) {
assert((ASSERTION), MSG);
- _rbit(Vd, SIMD_Arrangement(T & 1 | 0b010), Vn);
+ _rbit(Vd, SIMD_Arrangement((T & 1) | 0b010), Vn);
}
#undef ASSERTION
diff --git a/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp
index 100b9e9c1154..eb013eb52be4 100644
--- a/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp
+++ b/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp
@@ -1078,8 +1078,8 @@ void LIR_Assembler::emit_opBranch(LIR_OpBranch* op) {
// Assembler::EQ does not permit unordered branches, so we add
// another branch here. Likewise, Assembler::NE does not permit
// ordered branches.
- if (is_unordered && op->cond() == lir_cond_equal
- || !is_unordered && op->cond() == lir_cond_notEqual)
+ if ((is_unordered && op->cond() == lir_cond_equal)
+ || (!is_unordered && op->cond() == lir_cond_notEqual))
__ br(Assembler::VS, *(op->ublock()->label()));
switch(op->cond()) {
case lir_cond_equal: acond = Assembler::EQ; break;
@@ -1789,18 +1789,22 @@ void LIR_Assembler::arith_op(LIR_Code code, LIR_Opr left, LIR_Opr right, LIR_Opr
switch (code) {
case lir_add: __ fadds (dest->as_float_reg(), left->as_float_reg(), right->as_float_reg()); break;
case lir_sub: __ fsubs (dest->as_float_reg(), left->as_float_reg(), right->as_float_reg()); break;
+ case lir_mul_strictfp: // fall through
case lir_mul: __ fmuls (dest->as_float_reg(), left->as_float_reg(), right->as_float_reg()); break;
+ case lir_div_strictfp: // fall through
case lir_div: __ fdivs (dest->as_float_reg(), left->as_float_reg(), right->as_float_reg()); break;
default:
ShouldNotReachHere();
}
} else if (left->is_double_fpu()) {
if (right->is_double_fpu()) {
- // cpu register - cpu register
+ // fpu register - fpu register
switch (code) {
case lir_add: __ faddd (dest->as_double_reg(), left->as_double_reg(), right->as_double_reg()); break;
case lir_sub: __ fsubd (dest->as_double_reg(), left->as_double_reg(), right->as_double_reg()); break;
+ case lir_mul_strictfp: // fall through
case lir_mul: __ fmuld (dest->as_double_reg(), left->as_double_reg(), right->as_double_reg()); break;
+ case lir_div_strictfp: // fall through
case lir_div: __ fdivd (dest->as_double_reg(), left->as_double_reg(), right->as_double_reg()); break;
default:
ShouldNotReachHere();
diff --git a/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp
index 19c9ea688f6d..185e93b99f93 100644
--- a/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp
+++ b/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp
@@ -426,7 +426,7 @@ void LIRGenerator::do_ArithmeticOp_FPU(ArithmeticOp* x) {
tmp = new_register(T_DOUBLE);
}
- arithmetic_op_fpu(x->op(), reg, left.result(), right.result(), NULL);
+ arithmetic_op_fpu(x->op(), reg, left.result(), right.result(), x->is_strictfp());
set_result(x, round_item(reg));
}
diff --git a/hotspot/src/cpu/aarch64/vm/frame_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/frame_aarch64.cpp
index 08b8f2b915b7..3019cb01acc6 100644
--- a/hotspot/src/cpu/aarch64/vm/frame_aarch64.cpp
+++ b/hotspot/src/cpu/aarch64/vm/frame_aarch64.cpp
@@ -768,11 +768,13 @@ extern "C" void npf() {
extern "C" void pf(unsigned long sp, unsigned long fp, unsigned long pc,
unsigned long bcx, unsigned long thread) {
- RegisterMap map((JavaThread*)thread, false);
if (!reg_map) {
- reg_map = (RegisterMap*)os::malloc(sizeof map, mtNone);
+ reg_map = NEW_C_HEAP_OBJ(RegisterMap, mtNone);
+ ::new (reg_map) RegisterMap((JavaThread*)thread, false);
+ } else {
+ *reg_map = RegisterMap((JavaThread*)thread, false);
}
- memcpy(reg_map, &map, sizeof map);
+
{
CodeBlob *cb = CodeCache::find_blob((address)pc);
if (cb && cb->frame_size())
diff --git a/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.hpp
index 72ec4cd1e36b..8168b50ec9f1 100644
--- a/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.hpp
+++ b/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.hpp
@@ -38,8 +38,6 @@ class InterpreterMacroAssembler: public MacroAssembler {
protected:
protected:
- using MacroAssembler::call_VM_leaf_base;
-
// Interpreter specific version of call_VM_base
using MacroAssembler::call_VM_leaf_base;
diff --git a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp
index 5bfa8133d5bb..1c264b4df248 100644
--- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp
+++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp
@@ -2681,7 +2681,7 @@ Address MacroAssembler::spill_address(int size, int offset, Register tmp)
if ((offset & (size-1)) && offset >= (1<<8)) {
add(tmp, base, offset & ((1<<12)-1));
base = tmp;
- offset &= -1<<12;
+ offset &= -1u<<12;
}
if (offset >= (1<<12) * size) {
diff --git a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp
index b917636cb635..dbf1dcdb5409 100644
--- a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp
+++ b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp
@@ -177,7 +177,7 @@ void VM_Version::get_processor_features() {
if (FILE *f = fopen("/proc/cpuinfo", "r")) {
char buf[128], *p;
while (fgets(buf, sizeof (buf), f) != NULL) {
- if (p = strchr(buf, ':')) {
+ if ((p = strchr(buf, ':')) != NULL) {
long v = strtol(p+1, NULL, 0);
if (strncmp(buf, "CPU implementer", sizeof "CPU implementer" - 1) == 0) {
_cpu = v;
diff --git a/hotspot/src/os_cpu/linux_aarch64/vm/copy_linux_aarch64.s b/hotspot/src/os_cpu/linux_aarch64/vm/copy_linux_aarch64.s
index 25e3b054f779..4b8ed597c59f 100644
--- a/hotspot/src/os_cpu/linux_aarch64/vm/copy_linux_aarch64.s
+++ b/hotspot/src/os_cpu/linux_aarch64/vm/copy_linux_aarch64.s
@@ -159,7 +159,7 @@ bwd_copy_aligned:
blo bwd_copy_drain
bwd_copy_again:
- prfm pldl1keep, [s, #-256]
+ prfum pldl1keep, [s, #-256]
stp t0, t1, [d, #-16]
ldp t0, t1, [s, #-16]
stp t2, t3, [d, #-32]
diff --git a/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp b/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp
index c728687a4044..e428e89baa09 100644
--- a/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp
+++ b/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp
@@ -83,19 +83,13 @@
#define REG_SP REG_RSP
#define REG_PC REG_RIP
#define REG_FP REG_RBP
-#define SPELL_REG_SP "rsp"
-#define SPELL_REG_FP "rbp"
#else
#define REG_FP 29
#define REG_LR 30
-
-#define SPELL_REG_SP "sp"
-#define SPELL_REG_FP "x29"
#endif
-address os::current_stack_pointer() {
- register void *esp __asm__ (SPELL_REG_SP);
- return (address) esp;
+NOINLINE address os::current_stack_pointer() {
+ return (address)__builtin_frame_address(0);
}
char* os::non_memory_address_word() {
@@ -233,14 +233,8 @@ frame os::get_sender_for_C_frame(frame* fr) {
#endif
}
-intptr_t* _get_previous_fp() {
- register intptr_t **ebp __asm__ (SPELL_REG_FP);
- return (intptr_t*) *ebp; // we want what it points to.
-}
-
-
-frame os::current_frame() {
- intptr_t* fp = _get_previous_fp();
+NOINLINE frame os::current_frame() {
+ intptr_t *fp = *(intptr_t **)__builtin_frame_address(0);
frame myframe((intptr_t*)os::current_stack_pointer(),
(intptr_t*)fp,
CAST_FROM_FN_PTR(address, os::current_frame));
@@ -259,12 +238,6 @@ frame os::current_frame() {
}
// Utility functions
-
-// From IA32 System Programming Guide
-enum {
- trap_page_fault = 0xE
-};
-
#ifdef BUILTIN_SIM
extern "C" void Fetch32PFI () ;
extern "C" void Fetch32Resume () ;
@@ -667,42 +640,42 @@ extern "C" {
return 0;
}
- void _Copy_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) {
+ void _Copy_conjoint_jshorts_atomic(const jshort* from, jshort* to, size_t count) {
if (from > to) {
- jshort *end = from + count;
+ const jshort *end = from + count;
while (from < end)
*(to++) = *(from++);
}
else if (from < to) {
- jshort *end = from;
+ const jshort *end = from;
from += count - 1;
to += count - 1;
while (from >= end)
*(to--) = *(from--);
}
}
- void _Copy_conjoint_jints_atomic(jint* from, jint* to, size_t count) {
+ void _Copy_conjoint_jints_atomic(const jint* from, jint* to, size_t count) {
if (from > to) {
- jint *end = from + count;
+ const jint *end = from + count;
while (from < end)
*(to++) = *(from++);
}
else if (from < to) {
- jint *end = from;
+ const jint *end = from;
from += count - 1;
to += count - 1;
while (from >= end)
*(to--) = *(from--);
}
}
- void _Copy_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) {
+ void _Copy_conjoint_jlongs_atomic(volatile jlong* from, volatile jlong* to, size_t count) {
if (from > to) {
- jlong *end = from + count;
+ const jlong *end = (const jlong*)from + count;
while (from < end)
os::atomic_copy64(from++, to++);
}
else if (from < to) {
- jlong *end = from;
+ const jlong *end = (const jlong*)from;
from += count - 1;
to += count - 1;
while (from >= end)
@@ -710,22 +683,22 @@ extern "C" {
}
}
- void _Copy_arrayof_conjoint_bytes(HeapWord* from,
+ void _Copy_arrayof_conjoint_bytes(const HeapWord* from,
HeapWord* to,
size_t count) {
memmove(to, from, count);
}
- void _Copy_arrayof_conjoint_jshorts(HeapWord* from,
+ void _Copy_arrayof_conjoint_jshorts(const HeapWord* from,
HeapWord* to,
size_t count) {
memmove(to, from, count * 2);
}
- void _Copy_arrayof_conjoint_jints(HeapWord* from,
+ void _Copy_arrayof_conjoint_jints(const HeapWord* from,
HeapWord* to,
size_t count) {
memmove(to, from, count * 4);
}
- void _Copy_arrayof_conjoint_jlongs(HeapWord* from,
+ void _Copy_arrayof_conjoint_jlongs(const HeapWord* from,
HeapWord* to,
size_t count) {
memmove(to, from, count * 8);
diff --git a/hotspot/src/os/linux/vm/os_linux.inline.hpp b/hotspot/src/os/linux/vm/os_linux.inline.hpp
index 937cd47..a6c9a87 100644
--- a/hotspot/src/os/linux/vm/os_linux.inline.hpp
+++ b/hotspot/src/os/linux/vm/os_linux.inline.hpp
@@ -99,18 +99,16 @@ inline int os::ftruncate(int fd, jlong length) {
inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf)
{
dirent* p;
- int status;
assert(dirp != NULL, "just checking");
// NOTE: Linux readdir_r (on RH 6.2 and 7.2 at least) is NOT like the POSIX
// version. Here is the doc for this function:
// http://www.gnu.org/manual/glibc-2.2.3/html_node/libc_262.html
- if((status = ::readdir_r(dirp, dbuf, &p)) != 0) {
- errno = status;
- return NULL;
- } else
+ if((p = ::readdir(dirp)) != NULL) {
return p;
+ } else
+ return NULL;
}
inline int os::closedir(DIR *dirp) {
|