Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8340620: Fix -Wzero-as-null-pointer-constant warnings for CompressedOops #21172

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/hotspot/cpu/ppc/ppc.ad
Original file line number Diff line number Diff line change
@@ -6598,7 +6598,7 @@ instruct encodeP_not_null_Ex(iRegNdst dst, iRegPsrc src) %{
instruct encodeP_not_null_base_null(iRegNdst dst, iRegPsrc src) %{
match(Set dst (EncodeP src));
predicate(CompressedOops::shift() != 0 &&
CompressedOops::base() ==0);
CompressedOops::base() == nullptr);

format %{ "SRDI $dst, $src, #3 \t// encodeP, $src != nullptr" %}
size(4);
@@ -6695,7 +6695,7 @@ instruct decodeN_Ex(iRegPdst dst, iRegNsrc src, flagsReg crx) %{
predicate((n->bottom_type()->is_oopptr()->ptr() != TypePtr::NotNull &&
n->bottom_type()->is_oopptr()->ptr() != TypePtr::Constant) &&
CompressedOops::shift() != 0 &&
CompressedOops::base() != 0);
CompressedOops::base() != nullptr);
ins_cost(4 * DEFAULT_COST); // Should be more expensive than decodeN_Disjoint_isel_Ex.
effect(TEMP crx);

@@ -6707,7 +6707,7 @@ instruct decodeN_Ex(iRegPdst dst, iRegNsrc src, flagsReg crx) %{
instruct decodeN_nullBase(iRegPdst dst, iRegNsrc src) %{
match(Set dst (DecodeN src));
predicate(CompressedOops::shift() != 0 &&
CompressedOops::base() == 0);
CompressedOops::base() == nullptr);

format %{ "SLDI $dst, $src, #3 \t// DecodeN (zerobased)" %}
size(4);
@@ -6825,7 +6825,7 @@ instruct decodeN_notNull_addBase_Ex(iRegPdst dst, iRegNsrc src) %{
predicate((n->bottom_type()->is_oopptr()->ptr() == TypePtr::NotNull ||
n->bottom_type()->is_oopptr()->ptr() == TypePtr::Constant) &&
CompressedOops::shift() != 0 &&
CompressedOops::base() != 0);
CompressedOops::base() != nullptr);
ins_cost(2 * DEFAULT_COST);

format %{ "DecodeN $dst, $src \t// $src != nullptr, postalloc expanded" %}
4 changes: 2 additions & 2 deletions src/hotspot/cpu/s390/s390.ad
Original file line number Diff line number Diff line change
@@ -4628,7 +4628,7 @@ instruct encodeP(iRegN dst, iRegP src, flagsReg cr) %{
match(Set dst (EncodeP src));
effect(KILL cr);
predicate((n->bottom_type()->make_ptr()->ptr() != TypePtr::NotNull) &&
(CompressedOops::base() == 0 ||
(CompressedOops::base() == nullptr ||
CompressedOops::base_disjoint() ||
!ExpandLoadingBaseEncode));
ins_cost(MEMORY_REF_COST+3 * DEFAULT_COST);
@@ -4651,7 +4651,7 @@ instruct encodeP_NN(iRegN dst, iRegP src, flagsReg cr) %{
match(Set dst (EncodeP src));
effect(KILL cr);
predicate((n->bottom_type()->make_ptr()->ptr() == TypePtr::NotNull) &&
(CompressedOops::base() == 0 ||
(CompressedOops::base() == nullptr ||
CompressedOops::base_disjoint() ||
!ExpandLoadingBaseEncode_NN));
ins_cost(MEMORY_REF_COST+3 * DEFAULT_COST);
6 changes: 3 additions & 3 deletions src/hotspot/share/oops/compressedOops.cpp
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ void CompressedOops::initialize(const ReservedHeapSpace& heap_space) {
}
if ((uint64_t)heap_space.end() <= OopEncodingHeapMax) {
// Did reserve heap below 32Gb. Can use base == 0;
set_base(0);
set_base(nullptr);
} else {
set_base((address)heap_space.compressed_oop_base());
}
@@ -115,7 +115,7 @@ CompressedOops::Mode CompressedOops::mode() {
return DisjointBaseNarrowOop;
}

if (base() != 0) {
if (base() != nullptr) {
return HeapBasedNarrowOop;
}

@@ -166,7 +166,7 @@ void CompressedOops::print_mode(outputStream* st) {

st->print(", Compressed Oops mode: %s", mode_to_string(mode()));

if (base() != 0) {
if (base() != nullptr) {
st->print(": " PTR_FORMAT, p2i(base()));
}