-
Notifications
You must be signed in to change notification settings - Fork 5.8k
JDK-8301493: Replace NULL with nullptr in cpu/aarch64 #12321
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. |
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 simple fixes here
@@ -171,13 +171,13 @@ inline frame::frame(intptr_t* sp, intptr_t* fp) { | |||
// call a specilaized frame constructor instead of this one. | |||
// Then we could use the assert below. However this assert is of somewhat dubious | |||
// value. | |||
// 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
@@ -159,7 +159,7 @@ void G1BarrierSetAssembler::g1_write_barrier_pre(MacroAssembler* masm, | |||
|
|||
// Calling the runtime using the regular call_VM_leaf mechanism generates | |||
// code (generated by InterpreterMacroAssember::call_VM_leaf_base) | |||
// that checks that the *(rfp+frame::interpreter_frame_last_sp) == NULL. | |||
// that checks that the *(rfp+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
@@ -157,7 +157,7 @@ void ShenandoahBarrierSetAssembler::satb_write_barrier_pre(MacroAssembler* masm, | |||
|
|||
// Calling the runtime using the regular call_VM_leaf mechanism generates | |||
// code (generated by InterpreterMacroAssember::call_VM_leaf_base) | |||
// that checks that the *(rfp+frame::interpreter_frame_last_sp) == NULL. | |||
// that checks that the *(rfp+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
@@ -47,7 +47,7 @@ void InlineCacheBuffer::assemble_ic_buffer_code(address code_begin, void* cached | |||
// because | |||
// (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
@@ -140,7 +140,7 @@ void InterpreterMacroAssembler::check_and_handle_earlyret(Register java_thread) | |||
if (JvmtiExport::can_force_early_return()) { | |||
Label L; | |||
ldr(rscratch1, Address(rthread, JavaThread::jvmti_thread_state_offset())); | |||
cbz(rscratch1, L); // if (thread->jvmti_thread_state() == NULL) exit; | |||
cbz(rscratch1, 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.
nullptr
@@ -1155,7 +1155,7 @@ void MacroAssembler::lookup_interface_method(Register recv_klass, | |||
add(recv_klass, recv_klass, itentry_off); | |||
} | |||
|
|||
// 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.
nullptr
@@ -4788,15 +4788,15 @@ address MacroAssembler::arrays_equals(Register a1, Register a2, Register tmp3, | |||
br(EQ, SAME); | |||
|
|||
if (UseSimpleArrayEquals) { | |||
Label NEXT_WORD, SHORT, TAIL03, TAIL01, A_MIGHT_BE_NULL, A_IS_NOT_NULL; | |||
Label NEXT_WORD, SHORT, TAIL03, TAIL01, A_MIGHT_BE_nullptr, A_IS_NOT_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.
Fix this macro
// if (src == NULL) return -1; | ||
// if (src == null) return -1; | ||
__ cbz(src, L_failed); | ||
|
||
// if (src_pos < 0) return -1; | ||
__ tbnz(src_pos, 31, L_failed); // i.e. sign bit set | ||
|
||
// 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
// 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
@@ -3694,8 +3694,8 @@ void TemplateTable::instanceof() { | |||
__ bind(is_null); // same as 'done' | |||
} | |||
__ bind(done); | |||
// r0 = 0: obj == NULL or obj is not an instanceof the specified klass | |||
// r0 = 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
Webrevs
|
@jdksjolen this pull request can not be integrated into git checkout JDK-8301493
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 |
@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! |
Not yet. |
This looks OK so far. |
@@ -267,7 +267,7 @@ class SlowSignatureHandler | |||
|
|||
virtual void pass_object() { | |||
intptr_t* addr = single_slot_addr(); | |||
intptr_t value = *addr == 0 ? NULL : (intptr_t)addr; | |||
intptr_t value = *addr == 0 ? nullptr : (intptr_t)addr; |
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.
This doesn't compile - perhaps replace nullptr with zero? Unless casting it is more appropriate.
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.
There's similar code in other patches, I did casting in those.
I'm only touching the .cpp/.hpp files in these PRs. The NULL count of all .ad files is only 339, so if I do those it'll all be in one commit (probably). |
Hi @stooart-mon , would you be interested in approving this :)? Thanks! |
As I'm only an author, I can't sponsor this patch, but it looks OK to me. It is consistent with the NULL->nullptr changes you have been doing elsewhere. There might always be this problem, but there are some missing instances NULL that may have appeared since you started this - I've listed them below.
|
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.
Remaining NULL
in
gc/shared/BarrierSetAssembler::check_oop()
codeBuffer_aarch64.cpp/emit_shared_trampolines()
stubGenerator_aarch64.cpp/generate_final_stubs()
vm_version_aarch64.cpp/check_info_file()
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.
I only looked at the changes that you did make, not what you could have done and it LGTM.
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 - thanks!
Three minor suggested changes and three opportunities to remove casts (that I spotted).
@@ -29,7 +29,7 @@ | |||
void ICacheStubGenerator::generate_icache_flush( | |||
ICache::flush_icache_stub_t* flush_icache_stub) { | |||
// Give anyone who calls this a surprise | |||
*flush_icache_stub = (ICache::flush_icache_stub_t)NULL; | |||
*flush_icache_stub = (ICache::flush_icache_stub_t)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.
Hopefully don't need the cast any more.
@@ -267,7 +267,7 @@ class SlowSignatureHandler | |||
|
|||
virtual void pass_object() { | |||
intptr_t* addr = single_slot_addr(); | |||
intptr_t value = *addr == 0 ? NULL : (intptr_t)addr; | |||
intptr_t value = *addr == 0 ? (intptr_t)nullptr : (intptr_t)addr; |
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.
This looks like it should be using 0 (zero) not NULL/nullptr?
@@ -968,7 +968,7 @@ void MacroAssembler::emit_static_call_stub() { | |||
// exact layout of this stub. | |||
|
|||
isb(); | |||
mov_metadata(rmethod, (Metadata*)NULL); | |||
mov_metadata(rmethod, (Metadata*)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.
Shouldn't need cast any more.
@@ -1639,13 +1639,13 @@ void MacroAssembler::super_call_VM_leaf(address entry_point, Register arg_0, Reg | |||
|
|||
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.
Suggest reg is null
// accessing M[reg] w/o changing any registers | ||
// NOTE: this is plenty to provoke a segv | ||
ldr(zr, Address(reg)); | ||
} 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.
Suggest reg is null
@@ -1421,10 +1421,10 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, | |||
stack_slots / VMRegImpl::slots_per_word, | |||
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.
Shouldn't need cast any more
@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 341 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 |
Thanks @tschatzl, probably new code from when I merged that didn't get a conflict. I did a grep for NULL and checked that no more occurrences are in the code. Running tier1 testing. |
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.
Alright, tier1 looks good. Integrating. Thank you for the reviews, good people. /integrate |
Going to push as commit 948f3b3.
Your commit was automatically rebased without conflicts. |
@jdksjolen Pushed as commit 948f3b3. 💡 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/aarch64. 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.git pull/12321/head:pull/12321
$ git checkout pull/12321
Update a local copy of the PR:
$ git checkout pull/12321
$ git pull https://git.openjdk.org/jdk.git pull/12321/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 12321
View PR using the GUI difftool:
$ git pr show -t 12321
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/12321.diff
Webrev
Link to Webrev Comment