From 431d4f7e18369466eedd00926a5162a1461d0b25 Mon Sep 17 00:00:00 2001 From: Kim Barrett Date: Mon, 5 Aug 2024 19:53:49 +0000 Subject: [PATCH] 8337785: Fix simple -Wzero-as-null-pointer-constant warnings in x86 code Reviewed-by: jwaters, ayang, shade --- src/hotspot/cpu/x86/frame_x86.cpp | 6 +++--- src/hotspot/cpu/x86/macroAssembler_x86_sha.cpp | 6 +++--- src/hotspot/cpu/x86/methodHandles_x86.cpp | 4 ++-- src/hotspot/cpu/x86/vm_version_x86.cpp | 8 ++++---- src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/hotspot/cpu/x86/frame_x86.cpp b/src/hotspot/cpu/x86/frame_x86.cpp index 2366d31992d..aeb77763e7f 100644 --- a/src/hotspot/cpu/x86/frame_x86.cpp +++ b/src/hotspot/cpu/x86/frame_x86.cpp @@ -279,7 +279,7 @@ void frame::patch_pc(Thread* thread, address pc) { assert(!Continuation::is_return_barrier_entry(*pc_addr), "return barrier"); - assert(_pc == *pc_addr || pc == *pc_addr || *pc_addr == 0, ""); + assert(_pc == *pc_addr || pc == *pc_addr || *pc_addr == nullptr, ""); DEBUG_ONLY(address old_pc = _pc;) *pc_addr = pc; _pc = pc; // must be set before call to get_deopt_original_pc @@ -483,10 +483,10 @@ frame frame::sender_for_interpreter_frame(RegisterMap* map) const { 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; } if (fp() + interpreter_frame_initial_sp_offset < sp()) { diff --git a/src/hotspot/cpu/x86/macroAssembler_x86_sha.cpp b/src/hotspot/cpu/x86/macroAssembler_x86_sha.cpp index c4e9e836fd3..090de71425f 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86_sha.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86_sha.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2016, 2021, Intel Corporation. All rights reserved. +* Copyright (c) 2016, 2024, Intel Corporation. All rights reserved. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -689,7 +689,7 @@ void MacroAssembler::sha256_AVX2(XMMRegister msg, XMMRegister state0, XMMRegiste address K256_W = StubRoutines::x86::k256_W_addr(); address pshuffle_byte_flip_mask = StubRoutines::x86::pshuffle_byte_flip_mask_addr(); - address pshuffle_byte_flip_mask_addr = 0; + address pshuffle_byte_flip_mask_addr = nullptr; const XMMRegister& SHUF_00BA = xmm10; // ymm10: shuffle xBxA -> 00BA const XMMRegister& SHUF_DC00 = xmm12; // ymm12: shuffle xDxC -> DC00 @@ -1247,7 +1247,7 @@ void MacroAssembler::sha512_AVX2(XMMRegister msg, XMMRegister state0, XMMRegiste address K512_W = StubRoutines::x86::k512_W_addr(); address pshuffle_byte_flip_mask_sha512 = StubRoutines::x86::pshuffle_byte_flip_mask_addr_sha512(); - address pshuffle_byte_flip_mask_addr = 0; + address pshuffle_byte_flip_mask_addr = nullptr; const XMMRegister& XFER = xmm0; // YTMP0 const XMMRegister& BYTE_FLIP_MASK = xmm9; // ymm9 diff --git a/src/hotspot/cpu/x86/methodHandles_x86.cpp b/src/hotspot/cpu/x86/methodHandles_x86.cpp index de897d71fac..3a8c1048766 100644 --- a/src/hotspot/cpu/x86/methodHandles_x86.cpp +++ b/src/hotspot/cpu/x86/methodHandles_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -572,7 +572,7 @@ void trace_method_handle_stub(const char* adaptername, frame cur_frame = os::current_frame(); - if (cur_frame.fp() != 0) { // not walkable + if (cur_frame.fp() != nullptr) { // not walkable // Robust search of trace_calling_frame (independent of inlining). // Assumes saved_regs comes from a pusha in the trace_calling_frame. diff --git a/src/hotspot/cpu/x86/vm_version_x86.cpp b/src/hotspot/cpu/x86/vm_version_x86.cpp index 02e147743cb..6216cf44b88 100644 --- a/src/hotspot/cpu/x86/vm_version_x86.cpp +++ b/src/hotspot/cpu/x86/vm_version_x86.cpp @@ -53,13 +53,13 @@ const char* VM_Version::_features_names[] = { CPU_FEATURE_FLAGS(DECLARE_CPU_FEAT #undef DECLARE_CPU_FEATURE_FLAG // Address of instruction which causes SEGV -address VM_Version::_cpuinfo_segv_addr = 0; +address VM_Version::_cpuinfo_segv_addr = nullptr; // Address of instruction after the one which causes SEGV -address VM_Version::_cpuinfo_cont_addr = 0; +address VM_Version::_cpuinfo_cont_addr = nullptr; // Address of instruction which causes APX specific SEGV -address VM_Version::_cpuinfo_segv_addr_apx = 0; +address VM_Version::_cpuinfo_segv_addr_apx = nullptr; // Address of instruction after the one which causes APX specific SEGV -address VM_Version::_cpuinfo_cont_addr_apx = 0; +address VM_Version::_cpuinfo_cont_addr_apx = nullptr; static BufferBlob* stub_blob; static const int stub_size = 2000; diff --git a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp index 78988dd4fd0..0d5d07fc8a8 100644 --- a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp +++ b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp @@ -224,7 +224,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, if (info != nullptr && uc != nullptr && thread != nullptr) { pc = (address) os::Posix::ucontext_get_pc(uc); - if (sig == SIGSEGV && info->si_addr == 0 && info->si_code == SI_KERNEL) { + if (sig == SIGSEGV && info->si_addr == nullptr && info->si_code == SI_KERNEL) { // An irrecoverable SI_KERNEL SIGSEGV has occurred. // It's likely caused by dereferencing an address larger than TASK_SIZE. return false;