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

8256038: G1: Improve comment about mark word handling of displaced mark words #1118

Conversation

tschatzl
Copy link
Contributor

@tschatzl tschatzl commented Nov 9, 2020

Hi all,

can I have reviews for this small comment change that fixes an imho completely misleading comment into something more understandable. Reasons outlined below:

I.e. in the code:

   if (old_mark.has_displaced_mark_helper()) {
    // In this case, we have to install the mark word first,
    // otherwise obj looks to be forwarded (the old mark word,
    // which contains the forward pointer, was copied)
    obj->set_mark(old_mark);
    markWord new_mark = old_mark.displaced_mark_helper().set_age(age);
    old_mark.set_displaced_mark_helper(new_mark);

"in this case ... the obj looks to be forwarded" - it is not true that only in this case the mark word looks to be forwarded because of the copy. G1 always copies the mark word containing the forwarded pointer, i.e. after the copy, the mark word in obj is always the forwarding pointer.
That's why we need to set it to the (eventually updated) old mark word value in all cases....

"we have to install the mark word first" - the order of installing the mark word and updating the displaced mark word is completely irrelevant here - the point is that we need to update the age in the displaced mark word and must not change the old mark word in this branch. The obj->set_mark() call can be at any position actually.

I went with fixing the comment and setting the mark word last in that code block to be similar to other cases. I refrained from other refactorings like refactoring this into (inlined) methods.

Testing: compilation, some quick tests like gcbasher (but errors here typically make building the image fail).

Thanks,
Thomas


Progress

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

Issue

  • JDK-8256038: G1: Improve comment about mark word handling of displaced mark words

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/1118/head:pull/1118
$ git checkout pull/1118

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Nov 9, 2020

👋 Welcome back tschatzl! 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 label Nov 9, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Nov 9, 2020

@tschatzl The following label will be automatically applied to this pull request:

  • hotspot-gc

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-gc label Nov 9, 2020
@mlbridge
Copy link

@mlbridge mlbridge bot commented Nov 9, 2020

Webrevs

Copy link
Contributor

@kstefanj kstefanj left a comment

Looks good.

@openjdk
Copy link

@openjdk openjdk bot commented Nov 9, 2020

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

8256038: G1: Improve comment about mark word handling of displaced mark words

Reviewed-by: sjohanss, kbarrett

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

  • a38dd53: 8256040: Shenandoah: Allow NULL referent in ShenandoahReferenceProcessor::should_discover()
  • 01567b5: 8256036: Shenandoah: MethodHandles adapters section overflows after JDK-8255762
  • 4bc065c: 8255782: Turn UseTLAB and ResizeTLAB from product_pd to product, defaulting to "true"
  • b5d78af: 8254863: Delete code leftover from old fixes
  • 8066b33: 8253905: Update sanity test suite to not place windows at (0,0)
  • f71f9dc: 8255949: AArch64: Add support for vectorized shift right and accumulate
  • 1332ba3: 8256039: Shenandoah: runtime/stringtable/StringTableCleaningTest.java fails
  • 11431b1: 4619330: All built-in java.awt.color.ColorSpace fields should be specified as such
  • 17f04fc: 8254078: DataOutputStream is very slow post-disabling of Biased Locking
  • 79b7909: 8255980: G1 Service thread register_task can be used after shutdown
  • ... and 2 more: https://git.openjdk.java.net/jdk/compare/c7551c37c7e9be7112371c351a4cc0d0d817cb46...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 label Nov 9, 2020
@tschatzl
Copy link
Contributor Author

@tschatzl tschatzl commented Nov 10, 2020

Thanks @kstefanj @kimbarrett for your reviews.

/integrate

@openjdk openjdk bot closed this Nov 10, 2020
@openjdk openjdk bot added integrated and removed ready rfr labels Nov 10, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Nov 10, 2020

@tschatzl Since your change was applied there have been 12 commits pushed to the master branch:

  • a38dd53: 8256040: Shenandoah: Allow NULL referent in ShenandoahReferenceProcessor::should_discover()
  • 01567b5: 8256036: Shenandoah: MethodHandles adapters section overflows after JDK-8255762
  • 4bc065c: 8255782: Turn UseTLAB and ResizeTLAB from product_pd to product, defaulting to "true"
  • b5d78af: 8254863: Delete code leftover from old fixes
  • 8066b33: 8253905: Update sanity test suite to not place windows at (0,0)
  • f71f9dc: 8255949: AArch64: Add support for vectorized shift right and accumulate
  • 1332ba3: 8256039: Shenandoah: runtime/stringtable/StringTableCleaningTest.java fails
  • 11431b1: 4619330: All built-in java.awt.color.ColorSpace fields should be specified as such
  • 17f04fc: 8254078: DataOutputStream is very slow post-disabling of Biased Locking
  • 79b7909: 8255980: G1 Service thread register_task can be used after shutdown
  • ... and 2 more: https://git.openjdk.java.net/jdk/compare/c7551c37c7e9be7112371c351a4cc0d0d817cb46...master

Your commit was automatically rebased without conflicts.

Pushed as commit c601849.

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

openjdk-notifier bot referenced this issue Nov 10, 2020
@tschatzl tschatzl deleted the 8256038-improve-mark-word-handling-comment branch Nov 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-gc integrated
3 participants