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

8315044: GenShen: Verifier detects clean card should be dirty #314

Closed

Conversation

kdnilsen
Copy link
Contributor

@kdnilsen kdnilsen commented Aug 28, 2023

When a Reference object is newly discovered, it is placed onto the worker's thread-local discovered list. This sometimes results in a reference from an old object to a young object, requiring that the remembered set card-table entry be marked as dirty. This patch causes the marking to be performed.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (1 review required, with at least 1 Committer)

Issue

  • JDK-8315044: GenShen: Verifier detects clean card should be dirty (Bug - P2)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 314

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/shenandoah/pull/314.diff

Webrev

Link to Webrev Comment

@kdnilsen kdnilsen marked this pull request as draft August 28, 2023 23:35
@kdnilsen
Copy link
Contributor Author

I'm going to leave this in draft mode until I see and analyze results of integration testing.

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 28, 2023

👋 Welcome back kdnilsen! 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 changed the title JDK-8315044: GenShen: Verifier detects clean card should be dirt 8315044: GenShen: Verifier detects clean card should be dirty Aug 28, 2023
@kdnilsen kdnilsen marked this pull request as ready for review August 29, 2023 17:24
@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 29, 2023
@mlbridge
Copy link

mlbridge bot commented Aug 29, 2023

Webrevs

Copy link
Member

@ysramakrishna ysramakrishna left a comment

Choose a reason for hiding this comment

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

changes look good; minor suggestion on some potential refactor/consolidation with existing card marking code.

Comment on lines 385 to 387
T* addr = reinterpret_cast<T*>(java_lang_ref_Reference::discovered_addr_raw(reference));
if (heap->is_in_old(addr) && heap->is_in_young(discovered_head)) {
heap->mark_card_as_dirty(addr);
Copy link
Member

Choose a reason for hiding this comment

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

Can you instead call the existing card_mark_barrier method?
At that time, could also look at the existing uses of that method and refactor them to use the ShenandoahCardBarrier test like you did above, and elide the generational check in the body of the method itself, replacing it with an assertion (if you want, that the heap is generational).

(PS: I was also thinking that in the fullness of time it might be worth doing an audit of the uses of cas and set_oop and making sure they would call the card-marking code instead of exposing the functionality at the call-sites like done here. Callers that want to avoid card-marking would need to call the respective _raw versions then. We should makr sure to conform to naming conventions for those methods that are consistent with those used in other parts of jvm/gc code. This can be done separately and might affect legacy Shenandoah code as well. Just leaving this comment here so as not to lose the thought, but I doubt we want to do that locally here in this PR.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made this change and am testing result.

I agree that audit/refactoring in the future would be a good idea.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've made your suggested changes and am sending through the test pipeline again.

I agree that it would be good to eventually audit/refactor to have more consistent method names and conventions.

Copy link
Member

@ysramakrishna ysramakrishna left a comment

Choose a reason for hiding this comment

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

One more change, I think? See comment in-line.

May be there is an issue with it though that I am not seeing which perhaps you might have tried already, but doesn't work?

Rest looks good.

Comment on lines 581 to 590
if (UseCompressedOops) {
*reinterpret_cast<narrowOop*>(_pending_list_tail) = CompressedOops::encode(Universe::swap_reference_pending_list(_pending_list));
*reinterpret_cast<narrowOop*>(_pending_list_tail) = CompressedOops::encode(former_head_of_global_list);
} else {
*reinterpret_cast<oop*>(_pending_list_tail) = Universe::swap_reference_pending_list(_pending_list);
*reinterpret_cast<oop*>(_pending_list_tail) = former_head_of_global_list;
}
ShenandoahHeap* heap = ShenandoahHeap::heap();
if (ShenandoahCardBarrier) {
if (heap->is_in_old(_pending_list_tail) && heap->is_in_young(former_head_of_global_list)) {
heap->mark_card_as_dirty(_pending_list_tail);
}
Copy link
Member

Choose a reason for hiding this comment

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

Can we just replace this section with set_oop_field(_pending_list_tail, former_head_of_global_list) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have made this improvement, and am retesting.

@openjdk
Copy link

openjdk bot commented Sep 1, 2023

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

8315044: GenShen: Verifier detects clean card should be dirty

Reviewed-by: ysr, wkemper

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 no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential 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 Sep 1, 2023
@kdnilsen
Copy link
Contributor Author

kdnilsen commented Sep 6, 2023

/integrate

@openjdk
Copy link

openjdk bot commented Sep 6, 2023

Going to push as commit c4d0a24.

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

openjdk bot commented Sep 6, 2023

@kdnilsen Pushed as commit c4d0a24.

💡 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
integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants