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

8269870: PS: Membar in PSPromotionManager::copy_unmarked_to_survivor_space could be relaxed #19764

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp
Original file line number Diff line number Diff line change
@@ -254,6 +254,10 @@ inline oop PSPromotionManager::copy_unmarked_to_survivor_space(oop o,
ContinuationGCSupport::transform_stack_chunk(new_obj);

// Now we have to CAS in the header.
// Because the forwarding is done with memory_order_relaxed there is no
// ordering with the above copy. Clients that get the forwardee must not
// examine its contents without other synchronization, since the contents
// may not be up to date for them.
oop forwardee = o->forward_to_atomic(new_obj, test_mark, memory_order_relaxed);

Choose a reason for hiding this comment

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

I think this needs a comment similar to what's in G1ParScanThreadState::do_copy_to_suvivor_space, e.g.

// Because the forwarding is done with memory_order_relaxed there is no
// ordering with the above copy. Clients that get the forwardee must not
// examine its contents without other synchronization, since the contents
// may not be up to date for them.

if (forwardee == nullptr) { // forwardee is null when forwarding is successful
// We won any races, we "own" this object.