Skip to content

Commit b5f8c31

Browse files
Reka Kovacslewurm
authored and
Vladimir Kempik
committed
8254072: AArch64: Get rid of --disable-warnings-as-errors on Windows+ARM64 build
Co-authored-by: Bernhard Urban-Forster <burban@openjdk.org> Reviewed-by: burban, aph Backport-of: d2812f7
1 parent 0aa5f75 commit b5f8c31

11 files changed

+31
-28
lines changed

make/hotspot/lib/CompileGtest.gmk

+4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ endif
5555
# Disabling undef, switch, format-nonliteral and tautological-undefined-compare
5656
# warnings for clang because of test source.
5757

58+
# Disable MSVC warning C4146 "unary minus operator applied to unsigned type,
59+
# result still unsigned". This operation is well-defined.
60+
5861
# Solaris: Disable inlining (+d) to workaround Assertion: (../lnk/vardescr.h, line 109)
5962
$(eval $(call SetupNativeCompilation, BUILD_GTEST_LIBJVM, \
6063
NAME := jvm, \
@@ -78,6 +81,7 @@ $(eval $(call SetupNativeCompilation, BUILD_GTEST_LIBJVM, \
7881
DISABLED_WARNINGS_clang := undef switch format-nonliteral \
7982
tautological-undefined-compare $(BUILD_LIBJVM_DISABLED_WARNINGS_clang), \
8083
DISABLED_WARNINGS_solstudio := identexpected, \
84+
DISABLED_WARNINGS_microsoft := 4146, \
8185
LDFLAGS := $(JVM_LDFLAGS), \
8286
LDFLAGS_solaris := -library=stlport4 $(call SET_SHARED_LIBRARY_ORIGIN), \
8387
LIBS := $(JVM_LIBS), \

make/hotspot/lib/CompileJvm.gmk

+3
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ JVM_STRIPFLAGS ?= $(STRIPFLAGS)
148148
################################################################################
149149
# Now set up the actual compilation of the main hotspot native library
150150

151+
# Disable MSVC warning C4146 "unary minus operator applied to unsigned type,
152+
# result still unsigned". This operation is well-defined.
151153
$(eval $(call SetupNativeCompilation, BUILD_LIBJVM, \
152154
NAME := jvm, \
153155
TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
@@ -164,6 +166,7 @@ $(eval $(call SetupNativeCompilation, BUILD_LIBJVM, \
164166
DISABLED_WARNINGS_solstudio := $(DISABLED_WARNINGS_solstudio), \
165167
DISABLED_WARNINGS_xlc := 1540-0216 1540-0198 1540-1090 1540-1639 \
166168
1540-1088 1500-010, \
169+
DISABLED_WARNINGS_microsoft := 4146, \
167170
ASFLAGS := $(JVM_ASFLAGS), \
168171
LDFLAGS := $(JVM_LDFLAGS), \
169172
LIBS := $(JVM_LIBS), \

src/hotspot/cpu/aarch64/aarch64.ad

-5
Original file line numberDiff line numberDiff line change
@@ -2055,11 +2055,6 @@ int HandlerImpl::emit_deopt_handler(CodeBuffer& cbuf)
20552055

20562056
const bool Matcher::match_rule_supported(int opcode) {
20572057

2058-
switch (opcode) {
2059-
default:
2060-
break;
2061-
}
2062-
20632058
if (!has_match_rule(opcode)) {
20642059
return false;
20652060
}

src/hotspot/cpu/aarch64/assembler_aarch64.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ class Instruction_aarch64 {
214214

215215
static void patch(address a, int msb, int lsb, uint64_t val) {
216216
int nbits = msb - lsb + 1;
217-
guarantee(val < (1U << nbits), "Field too big for insn");
217+
guarantee(val < (1ULL << nbits), "Field too big for insn");
218218
assert_cond(msb >= lsb);
219219
unsigned mask = checked_cast<unsigned>(right_n_bits(nbits));
220220
val <<= lsb;
@@ -436,8 +436,8 @@ class Address {
436436
}
437437

438438
Register base() const {
439-
guarantee((_mode == base_plus_offset | _mode == base_plus_offset_reg
440-
| _mode == post | _mode == post_reg),
439+
guarantee((_mode == base_plus_offset || _mode == base_plus_offset_reg
440+
|| _mode == post || _mode == post_reg),
441441
"wrong mode");
442442
return _base;
443443
}

src/hotspot/cpu/aarch64/frame_aarch64.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -676,11 +676,12 @@ intptr_t* frame::real_fp() const {
676676

677677
#undef DESCRIBE_FP_OFFSET
678678

679-
#define DESCRIBE_FP_OFFSET(name) \
680-
{ \
681-
uintptr_t *p = (uintptr_t *)fp; \
682-
printf("0x%016lx 0x%016lx %s\n", (uintptr_t)(p + frame::name##_offset), \
683-
p[frame::name##_offset], #name); \
679+
#define DESCRIBE_FP_OFFSET(name) \
680+
{ \
681+
uintptr_t *p = (uintptr_t *)fp; \
682+
printf(INTPTR_FORMAT " " INTPTR_FORMAT " %s\n", \
683+
(uintptr_t)(p + frame::name##_offset), \
684+
p[frame::name##_offset], #name); \
684685
}
685686

686687
static THREAD_LOCAL_DECL uintptr_t nextfp;

src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1832,7 +1832,7 @@ bool MacroAssembler::try_merge_ldst(Register rt, const Address &adr, size_t size
18321832
return true;
18331833
} else {
18341834
assert(size_in_bytes == 8 || size_in_bytes == 4, "only 8 bytes or 4 bytes load/store is supported.");
1835-
const unsigned mask = size_in_bytes - 1;
1835+
const uint64_t mask = size_in_bytes - 1;
18361836
if (adr.getMode() == Address::base_plus_offset &&
18371837
(adr.offset() & mask) == 0) { // only supports base_plus_offset.
18381838
code()->set_last_insn(pc());
@@ -2774,7 +2774,7 @@ void MacroAssembler::merge_ldst(Register rt,
27742774
// Overwrite previous generated binary.
27752775
code_section()->set_end(prev);
27762776

2777-
const int sz = prev_ldst->size_in_bytes();
2777+
const size_t sz = prev_ldst->size_in_bytes();
27782778
assert(sz == 8 || sz == 4, "only supports 64/32bit merging.");
27792779
if (!is_store) {
27802780
BLOCK_COMMENT("merged ldr pair");

src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class MacroAssembler: public Assembler {
8989
= (operand_valid_for_logical_immediate(false /*is32*/,
9090
(uint64_t)Universe::narrow_klass_base())
9191
&& ((uint64_t)Universe::narrow_klass_base()
92-
> (1UL << log2_intptr((uintptr_t)Universe::narrow_klass_range()))));
92+
> (1ULL << log2_intptr(Universe::narrow_klass_range()))));
9393
}
9494

9595
// These routines should emit JVMTI PopFrame and ForceEarlyReturn handling code.

src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ class NativeLdSt : public NativeInstruction {
681681
return 0;
682682
}
683683
}
684-
size_t size_in_bytes() { return 1 << size(); }
684+
size_t size_in_bytes() { return 1ULL << size(); }
685685
bool is_not_pre_post_index() { return (is_ldst_ur() || is_ldst_unsigned_offset()); }
686686
bool is_load() {
687687
assert(Instruction_aarch64::extract(uint_at(0), 23, 22) == 0b01 ||

src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1498,7 +1498,7 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
14981498

14991499
// Generate stack overflow check
15001500
if (UseStackBanging) {
1501-
__ bang_stack_with_offset(JavaThread::stack_shadow_zone_size());
1501+
__ bang_stack_with_offset(checked_cast<int>(JavaThread::stack_shadow_zone_size()));
15021502
} else {
15031503
Unimplemented();
15041504
}
@@ -2446,7 +2446,7 @@ void SharedRuntime::generate_deopt_blob() {
24462446
__ sub(sp, sp, r19);
24472447

24482448
// Push interpreter frames in a loop
2449-
__ mov(rscratch1, (address)0xDEADDEAD); // Make a recognizable pattern
2449+
__ mov(rscratch1, (uint64_t)0xDEADDEAD); // Make a recognizable pattern
24502450
__ mov(rscratch2, rscratch1);
24512451
Label loop;
24522452
__ bind(loop);

src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -1299,14 +1299,14 @@ class StubGenerator: public StubCodeGenerator {
12991299

13001300
// Scan over array at a for count oops, verifying each one.
13011301
// Preserves a and count, clobbers rscratch1 and rscratch2.
1302-
void verify_oop_array (size_t size, Register a, Register count, Register temp) {
1302+
void verify_oop_array (int size, Register a, Register count, Register temp) {
13031303
Label loop, end;
13041304
__ mov(rscratch1, a);
13051305
__ mov(rscratch2, zr);
13061306
__ bind(loop);
13071307
__ cmp(rscratch2, count);
13081308
__ br(Assembler::HS, end);
1309-
if (size == (size_t)wordSize) {
1309+
if (size == wordSize) {
13101310
__ ldr(temp, Address(a, rscratch2, Address::lsl(exact_log2(size))));
13111311
__ verify_oop(temp);
13121312
} else {
@@ -1338,7 +1338,7 @@ class StubGenerator: public StubCodeGenerator {
13381338
// used by generate_conjoint_int_oop_copy().
13391339
//
13401340
address generate_disjoint_copy(size_t size, bool aligned, bool is_oop, address *entry,
1341-
const char *name, bool dest_uninitialized = false) {
1341+
const char *name, bool dest_uninitialized = false) {
13421342
Register s = c_rarg0, d = c_rarg1, count = c_rarg2;
13431343
RegSet saved_reg = RegSet::of(s, d, count);
13441344
__ align(CodeEntryAlignment);
@@ -1367,12 +1367,12 @@ class StubGenerator: public StubCodeGenerator {
13671367
// save regs before copy_memory
13681368
__ push(RegSet::of(d, count), sp);
13691369
}
1370-
copy_memory(aligned, s, d, count, rscratch1, size);
1370+
copy_memory(aligned, s, d, count, rscratch1, checked_cast<int>(size));
13711371

13721372
if (is_oop) {
13731373
__ pop(RegSet::of(d, count), sp);
13741374
if (VerifyOops)
1375-
verify_oop_array(size, d, count, r16);
1375+
verify_oop_array(checked_cast<int>(size), d, count, r16);
13761376
}
13771377

13781378
bs->arraycopy_epilogue(_masm, decorators, is_oop, d, count, rscratch1, RegSet());
@@ -1398,7 +1398,7 @@ class StubGenerator: public StubCodeGenerator {
13981398
// the hardware handle it. The two dwords within qwords that span
13991399
// cache line boundaries will still be loaded and stored atomically.
14001400
//
1401-
address generate_conjoint_copy(size_t size, bool aligned, bool is_oop, address nooverlap_target,
1401+
address generate_conjoint_copy(int size, bool aligned, bool is_oop, address nooverlap_target,
14021402
address *entry, const char *name,
14031403
bool dest_uninitialized = false) {
14041404
Register s = c_rarg0, d = c_rarg1, count = c_rarg2;
@@ -1644,7 +1644,7 @@ class StubGenerator: public StubCodeGenerator {
16441644
address generate_disjoint_oop_copy(bool aligned, address *entry,
16451645
const char *name, bool dest_uninitialized) {
16461646
const bool is_oop = true;
1647-
const size_t size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
1647+
const int size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
16481648
return generate_disjoint_copy(size, aligned, is_oop, entry, name, dest_uninitialized);
16491649
}
16501650

@@ -1662,7 +1662,7 @@ class StubGenerator: public StubCodeGenerator {
16621662
address nooverlap_target, address *entry,
16631663
const char *name, bool dest_uninitialized) {
16641664
const bool is_oop = true;
1665-
const size_t size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
1665+
const int size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
16661666
return generate_conjoint_copy(size, aligned, is_oop, nooverlap_target, entry,
16671667
name, dest_uninitialized);
16681668
}

src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,7 @@ void TemplateInterpreterGenerator::bang_stack_shadow_pages(bool native_call) {
11251125
// an interpreter frame with greater than a page of locals, so each page
11261126
// needs to be checked. Only true for non-native.
11271127
if (UseStackBanging) {
1128-
const int n_shadow_pages = JavaThread::stack_shadow_zone_size() / os::vm_page_size();
1128+
const int n_shadow_pages = checked_cast<int>(JavaThread::stack_shadow_zone_size() / os::vm_page_size());
11291129
const int start_page = native_call ? n_shadow_pages : 1;
11301130
const int page_size = os::vm_page_size();
11311131
for (int pages = start_page; pages <= n_shadow_pages ; pages++) {

0 commit comments

Comments
 (0)