< prev index next >

src/hotspot/share/memory/iterator.hpp

Print this page
*** 26,10 ***
--- 26,11 ---
  #define SHARE_MEMORY_ITERATOR_HPP
  
  #include "memory/allocation.hpp"
  #include "memory/memRegion.hpp"
  #include "oops/oopsHierarchy.hpp"
+ #include "utilities/bitMap.hpp"
  
  class CodeBlob;
  class nmethod;
  class ReferenceDiscoverer;
  class DataLayout;

*** 100,20 ***
--- 101,31 ---
    // 3) do_cld   on the class loader data in class loaders.
  
    virtual bool do_metadata() = 0;
    virtual void do_klass(Klass* k) = 0;
    virtual void do_cld(ClassLoaderData* cld) = 0;
+   virtual void do_method(Method* m) = 0;
+   virtual void do_nmethod(nmethod* nm) = 0;
  };
  
  // An OopIterateClosure that can be used when there's no need to visit the Metadata.
  class BasicOopIterateClosure : public OopIterateClosure {
  public:
    BasicOopIterateClosure(ReferenceDiscoverer* rd = NULL) : OopIterateClosure(rd) {}
  
    virtual bool do_metadata() { return false; }
    virtual void do_klass(Klass* k) { ShouldNotReachHere(); }
    virtual void do_cld(ClassLoaderData* cld) { ShouldNotReachHere(); }
+   virtual void do_method(Method* m) { ShouldNotReachHere(); }
+   virtual void do_nmethod(nmethod* nm) { ShouldNotReachHere(); }
+ };
+ 
+ enum class derived_pointer : intptr_t;
+ class DerivedOopClosure : public Closure {
+  public:
+   enum { SkipNull = true };
+   virtual void do_derived_oop(oop* base, derived_pointer* derived) = 0;
  };
  
  class KlassClosure : public Closure {
   public:
    virtual void do_klass(Klass* k) = 0;

*** 159,10 ***
--- 171,12 ---
        _claim(claim) { }
  
    virtual bool do_metadata() { return true; }
    virtual void do_klass(Klass* k);
    virtual void do_cld(ClassLoaderData* cld);
+   virtual void do_method(Method* m);
+   virtual void do_nmethod(nmethod* nm);
  };
  
  // The base class for all concurrent marking closures,
  // that participates in class unloading.
  // It's used to proxy through the metadata to the oops defined in them.

*** 232,13 ***
  };
  
  // Applies an oop closure to all ref fields in code blobs
  // iterated over in an object iteration.
  class CodeBlobToOopClosure : public CodeBlobClosure {
    OopClosure* _cl;
    bool _fix_relocations;
-  protected:
    void do_nmethod(nmethod* nm);
   public:
    // If fix_relocations(), then cl must copy objects to their new location immediately to avoid
    // patching nmethods with the old locations.
    CodeBlobToOopClosure(OopClosure* cl, bool fix_relocations) : _cl(cl), _fix_relocations(fix_relocations) {}
--- 246,13 ---
  };
  
  // Applies an oop closure to all ref fields in code blobs
  // iterated over in an object iteration.
  class CodeBlobToOopClosure : public CodeBlobClosure {
+  protected:
    OopClosure* _cl;
    bool _fix_relocations;
    void do_nmethod(nmethod* nm);
   public:
    // If fix_relocations(), then cl must copy objects to their new location immediately to avoid
    // patching nmethods with the old locations.
    CodeBlobToOopClosure(OopClosure* cl, bool fix_relocations) : _cl(cl), _fix_relocations(fix_relocations) {}

*** 247,12 ***
    bool fix_relocations() const { return _fix_relocations; }
    const static bool FixRelocations = true;
  };
  
  class MarkingCodeBlobClosure : public CodeBlobToOopClosure {
   public:
!   MarkingCodeBlobClosure(OopClosure* cl, bool fix_relocations) : CodeBlobToOopClosure(cl, fix_relocations) {}
    // Called for each code blob, but at most once per unique blob.
  
    virtual void do_code_blob(CodeBlob* cb);
  };
  
--- 261,16 ---
    bool fix_relocations() const { return _fix_relocations; }
    const static bool FixRelocations = true;
  };
  
  class MarkingCodeBlobClosure : public CodeBlobToOopClosure {
+   bool _keepalive_nmethods;
+ 
   public:
!   MarkingCodeBlobClosure(OopClosure* cl, bool fix_relocations, bool keepalive_nmethods) :
+       CodeBlobToOopClosure(cl, fix_relocations),
+       _keepalive_nmethods(keepalive_nmethods) {}
    // Called for each code blob, but at most once per unique blob.
  
    virtual void do_code_blob(CodeBlob* cb);
  };
  

*** 353,10 ***
--- 371,12 ---
   public:
    template <typename OopClosureType, typename T> static void do_oop(OopClosureType* closure, T* p);
    template <typename OopClosureType>             static void do_klass(OopClosureType* closure, Klass* k);
    template <typename OopClosureType>             static void do_cld(OopClosureType* closure, ClassLoaderData* cld);
    template <typename OopClosureType>             static bool do_metadata(OopClosureType* closure);
+   template <typename DerivedOopClosureType>      static void do_derived_oop(DerivedOopClosureType* closure, oop* base, derived_pointer* derived);
+   template <typename BitMapClosureType>          static bool do_bit(BitMapClosureType* closure, BitMap::idx_t index);
  };
  
  class OopIteratorClosureDispatch {
   public:
    template <typename OopClosureType> static void oop_oop_iterate(OopClosureType* cl, oop obj, Klass* klass);
< prev index next >