Skip to content

Commit 25e8929

Browse files
author
Kim Barrett
committedSep 27, 2024
8340620: Fix -Wzero-as-null-pointer-constant warnings for CompressedOops
Reviewed-by: shade, stefank, mli, amitkumar
1 parent 6587909 commit 25e8929

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed
 

‎src/hotspot/cpu/ppc/ppc.ad

+4-4
Original file line numberDiff line numberDiff line change
@@ -6598,7 +6598,7 @@ instruct encodeP_not_null_Ex(iRegNdst dst, iRegPsrc src) %{
65986598
instruct encodeP_not_null_base_null(iRegNdst dst, iRegPsrc src) %{
65996599
match(Set dst (EncodeP src));
66006600
predicate(CompressedOops::shift() != 0 &&
6601-
CompressedOops::base() ==0);
6601+
CompressedOops::base() == nullptr);
66026602

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

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

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

68316831
format %{ "DecodeN $dst, $src \t// $src != nullptr, postalloc expanded" %}

‎src/hotspot/cpu/s390/s390.ad

+2-2
Original file line numberDiff line numberDiff line change
@@ -4628,7 +4628,7 @@ instruct encodeP(iRegN dst, iRegP src, flagsReg cr) %{
46284628
match(Set dst (EncodeP src));
46294629
effect(KILL cr);
46304630
predicate((n->bottom_type()->make_ptr()->ptr() != TypePtr::NotNull) &&
4631-
(CompressedOops::base() == 0 ||
4631+
(CompressedOops::base() == nullptr ||
46324632
CompressedOops::base_disjoint() ||
46334633
!ExpandLoadingBaseEncode));
46344634
ins_cost(MEMORY_REF_COST+3 * DEFAULT_COST);
@@ -4651,7 +4651,7 @@ instruct encodeP_NN(iRegN dst, iRegP src, flagsReg cr) %{
46514651
match(Set dst (EncodeP src));
46524652
effect(KILL cr);
46534653
predicate((n->bottom_type()->make_ptr()->ptr() == TypePtr::NotNull) &&
4654-
(CompressedOops::base() == 0 ||
4654+
(CompressedOops::base() == nullptr ||
46554655
CompressedOops::base_disjoint() ||
46564656
!ExpandLoadingBaseEncode_NN));
46574657
ins_cost(MEMORY_REF_COST+3 * DEFAULT_COST);

‎src/hotspot/share/oops/compressedOops.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void CompressedOops::initialize(const ReservedHeapSpace& heap_space) {
6161
}
6262
if ((uint64_t)heap_space.end() <= OopEncodingHeapMax) {
6363
// Did reserve heap below 32Gb. Can use base == 0;
64-
set_base(0);
64+
set_base(nullptr);
6565
} else {
6666
set_base((address)heap_space.compressed_oop_base());
6767
}
@@ -115,7 +115,7 @@ CompressedOops::Mode CompressedOops::mode() {
115115
return DisjointBaseNarrowOop;
116116
}
117117

118-
if (base() != 0) {
118+
if (base() != nullptr) {
119119
return HeapBasedNarrowOop;
120120
}
121121

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

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

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

0 commit comments

Comments
 (0)
Please sign in to comment.