Skip to content

Commit

Permalink
8301074: Replace NULL with nullptr in share/opto/
Browse files Browse the repository at this point in the history
Reviewed-by: mdoerr
Backport-of: 5726d31e56530bbe7dee61ae04b126e20cb3611d
  • Loading branch information
GoeLin committed Jun 30, 2023
1 parent 1472676 commit 99c7ade
Show file tree
Hide file tree
Showing 110 changed files with 5,225 additions and 5,224 deletions.
108 changes: 54 additions & 54 deletions src/hotspot/share/opto/addnode.cpp

Large diffs are not rendered by default.

84 changes: 42 additions & 42 deletions src/hotspot/share/opto/arraycopynode.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2023, 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
Expand Down Expand Up @@ -34,7 +34,7 @@
#include "utilities/powerOfTwo.hpp"

ArrayCopyNode::ArrayCopyNode(Compile* C, bool alloc_tightly_coupled, bool has_negative_length_guard)
: CallNode(arraycopy_type(), NULL, TypePtr::BOTTOM),
: CallNode(arraycopy_type(), nullptr, TypePtr::BOTTOM),
_kind(None),
_alloc_tightly_coupled(alloc_tightly_coupled),
_has_negative_length_guard(has_negative_length_guard),
Expand Down Expand Up @@ -131,7 +131,7 @@ int ArrayCopyNode::get_count(PhaseGVN *phase) const {
return nb_fields;
} else {
const TypeAryPtr* ary_src = src_type->isa_aryptr();
assert (ary_src != NULL, "not an array or instance?");
assert (ary_src != nullptr, "not an array or instance?");
// clone passes a length as a rounded number of longs. If we're
// cloning an array we'll do it element by element. If the
// length input to ArrayCopyNode is constant, length of input
Expand Down Expand Up @@ -174,7 +174,7 @@ void ArrayCopyNode::store(BarrierSetC2* bs, PhaseGVN *phase, Node*& ctl, MergeMe

Node* ArrayCopyNode::try_clone_instance(PhaseGVN *phase, bool can_reshape, int count) {
if (!is_clonebasic()) {
return NULL;
return nullptr;
}

Node* base_src = in(ArrayCopyNode::Src);
Expand All @@ -184,8 +184,8 @@ Node* ArrayCopyNode::try_clone_instance(PhaseGVN *phase, bool can_reshape, int c

const Type* src_type = phase->type(base_src);
const TypeInstPtr* inst_src = src_type->isa_instptr();
if (inst_src == NULL) {
return NULL;
if (inst_src == nullptr) {
return nullptr;
}

MergeMemNode* mem = phase->transform(MergeMemNode::make(in_mem))->as_MergeMem();
Expand Down Expand Up @@ -318,7 +318,7 @@ bool ArrayCopyNode::prepare_array_copy(PhaseGVN *phase, bool can_reshape,

copy_type = dest_elem;
} else {
assert(ary_src != NULL, "should be a clone");
assert(ary_src != nullptr, "should be a clone");
assert(is_clonebasic(), "should be");

disjoint_bases = true;
Expand Down Expand Up @@ -366,7 +366,7 @@ void ArrayCopyNode::array_copy_test_overlap(PhaseGVN *phase, bool can_reshape, b
if (!disjoint_bases && count > 1) {
Node* src_offset = in(ArrayCopyNode::SrcPos);
Node* dest_offset = in(ArrayCopyNode::DestPos);
assert(src_offset != NULL && dest_offset != NULL, "should be");
assert(src_offset != nullptr && dest_offset != nullptr, "should be");
Node* cmp = phase->transform(new CmpINode(src_offset, dest_offset));
Node *bol = phase->transform(new BoolNode(cmp, BoolTest::lt));
IfNode *iff = new IfNode(ctl, bol, PROB_FAIR, COUNT_UNKNOWN);
Expand Down Expand Up @@ -483,13 +483,13 @@ bool ArrayCopyNode::finish_transform(PhaseGVN *phase, bool can_reshape,
CallProjections callprojs;
extract_projections(&callprojs, true, false);

if (callprojs.fallthrough_ioproj != NULL) {
if (callprojs.fallthrough_ioproj != nullptr) {
igvn->replace_node(callprojs.fallthrough_ioproj, in(TypeFunc::I_O));
}
if (callprojs.fallthrough_memproj != NULL) {
if (callprojs.fallthrough_memproj != nullptr) {
igvn->replace_node(callprojs.fallthrough_memproj, mem);
}
if (callprojs.fallthrough_catchproj != NULL) {
if (callprojs.fallthrough_catchproj != nullptr) {
igvn->replace_node(callprojs.fallthrough_catchproj, ctl);
}

Expand Down Expand Up @@ -519,7 +519,7 @@ Node *ArrayCopyNode::Ideal(PhaseGVN *phase, bool can_reshape) {

if (StressArrayCopyMacroNode && !can_reshape) {
phase->record_for_igvn(this);
return NULL;
return nullptr;
}

// See if it's a small array copy and we can inline it as
Expand All @@ -531,51 +531,51 @@ Node *ArrayCopyNode::Ideal(PhaseGVN *phase, bool can_reshape) {

if (!is_clonebasic() && !is_arraycopy_validated() &&
!is_copyofrange_validated() && !is_copyof_validated()) {
return NULL;
return nullptr;
}

assert(in(TypeFunc::Control) != NULL &&
in(TypeFunc::Memory) != NULL &&
in(ArrayCopyNode::Src) != NULL &&
in(ArrayCopyNode::Dest) != NULL &&
in(ArrayCopyNode::Length) != NULL &&
in(ArrayCopyNode::SrcPos) != NULL &&
in(ArrayCopyNode::DestPos) != NULL, "broken inputs");
assert(in(TypeFunc::Control) != nullptr &&
in(TypeFunc::Memory) != nullptr &&
in(ArrayCopyNode::Src) != nullptr &&
in(ArrayCopyNode::Dest) != nullptr &&
in(ArrayCopyNode::Length) != nullptr &&
in(ArrayCopyNode::SrcPos) != nullptr &&
in(ArrayCopyNode::DestPos) != nullptr, "broken inputs");

if (in(TypeFunc::Control)->is_top() ||
in(TypeFunc::Memory)->is_top() ||
phase->type(in(ArrayCopyNode::Src)) == Type::TOP ||
phase->type(in(ArrayCopyNode::Dest)) == Type::TOP ||
(in(ArrayCopyNode::SrcPos) != NULL && in(ArrayCopyNode::SrcPos)->is_top()) ||
(in(ArrayCopyNode::DestPos) != NULL && in(ArrayCopyNode::DestPos)->is_top())) {
return NULL;
(in(ArrayCopyNode::SrcPos) != nullptr && in(ArrayCopyNode::SrcPos)->is_top()) ||
(in(ArrayCopyNode::DestPos) != nullptr && in(ArrayCopyNode::DestPos)->is_top())) {
return nullptr;
}

int count = get_count(phase);

if (count < 0 || count > ArrayCopyLoadStoreMaxElem) {
return NULL;
return nullptr;
}

Node* mem = try_clone_instance(phase, can_reshape, count);
if (mem != NULL) {
return (mem == NodeSentinel) ? NULL : mem;
if (mem != nullptr) {
return (mem == NodeSentinel) ? nullptr : mem;
}

Node* adr_src = NULL;
Node* base_src = NULL;
Node* adr_dest = NULL;
Node* base_dest = NULL;
Node* adr_src = nullptr;
Node* base_src = nullptr;
Node* adr_dest = nullptr;
Node* base_dest = nullptr;
BasicType copy_type = T_ILLEGAL;
const Type* value_type = NULL;
const Type* value_type = nullptr;
bool disjoint_bases = false;

if (!prepare_array_copy(phase, can_reshape,
adr_src, base_src, adr_dest, base_dest,
copy_type, value_type, disjoint_bases)) {
assert(adr_src == NULL, "no node can be left behind");
assert(adr_dest == NULL, "no node can be left behind");
return NULL;
assert(adr_src == nullptr, "no node can be left behind");
assert(adr_dest == nullptr, "no node can be left behind");
return nullptr;
}

Node* src = in(ArrayCopyNode::Src);
Expand Down Expand Up @@ -605,7 +605,7 @@ Node *ArrayCopyNode::Ideal(PhaseGVN *phase, bool can_reshape) {
adr_src, base_src, adr_dest, base_dest,
copy_type, value_type, count);

Node* ctl = NULL;
Node* ctl = nullptr;
if (!forward_ctl->is_top() && !backward_ctl->is_top()) {
ctl = new RegionNode(3);
ctl->init_req(1, forward_ctl);
Expand Down Expand Up @@ -642,7 +642,7 @@ Node *ArrayCopyNode::Ideal(PhaseGVN *phase, bool can_reshape) {
// put in worklist, so that if it happens to be dead it is removed
phase->is_IterGVN()->_worklist.push(mem);
}
return NULL;
return nullptr;
}

return mem;
Expand All @@ -667,7 +667,7 @@ bool ArrayCopyNode::may_modify(const TypeOopPtr *t_oop, PhaseTransform *phase) {
}

bool ArrayCopyNode::may_modify_helper(const TypeOopPtr *t_oop, Node* n, PhaseTransform *phase, CallNode*& call) {
if (n != NULL &&
if (n != nullptr &&
n->is_Call() &&
n->as_Call()->may_modify(t_oop, phase) &&
(n->as_Call()->is_ArrayCopy() || n->as_Call()->is_call_to_arraycopystub())) {
Expand All @@ -685,11 +685,11 @@ bool ArrayCopyNode::may_modify(const TypeOopPtr *t_oop, MemBarNode* mb, PhaseTra
// step over g1 gc barrier if we're at e.g. a clone with ReduceInitialCardMarks off
c = bs->step_over_gc_barrier(c);

CallNode* call = NULL;
guarantee(c != NULL, "step_over_gc_barrier failed, there must be something to step to.");
CallNode* call = nullptr;
guarantee(c != nullptr, "step_over_gc_barrier failed, there must be something to step to.");
if (c->is_Region()) {
for (uint i = 1; i < c->req(); i++) {
if (c->in(i) != NULL) {
if (c->in(i) != nullptr) {
Node* n = c->in(i)->in(0);
if (may_modify_helper(t_oop, n, phase, call)) {
ac = call->isa_ArrayCopy();
Expand All @@ -703,7 +703,7 @@ bool ArrayCopyNode::may_modify(const TypeOopPtr *t_oop, MemBarNode* mb, PhaseTra
#ifdef ASSERT
bool use_ReduceInitialCardMarks = BarrierSet::barrier_set()->is_a(BarrierSet::CardTableBarrierSet) &&
static_cast<CardTableBarrierSetC2*>(bs)->use_ReduceInitialCardMarks();
assert(c == mb->in(0) || (ac != NULL && ac->is_clonebasic() && !use_ReduceInitialCardMarks), "only for clone");
assert(c == mb->in(0) || (ac != nullptr && ac->is_clonebasic() && !use_ReduceInitialCardMarks), "only for clone");
#endif
return true;
} else if (mb->trailing_partial_array_copy()) {
Expand All @@ -730,7 +730,7 @@ bool ArrayCopyNode::modifies(intptr_t offset_lo, intptr_t offset_hi, PhaseTransf
const TypeInt *len_t = phase->type(len)->isa_int();
const TypeAryPtr* ary_t = phase->type(dest)->isa_aryptr();

if (dest_pos_t == NULL || len_t == NULL || ary_t == NULL) {
if (dest_pos_t == nullptr || len_t == nullptr || ary_t == nullptr) {
return !must_modify;
}

Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/share/opto/arraycopynode.hpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2023, 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
Expand Down Expand Up @@ -142,8 +142,8 @@ class ArrayCopyNode : public CallNode {
Node* length,
bool alloc_tightly_coupled,
bool has_negative_length_guard,
Node* src_klass = NULL, Node* dest_klass = NULL,
Node* src_length = NULL, Node* dest_length = NULL);
Node* src_klass = nullptr, Node* dest_klass = nullptr,
Node* src_length = nullptr, Node* dest_length = nullptr);

void connect_outputs(GraphKit* kit, bool deoptimize_on_exception = false);

Expand Down

1 comment on commit 99c7ade

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.