--- a/hotspot/src/share/vm/memory/genOopClosures.hpp Fri Apr 11 09:56:35 2008 -0400
+++ b/hotspot/src/share/vm/memory/genOopClosures.hpp Sun Apr 13 17:43:42 2008 -0400
@@ -28,6 +28,11 @@
class CardTableModRefBS;
class DefNewGeneration;
+template<class E> class GenericTaskQueue;
+typedef GenericTaskQueue<oop> OopTaskQueue;
+template<class E> class GenericTaskQueueSet;
+typedef GenericTaskQueueSet<oop> OopTaskQueueSet;
+
// Closure for iterating roots from a particular generation
// Note: all classes deriving from this MUST call this do_barrier
// method at the end of their own do_oop method!
@@ -35,13 +40,13 @@
class OopsInGenClosure : public OopClosure {
private:
- Generation* _orig_gen; // generation originally set in ctor
- Generation* _gen; // generation being scanned
+ Generation* _orig_gen; // generation originally set in ctor
+ Generation* _gen; // generation being scanned
protected:
// Some subtypes need access.
- HeapWord* _gen_boundary; // start of generation
- CardTableRS* _rs; // remembered set
+ HeapWord* _gen_boundary; // start of generation
+ CardTableRS* _rs; // remembered set
// For assertions
Generation* generation() { return _gen; }
@@ -49,7 +54,7 @@
// Derived classes that modify oops so that they might be old-to-young
// pointers must call the method below.
- void do_barrier(oop* p);
+ template <class T> void do_barrier(T* p);
public:
OopsInGenClosure() : OopClosure(NULL),
@@ -75,14 +80,17 @@
// This closure will perform barrier store calls for ALL
// pointers in scanned oops.
class ScanClosure: public OopsInGenClosure {
-protected:
+ protected:
DefNewGeneration* _g;
- HeapWord* _boundary;
- bool _gc_barrier;
-public:
+ HeapWord* _boundary;
+ bool _gc_barrier;
+ template <class T> inline void do_oop_work(T* p);
+ public:
ScanClosure(DefNewGeneration* g, bool gc_barrier);
- void do_oop(oop* p);
- void do_oop_nv(oop* p);
+ virtual void do_oop(oop* p);
+ virtual void do_oop(narrowOop* p);
+ inline void do_oop_nv(oop* p);
+ inline void do_oop_nv(narrowOop* p);
bool do_header() { return false; }
Prefetch::style prefetch_style() {
return Prefetch::do_write;
@@ -95,14 +103,17 @@
// pointers into the DefNewGeneration. This is less
// precise, but faster, than a ScanClosure
class FastScanClosure: public OopsInGenClosure {
-protected:
+ protected:
DefNewGeneration* _g;
- HeapWord* _boundary;
- bool _gc_barrier;
-public:
+ HeapWord* _boundary;
+ bool _gc_barrier;
+ template <class T> inline void do_oop_work(T* p);
+ public:
FastScanClosure(DefNewGeneration* g, bool gc_barrier);
- void do_oop(oop* p);
- void do_oop_nv(oop* p);
+ virtual void do_oop(oop* p);
+ virtual void do_oop(narrowOop* p);
+ inline void do_oop_nv(oop* p);
+ inline void do_oop_nv(narrowOop* p);
bool do_header() { return false; }
Prefetch::style prefetch_style() {
return Prefetch::do_write;
@@ -110,19 +121,27 @@
};
class FilteringClosure: public OopClosure {
- HeapWord* _boundary;
+ private:
+ HeapWord* _boundary;
OopClosure* _cl;
-public:
+ protected:
+ template <class T> inline void do_oop_work(T* p) {
+ T heap_oop = oopDesc::load_heap_oop(p);
+ if (!oopDesc::is_null(heap_oop)) {
+ oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
+ if ((HeapWord*)obj < _boundary) {
+ _cl->do_oop(p);
+ }
+ }
+ }
+ public:
FilteringClosure(HeapWord* boundary, OopClosure* cl) :
OopClosure(cl->_ref_processor), _boundary(boundary),
_cl(cl) {}
- void do_oop(oop* p);
- void do_oop_nv(oop* p) {
- oop obj = *p;
- if ((HeapWord*)obj < _boundary && obj != NULL) {
- _cl->do_oop(p);
- }
- }
+ virtual void do_oop(oop* p);
+ virtual void do_oop(narrowOop* p);
+ inline void do_oop_nv(oop* p) { FilteringClosure::do_oop_work(p); }
+ inline void do_oop_nv(narrowOop* p) { FilteringClosure::do_oop_work(p); }
bool do_header() { return false; }
};
@@ -131,19 +150,26 @@
// OopsInGenClosure -- weak references are processed all
// at once, with no notion of which generation they were in.
class ScanWeakRefClosure: public OopClosure {
-protected:
- DefNewGeneration* _g;
- HeapWord* _boundary;
-public:
+ protected:
+ DefNewGeneration* _g;
+ HeapWord* _boundary;
+ template <class T> inline void do_oop_work(T* p);
+ public:
ScanWeakRefClosure(DefNewGeneration* g);
- void do_oop(oop* p);
- void do_oop_nv(oop* p);
+ virtual void do_oop(oop* p);
+ virtual void do_oop(narrowOop* p);
+ inline void do_oop_nv(oop* p);
+ inline void do_oop_nv(narrowOop* p);
};
class VerifyOopClosure: public OopClosure {
-public:
- void do_oop(oop* p) {
- guarantee((*p)->is_oop_or_null(), "invalid oop");
+ protected:
+ template <class T> inline void do_oop_work(T* p) {
+ oop obj = oopDesc::load_decode_heap_oop(p);
+ guarantee(obj->is_oop_or_null(), "invalid oop");
}
+ public:
+ virtual void do_oop(oop* p);
+ virtual void do_oop(narrowOop* p);
static VerifyOopClosure verify_oop;
};