src/share/vm/memory/iterator.hpp

changeset 6992
2c6ef90f030a
parent 6982
4c1b88a53c74
child 7535
7ae4e26cb1e0
child 9661
379a59bf685d
     1.1 --- a/src/share/vm/memory/iterator.hpp	Tue Jul 01 09:03:55 2014 +0200
     1.2 +++ b/src/share/vm/memory/iterator.hpp	Mon Jul 07 10:12:40 2014 +0200
     1.3 @@ -84,8 +84,8 @@
     1.4    //
     1.5    // Providing default implementations of the _nv functions unfortunately
     1.6    // removes the compile-time safeness, but reduces the clutter for the
     1.7 -  // ExtendedOopClosures that don't need to walk the metadata. Currently,
     1.8 -  // only CMS needs these.
     1.9 +  // ExtendedOopClosures that don't need to walk the metadata.
    1.10 +  // Currently, only CMS and G1 need these.
    1.11  
    1.12    virtual bool do_metadata() { return do_metadata_nv(); }
    1.13    bool do_metadata_v()       { return do_metadata(); }
    1.14 @@ -145,15 +145,16 @@
    1.15      _oop_closure = oop_closure;
    1.16    }
    1.17  
    1.18 -public:
    1.19 + public:
    1.20    KlassToOopClosure(OopClosure* oop_closure = NULL) : _oop_closure(oop_closure) {}
    1.21 +
    1.22    virtual void do_klass(Klass* k);
    1.23  };
    1.24  
    1.25  class CLDToOopClosure : public CLDClosure {
    1.26 -  OopClosure* _oop_closure;
    1.27 +  OopClosure*       _oop_closure;
    1.28    KlassToOopClosure _klass_closure;
    1.29 -  bool _must_claim_cld;
    1.30 +  bool              _must_claim_cld;
    1.31  
    1.32   public:
    1.33    CLDToOopClosure(OopClosure* oop_closure, bool must_claim_cld = true) :
    1.34 @@ -164,6 +165,23 @@
    1.35    void do_cld(ClassLoaderData* cld);
    1.36  };
    1.37  
    1.38 +class CLDToKlassAndOopClosure : public CLDClosure {
    1.39 +  friend class SharedHeap;
    1.40 +  friend class G1CollectedHeap;
    1.41 + protected:
    1.42 +  OopClosure*   _oop_closure;
    1.43 +  KlassClosure* _klass_closure;
    1.44 +  bool          _must_claim_cld;
    1.45 + public:
    1.46 +  CLDToKlassAndOopClosure(KlassClosure* klass_closure,
    1.47 +                          OopClosure* oop_closure,
    1.48 +                          bool must_claim_cld) :
    1.49 +                              _oop_closure(oop_closure),
    1.50 +                              _klass_closure(klass_closure),
    1.51 +                              _must_claim_cld(must_claim_cld) {}
    1.52 +  void do_cld(ClassLoaderData* cld);
    1.53 +};
    1.54 +
    1.55  // The base class for all concurrent marking closures,
    1.56  // that participates in class unloading.
    1.57  // It's used to proxy through the metadata to the oops defined in them.
    1.58 @@ -265,14 +283,26 @@
    1.59    virtual void do_code_blob(CodeBlob* cb) = 0;
    1.60  };
    1.61  
    1.62 +// Applies an oop closure to all ref fields in code blobs
    1.63 +// iterated over in an object iteration.
    1.64 +class CodeBlobToOopClosure : public CodeBlobClosure {
    1.65 +  OopClosure* _cl;
    1.66 +  bool _fix_relocations;
    1.67 + protected:
    1.68 +  void do_nmethod(nmethod* nm);
    1.69 + public:
    1.70 +  CodeBlobToOopClosure(OopClosure* cl, bool fix_relocations) : _cl(cl), _fix_relocations(fix_relocations) {}
    1.71 +  virtual void do_code_blob(CodeBlob* cb);
    1.72  
    1.73 -class MarkingCodeBlobClosure : public CodeBlobClosure {
    1.74 +  const static bool FixRelocations = true;
    1.75 +};
    1.76 +
    1.77 +class MarkingCodeBlobClosure : public CodeBlobToOopClosure {
    1.78   public:
    1.79 +  MarkingCodeBlobClosure(OopClosure* cl, bool fix_relocations) : CodeBlobToOopClosure(cl, fix_relocations) {}
    1.80    // Called for each code blob, but at most once per unique blob.
    1.81 -  virtual void do_newly_marked_nmethod(nmethod* nm) = 0;
    1.82  
    1.83    virtual void do_code_blob(CodeBlob* cb);
    1.84 -    // = { if (!nmethod(cb)->test_set_oops_do_mark())  do_newly_marked_nmethod(cb); }
    1.85  
    1.86    class MarkScope : public StackObj {
    1.87    protected:
    1.88 @@ -285,23 +315,6 @@
    1.89    };
    1.90  };
    1.91  
    1.92 -
    1.93 -// Applies an oop closure to all ref fields in code blobs
    1.94 -// iterated over in an object iteration.
    1.95 -class CodeBlobToOopClosure: public MarkingCodeBlobClosure {
    1.96 -  OopClosure* _cl;
    1.97 -  bool _do_marking;
    1.98 -public:
    1.99 -  virtual void do_newly_marked_nmethod(nmethod* cb);
   1.100 -    // = { cb->oops_do(_cl); }
   1.101 -  virtual void do_code_blob(CodeBlob* cb);
   1.102 -    // = { if (_do_marking)  super::do_code_blob(cb); else cb->oops_do(_cl); }
   1.103 -  CodeBlobToOopClosure(OopClosure* cl, bool do_marking)
   1.104 -    : _cl(cl), _do_marking(do_marking) {}
   1.105 -};
   1.106 -
   1.107 -
   1.108 -
   1.109  // MonitorClosure is used for iterating over monitors in the monitors cache
   1.110  
   1.111  class ObjectMonitor;

mercurial