Skip to content

Commit d99e1f6

Browse files
committedNov 9, 2020
8255991: Shenandoah: Apply 'weak' LRB on cmpxchg and xchg
Reviewed-by: shade
1 parent c7551c3 commit d99e1f6

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed
 

‎src/hotspot/cpu/x86/gc/shenandoah/c1/shenandoahBarrierSetC1_x86.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ LIR_Opr ShenandoahBarrierSetC1::atomic_xchg_at_resolved(LIRAccess& access, LIRIt
111111
__ xchg(access.resolved_addr(), result, result, LIR_OprFact::illegalOpr);
112112

113113
if (access.is_oop()) {
114-
result = load_reference_barrier(access.gen(), result, LIR_OprFact::addressConst(0), ShenandoahBarrierSet::AccessKind::NORMAL);
114+
ShenandoahBarrierSet::AccessKind kind = ShenandoahBarrierSet::access_kind(access.decorators(), access.type());
115+
result = load_reference_barrier(access.gen(), result, LIR_OprFact::addressConst(0), kind);
115116
LIR_Opr tmp = gen->new_register(type);
116117
__ move(result, tmp);
117118
result = tmp;

‎src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,8 @@ Node* ShenandoahBarrierSetC2::atomic_cmpxchg_val_at_resolved(C2AtomicParseAccess
644644
load_store = kit->gvn().transform(new DecodeNNode(load_store, load_store->get_ptr_type()));
645645
}
646646
#endif
647-
load_store = kit->gvn().transform(new ShenandoahLoadReferenceBarrierNode(NULL, load_store, ShenandoahBarrierSet::AccessKind::NORMAL));
647+
ShenandoahBarrierSet::AccessKind kind = ShenandoahBarrierSet::access_kind(access.decorators(), access.type());
648+
load_store = kit->gvn().transform(new ShenandoahLoadReferenceBarrierNode(NULL, load_store, kind));
648649
return load_store;
649650
}
650651
return BarrierSetC2::atomic_cmpxchg_val_at_resolved(access, expected_val, new_val, value_type);
@@ -712,7 +713,8 @@ Node* ShenandoahBarrierSetC2::atomic_xchg_at_resolved(C2AtomicParseAccess& acces
712713
}
713714
Node* result = BarrierSetC2::atomic_xchg_at_resolved(access, val, value_type);
714715
if (access.is_oop()) {
715-
result = kit->gvn().transform(new ShenandoahLoadReferenceBarrierNode(NULL, result, ShenandoahBarrierSet::AccessKind::NORMAL));
716+
ShenandoahBarrierSet::AccessKind kind = ShenandoahBarrierSet::access_kind(access.decorators(), access.type());
717+
result = kit->gvn().transform(new ShenandoahLoadReferenceBarrierNode(NULL, result, kind));
716718
shenandoah_write_barrier_pre(kit, false /* do_load */,
717719
NULL, NULL, max_juint, NULL, NULL,
718720
result /* pre_val */, T_OBJECT);

‎src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ inline oop ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_ato
255255

256256
// Note: We don't need a keep-alive-barrier here. We already enqueue any loaded reference for SATB anyway,
257257
// because it must be the previous value.
258-
res = ShenandoahBarrierSet::barrier_set()->load_reference_barrier(res);
258+
res = ShenandoahBarrierSet::barrier_set()->load_reference_barrier<decorators, T>(res, NULL);
259259
bs->satb_enqueue(res);
260260
return res;
261261
}
@@ -281,7 +281,7 @@ inline oop ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_ato
281281

282282
// Note: We don't need a keep-alive-barrier here. We already enqueue any loaded reference for SATB anyway,
283283
// because it must be the previous value.
284-
previous = ShenandoahBarrierSet::barrier_set()->load_reference_barrier(previous);
284+
previous = ShenandoahBarrierSet::barrier_set()->load_reference_barrier<decorators, T>(previous, NULL);
285285
bs->satb_enqueue(previous);
286286
return previous;
287287
}

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on Nov 9, 2020

@openjdk-notifier[bot]
Please sign in to comment.