Skip to content

Commit 1e9204f

Browse files
author
Kim Barrett
committed
8345273: Fix -Wzero-as-null-pointer-constant warnings in s390 code
Reviewed-by: jwaters, aph, amitkumar
1 parent c40140e commit 1e9204f

6 files changed

+12
-13
lines changed

src/hotspot/cpu/s390/assembler_s390.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,14 @@ class RelAddr {
122122
return is_in_range_of_RelAddr(target, pc, true);
123123
}
124124
static bool is_in_range_of_RelAddr16(ptrdiff_t distance) {
125-
return is_in_range_of_RelAddr((address)distance, 0, true);
125+
return is_in_range_of_RelAddr((address)distance, nullptr, true);
126126
}
127127

128128
static bool is_in_range_of_RelAddr32(address target, address pc) {
129129
return is_in_range_of_RelAddr(target, pc, false);
130130
}
131131
static bool is_in_range_of_RelAddr32(ptrdiff_t distance) {
132-
return is_in_range_of_RelAddr((address)distance, 0, false);
132+
return is_in_range_of_RelAddr((address)distance, nullptr, false);
133133
}
134134

135135
static int pcrel_off(address target, address pc, bool shortForm) {
@@ -149,14 +149,14 @@ class RelAddr {
149149
return pcrel_off(target, pc, true);
150150
}
151151
static int pcrel_off16(ptrdiff_t distance) {
152-
return pcrel_off((address)distance, 0, true);
152+
return pcrel_off((address)distance, nullptr, true);
153153
}
154154

155155
static int pcrel_off32(address target, address pc) {
156156
return pcrel_off(target, pc, false);
157157
}
158158
static int pcrel_off32(ptrdiff_t distance) {
159-
return pcrel_off((address)distance, 0, false);
159+
return pcrel_off((address)distance, nullptr, false);
160160
}
161161

162162
static ptrdiff_t inv_pcrel_off16(int offset) {

src/hotspot/cpu/s390/frame_s390.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ void frame::patch_pc(Thread* thread, address pc) {
265265
p2i(&((address*) _sp)[-1]), p2i(((address*) _sp)[-1]), p2i(pc));
266266
}
267267
assert(!Continuation::is_return_barrier_entry(*pc_addr), "return barrier");
268-
assert(_pc == *pc_addr || pc == *pc_addr || 0 == *pc_addr,
268+
assert(_pc == *pc_addr || pc == *pc_addr || nullptr == *pc_addr,
269269
"must be (pc: " INTPTR_FORMAT " _pc: " INTPTR_FORMAT " pc_addr: " INTPTR_FORMAT
270270
" *pc_addr: " INTPTR_FORMAT " sp: " INTPTR_FORMAT ")",
271271
p2i(pc), p2i(_pc), p2i(pc_addr), p2i(*pc_addr), p2i(sp()));
@@ -296,10 +296,10 @@ void frame::patch_pc(Thread* thread, address pc) {
296296
bool frame::is_interpreted_frame_valid(JavaThread* thread) const {
297297
assert(is_interpreted_frame(), "Not an interpreted frame");
298298
// These are reasonable sanity checks
299-
if (fp() == 0 || (intptr_t(fp()) & (wordSize-1)) != 0) {
299+
if (fp() == nullptr || (intptr_t(fp()) & (wordSize-1)) != 0) {
300300
return false;
301301
}
302-
if (sp() == 0 || (intptr_t(sp()) & (wordSize-1)) != 0) {
302+
if (sp() == nullptr || (intptr_t(sp()) & (wordSize-1)) != 0) {
303303
return false;
304304
}
305305
int min_frame_slots = (z_common_abi_size + z_ijava_state_size) / sizeof(intptr_t);
@@ -420,7 +420,7 @@ void frame::back_trace(outputStream* st, intptr_t* start_sp, intptr_t* top_pc, u
420420
? (address) top_pc
421421
: (address) *((intptr_t*)(((address) current_sp) + _z_abi(return_pc)));
422422

423-
if ((intptr_t*) current_fp != 0 && (intptr_t*) current_fp <= current_sp) {
423+
if ((intptr_t*) current_fp != nullptr && (intptr_t*) current_fp <= current_sp) {
424424
st->print_cr("ERROR: corrupt stack");
425425
return;
426426
}
@@ -503,7 +503,7 @@ void frame::back_trace(outputStream* st, intptr_t* start_sp, intptr_t* top_pc, u
503503
case 0: // C frame:
504504
{
505505
st->print(" ");
506-
if (current_pc == 0) {
506+
if (current_pc == nullptr) {
507507
st->print("? ");
508508
} else {
509509
// name

src/hotspot/cpu/s390/macroAssembler_s390.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4108,7 +4108,7 @@ void MacroAssembler::encode_klass_not_null(Register dst, Register src) {
41084108
Register current = (src != noreg) ? src : dst; // Klass is in dst if no src provided. (dst == src) also possible.
41094109
address base = CompressedKlassPointers::base();
41104110
int shift = CompressedKlassPointers::shift();
4111-
bool need_zero_extend = base != 0;
4111+
bool need_zero_extend = base != nullptr;
41124112
assert(UseCompressedClassPointers, "only for compressed klass ptrs");
41134113

41144114
BLOCK_COMMENT("cKlass encoder {");

src/hotspot/cpu/s390/nativeInst_s390.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void NativeInstruction::verify() {
5959
// - any address in first page (0x0000 .. 0x0fff)
6060
// - odd address (will cause a "specification exception")
6161
address addr = addr_at(0);
62-
if ((addr == 0) || (((unsigned long)addr & ~0x0fff) == 0) || ((intptr_t)addr & 1) != 0) {
62+
if ((addr == nullptr) || (((unsigned long)addr & ~0x0fff) == 0) || ((intptr_t)addr & 1) != 0) {
6363
tty->print_cr(INTPTR_FORMAT ": bad instruction address", p2i(addr));
6464
fatal("not an instruction address");
6565
}

src/hotspot/cpu/s390/relocInfo_s390.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ void Relocation::pd_set_call_destination(address x) {
164164

165165
address* Relocation::pd_address_in_code() {
166166
ShouldNotReachHere();
167-
return 0;
168167
}
169168

170169
address Relocation::pd_get_address_from_code() {

src/hotspot/cpu/s390/stubGenerator_s390.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ class StubGenerator: public StubCodeGenerator {
688688
// code (code_size == 0) confuses opjitconv
689689
// StubCodeMark mark(this, "StubRoutines", "verify_oop_stub");
690690

691-
address start = 0;
691+
address start = nullptr;
692692

693693
#if !defined(PRODUCT)
694694
start = CAST_FROM_FN_PTR(address, verify_oop_helper);

0 commit comments

Comments
 (0)