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

8322383: G1: Only preserve marks on objects that are actually moved #17159

Closed
wants to merge 4 commits into from

Conversation

rkennke
Copy link
Contributor

@rkennke rkennke commented Dec 19, 2023

The G1 full-GC preserves marks during marking, for all live objects in compaction region. However, not all live objects do actually move. In particular, the start of a compaction chain may have a sediment of all-live objects which would not move, and thus don't need to have their marks preserved.
The problem can easily be solved by preserving marks during forwarding. That also seems a more natural place to do that.

Testing:

  • hotspot_gc
  • tier1
  • tier2

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-8322383: G1: Only preserve marks on objects that are actually moved (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 17159

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 19, 2023

👋 Welcome back rkennke! 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 Dec 19, 2023
@openjdk
Copy link

openjdk bot commented Dec 19, 2023

@rkennke 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 Dec 19, 2023
@mlbridge
Copy link

mlbridge bot commented Dec 19, 2023

Webrevs

@albertnetymk
Copy link
Member

/label add hotspot-gc

@openjdk openjdk bot added the hotspot-gc hotspot-gc-dev@openjdk.org label Jan 4, 2024
@openjdk
Copy link

openjdk bot commented Jan 4, 2024

@albertnetymk
The hotspot-gc label was successfully added.

@@ -102,6 +103,7 @@ void G1FullGCCompactionPoint::forward(oop object, size_t size) {

// Store a forwarding pointer if the object should be moved.
if (cast_from_oop<HeapWord*>(object) != _compaction_top) {
preserved_stack()->push_if_necessary(object, object->mark());
Copy link
Member

Choose a reason for hiding this comment

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

Can this be made conditionally on whether the markword is NOT marked/forwarded? (IOW, move the added predicate in markWord here.) The rationale is to minimize changes to the shared code for G1 specific usages.

Copy link
Member

Choose a reason for hiding this comment

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

My previous msg was probably unclear... I meant sth like:

if (!object->is_forwarded) {
  preserved_stack()->push_if_necessary...
}

(The newly added assert here is incorrect -- fails in GHA.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I see! This makes more sense, yes. I made that change and cleaned up non G1 code.

BTW: I am working on new/alternative full-GCs for Serial, G1 and Shenandoah that don't store forwarding pointers in the mark-word at all, and thus avoid all that preserved-headers stuff (and together with the OM-world work that some Oracle engineers are working on, get rid of header displacement altogether). The SerialGC version is almost ready in Lilliput: openjdk/lilliput#122

@openjdk
Copy link

openjdk bot commented Jan 12, 2024

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

8322383: G1: Only preserve marks on objects that are actually moved

Reviewed-by: ayang, tschatzl

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

  • a03eb6d: 8321620: Optimize JImage decompressors
  • f5b757c: 8323159: Consider adding some text re. memory zeroing in Arena::allocate
  • 1f4474f: 8323726: Serial: Remove unused definitions in Generation
  • dd0694b: 8323671: DevKit build gcc libraries contain full paths to source location
  • bf813be: 8322279: Generational ZGC: Use ZFragmentationLimit and ZYoungCompactionLimit as percentage instead of multiples
  • c84c0ab: 8323637: Capture hotspot replay files in GHA
  • f368a0c: 8320328: Restore interrupted flag in ImageIcon.loadImage
  • a45b5b4: 8323722: Serial: Remove unused no_gc_in_progress
  • 7e0a4ed: 8323101: C2: assert(n->in(0) == nullptr) failed: divisions with zero check should already have bailed out earlier in split-if
  • 34f85ee: 8323584: AArch64: Unnecessary ResourceMark in NativeCall::set_destination_mt_safe
  • ... and 236 more: https://git.openjdk.org/jdk/compare/fff2e580cdab90ea828c1c300440471981646c51...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 Jan 12, 2024
@rkennke
Copy link
Contributor Author

rkennke commented Jan 19, 2024

/integrate

@openjdk
Copy link

openjdk bot commented Jan 19, 2024

Going to push as commit 16be388.
Since your change was applied there have been 310 commits pushed to the master branch:

  • 0081d8c: 8324147: Serial: Remove generation::compute_new_size
  • 5f71419: 8322366: Add IEEE rounding mode corruption check to JNI checks
  • 0533022: 8222719: libperfstat on AIX - cleanup old API versions
  • 05dad67: 8295804: javax/swing/JFileChooser/JFileChooserSetLocationTest.java failed with "setLocation() is not working properly"
  • 9efdd24: 8324053: Use the blessed modifier order for sealed in java.base
  • 81df265: 8320458: Improve structural navigation in API documentation
  • a6c0b10: 8323684: TypeMirror.{getAnnotationsByType, getAnnotation} return uninformative results
  • 5c874c1: 8324161: validate-source fails after JDK-8275338
  • b6233c3: 8321925: sun/security/mscapi/KeytoolChangeAlias.java fails with "Alias <246810> does not exist"
  • bfd2afe: 8275338: Add JFR events for notable serialization situations
  • ... and 300 more: https://git.openjdk.org/jdk/compare/fff2e580cdab90ea828c1c300440471981646c51...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jan 19, 2024

@rkennke Pushed as commit 16be388.

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

Successfully merging this pull request may close these issues.

3 participants