< prev index next >

src/hotspot/share/gc/shared/genOopClosures.hpp

Print this page




  41 
  42 class OopsInGenClosure : public OopIterateClosure {
  43  private:
  44   Generation*  _orig_gen;     // generation originally set in ctor
  45   Generation*  _gen;          // generation being scanned
  46 
  47  protected:
  48   // Some subtypes need access.
  49   HeapWord*    _gen_boundary; // start of generation
  50   CardTableRS* _rs;           // remembered set
  51 
  52   // For assertions
  53   Generation* generation() { return _gen; }
  54   CardTableRS* rs() { return _rs; }
  55 
  56   // Derived classes that modify oops so that they might be old-to-young
  57   // pointers must call the method below.
  58   template <class T> void do_barrier(T* p);
  59 
  60  public:
  61   OopsInGenClosure() : OopIterateClosure(NULL),
  62     _orig_gen(NULL), _gen(NULL), _gen_boundary(NULL), _rs(NULL) {};
  63 
  64   OopsInGenClosure(Generation* gen);
  65   void set_generation(Generation* gen);
  66 
  67   void reset_generation() { _gen = _orig_gen; }
  68 
  69   // Problem with static closures: must have _gen_boundary set at some point,
  70   // but cannot do this until after the heap is initialized.
  71   void set_orig_generation(Generation* gen) {
  72     _orig_gen = gen;
  73     set_generation(gen);
  74   }
  75 
  76   HeapWord* gen_boundary() { return _gen_boundary; }
  77 
  78 };
  79 
  80 class BasicOopsInGenClosure: public OopsInGenClosure {
  81  public:
  82   BasicOopsInGenClosure() : OopsInGenClosure() {}
  83   BasicOopsInGenClosure(Generation* gen);
  84 
  85   virtual bool do_metadata() { return false; }
  86   virtual void do_klass(Klass* k) { ShouldNotReachHere(); }
  87   virtual void do_cld(ClassLoaderData* cld) { ShouldNotReachHere(); }
  88 };
  89 
  90 // Super class for scan closures. It contains code to dirty scanned class loader data.
  91 class OopsInClassLoaderDataOrGenClosure: public BasicOopsInGenClosure {
  92   ClassLoaderData* _scanned_cld;
  93  public:
  94   OopsInClassLoaderDataOrGenClosure(Generation* g) : BasicOopsInGenClosure(g), _scanned_cld(NULL) {}
  95   void set_scanned_cld(ClassLoaderData* cld) {
  96     assert(cld == NULL || _scanned_cld == NULL, "Must be");
  97     _scanned_cld = cld;
  98   }
  99   bool is_scanning_a_cld() { return _scanned_cld != NULL; }
 100   void do_cld_barrier();
 101 };
 102 




  41 
  42 class OopsInGenClosure : public OopIterateClosure {
  43  private:
  44   Generation*  _orig_gen;     // generation originally set in ctor
  45   Generation*  _gen;          // generation being scanned
  46 
  47  protected:
  48   // Some subtypes need access.
  49   HeapWord*    _gen_boundary; // start of generation
  50   CardTableRS* _rs;           // remembered set
  51 
  52   // For assertions
  53   Generation* generation() { return _gen; }
  54   CardTableRS* rs() { return _rs; }
  55 
  56   // Derived classes that modify oops so that they might be old-to-young
  57   // pointers must call the method below.
  58   template <class T> void do_barrier(T* p);
  59 
  60  public:



  61   OopsInGenClosure(Generation* gen);
  62   void set_generation(Generation* gen);
  63 
  64   void reset_generation() { _gen = _orig_gen; }
  65 







  66   HeapWord* gen_boundary() { return _gen_boundary; }

  67 };
  68 
  69 class BasicOopsInGenClosure: public OopsInGenClosure {
  70  public:

  71   BasicOopsInGenClosure(Generation* gen);
  72 
  73   virtual bool do_metadata() { return false; }
  74   virtual void do_klass(Klass* k) { ShouldNotReachHere(); }
  75   virtual void do_cld(ClassLoaderData* cld) { ShouldNotReachHere(); }
  76 };
  77 
  78 // Super class for scan closures. It contains code to dirty scanned class loader data.
  79 class OopsInClassLoaderDataOrGenClosure: public BasicOopsInGenClosure {
  80   ClassLoaderData* _scanned_cld;
  81  public:
  82   OopsInClassLoaderDataOrGenClosure(Generation* g) : BasicOopsInGenClosure(g), _scanned_cld(NULL) {}
  83   void set_scanned_cld(ClassLoaderData* cld) {
  84     assert(cld == NULL || _scanned_cld == NULL, "Must be");
  85     _scanned_cld = cld;
  86   }
  87   bool is_scanning_a_cld() { return _scanned_cld != NULL; }
  88   void do_cld_barrier();
  89 };
  90 


< prev index next >