Skip to content

Commit 388fcf0

Browse files
author
Kim Barrett
committed
8336349: Fix more simple -Wzero-as-null-pointer-constant warnings in C2 code
Reviewed-by: kvn, shade
1 parent ab27aca commit 388fcf0

17 files changed

+42
-42
lines changed

src/hotspot/share/opto/buildOopMap.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -489,7 +489,7 @@ static void do_liveness(PhaseRegAlloc* regalloc, PhaseCFG* cfg, Block_List* work
489489
// GEN use'd bits
490490
for( uint l=1; l<n->req(); l++ ) {
491491
Node *def = n->in(l);
492-
assert(def != 0, "input edge required");
492+
assert(def != nullptr, "input edge required");
493493
int first = regalloc->get_reg_first(def);
494494
int second = regalloc->get_reg_second(def);
495495
//If peephole had removed the node,do not set live bit for it.

src/hotspot/share/opto/callnode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ Node* CallNode::Ideal(PhaseGVN* phase, bool can_reshape) {
985985
}
986986

987987
bool CallNode::is_call_to_arraycopystub() const {
988-
if (_name != nullptr && strstr(_name, "arraycopy") != 0) {
988+
if (_name != nullptr && strstr(_name, "arraycopy") != nullptr) {
989989
return true;
990990
}
991991
return false;

src/hotspot/share/opto/chaitin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void LRG::dump() const {
6969
tty->print(") ");
7070
}
7171
}
72-
else if( _def == 0 ) tty->print("Dead ");
72+
else if( _def == nullptr ) tty->print("Dead ");
7373
else tty->print("Def: N%d ",_def->_idx);
7474

7575
tty->print("Cost:%4.2g Area:%4.2g Score:%4.2g ",_cost,_area, score());
@@ -203,7 +203,7 @@ PhaseChaitin::PhaseChaitin(uint unique, PhaseCFG &cfg, Matcher &matcher, bool sc
203203
nullptr
204204
#endif
205205
)
206-
, _live(0)
206+
, _live(nullptr)
207207
, _lo_degree(0), _lo_stk_degree(0), _hi_degree(0), _simplified(0)
208208
, _oldphi(unique)
209209
#ifndef PRODUCT

src/hotspot/share/opto/compile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ void Compile::Init(bool aliasing) {
10661066
if (has_method() && _directive->VectorizeOption) {
10671067
set_do_vector_loop(true);
10681068
NOT_PRODUCT(if (do_vector_loop() && Verbose) {tty->print("Compile::Init: do vectorized loops (SIMD like) for method %s\n", method()->name()->as_quoted_ascii());})
1069-
} else if (has_method() && method()->name() != 0 &&
1069+
} else if (has_method() && method()->name() != nullptr &&
10701070
method()->intrinsic_id() == vmIntrinsics::_forEachRemaining) {
10711071
set_do_vector_loop(true);
10721072
}

src/hotspot/share/opto/domgraph.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -62,7 +62,7 @@ struct Tarjan {
6262
// constructed. This is the Lengauer & Tarjan O(E-alpha(E,V)) algorithm.
6363
void PhaseCFG::build_dominator_tree() {
6464
// Pre-grow the blocks array, prior to the ResourceMark kicking in
65-
_blocks.map(number_of_blocks(), 0);
65+
_blocks.map(number_of_blocks(), nullptr);
6666

6767
ResourceMark rm;
6868
// Setup mappings from my Graph to Tarjan's stuff and back
@@ -286,8 +286,8 @@ uint PhaseCFG::do_DFS(Tarjan *tarjan, uint rpo_counter) {
286286

287287
void Tarjan::COMPRESS()
288288
{
289-
assert( _ancestor != 0, "" );
290-
if( _ancestor->_ancestor != 0 ) {
289+
assert( _ancestor != nullptr, "" );
290+
if( _ancestor->_ancestor != nullptr ) {
291291
_ancestor->COMPRESS( );
292292
if( _ancestor->_label->_semi < _label->_semi )
293293
_label = _ancestor->_label;
@@ -575,8 +575,8 @@ int NTarjan::DFS( NTarjan *ntarjan, VectorSet &visited, PhaseIdealLoop *pil, uin
575575

576576
void NTarjan::COMPRESS()
577577
{
578-
assert( _ancestor != 0, "" );
579-
if( _ancestor->_ancestor != 0 ) {
578+
assert( _ancestor != nullptr, "" );
579+
if( _ancestor->_ancestor != nullptr ) {
580580
_ancestor->COMPRESS( );
581581
if( _ancestor->_label->_semi < _label->_semi )
582582
_label = _ancestor->_label;

src/hotspot/share/opto/idealKit.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@ IdealKit::IdealKit(GraphKit* gkit, bool delay_all_transforms, bool has_declarati
5050
assert(_initial_memory == nullptr || _initial_memory->Opcode() == Op_MergeMem, "memory must be pre-split");
5151
assert(!_gvn.is_IterGVN(), "IdealKit can't be used during Optimize phase");
5252
int init_size = 5;
53-
_pending_cvstates = new (C->node_arena()) GrowableArray<Node*>(C->node_arena(), init_size, 0, 0);
53+
_pending_cvstates = new (C->node_arena()) GrowableArray<Node*>(C->node_arena(), init_size, 0, nullptr);
5454
DEBUG_ONLY(_state = new (C->node_arena()) GrowableArray<int>(C->node_arena(), init_size, 0, 0));
5555
if (!has_declarations) {
5656
declarations_done();

src/hotspot/share/opto/ifg.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -622,7 +622,7 @@ bool PhaseChaitin::remove_node_if_not_used(Block* b, uint location, Node* n, uin
622622
b->remove_node(location);
623623
LRG& lrg = lrgs(lid);
624624
if (lrg._def == n) {
625-
lrg._def = 0;
625+
lrg._def = nullptr;
626626
}
627627
n->disconnect_inputs(C);
628628
_cfg.unmap_node_from_block(n);

src/hotspot/share/opto/live.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -44,8 +44,8 @@
4444
// live-out sets. This separate compilation is done in the outer loop below.
4545
PhaseLive::PhaseLive(const PhaseCFG &cfg, const LRG_List &names, Arena *arena, bool keep_deltas)
4646
: Phase(LIVE),
47-
_live(0),
48-
_livein(0),
47+
_live(nullptr),
48+
_livein(nullptr),
4949
_cfg(cfg),
5050
_names(names),
5151
_arena(arena),

src/hotspot/share/opto/loopnode.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6338,7 +6338,7 @@ void PhaseIdealLoop::build_loop_late_post_work(Node *n, bool pinned) {
63386338
}
63396339
} else { // No slot zero
63406340
if( n->is_CFG() ) { // CFG with no slot 0 is dead
6341-
_loop_or_ctrl.map(n->_idx,0); // No block setting, it's globally dead
6341+
_loop_or_ctrl.map(n->_idx,nullptr); // No block setting, it's globally dead
63426342
return;
63436343
}
63446344
assert(!n->is_CFG() || n->outcnt() == 0, "");
@@ -6356,7 +6356,7 @@ void PhaseIdealLoop::build_loop_late_post_work(Node *n, bool pinned) {
63566356
assert(_loop_or_ctrl[n->out(i1)->_idx] == nullptr, "all uses must also be dead");
63576357
}
63586358
#endif
6359-
_loop_or_ctrl.map(n->_idx, 0); // This node is useless
6359+
_loop_or_ctrl.map(n->_idx, nullptr); // This node is useless
63606360
_deadlist.push(n);
63616361
return;
63626362
}

src/hotspot/share/opto/matcher.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -1812,7 +1812,7 @@ MachNode *Matcher::ReduceInst( State *s, int rule, Node *&mem ) {
18121812
ReduceInst_Interior( s, rule, mem, mach, 1 );
18131813
} else {
18141814
// Instruction chain rules are data-dependent on their inputs
1815-
mach->add_req(0); // Set initial control to none
1815+
mach->add_req(nullptr); // Set initial control to none
18161816
ReduceInst_Chain_Rule( s, rule, mem, mach );
18171817
}
18181818

src/hotspot/share/opto/memnode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2862,7 +2862,7 @@ class ArrayPointer {
28622862
_pointer->_idx, _pointer->Name(),
28632863
_base->_idx, _base->Name(),
28642864
(long long)_constant_offset);
2865-
if (_int_offset != 0) {
2865+
if (_int_offset != nullptr) {
28662866
tty->print(" + I2L[%d %s] << %d",
28672867
_int_offset->_idx, _int_offset->Name(), _int_offset_shift);
28682868
}

src/hotspot/share/opto/node.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,7 @@ uint Node::size(PhaseRegAlloc *ra_) const { return 0; }
11011101
//------------------------------CFG Construction-------------------------------
11021102
// Nodes that end basic blocks, e.g. IfTrue/IfFalse, JumpProjNode, Root,
11031103
// Goto and Return.
1104-
const Node *Node::is_block_proj() const { return 0; }
1104+
const Node *Node::is_block_proj() const { return nullptr; }
11051105

11061106
// Minimum guaranteed type
11071107
const Type *Node::bottom_type() const { return Type::BOTTOM; }

src/hotspot/share/opto/output.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2900,7 +2900,7 @@ void Scheduling::verify_good_schedule( Block *b, const char *msg ) {
29002900
// Now make all USEs live
29012901
for( uint i=1; i<n->req(); i++ ) {
29022902
Node *def = n->in(i);
2903-
assert(def != 0, "input edge required");
2903+
assert(def != nullptr, "input edge required");
29042904
OptoReg::Name reg_lo = _regalloc->get_reg_first(def);
29052905
OptoReg::Name reg_hi = _regalloc->get_reg_second(def);
29062906
if( OptoReg::is_valid(reg_lo) ) {
@@ -2923,7 +2923,7 @@ void Scheduling::verify_good_schedule( Block *b, const char *msg ) {
29232923
// Conditionally add precedence edges. Avoid putting edges on Projs.
29242924
static void add_prec_edge_from_to( Node *from, Node *to ) {
29252925
if( from->is_Proj() ) { // Put precedence edge on Proj's input
2926-
assert( from->req() == 1 && (from->len() == 1 || from->in(1)==0), "no precedence edges on projections" );
2926+
assert( from->req() == 1 && (from->len() == 1 || from->in(1) == nullptr), "no precedence edges on projections" );
29272927
from = from->in(0);
29282928
}
29292929
if( from != to && // No cycles (for things like LD L0,[L0+4] )

src/hotspot/share/opto/phaseX.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -780,7 +780,7 @@ void PhaseGVN::dead_loop_check( Node *n ) {
780780
}
781781
}
782782
}
783-
if (!no_dead_loop) n->dump_bfs(100,0,"#");
783+
if (!no_dead_loop) n->dump_bfs(100,nullptr,"#");
784784
assert(no_dead_loop, "dead loop detected");
785785
}
786786
}
@@ -1135,7 +1135,7 @@ bool PhaseIterGVN::verify_node_value(Node* n) {
11351135
}
11361136
tty->cr();
11371137
tty->print_cr("Missed Value optimization:");
1138-
n->dump_bfs(1, 0, "");
1138+
n->dump_bfs(1, nullptr, "");
11391139
tty->print_cr("Current type:");
11401140
told->dump_on(tty);
11411141
tty->cr();

src/hotspot/share/opto/reg_split.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ static Node* clone_node(Node* def, Block *b, Compile* C) {
309309
assert(false, "RA Split failed: attempt to clone node with anti_dependence");
310310
C->record_method_not_compilable("RA Split failed: attempt to clone node with anti_dependence");
311311
}
312-
return 0;
312+
return nullptr;
313313
}
314314
return def->clone();
315315
}
@@ -341,7 +341,7 @@ Node *PhaseChaitin::split_Rematerialize(Node *def, Block *b, uint insidx, uint &
341341
Node *in_spill;
342342
if (in->ideal_reg() != Op_RegFlags) {
343343
in_spill = get_spillcopy_wide(MachSpillCopyNode::InputToRematerialization, in, def, i);
344-
if (!in_spill) { return 0; } // Bailed out
344+
if (!in_spill) { return nullptr; } // Bailed out
345345
insert_proj(b_def, idx_def, in_spill, maxlrg++);
346346
if (b_def == b) {
347347
insidx++;
@@ -357,7 +357,7 @@ Node *PhaseChaitin::split_Rematerialize(Node *def, Block *b, uint insidx, uint &
357357
" range and defining node %d: %s may not be rematerialized.",
358358
def->_idx, def->Name(), in->_idx, in->Name());
359359
C->record_method_not_compilable("attempted to spill a non-spillable item with RegFlags input");
360-
return 0; // Bailed out
360+
return nullptr; // Bailed out
361361
}
362362
}
363363
}
@@ -366,7 +366,7 @@ Node *PhaseChaitin::split_Rematerialize(Node *def, Block *b, uint insidx, uint &
366366
Node *spill = clone_node(def, b, C);
367367
if (spill == nullptr || C->check_node_count(NodeLimitFudgeFactor, out_of_nodes)) {
368368
// Check when generating nodes
369-
return 0;
369+
return nullptr;
370370
}
371371

372372
// See if any inputs are currently being spilled, and take the

src/hotspot/share/opto/regalloc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@ PhaseRegAlloc::PhaseRegAlloc( uint unique, PhaseCFG &cfg,
3838
Matcher &matcher,
3939
void (*pr_stats)() ):
4040
Phase(Register_Allocation),
41-
_node_regs(0),
41+
_node_regs(nullptr),
4242
_node_regs_max_index(0),
4343
_cfg(cfg),
4444
_framesize(0xdeadbeef),

src/hotspot/share/opto/type.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -554,9 +554,9 @@ void Type::Initialize_shared(Compile* current) {
554554
TypeInstPtr::BOTTOM = TypeInstPtr::make(TypePtr::BotPTR, current->env()->Object_klass());
555555
TypeInstPtr::MIRROR = TypeInstPtr::make(TypePtr::NotNull, current->env()->Class_klass());
556556
TypeInstPtr::MARK = TypeInstPtr::make(TypePtr::BotPTR, current->env()->Object_klass(),
557-
false, 0, oopDesc::mark_offset_in_bytes());
557+
false, nullptr, oopDesc::mark_offset_in_bytes());
558558
TypeInstPtr::KLASS = TypeInstPtr::make(TypePtr::BotPTR, current->env()->Object_klass(),
559-
false, 0, oopDesc::klass_offset_in_bytes());
559+
false, nullptr, oopDesc::klass_offset_in_bytes());
560560
TypeOopPtr::BOTTOM = TypeOopPtr::make(TypePtr::BotPTR, OffsetBot, TypeOopPtr::InstanceBot);
561561

562562
TypeMetadataPtr::BOTTOM = TypeMetadataPtr::make(TypePtr::BotPTR, nullptr, OffsetBot);
@@ -567,7 +567,7 @@ void Type::Initialize_shared(Compile* current) {
567567
TypeNarrowKlass::NULL_PTR = TypeNarrowKlass::make( TypePtr::NULL_PTR );
568568

569569
mreg2type[Op_Node] = Type::BOTTOM;
570-
mreg2type[Op_Set ] = 0;
570+
mreg2type[Op_Set ] = nullptr;
571571
mreg2type[Op_RegN] = TypeNarrowOop::BOTTOM;
572572
mreg2type[Op_RegI] = TypeInt::INT;
573573
mreg2type[Op_RegP] = TypePtr::BOTTOM;
@@ -3129,7 +3129,7 @@ const TypeRawPtr *TypeRawPtr::NOTNULL;
31293129
const TypeRawPtr *TypeRawPtr::make( enum PTR ptr ) {
31303130
assert( ptr != Constant, "what is the constant?" );
31313131
assert( ptr != Null, "Use TypePtr for null" );
3132-
return (TypeRawPtr*)(new TypeRawPtr(ptr,0))->hashcons();
3132+
return (TypeRawPtr*)(new TypeRawPtr(ptr,nullptr))->hashcons();
31333133
}
31343134

31353135
const TypeRawPtr *TypeRawPtr::make( address bits ) {
@@ -3141,7 +3141,7 @@ const TypeRawPtr *TypeRawPtr::make( address bits ) {
31413141
const TypeRawPtr* TypeRawPtr::cast_to_ptr_type(PTR ptr) const {
31423142
assert( ptr != Constant, "what is the constant?" );
31433143
assert( ptr != Null, "Use TypePtr for null" );
3144-
assert( _bits==0, "Why cast a constant address?");
3144+
assert( _bits == nullptr, "Why cast a constant address?");
31453145
if( ptr == _ptr ) return this;
31463146
return make(ptr);
31473147
}
@@ -3525,7 +3525,7 @@ TypeOopPtr::TypeOopPtr(TYPES t, PTR ptr, ciKlass* k, const TypeInterfaces* inter
35253525
}
35263526
#endif
35273527
if (Compile::current()->eliminate_boxing() && (t == InstPtr) &&
3528-
(offset > 0) && xk && (k != 0) && k->is_instance_klass()) {
3528+
(offset > 0) && xk && (k != nullptr) && k->is_instance_klass()) {
35293529
_is_ptr_to_boxed_value = k->as_instance_klass()->is_boxed_value_offset(offset);
35303530
}
35313531
#ifdef _LP64

0 commit comments

Comments
 (0)