mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
8046670: Make CMS metadata aware closures applicable for other collectors
Reviewed-by: ehelin, mgerdin
This commit is contained in:
parent
4241d1c605
commit
fd43773a10
11 changed files with 139 additions and 123 deletions
|
@ -26,6 +26,7 @@
|
|||
#define SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSOOPCLOSURES_HPP
|
||||
|
||||
#include "memory/genOopClosures.hpp"
|
||||
#include "memory/iterator.hpp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// Closures used by ConcurrentMarkSweepGeneration's collector
|
||||
|
@ -48,33 +49,13 @@ class Par_MarkFromRootsClosure;
|
|||
} \
|
||||
}
|
||||
|
||||
// Applies the given oop closure to all oops in all klasses visited.
|
||||
class CMKlassClosure : public KlassClosure {
|
||||
friend class CMSOopClosure;
|
||||
friend class CMSOopsInGenClosure;
|
||||
|
||||
OopClosure* _oop_closure;
|
||||
|
||||
// Used when _oop_closure couldn't be set in an initialization list.
|
||||
void initialize(OopClosure* oop_closure) {
|
||||
assert(_oop_closure == NULL, "Should only be called once");
|
||||
_oop_closure = oop_closure;
|
||||
}
|
||||
// TODO: This duplication of the MetadataAwareOopClosure class is only needed
|
||||
// because some CMS OopClosures derive from OopsInGenClosure. It would be
|
||||
// good to get rid of them completely.
|
||||
class MetadataAwareOopsInGenClosure: public OopsInGenClosure {
|
||||
KlassToOopClosure _klass_closure;
|
||||
public:
|
||||
CMKlassClosure(OopClosure* oop_closure = NULL) : _oop_closure(oop_closure) { }
|
||||
|
||||
void do_klass(Klass* k);
|
||||
};
|
||||
|
||||
// The base class for all CMS marking closures.
|
||||
// It's used to proxy through the metadata to the oops defined in them.
|
||||
class CMSOopClosure: public ExtendedOopClosure {
|
||||
CMKlassClosure _klass_closure;
|
||||
public:
|
||||
CMSOopClosure() : ExtendedOopClosure() {
|
||||
_klass_closure.initialize(this);
|
||||
}
|
||||
CMSOopClosure(ReferenceProcessor* rp) : ExtendedOopClosure(rp) {
|
||||
MetadataAwareOopsInGenClosure() {
|
||||
_klass_closure.initialize(this);
|
||||
}
|
||||
|
||||
|
@ -87,26 +68,7 @@ class CMSOopClosure: public ExtendedOopClosure {
|
|||
virtual void do_class_loader_data(ClassLoaderData* cld);
|
||||
};
|
||||
|
||||
// TODO: This duplication of the CMSOopClosure class is only needed because
|
||||
// some CMS OopClosures derive from OopsInGenClosure. It would be good
|
||||
// to get rid of them completely.
|
||||
class CMSOopsInGenClosure: public OopsInGenClosure {
|
||||
CMKlassClosure _klass_closure;
|
||||
public:
|
||||
CMSOopsInGenClosure() {
|
||||
_klass_closure.initialize(this);
|
||||
}
|
||||
|
||||
virtual bool do_metadata() { return do_metadata_nv(); }
|
||||
inline bool do_metadata_nv() { return true; }
|
||||
|
||||
virtual void do_klass(Klass* k);
|
||||
void do_klass_nv(Klass* k);
|
||||
|
||||
virtual void do_class_loader_data(ClassLoaderData* cld);
|
||||
};
|
||||
|
||||
class MarkRefsIntoClosure: public CMSOopsInGenClosure {
|
||||
class MarkRefsIntoClosure: public MetadataAwareOopsInGenClosure {
|
||||
private:
|
||||
const MemRegion _span;
|
||||
CMSBitMap* _bitMap;
|
||||
|
@ -118,7 +80,7 @@ class MarkRefsIntoClosure: public CMSOopsInGenClosure {
|
|||
virtual void do_oop(narrowOop* p);
|
||||
};
|
||||
|
||||
class Par_MarkRefsIntoClosure: public CMSOopsInGenClosure {
|
||||
class Par_MarkRefsIntoClosure: public MetadataAwareOopsInGenClosure {
|
||||
private:
|
||||
const MemRegion _span;
|
||||
CMSBitMap* _bitMap;
|
||||
|
@ -132,7 +94,7 @@ class Par_MarkRefsIntoClosure: public CMSOopsInGenClosure {
|
|||
|
||||
// A variant of the above used in certain kinds of CMS
|
||||
// marking verification.
|
||||
class MarkRefsIntoVerifyClosure: public CMSOopsInGenClosure {
|
||||
class MarkRefsIntoVerifyClosure: public MetadataAwareOopsInGenClosure {
|
||||
private:
|
||||
const MemRegion _span;
|
||||
CMSBitMap* _verification_bm;
|
||||
|
@ -147,7 +109,7 @@ class MarkRefsIntoVerifyClosure: public CMSOopsInGenClosure {
|
|||
};
|
||||
|
||||
// The non-parallel version (the parallel version appears further below).
|
||||
class PushAndMarkClosure: public CMSOopClosure {
|
||||
class PushAndMarkClosure: public MetadataAwareOopClosure {
|
||||
private:
|
||||
CMSCollector* _collector;
|
||||
MemRegion _span;
|
||||
|
@ -177,7 +139,7 @@ class PushAndMarkClosure: public CMSOopClosure {
|
|||
// synchronization (for instance, via CAS). The marking stack
|
||||
// used in the non-parallel case above is here replaced with
|
||||
// an OopTaskQueue structure to allow efficient work stealing.
|
||||
class Par_PushAndMarkClosure: public CMSOopClosure {
|
||||
class Par_PushAndMarkClosure: public MetadataAwareOopClosure {
|
||||
private:
|
||||
CMSCollector* _collector;
|
||||
MemRegion _span;
|
||||
|
@ -198,7 +160,7 @@ class Par_PushAndMarkClosure: public CMSOopClosure {
|
|||
};
|
||||
|
||||
// The non-parallel version (the parallel version appears further below).
|
||||
class MarkRefsIntoAndScanClosure: public CMSOopsInGenClosure {
|
||||
class MarkRefsIntoAndScanClosure: public MetadataAwareOopsInGenClosure {
|
||||
private:
|
||||
MemRegion _span;
|
||||
CMSBitMap* _bit_map;
|
||||
|
@ -239,7 +201,7 @@ class MarkRefsIntoAndScanClosure: public CMSOopsInGenClosure {
|
|||
// stack and the bitMap are shared, so access needs to be suitably
|
||||
// synchronized. An OopTaskQueue structure, supporting efficient
|
||||
// work stealing, replaces a CMSMarkStack for storing grey objects.
|
||||
class Par_MarkRefsIntoAndScanClosure: public CMSOopsInGenClosure {
|
||||
class Par_MarkRefsIntoAndScanClosure: public MetadataAwareOopsInGenClosure {
|
||||
private:
|
||||
MemRegion _span;
|
||||
CMSBitMap* _bit_map;
|
||||
|
@ -265,7 +227,7 @@ class Par_MarkRefsIntoAndScanClosure: public CMSOopsInGenClosure {
|
|||
// This closure is used during the concurrent marking phase
|
||||
// following the first checkpoint. Its use is buried in
|
||||
// the closure MarkFromRootsClosure.
|
||||
class PushOrMarkClosure: public CMSOopClosure {
|
||||
class PushOrMarkClosure: public MetadataAwareOopClosure {
|
||||
private:
|
||||
CMSCollector* _collector;
|
||||
MemRegion _span;
|
||||
|
@ -298,7 +260,7 @@ class PushOrMarkClosure: public CMSOopClosure {
|
|||
// This closure is used during the concurrent marking phase
|
||||
// following the first checkpoint. Its use is buried in
|
||||
// the closure Par_MarkFromRootsClosure.
|
||||
class Par_PushOrMarkClosure: public CMSOopClosure {
|
||||
class Par_PushOrMarkClosure: public MetadataAwareOopClosure {
|
||||
private:
|
||||
CMSCollector* _collector;
|
||||
MemRegion _whole_span;
|
||||
|
@ -338,7 +300,7 @@ class Par_PushOrMarkClosure: public CMSOopClosure {
|
|||
// processing phase of the CMS final checkpoint step, as
|
||||
// well as during the concurrent precleaning of the discovered
|
||||
// reference lists.
|
||||
class CMSKeepAliveClosure: public CMSOopClosure {
|
||||
class CMSKeepAliveClosure: public MetadataAwareOopClosure {
|
||||
private:
|
||||
CMSCollector* _collector;
|
||||
const MemRegion _span;
|
||||
|
@ -358,7 +320,7 @@ class CMSKeepAliveClosure: public CMSOopClosure {
|
|||
inline void do_oop_nv(narrowOop* p) { CMSKeepAliveClosure::do_oop_work(p); }
|
||||
};
|
||||
|
||||
class CMSInnerParMarkAndPushClosure: public CMSOopClosure {
|
||||
class CMSInnerParMarkAndPushClosure: public MetadataAwareOopClosure {
|
||||
private:
|
||||
CMSCollector* _collector;
|
||||
MemRegion _span;
|
||||
|
@ -379,7 +341,7 @@ class CMSInnerParMarkAndPushClosure: public CMSOopClosure {
|
|||
// A parallel (MT) version of the above, used when
|
||||
// reference processing is parallel; the only difference
|
||||
// is in the do_oop method.
|
||||
class CMSParKeepAliveClosure: public CMSOopClosure {
|
||||
class CMSParKeepAliveClosure: public MetadataAwareOopClosure {
|
||||
private:
|
||||
MemRegion _span;
|
||||
OopTaskQueue* _work_queue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue