Skip to content

Commit a5d8e12

Browse files
committedJan 25, 2023
8300244: Replace NULL with nullptr in share/interpreter/
Reviewed-by: coleenp, dholmes
1 parent 71107f4 commit a5d8e12

25 files changed

+556
-556
lines changed
 

‎src/hotspot/share/interpreter/abstractInterpreter.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2023, 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
@@ -83,12 +83,12 @@ void AbstractInterpreter::print() {
8383
//------------------------------------------------------------------------------------------------------------------------
8484
// Implementation of interpreter
8585

86-
StubQueue* AbstractInterpreter::_code = NULL;
86+
StubQueue* AbstractInterpreter::_code = nullptr;
8787
bool AbstractInterpreter::_notice_safepoints = false;
88-
address AbstractInterpreter::_rethrow_exception_entry = NULL;
88+
address AbstractInterpreter::_rethrow_exception_entry = nullptr;
8989

90-
address AbstractInterpreter::_native_entry_begin = NULL;
91-
address AbstractInterpreter::_native_entry_end = NULL;
90+
address AbstractInterpreter::_native_entry_begin = nullptr;
91+
address AbstractInterpreter::_native_entry_end = nullptr;
9292
address AbstractInterpreter::_slow_signature_handler;
9393
address AbstractInterpreter::_entry_table [AbstractInterpreter::number_of_method_entries];
9494
address AbstractInterpreter::_native_abi_to_tosca [AbstractInterpreter::number_of_result_handlers];
@@ -97,7 +97,7 @@ address AbstractInterpreter::_native_abi_to_tosca [AbstractInterpreter::nu
9797
// Generation of complete interpreter
9898

9999
AbstractInterpreterGenerator::AbstractInterpreterGenerator() {
100-
_masm = NULL;
100+
_masm = nullptr;
101101
}
102102

103103

@@ -231,7 +231,7 @@ bool AbstractInterpreter::is_not_reached(const methodHandle& method, int bci) {
231231
int method_index = invoke_bc.get_index_u2_cpcache(code);
232232
constantPoolHandle cp(Thread::current(), cpool);
233233
Method* resolved_method = ConstantPool::method_at_if_loaded(cp, method_index);
234-
return (resolved_method == NULL);
234+
return (resolved_method == nullptr);
235235
}
236236
default: ShouldNotReachHere();
237237
}

‎src/hotspot/share/interpreter/abstractInterpreter.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2023, 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
@@ -168,8 +168,8 @@ class AbstractInterpreter: AllStatic {
168168
// Runtime support
169169

170170
// length = invoke bytecode length (to advance to next bytecode)
171-
static address deopt_entry(TosState state, int length) { ShouldNotReachHere(); return NULL; }
172-
static address return_entry(TosState state, int length, Bytecodes::Code code) { ShouldNotReachHere(); return NULL; }
171+
static address deopt_entry(TosState state, int length) { ShouldNotReachHere(); return nullptr; }
172+
static address return_entry(TosState state, int length, Bytecodes::Code code) { ShouldNotReachHere(); return nullptr; }
173173

174174
static address rethrow_exception_entry() { return _rethrow_exception_entry; }
175175

‎src/hotspot/share/interpreter/bootstrapInfo.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2023, 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
@@ -188,9 +188,9 @@ void BootstrapInfo::resolve_args(TRAPS) {
188188
objArrayOop args_oop = oopFactory::new_objArray(vmClasses::Object_klass(), _argc, CHECK);
189189
objArrayHandle args(THREAD, args_oop);
190190
_pool->copy_bootstrap_arguments_at(_bss_index, 0, _argc, args, 0, true, Handle(), CHECK);
191-
oop arg_oop = ((_argc == 1) ? args->obj_at(0) : (oop)NULL);
191+
oop arg_oop = ((_argc == 1) ? args->obj_at(0) : (oop)nullptr);
192192
// try to discard the singleton array
193-
if (arg_oop != NULL && !arg_oop->is_array()) {
193+
if (arg_oop != nullptr && !arg_oop->is_array()) {
194194
// JVM treats arrays and nulls specially in this position,
195195
// but other things are just single arguments
196196
_arg_values = Handle(THREAD, arg_oop);
@@ -233,7 +233,7 @@ void BootstrapInfo::print_msg_on(outputStream* st, const char* msg) {
233233
os::snprintf_checked(what, sizeof(what), "indy#%d", decode_indy_index());
234234
else
235235
os::snprintf_checked(what, sizeof(what), "condy");
236-
bool have_msg = (msg != NULL && strlen(msg) > 0);
236+
bool have_msg = (msg != nullptr && strlen(msg) > 0);
237237
st->print_cr("%s%sBootstrap in %s %s@CP[%d] %s:%s%s BSMS[%d] BSM@CP[%d]%s argc=%d%s",
238238
(have_msg ? msg : ""), (have_msg ? " " : ""),
239239
caller()->name()->as_C_string(),
@@ -276,7 +276,7 @@ void BootstrapInfo::print_msg_on(outputStream* st, const char* msg) {
276276
int lines = 0;
277277
for (int i = 0; i < _argc; i++) {
278278
oop x = static_args->obj_at(i);
279-
if (x != NULL) {
279+
if (x != nullptr) {
280280
if (++lines > 6) {
281281
st->print_cr(" resolved arg[%d]: ...", i);
282282
break;

‎src/hotspot/share/interpreter/bootstrapInfo.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2023, 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
@@ -114,7 +114,7 @@ class BootstrapInfo : public StackObj {
114114
}
115115

116116
void print() { print_msg_on(tty); }
117-
void print_msg_on(outputStream* st, const char* msg = NULL);
117+
void print_msg_on(outputStream* st, const char* msg = nullptr);
118118
};
119119

120120
#endif // SHARE_INTERPRETER_BOOTSTRAPINFO_HPP

‎src/hotspot/share/interpreter/bytecode.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2023, 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
@@ -120,7 +120,7 @@ int Bytecode_tableswitch::dest_offset_at(int i) const {
120120

121121
void Bytecode_invoke::verify() const {
122122
assert(is_valid(), "check invoke");
123-
assert(cpcache() != NULL, "do not call this from verifier or rewriter");
123+
assert(cpcache() != nullptr, "do not call this from verifier or rewriter");
124124
}
125125

126126
int Bytecode_invoke::size_of_parameters() const {
@@ -208,7 +208,7 @@ BasicType Bytecode_loadconstant::result_type() const {
208208
}
209209

210210
oop Bytecode_loadconstant::resolve_constant(TRAPS) const {
211-
assert(_method != NULL, "must supply method to resolve constant");
211+
assert(_method != nullptr, "must supply method to resolve constant");
212212
int index = raw_index();
213213
ConstantPool* constants = _method->constants();
214214
if (has_cache_index()) {

‎src/hotspot/share/interpreter/bytecode.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2023, 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
@@ -56,10 +56,10 @@ class Bytecode: public StackObj {
5656

5757
public:
5858
Bytecode(Method* method, address bcp): _bcp(bcp), _code(Bytecodes::code_at(method, addr_at(0))) {
59-
assert(method != NULL, "this form requires a valid Method*");
59+
assert(method != nullptr, "this form requires a valid Method*");
6060
}
6161
// Defined in ciStreams.hpp
62-
inline Bytecode(const ciBytecodeStream* stream, address bcp = NULL);
62+
inline Bytecode(const ciBytecodeStream* stream, address bcp = nullptr);
6363

6464
// Attributes
6565
address bcp() const { return _bcp; }
@@ -323,7 +323,7 @@ class Bytecode_loadconstant: public Bytecode {
323323
Bytecode_loadconstant(const methodHandle& method, int bci): Bytecode(method(), method->bcp_from(bci)), _method(method()) { verify(); }
324324

325325
void verify() const {
326-
assert(_method != NULL, "must supply method");
326+
assert(_method != nullptr, "must supply method");
327327
Bytecodes::Code stdc = Bytecodes::java_code(code());
328328
assert(stdc == Bytecodes::_ldc ||
329329
stdc == Bytecodes::_ldc_w ||

‎src/hotspot/share/interpreter/bytecodeTracer.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2023, 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
@@ -201,8 +201,8 @@ void print_symbol(Symbol* sym, outputStream* st) {
201201
}
202202

203203
void print_oop(oop value, outputStream* st) {
204-
if (value == NULL) {
205-
st->print_cr(" NULL");
204+
if (value == nullptr) {
205+
st->print_cr(" null");
206206
} else if (java_lang_String::is_instance(value)) {
207207
char buf[40];
208208
int len = java_lang_String::utf8_length(value);
@@ -256,7 +256,7 @@ bool BytecodePrinter::check_cp_cache_index(int i, int& cp_index, outputStream* s
256256

257257
ConstantPoolCache* cache = constants->cache();
258258
// If rewriter hasn't run, the index is the cp_index
259-
if (cache == NULL) {
259+
if (cache == nullptr) {
260260
cp_index = i;
261261
return true;
262262
}
@@ -503,7 +503,7 @@ void BytecodePrinter::print_attributes(int bci, outputStream* st) {
503503
case Bytecodes::_newarray: {
504504
BasicType atype = (BasicType)get_index_u1();
505505
const char* str = type2name(atype);
506-
if (str == NULL || is_reference_type(atype)) {
506+
if (str == nullptr || is_reference_type(atype)) {
507507
assert(false, "Unidentified basic type");
508508
}
509509
st->print_cr(" %s", str);
@@ -649,9 +649,9 @@ void BytecodePrinter::print_attributes(int bci, outputStream* st) {
649649

650650
void BytecodePrinter::bytecode_epilog(int bci, outputStream* st) {
651651
MethodData* mdo = method()->method_data();
652-
if (mdo != NULL) {
652+
if (mdo != nullptr) {
653653
ProfileData* data = mdo->bci_to_data(bci);
654-
if (data != NULL) {
654+
if (data != nullptr) {
655655
st->print(" %d", mdo->dp_to_di(data->dp()));
656656
st->fill_to(6);
657657
data->print_data_on(st, mdo);

‎src/hotspot/share/interpreter/bytecodeUtils.cpp

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2019 SAP SE. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -193,7 +193,7 @@ class ExceptionMessageBuilder : public StackObj {
193193
int do_instruction(int bci);
194194

195195
bool print_NPE_cause0(outputStream *os, int bci, int slot, int max_detail,
196-
bool inner_expr = false, const char *prefix = NULL);
196+
bool inner_expr = false, const char *prefix = nullptr);
197197

198198
public:
199199

@@ -469,7 +469,7 @@ ExceptionMessageBuilder::ExceptionMessageBuilder(Method* method, int bci) :
469469
_stacks = new GrowableArray<SimulatedOperandStack*> (len + 1);
470470

471471
for (int i = 0; i <= len; ++i) {
472-
_stacks->push(NULL);
472+
_stacks->push(nullptr);
473473
}
474474

475475
// Initialize stack a bci 0.
@@ -481,7 +481,7 @@ ExceptionMessageBuilder::ExceptionMessageBuilder(Method* method, int bci) :
481481
for (int i = 0; i < const_method->exception_table_length(); ++i) {
482482
u2 index = et[i].handler_pc;
483483

484-
if (_stacks->at(index) == NULL) {
484+
if (_stacks->at(index) == nullptr) {
485485
_stacks->at_put(index, new SimulatedOperandStack());
486486
_stacks->at(index)->push(index, T_OBJECT);
487487
}
@@ -499,7 +499,7 @@ ExceptionMessageBuilder::ExceptionMessageBuilder(Method* method, int bci) :
499499
i += do_instruction(i);
500500

501501
// If we want the data only for a certain bci, we can possibly end early.
502-
if ((bci == i) && (_stacks->at(i) != NULL)) {
502+
if ((bci == i) && (_stacks->at(i) != nullptr)) {
503503
_all_processed = true;
504504
break;
505505
}
@@ -512,7 +512,7 @@ ExceptionMessageBuilder::ExceptionMessageBuilder(Method* method, int bci) :
512512
}
513513

514514
ExceptionMessageBuilder::~ExceptionMessageBuilder() {
515-
if (_stacks != NULL) {
515+
if (_stacks != nullptr) {
516516
for (int i = 0; i < _stacks->length(); ++i) {
517517
delete _stacks->at(i);
518518
}
@@ -522,7 +522,7 @@ ExceptionMessageBuilder::~ExceptionMessageBuilder() {
522522
void ExceptionMessageBuilder::merge(int bci, SimulatedOperandStack* stack) {
523523
assert(stack != _stacks->at(bci), "Cannot merge itself");
524524

525-
if (_stacks->at(bci) != NULL) {
525+
if (_stacks->at(bci) != nullptr) {
526526
stack->merge(*_stacks->at(bci));
527527
} else {
528528
// Got a new stack, so count the entries.
@@ -542,7 +542,7 @@ int ExceptionMessageBuilder::do_instruction(int bci) {
542542
int len = Bytecodes::java_length_at(_method, code_base + bci);
543543

544544
// If we have no stack for this bci, we cannot process the bytecode now.
545-
if (_stacks->at(bci) == NULL) {
545+
if (_stacks->at(bci) == nullptr) {
546546
_all_processed = false;
547547
return len;
548548
}
@@ -1066,23 +1066,23 @@ int ExceptionMessageBuilder::do_instruction(int bci) {
10661066
// Put new stack to the next instruction, if we might reach it from
10671067
// this bci.
10681068
if (!flow_ended) {
1069-
if (_stacks->at(bci + len) == NULL) {
1069+
if (_stacks->at(bci + len) == nullptr) {
10701070
_added_one = true;
10711071
}
10721072
merge(bci + len, stack);
10731073
}
10741074

10751075
// Put the stack to the branch target too.
10761076
if (dest_bci != -1) {
1077-
if (_stacks->at(dest_bci) == NULL) {
1077+
if (_stacks->at(dest_bci) == nullptr) {
10781078
_added_one = true;
10791079
}
10801080
merge(dest_bci, stack);
10811081
}
10821082

10831083
// If we have more than one branch target, process these too.
10841084
for (int64_t i = 0; i < dests.length(); ++i) {
1085-
if (_stacks->at(dests.at(i)) == NULL) {
1085+
if (_stacks->at(dests.at(i)) == nullptr) {
10861086
_added_one = true;
10871087
}
10881088
merge(dests.at(i), stack);
@@ -1200,7 +1200,7 @@ bool ExceptionMessageBuilder::print_NPE_cause0(outputStream* os, int bci, int sl
12001200
return false;
12011201
}
12021202

1203-
if (_stacks->at(bci) == NULL) {
1203+
if (_stacks->at(bci) == nullptr) {
12041204
return false;
12051205
}
12061206

@@ -1228,7 +1228,7 @@ bool ExceptionMessageBuilder::print_NPE_cause0(outputStream* os, int bci, int sl
12281228
}
12291229

12301230
if (max_detail == _max_cause_detail &&
1231-
prefix != NULL &&
1231+
prefix != nullptr &&
12321232
code != Bytecodes::_invokevirtual &&
12331233
code != Bytecodes::_invokespecial &&
12341234
code != Bytecodes::_invokestatic &&

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on Jan 25, 2023

@openjdk-notifier[bot]
Please sign in to comment.