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

8324680: Replace NULL with nullptr in JVMTI generated code #17866

Closed
wants to merge 1 commit into from

Conversation

sspitsyn
Copy link
Contributor

@sspitsyn sspitsyn commented Feb 15, 2024

This enhancement replaces uses of NULL with nullptr in the XML-description files for JVMTI. These are the files hotsport/share/prims/jvmti.xml and hotspot/share/prims/jvmti*.xls.

The following files are auto-generated from the jvmti.xml and *.xsl files in the build/<CFG>/variant-server/gensrc/jvmtifiles': jvmti.h, jvmti.html, jvmtiEnter.cpp, jvmtiEnterTrace.cpp, jvmtiEnv.hpp`

This addresses a category of NULL uses that wasn't dealt with by:
JDK-8299837.

Testing:

  • TBD: run mach5 tiers1-3

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-8324680: Replace NULL with nullptr in JVMTI generated code (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 17866

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 15, 2024

👋 Welcome back sspitsyn! 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 openjdk bot added the rfr Pull request is ready for review label Feb 15, 2024
@openjdk
Copy link

openjdk bot commented Feb 15, 2024

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

  • hotspot
  • serviceability

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 serviceability serviceability-dev@openjdk.org hotspot hotspot-dev@openjdk.org labels Feb 15, 2024
@mlbridge
Copy link

mlbridge bot commented Feb 15, 2024

Webrevs

@openjdk
Copy link

openjdk bot commented Feb 16, 2024

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

8324680: Replace NULL with nullptr in JVMTI generated code

Reviewed-by: amenkov, 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 59 new commits pushed to the master branch:

  • 0aaec97: 8325763: Revert properties: vm.opt.x.*
  • 4018b2b: 8323782: Race: Thread::interrupt vs. AbstractInterruptibleChannel.begin
  • 2705ed0: 8325074: ZGC fails assert(index == 0 || is_power_of_2(index)) failed: Incorrect load shift: 11
  • 3d85103: 8316813: NMT: Using WhiteBox API, virtual memory tracking should also be stressed in JMH tests
  • ba8db1f: 8325876: crashes in docker container tests on Linuxppc64le Power8 machines
  • 18cea82: 8319801: Recursive lightweight locking: aarch64 implementation
  • 9029bf6: 8316451: 6 java/lang/instrument/PremainClass tests ignore VM flags
  • 99c9ae1: 8323664: java/awt/font/JNICheck/FreeTypeScalerJNICheck.java still fails with JNI warning on some Windows configurations
  • 0fdfdf7: 8325983: Build failure after JDK-8324580
  • 3b1062d: 8322239: [macos] a11y : java.lang.NullPointerException is thrown when focus is moved on the JTabbedPane
  • ... and 49 more: https://git.openjdk.org/jdk/compare/b356fee5d82c3c72a705bb33b73189921a813828...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 16, 2024
@sspitsyn
Copy link
Contributor Author

Thank you for review, Alex!

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, thanks for fixing this.

@sspitsyn
Copy link
Contributor Author

Thank you for review, Coleen!

@sspitsyn
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Feb 16, 2024

Going to push as commit 267780b.
Since your change was applied there have been 68 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Feb 16, 2024

@sspitsyn Pushed as commit 267780b.

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

@AlanBateman
Copy link
Contributor

JVMTI agents can be developed in C or C++. If I read this changes correctly, then this will replace all the NULLs in the generated spec with nullptr. I wonder if this needs some setup in the Introduction section, e.g. the Function Return Values subsection, to make this clear.

@dholmes-ora
Copy link
Member

As with the other NULL -> nullptr changes, when it involves text (as opposed to code) and we are discussing the general concept of nullness, then the word "null" should be used rather than the programmatic values NULL or nullptr. But if the source here is used to generated both the spec's functional descriptions and the code functions themselves, then we cannot make that distinction. I'm not sure this change was actually a good idea. At a minimum we need something like @AlanBateman suggests, something upfront to say that where the spec says nullptr it also means a C null pointer.

@sspitsyn
Copy link
Contributor Author

Now, we this section:

Function Return Values

JVM TI functions always return an error code via the jvmtiError function return value. Some functions can return additional values through pointers provided by the calling function. In some cases, JVM TI functions allocate memory that your program must explicitly deallocate. This is indicated in the individual JVM TI function descriptions. Empty lists, arrays, sequences, etc are returned as nullptr.
In the event that the JVM TI function encounters an error (any return value other than JVMTI_ERROR_NONE) the values of memory referenced by argument pointers is undefined, but no memory will have been allocated and no global references will have been allocated. If the error occurs because of invalid input, no action will have occurred.

The nullptr is mentioned here. As I understand from the Alan's and David's comments above we want to clarify what does it mean for C/C++ code.

@sspitsyn
Copy link
Contributor Author

Filed new Enhancement:
8326716: JVMTI spec: clarify what nullptr means for C/C++ developers

@sspitsyn sspitsyn deleted the b18 branch February 29, 2024 04:33
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 serviceability serviceability-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

5 participants