8345273: Fix -Wzero-as-null-pointer-constant warnings in s390 code

Reviewed-by: jwaters, aph, amitkumar
This commit is contained in:
Kim Barrett 2024-12-11 04:47:44 +00:00
parent c40140eb9c
commit 1e9204fa43
6 changed files with 12 additions and 13 deletions

View File

@ -122,14 +122,14 @@ class RelAddr {
return is_in_range_of_RelAddr(target, pc, true);
}
static bool is_in_range_of_RelAddr16(ptrdiff_t distance) {
return is_in_range_of_RelAddr((address)distance, 0, true);
return is_in_range_of_RelAddr((address)distance, nullptr, true);
}
static bool is_in_range_of_RelAddr32(address target, address pc) {
return is_in_range_of_RelAddr(target, pc, false);
}
static bool is_in_range_of_RelAddr32(ptrdiff_t distance) {
return is_in_range_of_RelAddr((address)distance, 0, false);
return is_in_range_of_RelAddr((address)distance, nullptr, false);
}
static int pcrel_off(address target, address pc, bool shortForm) {
@ -149,14 +149,14 @@ class RelAddr {
return pcrel_off(target, pc, true);
}
static int pcrel_off16(ptrdiff_t distance) {
return pcrel_off((address)distance, 0, true);
return pcrel_off((address)distance, nullptr, true);
}
static int pcrel_off32(address target, address pc) {
return pcrel_off(target, pc, false);
}
static int pcrel_off32(ptrdiff_t distance) {
return pcrel_off((address)distance, 0, false);
return pcrel_off((address)distance, nullptr, false);
}
static ptrdiff_t inv_pcrel_off16(int offset) {

View File

@ -265,7 +265,7 @@ void frame::patch_pc(Thread* thread, address pc) {
p2i(&((address*) _sp)[-1]), p2i(((address*) _sp)[-1]), p2i(pc));
}
assert(!Continuation::is_return_barrier_entry(*pc_addr), "return barrier");
assert(_pc == *pc_addr || pc == *pc_addr || 0 == *pc_addr,
assert(_pc == *pc_addr || pc == *pc_addr || nullptr == *pc_addr,
"must be (pc: " INTPTR_FORMAT " _pc: " INTPTR_FORMAT " pc_addr: " INTPTR_FORMAT
" *pc_addr: " INTPTR_FORMAT " sp: " INTPTR_FORMAT ")",
p2i(pc), p2i(_pc), p2i(pc_addr), p2i(*pc_addr), p2i(sp()));
@ -296,10 +296,10 @@ void frame::patch_pc(Thread* thread, address pc) {
bool frame::is_interpreted_frame_valid(JavaThread* thread) const {
assert(is_interpreted_frame(), "Not an interpreted frame");
// These are reasonable sanity checks
if (fp() == 0 || (intptr_t(fp()) & (wordSize-1)) != 0) {
if (fp() == nullptr || (intptr_t(fp()) & (wordSize-1)) != 0) {
return false;
}
if (sp() == 0 || (intptr_t(sp()) & (wordSize-1)) != 0) {
if (sp() == nullptr || (intptr_t(sp()) & (wordSize-1)) != 0) {
return false;
}
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
? (address) top_pc
: (address) *((intptr_t*)(((address) current_sp) + _z_abi(return_pc)));
if ((intptr_t*) current_fp != 0 && (intptr_t*) current_fp <= current_sp) {
if ((intptr_t*) current_fp != nullptr && (intptr_t*) current_fp <= current_sp) {
st->print_cr("ERROR: corrupt stack");
return;
}
@ -503,7 +503,7 @@ void frame::back_trace(outputStream* st, intptr_t* start_sp, intptr_t* top_pc, u
case 0: // C frame:
{
st->print(" ");
if (current_pc == 0) {
if (current_pc == nullptr) {
st->print("? ");
} else {
// name

View File

@ -4108,7 +4108,7 @@ void MacroAssembler::encode_klass_not_null(Register dst, Register src) {
Register current = (src != noreg) ? src : dst; // Klass is in dst if no src provided. (dst == src) also possible.
address base = CompressedKlassPointers::base();
int shift = CompressedKlassPointers::shift();
bool need_zero_extend = base != 0;
bool need_zero_extend = base != nullptr;
assert(UseCompressedClassPointers, "only for compressed klass ptrs");
BLOCK_COMMENT("cKlass encoder {");

View File

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

View File

@ -164,7 +164,6 @@ void Relocation::pd_set_call_destination(address x) {
address* Relocation::pd_address_in_code() {
ShouldNotReachHere();
return 0;
}
address Relocation::pd_get_address_from_code() {

View File

@ -688,7 +688,7 @@ class StubGenerator: public StubCodeGenerator {
// code (code_size == 0) confuses opjitconv
// StubCodeMark mark(this, "StubRoutines", "verify_oop_stub");
address start = 0;
address start = nullptr;
#if !defined(PRODUCT)
start = CAST_FROM_FN_PTR(address, verify_oop_helper);