mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 10:04:42 +02:00
8204524: Unnecessary memory barriers in G1ParScanThreadState::copy_to_survivor_space
Reviewed-by: kbarrett, mdoerr, drwhite, tschatzl
This commit is contained in:
parent
84eec7f854
commit
4641ea7bed
3 changed files with 5 additions and 5 deletions
|
@ -266,7 +266,7 @@ oop G1ParScanThreadState::copy_to_survivor_space(InCSetState const state,
|
||||||
Prefetch::write(obj_ptr, PrefetchCopyIntervalInBytes);
|
Prefetch::write(obj_ptr, PrefetchCopyIntervalInBytes);
|
||||||
|
|
||||||
const oop obj = oop(obj_ptr);
|
const oop obj = oop(obj_ptr);
|
||||||
const oop forward_ptr = old->forward_to_atomic(obj);
|
const oop forward_ptr = old->forward_to_atomic(obj, memory_order_relaxed);
|
||||||
if (forward_ptr == NULL) {
|
if (forward_ptr == NULL) {
|
||||||
Copy::aligned_disjoint_words((HeapWord*) old, obj_ptr, word_sz);
|
Copy::aligned_disjoint_words((HeapWord*) old, obj_ptr, word_sz);
|
||||||
|
|
||||||
|
@ -356,7 +356,7 @@ void G1ParScanThreadStateSet::flush() {
|
||||||
oop G1ParScanThreadState::handle_evacuation_failure_par(oop old, markOop m) {
|
oop G1ParScanThreadState::handle_evacuation_failure_par(oop old, markOop m) {
|
||||||
assert(_g1h->is_in_cset(old), "Object " PTR_FORMAT " should be in the CSet", p2i(old));
|
assert(_g1h->is_in_cset(old), "Object " PTR_FORMAT " should be in the CSet", p2i(old));
|
||||||
|
|
||||||
oop forward_ptr = old->forward_to_atomic(old);
|
oop forward_ptr = old->forward_to_atomic(old, memory_order_relaxed);
|
||||||
if (forward_ptr == NULL) {
|
if (forward_ptr == NULL) {
|
||||||
// Forward-to-self succeeded. We are the "owner" of the object.
|
// Forward-to-self succeeded. We are the "owner" of the object.
|
||||||
HeapRegion* r = _g1h->heap_region_containing(old);
|
HeapRegion* r = _g1h->heap_region_containing(old);
|
||||||
|
|
|
@ -266,7 +266,7 @@ class oopDesc {
|
||||||
// Exactly one thread succeeds in inserting the forwarding pointer, and
|
// Exactly one thread succeeds in inserting the forwarding pointer, and
|
||||||
// this call returns "NULL" for that thread; any other thread has the
|
// this call returns "NULL" for that thread; any other thread has the
|
||||||
// value of the forwarding pointer returned and does not modify "this".
|
// value of the forwarding pointer returned and does not modify "this".
|
||||||
inline oop forward_to_atomic(oop p);
|
inline oop forward_to_atomic(oop p, atomic_memory_order order = memory_order_conservative);
|
||||||
|
|
||||||
inline oop forwardee() const;
|
inline oop forwardee() const;
|
||||||
inline oop forwardee_acquire() const;
|
inline oop forwardee_acquire() const;
|
||||||
|
|
|
@ -352,7 +352,7 @@ bool oopDesc::cas_forward_to(oop p, markOop compare, atomic_memory_order order)
|
||||||
return cas_set_mark_raw(m, compare, order) == compare;
|
return cas_set_mark_raw(m, compare, order) == compare;
|
||||||
}
|
}
|
||||||
|
|
||||||
oop oopDesc::forward_to_atomic(oop p) {
|
oop oopDesc::forward_to_atomic(oop p, atomic_memory_order order) {
|
||||||
markOop oldMark = mark_raw();
|
markOop oldMark = mark_raw();
|
||||||
markOop forwardPtrMark = markOopDesc::encode_pointer_as_mark(p);
|
markOop forwardPtrMark = markOopDesc::encode_pointer_as_mark(p);
|
||||||
markOop curMark;
|
markOop curMark;
|
||||||
|
@ -361,7 +361,7 @@ oop oopDesc::forward_to_atomic(oop p) {
|
||||||
assert(sizeof(markOop) == sizeof(intptr_t), "CAS below requires this.");
|
assert(sizeof(markOop) == sizeof(intptr_t), "CAS below requires this.");
|
||||||
|
|
||||||
while (!oldMark->is_marked()) {
|
while (!oldMark->is_marked()) {
|
||||||
curMark = cas_set_mark_raw(forwardPtrMark, oldMark);
|
curMark = cas_set_mark_raw(forwardPtrMark, oldMark, order);
|
||||||
assert(is_forwarded(), "object should have been forwarded");
|
assert(is_forwarded(), "object should have been forwarded");
|
||||||
if (curMark == oldMark) {
|
if (curMark == oldMark) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue