mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-04 20:18:49 +00:00
8240948: Shenandoah: cleanup not-forwarded-objects paths after JDK-8240868
Reviewed-by: rkennke
This commit is contained in:
parent
de5208e3c0
commit
3ee99ca1d7
@ -265,6 +265,8 @@ bool ShenandoahBarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_arraycopy
|
||||
|
||||
template <class T, bool HAS_FWD, bool EVAC, bool ENQUEUE>
|
||||
void ShenandoahBarrierSet::arraycopy_work(T* src, size_t count) {
|
||||
assert(HAS_FWD == _heap->has_forwarded_objects(), "Forwarded object status is sane");
|
||||
|
||||
Thread* thread = Thread::current();
|
||||
SATBMarkQueue& queue = ShenandoahThreadLocalData::satb_mark_queue(thread);
|
||||
ShenandoahMarkingContext* ctx = _heap->marking_context();
|
||||
@ -275,7 +277,6 @@ void ShenandoahBarrierSet::arraycopy_work(T* src, size_t count) {
|
||||
if (!CompressedOops::is_null(o)) {
|
||||
oop obj = CompressedOops::decode_not_null(o);
|
||||
if (HAS_FWD && cset->is_in(obj)) {
|
||||
assert(_heap->has_forwarded_objects(), "only get here with forwarded objects");
|
||||
oop fwd = resolve_forwarded_not_null(obj);
|
||||
if (EVAC && obj == fwd) {
|
||||
fwd = _heap->evacuate_object(obj, thread);
|
||||
@ -295,11 +296,7 @@ template <class T>
|
||||
void ShenandoahBarrierSet::arraycopy_pre_work(T* src, T* dst, size_t count) {
|
||||
if (_heap->is_concurrent_mark_in_progress() &&
|
||||
!_heap->marking_context()->allocated_after_mark_start(reinterpret_cast<HeapWord*>(dst))) {
|
||||
if (_heap->has_forwarded_objects()) {
|
||||
arraycopy_work<T, true, false, true>(dst, count);
|
||||
} else {
|
||||
arraycopy_work<T, false, false, true>(dst, count);
|
||||
}
|
||||
arraycopy_work<T, false, false, true>(dst, count);
|
||||
}
|
||||
|
||||
if (_heap->has_forwarded_objects()) {
|
||||
|
||||
@ -698,27 +698,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class ShenandoahPrecleanKeepAliveUpdateClosure : public OopClosure {
|
||||
private:
|
||||
ShenandoahObjToScanQueue* _queue;
|
||||
ShenandoahHeap* _heap;
|
||||
ShenandoahMarkingContext* const _mark_context;
|
||||
|
||||
template <class T>
|
||||
inline void do_oop_work(T* p) {
|
||||
ShenandoahConcurrentMark::mark_through_ref<T, CONCURRENT, NO_DEDUP>(p, _heap, _queue, _mark_context);
|
||||
}
|
||||
|
||||
public:
|
||||
ShenandoahPrecleanKeepAliveUpdateClosure(ShenandoahObjToScanQueue* q) :
|
||||
_queue(q),
|
||||
_heap(ShenandoahHeap::heap()),
|
||||
_mark_context(_heap->marking_context()) {}
|
||||
|
||||
void do_oop(narrowOop* p) { do_oop_work(p); }
|
||||
void do_oop(oop* p) { do_oop_work(p); }
|
||||
};
|
||||
|
||||
class ShenandoahPrecleanTask : public AbstractGangTask {
|
||||
private:
|
||||
ReferenceProcessor* _rp;
|
||||
@ -733,27 +712,19 @@ public:
|
||||
ShenandoahParallelWorkerSession worker_session(worker_id);
|
||||
|
||||
ShenandoahHeap* sh = ShenandoahHeap::heap();
|
||||
assert(!sh->has_forwarded_objects(), "No forwarded objects expected here");
|
||||
|
||||
ShenandoahObjToScanQueue* q = sh->concurrent_mark()->get_queue(worker_id);
|
||||
|
||||
ShenandoahCancelledGCYieldClosure yield;
|
||||
ShenandoahPrecleanCompleteGCClosure complete_gc;
|
||||
|
||||
if (sh->has_forwarded_objects()) {
|
||||
ShenandoahForwardedIsAliveClosure is_alive;
|
||||
ShenandoahPrecleanKeepAliveUpdateClosure keep_alive(q);
|
||||
ResourceMark rm;
|
||||
_rp->preclean_discovered_references(&is_alive, &keep_alive,
|
||||
&complete_gc, &yield,
|
||||
NULL);
|
||||
} else {
|
||||
ShenandoahIsAliveClosure is_alive;
|
||||
ShenandoahCMKeepAliveClosure keep_alive(q);
|
||||
ResourceMark rm;
|
||||
_rp->preclean_discovered_references(&is_alive, &keep_alive,
|
||||
&complete_gc, &yield,
|
||||
NULL);
|
||||
}
|
||||
ShenandoahIsAliveClosure is_alive;
|
||||
ShenandoahCMKeepAliveClosure keep_alive(q);
|
||||
ResourceMark rm;
|
||||
_rp->preclean_discovered_references(&is_alive, &keep_alive,
|
||||
&complete_gc, &yield,
|
||||
NULL);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -1384,6 +1384,7 @@ void ShenandoahHeap::op_init_mark() {
|
||||
|
||||
assert(marking_context()->is_bitmap_clear(), "need clear marking bitmap");
|
||||
assert(!marking_context()->is_complete(), "should not be complete");
|
||||
assert(!has_forwarded_objects(), "No forwarded objects on this path");
|
||||
|
||||
if (ShenandoahVerify) {
|
||||
verifier()->verify_before_concmark();
|
||||
@ -1450,6 +1451,7 @@ public:
|
||||
|
||||
void ShenandoahHeap::op_final_mark() {
|
||||
assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Should be at safepoint");
|
||||
assert(!has_forwarded_objects(), "No forwarded objects on this path");
|
||||
|
||||
// It is critical that we
|
||||
// evacuate roots right after finishing marking, so that we don't
|
||||
@ -1464,16 +1466,6 @@ void ShenandoahHeap::op_final_mark() {
|
||||
|
||||
parallel_cleaning(false /* full gc*/);
|
||||
|
||||
if (has_forwarded_objects()) {
|
||||
// Degen may be caused by failed evacuation of roots
|
||||
if (is_degenerated_gc_in_progress()) {
|
||||
concurrent_mark()->update_roots(ShenandoahPhaseTimings::degen_gc_update_roots);
|
||||
} else {
|
||||
concurrent_mark()->update_thread_roots(ShenandoahPhaseTimings::update_roots);
|
||||
}
|
||||
set_has_forwarded_objects(false);
|
||||
}
|
||||
|
||||
if (ShenandoahVerify) {
|
||||
verifier()->verify_roots_no_forwarded();
|
||||
}
|
||||
|
||||
@ -811,29 +811,16 @@ void ShenandoahVerifier::verify_generic(VerifyOption vo) {
|
||||
}
|
||||
|
||||
void ShenandoahVerifier::verify_before_concmark() {
|
||||
if (_heap->has_forwarded_objects()) {
|
||||
verify_at_safepoint(
|
||||
"Before Mark",
|
||||
_verify_forwarded_allow, // may have forwarded references
|
||||
_verify_marked_disable, // do not verify marked: lots ot time wasted checking dead allocations
|
||||
_verify_cset_forwarded, // allow forwarded references to cset
|
||||
_verify_liveness_disable, // no reliable liveness data
|
||||
_verify_regions_notrash, // no trash regions
|
||||
_verify_gcstate_forwarded, // there are forwarded objects
|
||||
_verify_all_weak_roots
|
||||
);
|
||||
} else {
|
||||
verify_at_safepoint(
|
||||
"Before Mark",
|
||||
_verify_forwarded_none, // UR should have fixed up
|
||||
_verify_marked_disable, // do not verify marked: lots ot time wasted checking dead allocations
|
||||
_verify_cset_none, // UR should have fixed this
|
||||
_verify_liveness_disable, // no reliable liveness data
|
||||
_verify_regions_notrash, // no trash regions
|
||||
_verify_gcstate_stable, // there are no forwarded objects
|
||||
_verify_all_weak_roots
|
||||
);
|
||||
}
|
||||
"Before Mark",
|
||||
_verify_forwarded_none, // UR should have fixed up
|
||||
_verify_marked_disable, // do not verify marked: lots ot time wasted checking dead allocations
|
||||
_verify_cset_none, // UR should have fixed this
|
||||
_verify_liveness_disable, // no reliable liveness data
|
||||
_verify_regions_notrash, // no trash regions
|
||||
_verify_gcstate_stable, // there are no forwarded objects
|
||||
_verify_all_weak_roots
|
||||
);
|
||||
}
|
||||
|
||||
void ShenandoahVerifier::verify_after_concmark() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user