Skip to content

JDK-8301497: Replace NULL with nullptr in cpu/s390 #12325

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

Closed
wants to merge 3 commits into from

Conversation

jdksjolen
Copy link
Contributor

@jdksjolen jdksjolen commented Jan 31, 2023

Hi, this PR changes all occurrences of NULL to nullptr for the subdirectory cpu/s390. 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:

  1. No changes but copyright header changed (probably because I reverted some changes but forgot the copyright).
  2. Macros having their NULL changed to nullptr, these are added to the script when I find them. They should be NULL.
  3. nullptr in comments and logs. We try to use lower case "null" in these cases as it reads better. An exception is made when code expressions are in a comment.

An example of this:

// This function returns null
void* ret_null();
// This function returns true if *x == nullptr
bool is_nullptr(void** x);

Note how nullptr participates in a code expression here, we really are talking about the specific value nullptr.

Thanks!


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/12325/head:pull/12325
$ git checkout pull/12325

Update a local copy of the PR:
$ git checkout pull/12325
$ git pull https://git.openjdk.org/jdk.git pull/12325/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 12325

View PR using the GUI difftool:
$ git pr show -t 12325

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/12325.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 31, 2023

👋 Welcome back jsjolen! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Jan 31, 2023

@jdksjolen The following label will be automatically applied to this pull request:

  • hotspot

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.

@openjdk openjdk bot added the hotspot hotspot-dev@openjdk.org label Jan 31, 2023
Copy link
Contributor Author

@jdksjolen jdksjolen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and found a decent chunk of things to fix.

@@ -121,9 +121,9 @@ int AbstractInterpreter::size_activation(int max_stack,
//
// Parameters:
//
// interpreter_frame != NULL:
// interpreter_frame != null:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nullptr

@@ -111,7 +111,7 @@ bool frame::safe_for_sender(JavaThread *thread) {
}

// At this point, there still is a chance that fp_safe is false.
// In particular, (fp == NULL) might be true. So let's check and
// In particular, (fp == null) might be true. So let's check and
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nullptr

@@ -404,7 +404,7 @@ void G1BarrierSetAssembler::resolve_jobject(MacroAssembler* masm, Register value
__ z_braz(Lnot_weak);
__ verify_oop(value, FILE_AND_LINE);
DecoratorSet decorators = IN_NATIVE | ON_PHANTOM_OOP_REF;
g1_write_barrier_pre(masm, decorators, (const Address*)NULL, value, noreg, tmp1, tmp2, true);
g1_write_barrier_pre(masm, decorators, (const Address*)nullptr, value, noreg, tmp1, tmp2, true);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary cast?

@@ -275,7 +275,7 @@ void InterpreterMacroAssembler::check_and_handle_earlyret(Register scratch_reg)
Register jvmti_thread_state = Z_ARG2;
Register tmp = Z_ARG3;
load_and_test_long(jvmti_thread_state, Address(Z_thread, JavaThread::jvmti_thread_state_offset()));
z_bre(L); // if (thread->jvmti_thread_state() == NULL) exit;
z_bre(L); // if (thread->jvmti_thread_state() == null) exit;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nullptr

@@ -981,7 +981,7 @@ void InterpreterMacroAssembler::lock_object(Register monitor, Register object) {
// // We stored the monitor address into the object's mark word.
// } else if (THREAD->is_lock_owned((address)displaced_header))
// // Simple recursive case.
// monitor->lock()->set_displaced_header(NULL);
// monitor->lock()->set_displaced_header(null);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nullptr

Comment on lines 1128 to 1133
// z_ijava_state->oop_temp = NULL;
// z_ijava_state->oop_temp = null;
__ store_const(Address(fp, oop_tmp_offset), 0);

// Initialize z_ijava_state->mdx.
Register Rmdp = Z_bcp;
// native_call: assert that mdo == NULL
// native_call: assert that mdo == null
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nullptr

Comment on lines 4014 to 4015
// tos = 0: obj == null or obj is not an instanceof the specified klass
// tos = 1: obj != null and obj is an instanceof the specified klass
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nullptr

@@ -4140,7 +4140,7 @@ void TemplateTable::monitorenter() {
__ bind(exit);
}

// Rfree_slot != NULL -> found one
// Rfree_slot != null -> found one
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nullptr

@@ -82,7 +82,7 @@ VtableStub* VtableStubs::create_vtable_stub(int vtable_index) {
assert(VtableStub::receiver_location() == Z_R2->as_VMReg(), "receiver expected in Z_ARG1");

const Register rcvr_klass = Z_R1_scratch;
address npe_addr = __ pc(); // npe == NULL ptr exception
address npe_addr = __ pc(); // npe == null ptr exception
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reads a bit strange.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read this as "npe means null pointer exception" or however you would like to spell it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it's saying "NPE is short for null pointer exception"?

@@ -195,7 +195,7 @@ VtableStub* VtableStubs::create_itable_stub(int itable_index) {

// Get receiver klass.
// Must do an explicit check if offset too large or implicit checks are disabled.
address npe_addr = __ pc(); // npe == NULL ptr exception
address npe_addr = __ pc(); // npe == null ptr exception
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also reads a bit strange

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read this as "npe means null pointer exception" or however you would like to spell it.

@openjdk
Copy link

openjdk bot commented Feb 17, 2023

@jdksjolen this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout JDK-8301497
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

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Feb 17, 2023
@jdksjolen
Copy link
Contributor Author

Don't close yet.

@jdksjolen jdksjolen marked this pull request as ready for review April 11, 2023 10:05
@openjdk openjdk bot added rfr Pull request is ready for review and removed merge-conflict Pull request has merge conflict with target branch labels Apr 11, 2023
@mlbridge
Copy link

mlbridge bot commented Apr 11, 2023

Webrevs

Copy link
Member

@offamitkumar offamitkumar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested release & fast debug build. Tier1 test on fastdebug as well. PR seems clean.

Thank you so much for the changes.

Copy link
Contributor

@coleenp coleenp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@openjdk
Copy link

openjdk bot commented Apr 17, 2023

@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:

8301497: Replace NULL with nullptr in cpu/s390

Reviewed-by: amitkumar, coleenp

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 68 new commits pushed to the master branch:

  • 6831f9d: 8278583: Open source SwingMark - Swing performance benchmark
  • 497f9e7: 8305755: [JVMCI] missing barriers in CompilerToVM.readFieldValue for Reference.referent
  • 4ed933c: 8296248: Update CLDR to Version 43.0
  • 7360960: 8305625: Stress test crashes with SEGV in Deoptimization::deoptimize_frame_internal(JavaThread*, long*, Deoptimization::DeoptReason)
  • cc60f2f: 8305060: G1: Refactor G1ScanHRForRegionClosure::scan_heap_roots
  • fb58d77: 8305192: serial GC fails "assert(Universe::on_page_boundary(bottom) && Universe::on_page_boundary(end)) failed: invalid space boundaries"
  • 7551529: 8305995: Footprint regression from JDK-8224957
  • 02347d0: 8305351: C2 setScopedValueCache intrinsic doesn't use access API
  • 2240c7e: 8305543: Ensure GC barriers for arraycopy on AArch64 use caller saved neon temp registers
  • 1958f0e: 8305233: G1: Refactor G1ClearCardTableTask
  • ... and 58 more: https://git.openjdk.org/jdk/compare/cd7d53c88c27eedbe16020b88c2219708d170a1e...master

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 master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 17, 2023
@jdksjolen
Copy link
Contributor Author

Thanks!

/integrate

@openjdk
Copy link

openjdk bot commented Apr 18, 2023

Going to push as commit 54f7b6c.
Since your change was applied there have been 75 commits pushed to the master branch:

  • 8ecb5df: 8305781: compiler/c2/irTests/TestVectorizationMultiInvar.java failed with "IRViolationException: There were one or multiple IR rule failures."
  • 49726ee: 8305690: [X86] Do not emit two REX prefixes in Assembler::prefix
  • 445ebef: 8305668: PPC: Non-Top Interpreted frames should be independent of ABI_ELFv2
  • e3ece36: 8303422: Use common functions to exit the VM for -Xshare:dump and CDS errors
  • bb1a7bb: 8305762: FileInputStream and FileOutputStream implSpec should be corrected or removed
  • 8858d54: 8305811: (bf) Improve performance of CharBuffer::append(CharSequence[,int,int])
  • 525a91e: 8305673: Convert DocCommentParser to use enhanced switch
  • 6831f9d: 8278583: Open source SwingMark - Swing performance benchmark
  • 497f9e7: 8305755: [JVMCI] missing barriers in CompilerToVM.readFieldValue for Reference.referent
  • 4ed933c: 8296248: Update CLDR to Version 43.0
  • ... and 65 more: https://git.openjdk.org/jdk/compare/cd7d53c88c27eedbe16020b88c2219708d170a1e...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Apr 18, 2023
@openjdk openjdk bot closed this Apr 18, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Apr 18, 2023
@openjdk
Copy link

openjdk bot commented Apr 18, 2023

@jdksjolen Pushed as commit 54f7b6c.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants