Skip to content

Commit 90ec19e

Browse files
committed
8301068: Replace NULL with nullptr in share/jvmci/
Reviewed-by: kvn, never
1 parent 419409b commit 90ec19e

19 files changed

+403
-403
lines changed

src/hotspot/share/jvmci/jvmci.cpp

Lines changed: 10 additions & 10 deletions
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
@@ -60,7 +60,7 @@ bool JVMCI::can_initialize_JVMCI() {
6060
// The JVMCI API itself isn't available until phase 2 and ServiceLoader (which
6161
// JVMCI initialization requires) isn't usable until after phase 3. Testing
6262
// whether the system loader is initialized satisfies all these invariants.
63-
if (SystemDictionary::java_system_loader() == NULL) {
63+
if (SystemDictionary::java_system_loader() == nullptr) {
6464
return false;
6565
}
6666
assert(Universe::is_module_initialized(), "must be");
@@ -69,16 +69,16 @@ bool JVMCI::can_initialize_JVMCI() {
6969

7070
void* JVMCI::get_shared_library(char*& path, bool load) {
7171
void* sl_handle = _shared_library_handle;
72-
if (sl_handle != NULL || !load) {
72+
if (sl_handle != nullptr || !load) {
7373
path = _shared_library_path;
7474
return sl_handle;
7575
}
7676
MutexLocker locker(JVMCI_lock);
77-
path = NULL;
78-
if (_shared_library_handle == NULL) {
77+
path = nullptr;
78+
if (_shared_library_handle == nullptr) {
7979
char path[JVM_MAXPATHLEN];
8080
char ebuf[1024];
81-
if (JVMCILibPath != NULL) {
81+
if (JVMCILibPath != nullptr) {
8282
if (!os::dll_locate_lib(path, sizeof(path), JVMCILibPath, JVMCI_SHARED_LIBRARY_NAME)) {
8383
fatal("Unable to create path to JVMCI shared library based on value of JVMCILibPath (%s)", JVMCILibPath);
8484
}
@@ -89,7 +89,7 @@ void* JVMCI::get_shared_library(char*& path, bool load) {
8989
}
9090

9191
void* handle = os::dll_load(path, ebuf, sizeof ebuf);
92-
if (handle == NULL) {
92+
if (handle == nullptr) {
9393
fatal("Unable to load JVMCI shared library from %s: %s", path, ebuf);
9494
}
9595
_shared_library_handle = handle;
@@ -103,7 +103,7 @@ void* JVMCI::get_shared_library(char*& path, bool load) {
103103

104104
void JVMCI::initialize_compiler(TRAPS) {
105105
if (JVMCILibDumpJNIConfig) {
106-
JNIJVMCI::initialize_ids(NULL);
106+
JNIJVMCI::initialize_ids(nullptr);
107107
ShouldNotReachHere();
108108
}
109109
JVMCIRuntime* runtime;
@@ -175,9 +175,9 @@ JVMCIRuntime* JVMCI::compiler_runtime(JavaThread* thread, bool create) {
175175
JavaThread* JVMCI::compilation_tick(JavaThread* thread) {
176176
if (thread->is_Compiler_thread()) {
177177
CompileTask *task = CompilerThread::cast(thread)->task();
178-
if (task != NULL) {
178+
if (task != nullptr) {
179179
JVMCICompileState *state = task->blocking_jvmci_compile_state();
180-
if (state != NULL) {
180+
if (state != nullptr) {
181181
state->inc_compilation_ticks();
182182
}
183183
}

src/hotspot/share/jvmci/jvmci.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 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
@@ -58,7 +58,7 @@ class JVMCI : public AllStatic {
5858
// Special libjvmci based JVMCIRuntime reserved for
5959
// threads trying to attach when in JVMCI shutdown.
6060
// This preserves the invariant that JVMCIRuntime::for_thread()
61-
// never returns nullptr.
61+
// never returns null.
6262
static JVMCIRuntime* _shutdown_compiler_runtime;
6363

6464
// True when at least one JVMCIRuntime::initialize_HotSpotJVMCIRuntime()
@@ -98,7 +98,7 @@ class JVMCI : public AllStatic {
9898
max_EventLog_level = 4
9999
};
100100

101-
// Gets the Thread* value for the current thread or NULL if it's not available.
101+
// Gets the Thread* value for the current thread or null if it's not available.
102102
static Thread* current_thread_or_null();
103103

104104
public:
@@ -130,7 +130,7 @@ class JVMCI : public AllStatic {
130130
// Logs the fatal crash data in `buf` to the appropriate stream.
131131
static void fatal_log(const char* buf, size_t count);
132132

133-
// Gets the name of the opened JVMCI shared library crash data file or NULL
133+
// Gets the name of the opened JVMCI shared library crash data file or null
134134
// if this file has not been created.
135135
static const char* fatal_log_filename() { return _fatal_log_filename; }
136136

src/hotspot/share/jvmci/jvmciCodeInstaller.cpp

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 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
@@ -45,7 +45,7 @@
4545
// Allocate them with new so they are never destroyed (otherwise, a
4646
// forced exit could destroy these objects while they are still in
4747
// use).
48-
ConstantOopWriteValue* CodeInstaller::_oop_null_scope_value = new (mtJVMCI) ConstantOopWriteValue(NULL);
48+
ConstantOopWriteValue* CodeInstaller::_oop_null_scope_value = new (mtJVMCI) ConstantOopWriteValue(nullptr);
4949
ConstantIntValue* CodeInstaller::_int_m1_scope_value = new (mtJVMCI) ConstantIntValue(-1);
5050
ConstantIntValue* CodeInstaller::_int_0_scope_value = new (mtJVMCI) ConstantIntValue((jint)0);
5151
ConstantIntValue* CodeInstaller::_int_1_scope_value = new (mtJVMCI) ConstantIntValue(1);
@@ -252,7 +252,7 @@ OopMap* CodeInstaller::create_oop_map(HotSpotCompiledCodeStream* stream, u1 debu
252252
assert(is_set(debug_info_flags, DI_HAS_REFERENCE_MAP), "must be");
253253
u2 max_register_size = stream->read_u2("maxRegisterSize");
254254
if (!_has_wide_vector && SharedRuntime::is_wide_vector(max_register_size)) {
255-
if (SharedRuntime::polling_page_vectors_safepoint_handler_blob() == NULL) {
255+
if (SharedRuntime::polling_page_vectors_safepoint_handler_blob() == nullptr) {
256256
JVMCI_ERROR_NULL("JVMCI is producing code using vectors larger than the runtime supports%s", stream->context());
257257
}
258258
_has_wide_vector = true;
@@ -377,15 +377,15 @@ Handle CodeInstaller::read_oop(HotSpotCompiledCodeStream* stream, u1 tag, JVMCI_
377377
JVMCI_ERROR_(Handle(), "unexpected oop tag: %d", tag)
378378
}
379379
if (obj == nullptr) {
380-
JVMCI_THROW_MSG_(InternalError, "Constant was unexpectedly NULL", Handle());
380+
JVMCI_THROW_MSG_(InternalError, "Constant was unexpectedly null", Handle());
381381
} else {
382382
oopDesc::verify(obj);
383383
}
384384
return Handle(stream->thread(), obj);
385385
}
386386

387387
ScopeValue* CodeInstaller::get_scope_value(HotSpotCompiledCodeStream* stream, u1 tag, BasicType type, ScopeValue* &second, JVMCI_TRAPS) {
388-
second = NULL;
388+
second = nullptr;
389389
switch (tag) {
390390
case ILLEGAL: {
391391
if (type != T_ILLEGAL) {
@@ -484,7 +484,7 @@ void CodeInstaller::record_object_value(ObjectValue* sv, HotSpotCompiledCodeStre
484484

485485
u2 length = stream->read_u2("values:length");
486486
for (jint i = 0; i < length; i++) {
487-
ScopeValue* cur_second = NULL;
487+
ScopeValue* cur_second = nullptr;
488488
BasicType type = (BasicType) stream->read_u1("basicType");
489489
ScopeValue* value;
490490
u1 tag = stream->read_u1("tag");
@@ -506,22 +506,22 @@ void CodeInstaller::record_object_value(ObjectValue* sv, HotSpotCompiledCodeStre
506506
value = get_scope_value(stream, tag, type, cur_second, JVMCI_CHECK);
507507
}
508508

509-
if (isLongArray && cur_second == NULL) {
509+
if (isLongArray && cur_second == nullptr) {
510510
// we're trying to put ints into a long array... this isn't really valid, but it's used for some optimizations.
511511
// add an int 0 constant
512512
cur_second = _int_0_scope_value;
513513
}
514514

515-
if (isByteArray && cur_second != NULL && (type == T_DOUBLE || type == T_LONG)) {
515+
if (isByteArray && cur_second != nullptr && (type == T_DOUBLE || type == T_LONG)) {
516516
// we are trying to write a long in a byte Array. We will need to count the illegals to restore the type of
517517
// the thing we put inside.
518-
cur_second = NULL;
518+
cur_second = nullptr;
519519
}
520520

521-
if (cur_second != NULL) {
521+
if (cur_second != nullptr) {
522522
sv->field_values()->append(cur_second);
523523
}
524-
assert(value != NULL, "missing value");
524+
assert(value != nullptr, "missing value");
525525
sv->field_values()->append(value);
526526
}
527527
}
@@ -573,9 +573,9 @@ GrowableArray<MonitorValue*>* CodeInstaller::read_monitor_values(HotSpotCompiled
573573
GrowableArray<MonitorValue*>* monitors = new GrowableArray<MonitorValue*>(length);
574574
for (int i = 0; i < length; i++) {
575575
bool eliminated = stream->read_bool("isEliminated");
576-
ScopeValue* second = NULL;
576+
ScopeValue* second = nullptr;
577577
ScopeValue* owner_value = get_scope_value(stream, stream->read_u1("tag"), T_OBJECT, second, JVMCI_CHECK_NULL);
578-
assert(second == NULL, "monitor cannot occupy two stack slots");
578+
assert(second == nullptr, "monitor cannot occupy two stack slots");
579579

580580
ScopeValue* lock_data_value = get_scope_value(stream, stream->read_u1("tag"), T_LONG, second, JVMCI_CHECK_NULL);
581581
assert(second == lock_data_value, "monitor is LONG value that occupies two stack slots");
@@ -589,9 +589,9 @@ GrowableArray<MonitorValue*>* CodeInstaller::read_monitor_values(HotSpotCompiled
589589

590590
void CodeInstaller::initialize_dependencies(HotSpotCompiledCodeStream* stream, u1 code_flags, OopRecorder* oop_recorder, JVMCI_TRAPS) {
591591
JavaThread* thread = stream->thread();
592-
CompilerThread* compilerThread = thread->is_Compiler_thread() ? CompilerThread::cast(thread) : NULL;
592+
CompilerThread* compilerThread = thread->is_Compiler_thread() ? CompilerThread::cast(thread) : nullptr;
593593
_oop_recorder = oop_recorder;
594-
_dependencies = new Dependencies(&_arena, _oop_recorder, compilerThread != NULL ? compilerThread->log() : NULL);
594+
_dependencies = new Dependencies(&_arena, _oop_recorder, compilerThread != nullptr ? compilerThread->log() : nullptr);
595595
if (is_set(code_flags, HCC_HAS_ASSUMPTIONS)) {
596596
u2 length = stream->read_u2("assumptions:length");
597597
for (int i = 0; i < length; ++i) {
@@ -714,7 +714,7 @@ JVMCI::CodeInstallResult CodeInstaller::install(JVMCICompiler* compiler,
714714
false);
715715
result = JVMCI::ok;
716716
} else {
717-
if (compile_state != NULL) {
717+
if (compile_state != nullptr) {
718718
jvmci_env()->set_compile_state(compile_state);
719719
}
720720

@@ -728,7 +728,7 @@ JVMCI::CodeInstallResult CodeInstaller::install(JVMCICompiler* compiler,
728728
}
729729

730730
JVMCIObject mirror = installed_code;
731-
nmethod* nm = NULL; // nm is an out parameter of register_method
731+
nmethod* nm = nullptr; // nm is an out parameter of register_method
732732
result = runtime()->register_method(jvmci_env(),
733733
method,
734734
nm,
@@ -754,7 +754,7 @@ JVMCI::CodeInstallResult CodeInstaller::install(JVMCICompiler* compiler,
754754
speculations_len);
755755
if (result == JVMCI::ok) {
756756
cb = nm;
757-
if (compile_state == NULL) {
757+
if (compile_state == nullptr) {
758758
// This compile didn't come through the CompileBroker so perform the printing here
759759
DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, compiler);
760760
nm->maybe_print_nmethod(directive);
@@ -763,7 +763,7 @@ JVMCI::CodeInstallResult CodeInstaller::install(JVMCICompiler* compiler,
763763
}
764764
}
765765

766-
if (cb != NULL) {
766+
if (cb != nullptr) {
767767
// Make sure the pre-calculated constants section size was correct.
768768
guarantee((cb->code_begin() - cb->content_begin()) >= _constants_size, "%d < %d", (int)(cb->code_begin() - cb->content_begin()), _constants_size);
769769
}
@@ -861,7 +861,7 @@ JVMCI::CodeInstallResult CodeInstaller::initialize_buffer(JVMCIObject compiled_c
861861
}
862862

863863
buffer.initialize(total_size, locs_buffer_size);
864-
if (buffer.blob() == NULL) {
864+
if (buffer.blob() == nullptr) {
865865
return JVMCI::cache_full;
866866
}
867867
buffer.initialize_stubs_size(stubs_size);
@@ -1017,7 +1017,7 @@ void CodeInstaller::read_virtual_objects(HotSpotCompiledCodeStream* stream, JVMC
10171017
if (length == 0) {
10181018
return;
10191019
}
1020-
GrowableArray<ScopeValue*> *objects = new GrowableArray<ScopeValue*>(length, length, NULL);
1020+
GrowableArray<ScopeValue*> *objects = new GrowableArray<ScopeValue*>(length, length, nullptr);
10211021
stream->set_virtual_objects(objects);
10221022
// Create the unique ObjectValues
10231023
JavaThread* thread = stream->thread();
@@ -1076,9 +1076,9 @@ void CodeInstaller::record_scope(jint pc_offset, HotSpotCompiledCodeStream* stre
10761076
bool reexecute = false;
10771077
bool rethrow_exception = false;
10781078

1079-
DebugToken* locals_token = NULL;
1080-
DebugToken* stack_token = NULL;
1081-
DebugToken* monitors_token = NULL;
1079+
DebugToken* locals_token = nullptr;
1080+
DebugToken* stack_token = nullptr;
1081+
DebugToken* monitors_token = nullptr;
10821082

10831083
if (full_info) {
10841084
u1 frame_flags = stream->read_u1("flags");
@@ -1100,7 +1100,7 @@ void CodeInstaller::record_scope(jint pc_offset, HotSpotCompiledCodeStream* stre
11001100
// has_ea_local_in_scope and arg_escape should be added to JVMCI
11011101
const bool has_ea_local_in_scope = false;
11021102
const bool arg_escape = false;
1103-
_debug_recorder->describe_scope(pc_offset, method, NULL, bci, reexecute, rethrow_exception, is_mh_invoke, return_oop,
1103+
_debug_recorder->describe_scope(pc_offset, method, nullptr, bci, reexecute, rethrow_exception, is_mh_invoke, return_oop,
11041104
has_ea_local_in_scope, arg_escape,
11051105
locals_token, stack_token, monitors_token);
11061106
}

src/hotspot/share/jvmci/jvmciCompiler.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 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
@@ -33,22 +33,22 @@
3333
#include "runtime/arguments.hpp"
3434
#include "runtime/handles.inline.hpp"
3535

36-
JVMCICompiler* JVMCICompiler::_instance = NULL;
36+
JVMCICompiler* JVMCICompiler::_instance = nullptr;
3737

3838
JVMCICompiler::JVMCICompiler() : AbstractCompiler(compiler_jvmci) {
3939
_bootstrapping = false;
4040
_bootstrap_compilation_request_handled = false;
4141
_methods_compiled = 0;
4242
_global_compilation_ticks = 0;
43-
assert(_instance == NULL, "only one instance allowed");
43+
assert(_instance == nullptr, "only one instance allowed");
4444
_instance = this;
4545
}
4646

4747
JVMCICompiler* JVMCICompiler::instance(bool require_non_null, TRAPS) {
4848
if (!EnableJVMCI) {
4949
THROW_MSG_NULL(vmSymbols::java_lang_InternalError(), "JVMCI is not enabled")
5050
}
51-
if (_instance == NULL && require_non_null) {
51+
if (_instance == nullptr && require_non_null) {
5252
THROW_MSG_NULL(vmSymbols::java_lang_InternalError(), "The JVMCI compiler instance has not been created");
5353
}
5454
return _instance;
@@ -127,12 +127,12 @@ bool JVMCICompiler::force_comp_at_level_simple(const methodHandle& method) {
127127
return false;
128128
} else {
129129
JVMCIRuntime* runtime = JVMCI::java_runtime();
130-
if (runtime != NULL) {
130+
if (runtime != nullptr) {
131131
JVMCIObject receiver = runtime->probe_HotSpotJVMCIRuntime();
132132
if (receiver.is_null()) {
133133
return false;
134134
}
135-
JVMCIEnv* ignored_env = NULL;
135+
JVMCIEnv* ignored_env = nullptr;
136136
objArrayHandle excludeModules(JavaThread::current(), HotSpotJVMCI::HotSpotJVMCIRuntime::excludeFromJVMCICompilation(ignored_env, HotSpotJVMCI::resolve(receiver)));
137137
if (excludeModules.not_null()) {
138138
ModuleEntry* moduleEntry = method->method_holder()->module();

0 commit comments

Comments
 (0)