-
Notifications
You must be signed in to change notification settings - Fork 6.2k
JDK-8301498: Replace NULL with nullptr in cpu/x86 #12326
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 labels 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 lists. If you would like to change these labels, use the /label pull request command. |
jdksjolen
left a comment
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.
Some things to fix
| // value. | ||
| // UPDATE: this constructor is only used by trace_method_handle_stub() now. | ||
| // assert(_pc != NULL, "no pc?"); | ||
| // assert(_pc != null, "no pc?"); |
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
| // Calling the runtime using the regular call_VM_leaf mechanism generates | ||
| // code (generated by InterpreterMacroAssember::call_VM_leaf_base) | ||
| // that checks that the *(ebp+frame::interpreter_frame_last_sp) == NULL. | ||
| // that checks that the *(ebp+frame::interpreter_frame_last_sp) == null. |
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
| // Calling the runtime using the regular call_VM_leaf mechanism generates | ||
| // code (generated by InterpreterMacroAssember::call_VM_leaf_base) | ||
| // that checks that the *(ebp+frame::interpreter_frame_last_sp) == NULL. | ||
| // that checks that the *(ebp+frame::interpreter_frame_last_sp) == null. |
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
src/hotspot/cpu/x86/icBuffer_x86.cpp
Outdated
| // (1) the value is old (i.e., doesn't matter for scavenges) | ||
| // (2) these ICStubs are removed *before* a GC happens, so the roots disappear | ||
| // assert(cached_value == NULL || cached_oop->is_perm(), "must be perm oop"); | ||
| // assert(cached_value == null || cached_oop->is_perm(), "must be perm oop"); |
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
| jcc(Assembler::equal, L); | ||
| stop("InterpreterMacroAssembler::call_VM_base:" | ||
| " last_sp != NULL"); | ||
| " last_sp != null"); |
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
| __ jccb(Assembler::negative, L_failed_0); | ||
|
|
||
| // if (dst == NULL) return -1; | ||
| // if (dst == null) return -1; |
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
| // if (src->klass() == NULL) return -1; | ||
| // if (src->klass() == null) return -1; | ||
| Address src_klass_addr(src, oopDesc::klass_offset_in_bytes()); | ||
| Address dst_klass_addr(dst, oopDesc::klass_offset_in_bytes()); | ||
| const Register rcx_src_klass = rcx; // array klass | ||
| __ movptr(rcx_src_klass, Address(src, oopDesc::klass_offset_in_bytes())); | ||
|
|
||
| #ifdef ASSERT | ||
| // assert(src->klass() != NULL); | ||
| // assert(src->klass() != null); |
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
| // | ||
|
|
||
| // if (src == NULL) return -1; | ||
| // if (src == null) return -1; |
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
| __ jccb(Assembler::negative, L_failed_0); | ||
|
|
||
| // if (dst == NULL) return -1; | ||
| // if (dst == null) return -1; |
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
| __ load_klass(r10_src_klass, src, rklass_tmp); | ||
| #ifdef ASSERT | ||
| // assert(src->klass() != NULL); | ||
| // assert(src->klass() != null); |
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
|
Builds and sent out for testing. |
|
Passes tier1. |
| jcc(Assembler::equal, L); | ||
| stop("InterpreterMacroAssembler::call_VM_base:" | ||
| " last_sp != NULL"); | ||
| " last_sp != 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.
null
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.
These are textual code fragments so I think nullptr is more appropriate - as per changes made to cpu/arm code.
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.
| jcc(Assembler::equal, L); | ||
| stop("InterpreterMacroAssembler::call_VM_base:" | ||
| " last_sp != NULL"); | ||
| " last_sp != 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.
These are textual code fragments so I think nullptr is more appropriate - as per changes made to cpu/arm code.
| jcc(Assembler::equal, L); | ||
| stop("InterpreterMacroAssembler::call_VM_leaf_base:" | ||
| " last_sp != NULL"); | ||
| " last_sp != null"); |
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
| void MacroAssembler::null_check(Register reg, int offset) { | ||
| if (needs_explicit_null_check(offset)) { | ||
| // provoke OS NULL exception if reg = NULL by | ||
| // provoke OS null exception if reg = null by |
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.
suggestion "reg is null"
| } else { | ||
| // nothing to do, (later) access of M[reg + offset] | ||
| // will provoke OS NULL exception if reg = NULL | ||
| // will provoke OS null exception if reg = null |
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.
suggestion: "reg is null"
| // Support for null-checks | ||
| // | ||
| // Generates code that causes a NULL OS exception if the content of reg is NULL. | ||
| // Generates code that causes a null OS exception if the content of reg is null. |
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.
Note use of "reg is null" here :)
| in_ByteSize(-1), | ||
| in_ByteSize(-1), | ||
| (OopMapSet*)NULL); | ||
| (OopMapSet*)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.
Unnecessary cast?
| // rax = 0: obj == null or obj is not an instanceof the specified klass | ||
| // rax = 1: obj != null and obj is an instanceof the specified klass |
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
|
I added the fixes, thanks! Last commit passed tier1. |
dholmes-ora
left a comment
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.
LGTM! Thanks
|
@jdksjolen this pull request can not be integrated into git checkout JDK-8301498
git fetch https://git.openjdk.org/jdk master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
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.
In addition to few missed placed I noticed that you keep mov_metadata(rbx, (Metadata*)nullptr); casting.
Is Metadata* something special we need to cast it?
And more general question - do we need to keep some casting for nullptr?
We kept them in previous PRs which are already pushed #12029
Should we update our "spec" for nullptr to remove all casting or keep some? What is condition to keep?
| movptr(tmp, Address(rthread, JavaThread::jvmti_thread_state_offset())); | ||
| testptr(tmp, tmp); | ||
| jcc(Assembler::zero, L); // if (thread->jvmti_thread_state() == NULL) exit; | ||
| jcc(Assembler::zero, L); // if (thread->jvmti_thread_state() == null) exit; |
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.
Missed change to nullptr as you suggested.
| // // main copy of decision tree, rooted at row[1] | ||
| // if (row[0].rec == rec) { row[0].incr(); goto done; } | ||
| // if (row[0].rec != NULL) { | ||
| // if (row[0].rec != null) { |
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.
Missed change to nullptr as you suggested.
| // if (row[1].rec != NULL) { | ||
| // if (row[1].rec != null) { | ||
| // // degenerate decision tree, rooted at row[2] | ||
| // if (row[2].rec == rec) { row[2].incr(); goto done; } | ||
| // if (row[2].rec != NULL) { count.incr(); goto done; } // overflow | ||
| // if (row[2].rec != null) { count.incr(); goto done; } // overflow |
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.
Missed change to nullptr.
| } | ||
|
|
||
| // for (scan = klass->itable(); scan->interface() != NULL; scan += scan_step) { | ||
| // for (scan = klass->itable(); scan->interface() != null; scan += scan_step) { |
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.
Missed change to nullptr as you suggested.
|
@jdksjolen This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
|
Hi Vladimir! I applied your changes, thanks for the review. |
vnkozlov
left a comment
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.
Looks good.
dholmes-ora
left a comment
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.
Still good. Thanks.
|
@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 74 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 |
dholmes-ora
left a comment
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.
Still good. Thanks.
(incremental change looked weird but end result seems fine)
|
Thanks. All of tier1 and tier2 is passing. /integrate |
|
Going to push as commit 4154a98.
Your commit was automatically rebased without conflicts. |
|
@jdksjolen Pushed as commit 4154a98. 💡 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 cpu/x86. 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
nullptrparticipates in a code expression here, we really are talking about the specific valuenullptr.Thanks!
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/12326/head:pull/12326$ git checkout pull/12326Update a local copy of the PR:
$ git checkout pull/12326$ git pull https://git.openjdk.org/jdk.git pull/12326/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 12326View PR using the GUI difftool:
$ git pr show -t 12326Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/12326.diff