Skip to content
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

JDK-8301225: Replace NULL with nullptr in share/gc/shenandoah/ #12251

Closed
wants to merge 5 commits into from

Conversation

jdksjolen
Copy link
Contributor

@jdksjolen jdksjolen commented Jan 27, 2023

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

  • JDK-8301225: Replace NULL with nullptr in share/gc/shenandoah/

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 12251

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 27, 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 27, 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-8301225
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 merge-conflict Pull request has merge conflict with target branch rfr Pull request is ready for review labels Jan 27, 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.

Manual stuff to fix

@@ -256,7 +256,7 @@ void ShenandoahBarrierSetC2::satb_write_barrier_pre(GraphKit* kit,
pre_val = __ load(__ ctrl(), adr, val_type, bt, alias_idx);
}

// if (pre_val != NULL)
// if (pre_val != 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

@@ -278,13 +278,13 @@ void ShenandoahBarrierSetC2::satb_write_barrier_pre(GraphKit* kit,
const TypeFunc *tf = ShenandoahBarrierSetC2::write_ref_field_pre_entry_Type();
__ make_leaf_call(tf, CAST_FROM_FN_PTR(address, ShenandoahRuntime::write_ref_field_pre_entry), "shenandoah_wb_pre", pre_val, tls);
} __ end_if(); // (!index)
} __ end_if(); // (pre_val != NULL)
} __ end_if(); // (pre_val != 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

@@ -425,15 +425,15 @@ void ShenandoahBarrierSetC2::insert_pre_barrier(GraphKit* kit, Node* base_oop, N
__ sync_kit(kit);

Node* one = __ ConI(1);
// is_instof == 0 if base_oop == NULL
// is_instof == 0 if base_oop == 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 58 to 61
#define SHENANDOAH_WORKER_DATA_NULL(type, title) \
_worker_data[i] = NULL;
SHENANDOAH_PAR_PHASE_DO(,, SHENANDOAH_WORKER_DATA_NULL)
#undef SHENANDOAH_WORKER_DATA_NULL
#define SHENANDOAH_WORKER_DATA_nullptr(type, title) \
_worker_data[i] = nullptr;
SHENANDOAH_PAR_PHASE_DO(,, SHENANDOAH_WORKER_DATA_nullptr)
#undef SHENANDOAH_WORKER_DATA_nullptr
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fix these macros

Copy link
Member

Choose a reason for hiding this comment

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

My suggestion would be to leave the macro name unchanged, just change the definition. Or at least use uppercasing in the macro name. (Perhaps the latter's what your comment intended.)

More generally, is there a jcheck rule that will prevent re-introduction of NULL usage into the mix?

Copy link
Contributor

Choose a reason for hiding this comment

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

This code diff is out of date, the macro name was reverted to the original in a subsequent commit. Good question about adding this to jcheck.

@openjdk
Copy link

openjdk bot commented Jan 27, 2023

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

  • hotspot-gc
  • shenandoah

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.

@openjdk openjdk bot added hotspot-gc hotspot-gc-dev@openjdk.org shenandoah shenandoah-dev@openjdk.org labels Jan 27, 2023
@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label Jan 27, 2023
@mlbridge
Copy link

mlbridge bot commented Jan 27, 2023

Webrevs

@jdksjolen
Copy link
Contributor Author

Passes tier1.

Copy link
Contributor

@earthling-amzn earthling-amzn left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@kdnilsen kdnilsen 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 to me. Thanks for doing this.

A few comments about copyright notices.

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2023, Oracle and/or its affiliates. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

minor glitch here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Weird, first time I'm seeing this glitch. Thanks!

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2023, Oracle and/or its affiliates. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

same glitch here

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably should be 2018, 2019, 2023

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 and the other ones are correct, it's $FirstChange, $LastChange,

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

check this

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

Trivial merge conflict fix and copyright fix. Tier1 passes, integrating.

/integrate

@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label Feb 10, 2023
@openjdk
Copy link

openjdk bot commented Feb 10, 2023

@jdksjolen This pull request has not yet been marked as ready for integration.

Copy link
Contributor

@rkennke rkennke 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 to me, thank you!

@openjdk
Copy link

openjdk bot commented Feb 13, 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:

8301225: Replace NULL with nullptr in share/gc/shenandoah/

Reviewed-by: wkemper, kdnilsen, rkennke

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

  • 101db26: 8301697: [s390] Optimized-build is broken
  • f4d4fa5: 8300255: Introduce interface for GC oop verification in the assembler
  • 99b6c0e: 8302289: RISC-V: Use bgez instruction in arraycopy_simple_check when possible
  • 57aef85: 8301838: PPC: continuation yield intrinsic: exception check not needed if yield succeeded
  • df93880: 8301942: java/net/httpclient/DigestEchoClientSSL.java fail with -Xcomp
  • 0025764: 8040793: vmTestbase/nsk/monitoring/stress/lowmem fails on calling isCollectionUsageThresholdExceeded()
  • 1f9c110: 8301958: Reduce Arrays.copyOf/-Range overheads
  • cb81073: 8300139: [AIX] Use pthreads to avoid JNI_createVM call from primordial thread
  • bbd8ae7: 8294194: [AArch64] Create intrinsics compress and expand
  • 4e327db: 8301499: Replace NULL with nullptr in cpu/zero
  • ... and 23 more: https://git.openjdk.org/jdk/compare/1c7b09bc23ac37f83b9043de35b71bea7e814da5...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 Feb 13, 2023
@jdksjolen
Copy link
Contributor Author

There we go, let's integrate!

/integrate

@openjdk
Copy link

openjdk bot commented Feb 15, 2023

Going to push as commit 0c96584.
Since your change was applied there have been 65 commits pushed to the master branch:

  • 26b111d: 8301700: Increase the default TLS Diffie-Hellman group size from 1024-bit to 2048-bit
  • 5238817: 8301463: Code in DatagramSocket still refers to resolved JDK-8237352
  • 11194e8: 8302325: Wrong comment in java.base/share/native/libjimage/imageFile.hpp
  • 33bec20: 8300808: Accelerate Base64 on x86 for AVX2
  • 46bcc49: 8302147: Speed up compiler/jvmci/compilerToVM/IterateFramesNative.java
  • a9a53f4: 8302152: Speed up tests with infinite loops, sleep less
  • 98a392c: 8302102: Disable ASan for SafeFetch and os::print_hex_dump
  • 9ccf8ad: 8302129: Make MetaspaceReclaimPolicy a diagnostic switch
  • bdcbafb: 8296344: Remove dependency on G1 for writing the CDS archive heap
  • f1d76fa: 8302262: Remove -XX:SuppressErrorAt develop option
  • ... and 55 more: https://git.openjdk.org/jdk/compare/1c7b09bc23ac37f83b9043de35b71bea7e814da5...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Feb 15, 2023

@jdksjolen Pushed as commit 0c96584.

💡 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-gc hotspot-gc-dev@openjdk.org integrated Pull request has been integrated shenandoah shenandoah-dev@openjdk.org
5 participants