-
Notifications
You must be signed in to change notification settings - Fork 5.8k
JDK-8301068: Replace NULL with nullptr in share/jvmci/ #12183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
👋 Welcome back jsjolen! A progress list of the required criteria for merging this PR into |
@jdksjolen The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Marked fixes.
@@ -377,19 +377,19 @@ Handle CodeInstaller::read_oop(HotSpotCompiledCodeStream* stream, u1 tag, JVMCI_ | |||
JVMCI_ERROR_(Handle(), "unexpected oop tag: %d", tag) | |||
} | |||
if (obj == nullptr) { | |||
JVMCI_THROW_MSG_(InternalError, "Constant was unexpectedly NULL", Handle()); | |||
JVMCI_THROW_MSG_(InternalError, "Constant was unexpectedly nullptr", Handle()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null
constantPoolHandle cp(THREAD, UNPACK_PAIR(ConstantPool, cp)); | ||
oop obj = cp->resolve_possibly_cached_constant_at(index, CHECK_NULL); | ||
constantTag tag = cp->tag_at(index); | ||
if (tag.is_dynamic_constant() || tag.is_dynamic_constant_in_error()) { | ||
if (obj == Universe::the_null_sentinel()) { | ||
return JVMCIENV->get_jobject(JVMCIENV->get_JavaConstant_NULL_POINTER()); | ||
return JVMCIENV->get_jobject(JVMCIENV->get_JavaConstant_nullptr_POINTER()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix
@@ -1292,14 +1292,14 @@ void resync_vframestream_to_compiled_frame(vframeStream& vfst, intptr_t* stack_p | |||
} | |||
|
|||
/* | |||
* Used by c2v_iterateFrames. Returns an array of any unallocated scope objects or NULL if none. | |||
* Used by c2v_iterateFrames. Returns an array of any unallocated scope objects or nullptr if none. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix
@@ -152,7 +152,7 @@ void CompilerToVM::Data::initialize(JVMCI_TRAPS) { | |||
vm_page_size = os::vm_page_size(); | |||
|
|||
#define SET_TRIGFUNC(name) \ | |||
if (StubRoutines::name() != NULL) { \ | |||
if (StubRoutines::name() != nullptr) { \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align
src/hotspot/share/jvmci/jvmciEnv.cpp
Outdated
@@ -1689,7 +1689,7 @@ nmethod* JVMCIEnv::get_nmethod(JVMCIObject obj) { | |||
return (JVMCIObjectArray) wrap(array); \ | |||
} else { \ | |||
JNIAccessMark jni(this); \ | |||
jobjectArray result = jni()->NewObjectArray(length, JNIJVMCI::className::clazz(), NULL); \ | |||
jobjectArray result = jni()->NewObjectArray(length, JNIJVMCI::className::clazz(), nullptr); \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align
@@ -129,10 +129,10 @@ class fileStream; | |||
"Maximum size of a compiled method.") \ | |||
range(0, max_jint) \ | |||
\ | |||
product(ccstr, JVMCILibPath, NULL, EXPERIMENTAL, \ | |||
product(ccstr, JVMCILibPath, nullptr, EXPERIMENTAL, \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align
@@ -30,24 +30,24 @@ | |||
class JVMCIVMStructs { | |||
public: | |||
/** | |||
* The last entry has a NULL fieldName. | |||
* The last entry has a nullptr fieldName. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null
*/ | ||
static VMStructEntry localHotSpotVMStructs[]; | ||
|
||
/** | ||
* The last entry has a NULL typeName. | ||
* The last entry has a nullptr typeName. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null
*/ | ||
static VMTypeEntry localHotSpotVMTypes[]; | ||
|
||
/** | ||
* Table of integer constants. | ||
* The last entry has a NULL typeName. | ||
* The last entry has a nullptr typeName. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null
*/ | ||
static VMIntConstantEntry localHotSpotVMIntConstants[]; | ||
|
||
/** | ||
* Table of long constants. | ||
* The last entry has a NULL typeName. | ||
* The last entry has a nullptr typeName. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null
8491475
to
df67747
Compare
Passes tier1. |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few missed nullptr
in messages.
resolved_methods = init_resolved_methods(methods, JVMCIENV); | ||
*resolved_methods_ref = resolved_methods; | ||
} | ||
assert(method != NULL, "method should not be NULL"); | ||
assert(method != nullptr, "method should not be nullptr"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nullptr
in message.
src/hotspot/share/jvmci/jvmciEnv.cpp
Outdated
@@ -1472,14 +1472,14 @@ JVMCIObject JVMCIEnv::wrap(jobject object) { | |||
} | |||
|
|||
jlong JVMCIEnv::make_oop_handle(const Handle& obj) { | |||
assert(!obj.is_null(), "should only create handle for non-NULL oops"); | |||
assert(!obj.is_null(), "should only create handle for non-nullptr oops"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nullptr
in message.
src/hotspot/share/jvmci/jvmciEnv.cpp
Outdated
if (result == NULL) { | ||
JVMCI_THROW_MSG_(InternalError, "Constant was unexpectedly NULL", Handle()); | ||
if (result == nullptr) { | ||
JVMCI_THROW_MSG_(InternalError, "Constant was unexpectedly nullptr", Handle()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nullptr
in message.
@@ -199,11 +199,11 @@ void HotSpotJVMCI::compute_offsets(TRAPS) { | |||
return resolve(object)->is_a(className::klass()); \ | |||
} \ | |||
void HotSpotJVMCI::className::check(oop obj, const char* field_name, int offset) { \ | |||
assert(obj != NULL, "NULL field access of %s.%s", #className, field_name); \ | |||
assert(obj != nullptr, "nullptr field access of %s.%s", #className, field_name); \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nullptr
in message
assert(className::klass() != nullptr && className::klass()->is_linked(), "Class not yet linked: " #className); \ | ||
assert(className::klass() != nullptr, "Class not yet loaded: " #className); \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align \
@@ -266,7 +266,7 @@ void HotSpotJVMCI::compute_offsets(TRAPS) { | |||
* oop HotSpotJVMCI::Architecture::wordKind(JVMCIEnv* env, oop obj) { ... } | |||
* void HotSpotJVMCI::Architecture::set_wordKind(JVMCIEnv* env, oop obj, oop x) { ... } | |||
* | |||
* InstanceKlass *HotSpotJVMCI::Architecture::_klass = NULL; | |||
* InstanceKlass *HotSpotJVMCI::Architecture::_klass = nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. This is exception case you listed: expression in comment.
@@ -621,11 +621,11 @@ JVMCI_CLASSES_DO(EMPTY2, EMPTY0, FIELD2, FIELD2, FIELD2, FIELD2, FIELD2, FIELD3, | |||
return jni()->IsInstanceOf(object.as_jobject(), className::clazz()) != 0; \ | |||
} \ | |||
void JNIJVMCI::className::check(JVMCIEnv* jvmciEnv, JVMCIObject obj, const char* field_name, jfieldID offset) { \ | |||
assert(obj.is_non_null(), "NULL field access of %s.%s", #className, field_name); \ | |||
assert(obj.is_non_null(), "nullptr field access of %s.%s", #className, field_name); \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nullptr
in message
@@ -391,8 +391,8 @@ class HotSpotJVMCI { | |||
static void check(JVMCIEnv* jvmciEnv, JVMCIObject obj, const char* field_name, jfieldID offset); \ | |||
static jclass _class; \ | |||
public: \ | |||
static jclass clazz() { assert(_class != NULL, #fullClassName " uninitialized"); return _class; } \ | |||
static jclass fullClassName ##_class() { assert(_class != NULL, "uninit"); return _class; } | |||
static jclass clazz() { assert(_class != nullptr, #fullClassName " uninitialized"); return _class; } \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we align \
in previous lines?
@@ -65,7 +65,7 @@ class JVMCIArray : public JVMCIObject { | |||
class JVMCIObjectArray : public JVMCIArray { | |||
public: | |||
JVMCIObjectArray() {} | |||
JVMCIObjectArray(void* v): JVMCIArray() { assert(v == NULL, "must be NULL"); } | |||
JVMCIObjectArray(void* v): JVMCIArray() { assert(v == nullptr, "must be nullptr"); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nullptr
in message
@@ -74,7 +74,7 @@ class JVMCIObjectArray : public JVMCIArray { | |||
class JVMCIPrimitiveArray : public JVMCIArray { | |||
public: | |||
JVMCIPrimitiveArray() {} | |||
JVMCIPrimitiveArray(void* v): JVMCIArray() { assert(v == NULL, "must be NULL"); } | |||
JVMCIPrimitiveArray(void* v): JVMCIArray() { assert(v == nullptr, "must be nullptr"); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nullptr
in message
Thanks @vnkozlov, I've fixed the issues you found! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good.
You need second review from JVMCI experts. @dougxc or @tkrodriguez please look. |
@jdksjolen This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 123 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
Thank you, integrating. /integrate |
Going to push as commit 90ec19e.
Your commit was automatically rebased without conflicts. |
@jdksjolen Pushed as commit 90ec19e. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Hi, this PR changes all occurrences of NULL to nullptr for the subdirectory share/jvmci/. Unfortunately the script that does the change isn't perfect, and so we
need to comb through these manually to make sure nothing has gone wrong. I also review these changes but things slip past my eyes sometimes.
Here are some typical things to look out for:
An example of this:
Note how
nullptr
participates in a code expression here, we really are talking about the specific valuenullptr
.Thanks!
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/12183/head:pull/12183
$ git checkout pull/12183
Update a local copy of the PR:
$ git checkout pull/12183
$ git pull https://git.openjdk.org/jdk pull/12183/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 12183
View PR using the GUI difftool:
$ git pr show -t 12183
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/12183.diff