< prev index next >
src/hotspot/share/gc/shenandoah/shenandoahTraversalGC.inline.hpp
Print this page
rev 56680 : 8232730: Shenandoah: Traversal should not CAS the roots
Reviewed-by: XXX
*** 33,48 ****
#include "gc/shenandoah/shenandoahTaskqueue.hpp"
#include "gc/shenandoah/shenandoahTaskqueue.inline.hpp"
#include "oops/compressedOops.inline.hpp"
#include "oops/oop.inline.hpp"
! template <class T, bool STRING_DEDUP, bool DEGEN>
void ShenandoahTraversalGC::process_oop(T* p, Thread* thread, ShenandoahObjToScanQueue* queue, ShenandoahMarkingContext* const mark_context) {
T o = RawAccess<>::oop_load(p);
if (!CompressedOops::is_null(o)) {
oop obj = CompressedOops::decode_not_null(o);
if (DEGEN) {
oop forw = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
if (obj != forw) {
// Update reference.
RawAccess<IS_NOT_NULL>::oop_store(p, forw);
}
--- 33,49 ----
#include "gc/shenandoah/shenandoahTaskqueue.hpp"
#include "gc/shenandoah/shenandoahTaskqueue.inline.hpp"
#include "oops/compressedOops.inline.hpp"
#include "oops/oop.inline.hpp"
! template <class T, bool STRING_DEDUP, bool DEGEN, bool ATOMIC_UPDATE>
void ShenandoahTraversalGC::process_oop(T* p, Thread* thread, ShenandoahObjToScanQueue* queue, ShenandoahMarkingContext* const mark_context) {
T o = RawAccess<>::oop_load(p);
if (!CompressedOops::is_null(o)) {
oop obj = CompressedOops::decode_not_null(o);
if (DEGEN) {
+ assert(!ATOMIC_UPDATE, "Degen path assumes non-atomic updates");
oop forw = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
if (obj != forw) {
// Update reference.
RawAccess<IS_NOT_NULL>::oop_store(p, forw);
}
*** 52,62 ****
--- 53,67 ----
if (obj == forw) {
forw = _heap->evacuate_object(obj, thread);
}
shenandoah_assert_forwarded_except(p, obj, _heap->cancelled_gc());
// Update reference.
+ if (ATOMIC_UPDATE) {
ShenandoahHeap::cas_oop(forw, p, obj);
+ } else {
+ RawAccess<IS_NOT_NULL>::oop_store(p, forw);
+ }
obj = forw;
}
shenandoah_assert_not_forwarded(p, obj);
shenandoah_assert_not_in_cset_except(p, obj, _heap->cancelled_gc());
< prev index next >