Skip to content

8307521: Introduce check_oop infrastructure to check oops in the oop class #13825

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

Conversation

stefank
Copy link
Member

@stefank stefank commented May 5, 2023

I'd like to add some extra verification to our C++ usages of oops. The intention is to quickly find when we are passing around an oop that wasn't fetched via a required load barrier. We have found this kind of verification crucial when developing Generational ZGC.

My proposal is to hook into the CHECK_UNHANDLED_OOPS code, which is only compiled when building fastdebug builds. In release and slowdebug builds, oops are simple oopDesc*, but with CHECK_UNHANDLED_OOPS oop is a class where we can easily hook in verification code.

The actual verification code is not included in the patch, but the required infrastructure is. Then when we deliver Generational ZGC, it will install a verification function pointer during initialization. See: https://github.com/openjdk/zgc/blob/349cf9ae38664991879402a90c5e23e291f1c1c3/src/hotspot/share/gc/z/zAddress.cpp#L92

static void initialize_check_oop_function() {
#ifdef CHECK_UNHANDLED_OOPS
  if (ZVerifyOops) {
    // Enable extra verification of usages of oops in oopsHierarchy.hpp
    check_oop_function = [](oopDesc* obj) {
      (void)to_zaddress(obj);
    };
  }
#endif
}

We've separated out this code from the larger Generational ZGC PR, so that it can get a proper review without being hidden together with all other changes.


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-8307521: Introduce check_oop infrastructure to check oops in the oop class

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 13825

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

Using diff file

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

Webrev

Link to Webrev Comment

@stefank
Copy link
Member Author

stefank commented May 5, 2023

/label add hotspot

@bridgekeeper
Copy link

bridgekeeper bot commented May 5, 2023

👋 Welcome back stefank! 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 rfr Pull request is ready for review hotspot hotspot-dev@openjdk.org labels May 5, 2023
@openjdk
Copy link

openjdk bot commented May 5, 2023

@stefank
The hotspot label was successfully added.

@mlbridge
Copy link

mlbridge bot commented May 5, 2023

Webrevs

Copy link
Contributor

@fisk fisk 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 May 5, 2023

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

8307521: Introduce check_oop infrastructure to check oops in the oop class

Reviewed-by: eosterlund, aboldtch, 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 11 new commits pushed to the master branch:

  • 12d6ec6: 8307236: Rendezvous GC threads under STS for monitor deflation
  • 6fe959c: 8307306: Change some ConstantPool::name_ref_at calls to uncached_name_ref_at
  • 3f6a354: 8305169: java/security/cert/CertPathValidator/OCSP/GetAndPostTests.java -- test server didn't start in timely manner
  • f143bf7: 8305084: Remove the removal warnings for finalize() from test/hotspot/jtreg/serviceability/dcmd/gc/FinalizerInfoTest.java and RunFinalizationTest.java
  • 746f8d1: 8305714: Add an extra test for JDK-8292755
  • 1a1ce66: 8305080: Suppress the 'removal' warning for finalize() from test/hotspot/jtreg/compiler/jvmci/common/testcases that used in compiler/jvmci/compilerToVM/ tests
  • 3b430b9: 8250596: Update remaining manpage references from "OS X" to "macOS"
  • 948f3b3: 8301493: Replace NULL with nullptr in cpu/aarch64
  • f94f957: 8307331: Correctly update line maps when class redefine rewrites bytecodes
  • 302bc2f: 8307421: Fix comment in g1CollectionSetChooser.hpp after JDK-8306836
  • ... and 1 more: https://git.openjdk.org/jdk/compare/1b143ba78712e7ac98ca9873c50989b3fba07394...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 May 5, 2023
Copy link
Member

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

@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 fine.

@stefank
Copy link
Member Author

stefank commented May 8, 2023

Thanks for reviewing!
/integrate

@openjdk
Copy link

openjdk bot commented May 8, 2023

Going to push as commit 959e62c.
Since your change was applied there have been 29 commits pushed to the master branch:

  • ad0e5a9: 8304720: SuperWord::schedule should rebuild C2-graph from SuperWord dependency-graph
  • 495f268: 8306966: RISC-V: Support vector cast node for Vector API
  • 0dca573: 8301739: AArch64: Add optimized rules for vector compare with immediate for SVE
  • 3d3eaed: 8306941: Open source several datatransfer and dnd AWT tests
  • 1f57ce0: 8307446: RISC-V: Improve performance of floating point to integer conversion
  • 4e4828e: 8307553: Remove dead code MetaspaceClosure::push_method_entry
  • 7d58978: 8280031: Deprecate GTK2 for removal
  • b5922c3: 8305846: Support compilation in Proc test utility
  • 73ac710: 8307425: Socket input stream read burns CPU cycles with back-to-back poll(0) calls
  • e2b1013: 8306326: [BACKOUT] 8277573: VmObjectAlloc is not generated by intrinsics methods which allocate objects
  • ... and 19 more: https://git.openjdk.org/jdk/compare/1b143ba78712e7ac98ca9873c50989b3fba07394...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented May 8, 2023

@stefank Pushed as commit 959e62c.

💡 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