< prev index next > src/hotspot/share/gc/shenandoah/shenandoahClosures.inline.hpp
Print this page
/*
* Copyright (c) 2019, 2020, Red Hat, Inc. All rights reserved.
+ * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
//
// ========= Marking
//
! ShenandoahMarkRefsSuperClosure::ShenandoahMarkRefsSuperClosure(ShenandoahObjToScanQueue* q, ShenandoahReferenceProcessor* rp) :
ShenandoahSuperClosure(rp),
_queue(q),
_mark_context(ShenandoahHeap::heap()->marking_context()),
_weak(false) {}
template<class T, ShenandoahGenerationType GENERATION>
inline void ShenandoahMarkRefsSuperClosure::work(T* p) {
! ShenandoahMark::mark_through_ref<T, GENERATION>(p, _queue, _mark_context, _weak);
}
ShenandoahForwardedIsAliveClosure::ShenandoahForwardedIsAliveClosure() :
_mark_context(ShenandoahHeap::heap()->marking_context()) {}
//
// ========= Marking
//
! ShenandoahMarkRefsSuperClosure::ShenandoahMarkRefsSuperClosure(ShenandoahObjToScanQueue* q,
+ ShenandoahReferenceProcessor* rp,
+ ShenandoahObjToScanQueue* old_q) :
ShenandoahSuperClosure(rp),
_queue(q),
+ _old_queue(old_q),
_mark_context(ShenandoahHeap::heap()->marking_context()),
_weak(false) {}
template<class T, ShenandoahGenerationType GENERATION>
inline void ShenandoahMarkRefsSuperClosure::work(T* p) {
! ShenandoahMark::mark_through_ref<T, GENERATION>(p, _queue, _old_queue, _mark_context, _weak);
}
ShenandoahForwardedIsAliveClosure::ShenandoahForwardedIsAliveClosure() :
_mark_context(ShenandoahHeap::heap()->marking_context()) {}
if (CompressedOops::is_null(obj)) {
return false;
}
obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
shenandoah_assert_not_forwarded_if(nullptr, obj, ShenandoahHeap::heap()->is_concurrent_mark_in_progress());
! return _mark_context->is_marked(obj);
}
ShenandoahIsAliveClosure::ShenandoahIsAliveClosure() :
_mark_context(ShenandoahHeap::heap()->marking_context()) {}
bool ShenandoahIsAliveClosure::do_object_b(oop obj) {
if (CompressedOops::is_null(obj)) {
return false;
}
shenandoah_assert_not_forwarded(nullptr, obj);
! return _mark_context->is_marked(obj);
}
BoolObjectClosure* ShenandoahIsAliveSelector::is_alive_closure() {
return ShenandoahHeap::heap()->has_forwarded_objects() ?
reinterpret_cast<BoolObjectClosure*>(&_fwd_alive_cl) :
if (CompressedOops::is_null(obj)) {
return false;
}
obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
shenandoah_assert_not_forwarded_if(nullptr, obj, ShenandoahHeap::heap()->is_concurrent_mark_in_progress());
! return _mark_context->is_marked_or_old(obj);
}
ShenandoahIsAliveClosure::ShenandoahIsAliveClosure() :
_mark_context(ShenandoahHeap::heap()->marking_context()) {}
bool ShenandoahIsAliveClosure::do_object_b(oop obj) {
if (CompressedOops::is_null(obj)) {
return false;
}
shenandoah_assert_not_forwarded(nullptr, obj);
! return _mark_context->is_marked_or_old(obj);
}
BoolObjectClosure* ShenandoahIsAliveSelector::is_alive_closure() {
return ShenandoahHeap::heap()->has_forwarded_objects() ?
reinterpret_cast<BoolObjectClosure*>(&_fwd_alive_cl) :
_bs(ShenandoahBarrierSet::barrier_set()) {}
template <typename T>
void ShenandoahKeepAliveClosure::do_oop_work(T* p) {
assert(ShenandoahHeap::heap()->is_concurrent_mark_in_progress(), "Only for concurrent marking phase");
! assert(!ShenandoahHeap::heap()->has_forwarded_objects(), "Not expected");
T o = RawAccess<>::oop_load(p);
if (!CompressedOops::is_null(o)) {
oop obj = CompressedOops::decode_not_null(o);
_bs->enqueue(obj);
_bs(ShenandoahBarrierSet::barrier_set()) {}
template <typename T>
void ShenandoahKeepAliveClosure::do_oop_work(T* p) {
assert(ShenandoahHeap::heap()->is_concurrent_mark_in_progress(), "Only for concurrent marking phase");
! assert(ShenandoahHeap::heap()->is_concurrent_old_mark_in_progress() || !ShenandoahHeap::heap()->has_forwarded_objects(), "Not expected");
T o = RawAccess<>::oop_load(p);
if (!CompressedOops::is_null(o)) {
oop obj = CompressedOops::decode_not_null(o);
_bs->enqueue(obj);
//
// ========= Update References
//
template <ShenandoahGenerationType GENERATION>
! ShenandoahMarkUpdateRefsClosure<GENERATION>::ShenandoahMarkUpdateRefsClosure(ShenandoahObjToScanQueue* q, ShenandoahReferenceProcessor* rp) :
! ShenandoahMarkRefsSuperClosure(q, rp) {
assert(_heap->is_stw_gc_in_progress(), "Can only be used for STW GC");
}
template<ShenandoahGenerationType GENERATION>
template<class T>
//
// ========= Update References
//
template <ShenandoahGenerationType GENERATION>
! ShenandoahMarkUpdateRefsClosure<GENERATION>::ShenandoahMarkUpdateRefsClosure(ShenandoahObjToScanQueue* q,
! ShenandoahReferenceProcessor* rp,
+ ShenandoahObjToScanQueue* old_q) :
+ ShenandoahMarkRefsSuperClosure(q, rp, old_q) {
assert(_heap->is_stw_gc_in_progress(), "Can only be used for STW GC");
}
template<ShenandoahGenerationType GENERATION>
template<class T>
< prev index next >