Path: blob/master/src/hotspot/share/gc/shenandoah/shenandoahClosures.hpp
40961 views
/*1* Copyright (c) 2019, 2020, Red Hat, Inc. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/23#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHCLOSURES_HPP24#define SHARE_GC_SHENANDOAH_SHENANDOAHCLOSURES_HPP2526#include "memory/iterator.hpp"27#include "oops/accessDecorators.hpp"28#include "runtime/handshake.hpp"2930class BarrierSetNMethod;31class ShenandoahBarrierSet;32class ShenandoahHeap;33class ShenandoahMarkingContext;34class ShenandoahHeapRegionSet;35class Thread;3637class ShenandoahForwardedIsAliveClosure: public BoolObjectClosure {38private:39ShenandoahMarkingContext* const _mark_context;40public:41inline ShenandoahForwardedIsAliveClosure();42inline bool do_object_b(oop obj);43};4445class ShenandoahIsAliveClosure: public BoolObjectClosure {46private:47ShenandoahMarkingContext* const _mark_context;48public:49inline ShenandoahIsAliveClosure();50inline bool do_object_b(oop obj);51};5253class ShenandoahIsAliveSelector : public StackObj {54private:55ShenandoahIsAliveClosure _alive_cl;56ShenandoahForwardedIsAliveClosure _fwd_alive_cl;57public:58inline BoolObjectClosure* is_alive_closure();59};6061class ShenandoahKeepAliveClosure : public OopClosure {62private:63ShenandoahBarrierSet* const _bs;64public:65inline ShenandoahKeepAliveClosure();66inline void do_oop(oop* p);67inline void do_oop(narrowOop* p);68private:69template <typename T>70void do_oop_work(T* p);71};7273class ShenandoahUpdateRefsClosure: public OopClosure {74private:75ShenandoahHeap* _heap;76public:77inline ShenandoahUpdateRefsClosure();78inline void do_oop(oop* p);79inline void do_oop(narrowOop* p);80private:81template <class T>82inline void do_oop_work(T* p);83};8485template <DecoratorSet MO = MO_UNORDERED>86class ShenandoahEvacuateUpdateMetadataClosure: public BasicOopIterateClosure {87private:88ShenandoahHeap* const _heap;89Thread* const _thread;90public:91inline ShenandoahEvacuateUpdateMetadataClosure();92inline void do_oop(oop* p);93inline void do_oop(narrowOop* p);9495private:96template <class T>97inline void do_oop_work(T* p);98};99100// Context free version, cannot cache calling thread101class ShenandoahEvacuateUpdateRootsClosure : public BasicOopIterateClosure {102private:103ShenandoahHeap* const _heap;104public:105inline ShenandoahEvacuateUpdateRootsClosure();106inline void do_oop(oop* p);107inline void do_oop(narrowOop* p);108protected:109template <typename T>110inline void do_oop_work(T* p, Thread* thr);111};112113class ShenandoahContextEvacuateUpdateRootsClosure : public ShenandoahEvacuateUpdateRootsClosure {114private:115Thread* const _thread;116public:117inline ShenandoahContextEvacuateUpdateRootsClosure();118inline void do_oop(oop* p);119inline void do_oop(narrowOop* p);120};121122template <bool CONCURRENT, typename IsAlive, typename KeepAlive>123class ShenandoahCleanUpdateWeakOopsClosure : public OopClosure {124private:125IsAlive* _is_alive;126KeepAlive* _keep_alive;127128public:129inline ShenandoahCleanUpdateWeakOopsClosure(IsAlive* is_alive, KeepAlive* keep_alive);130inline void do_oop(oop* p);131inline void do_oop(narrowOop* p);132};133134class ShenandoahCodeBlobAndDisarmClosure: public CodeBlobToOopClosure {135private:136BarrierSetNMethod* const _bs;137138public:139inline ShenandoahCodeBlobAndDisarmClosure(OopClosure* cl);140inline void do_code_blob(CodeBlob* cb);141};142143#ifdef ASSERT144class ShenandoahAssertNotForwardedClosure : public OopClosure {145private:146template <class T>147inline void do_oop_work(T* p);148149public:150inline void do_oop(narrowOop* p);151inline void do_oop(oop* p);152};153#endif // ASSERT154155#endif // SHARE_GC_SHENANDOAH_SHENANDOAHCLOSURES_HPP156157158