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

8271014: Refactor HeapShared::is_archived_object() #4855

Conversation

@iklam
Copy link
Member

@iklam iklam commented Jul 21, 2021

(This PR is in preparation of JDK-8270489 - Support archived heap objects in EpsilonGC)

We have the following function that's used ONLY in asserts and WhiteBox tests.

bool HeapShared::is_archived_object(oop p) {
  return Universe::heap()->is_archived_object(p);
}

This function is used for two completely different purposes:

[1] During dump time, is p an object that's about to be written into the archived heap?
[2] During runtime, is p an object in an archive region?

To support archived objects in other types of GCs that do not support archive regions, we should refactor this code to distinguish between the two use cases. This will make the code easier to understand.

=========

[0] Remove HeapShared::is_archived_object()
[1] -> add new function HeapShared::is_archived_object_during_dumptime()
[2] -> rewrite the code to call Universe::heap()->is_archived_object(p) instead.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8271014: Refactor HeapShared::is_archived_object()

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/4855/head:pull/4855
$ git checkout pull/4855

Update a local copy of the PR:
$ git checkout pull/4855
$ git pull https://git.openjdk.java.net/jdk pull/4855/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4855

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/4855.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Jul 21, 2021

👋 Welcome back iklam! 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.

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Jul 21, 2021

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

Loading

@openjdk openjdk bot added the hotspot label Jul 21, 2021
@iklam
Copy link
Member Author

@iklam iklam commented Jul 21, 2021

/label remove hotspot
/label add hotspot-runtime

Loading

@openjdk openjdk bot removed the hotspot label Jul 21, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Jul 21, 2021

@iklam
The hotspot label was successfully removed.

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Jul 21, 2021

@iklam
The hotspot-runtime label was successfully added.

Loading

@iklam iklam marked this pull request as ready for review Jul 21, 2021
@openjdk openjdk bot added the rfr label Jul 21, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Jul 21, 2021

Webrevs

Loading

@@ -39,6 +39,7 @@
#include "oops/compressedOops.inline.hpp"
#include "runtime/arguments.hpp"
#include "utilities/bitMap.inline.hpp"
#include "utilities/formatBuffer.hpp"
Copy link
Member

@calvinccheung calvinccheung Jul 21, 2021

Choose a reason for hiding this comment

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

Why add the above include?

Loading

Copy link
Member Author

@iklam iklam Jul 21, 2021

Choose a reason for hiding this comment

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

archiveUtils.cpp uses err_msg, which is declared in formatBuffer.hpp. Before this fix, this header was included indirectly from heapShared.inline.hpp -> collectedHeap.hpp -> formatBuffer.hpp.

In this PR, I removed the inclusion of collectedHeap.hpp in heapShared.inline.hpp, so the missing dependency was exposed.

Loading

#ifdef ASSERT
bool HeapShared::is_archived_object_during_dumptime(oop p) {
assert(HeapShared::is_heap_object_archiving_allowed(), "must be");
assert(DumpSharedSpaces, "must be called during dump time only");
Copy link
Member

@calvinccheung calvinccheung Jul 21, 2021

Choose a reason for hiding this comment

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

I'd suggest to change it to the following to be consistent with asserts in other places:
assert(DumpSharedSpaces, "this function is only used with -Xshare:dump");

Loading

Copy link
Member Author

@iklam iklam Jul 21, 2021

Choose a reason for hiding this comment

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

Fixed.

Loading

Copy link
Member

@calvinccheung calvinccheung left a comment

Looks good. Just one question and one suggestion.

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Jul 21, 2021

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

8271014: Refactor HeapShared::is_archived_object()

Reviewed-by: ccheung, minqi

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

  • 57611b3: 8270991: G1 Full GC always performs heap verification after JDK-8269295
  • cd8783c: 8270820: remove unused stiFileTableIndex from SDE.c
  • 1f51e13: 8270147: Increase stride size allowing unrolling more loops

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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.

Loading

@openjdk openjdk bot added the ready label Jul 21, 2021
yminqi
yminqi approved these changes Jul 21, 2021
Copy link
Contributor

@yminqi yminqi left a comment

LGTM.

Loading

@iklam
Copy link
Member Author

@iklam iklam commented Jul 21, 2021

Thanks @calvinccheung and @yminqi for the review.
/integrate

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Jul 21, 2021

Going to push as commit 024c402.
Since your change was applied there have been 5 commits pushed to the master branch:

  • ddce47c: 8270949: Make dynamically generated classes with the class file version of the current release
  • b7245c6: 8269849: vmTestbase/gc/gctests/PhantomReference/phantom002/TestDescription.java failed with "OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects"
  • 57611b3: 8270991: G1 Full GC always performs heap verification after JDK-8269295
  • cd8783c: 8270820: remove unused stiFileTableIndex from SDE.c
  • 1f51e13: 8270147: Increase stride size allowing unrolling more loops

Your commit was automatically rebased without conflicts.

Loading

@openjdk openjdk bot closed this Jul 21, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Jul 21, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Jul 21, 2021

@iklam Pushed as commit 024c402.

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

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants