< prev index next >

src/share/vm/memory/iterator.hpp

Print this page
rev 12851 : 8138737: Remove oop_ms_adjust_pointers and use oop_iterate instead
Reviewed-by:
rev 12852 : [mq]: 8138737-remove-oop-ms-adjust-kbarrett-rev1
rev 12853 : [mq]: 8138737-remove-oop-ms-adjust-stefank-rev1


  51 // ExtendedOopClosure adds extra code to be run during oop iterations.
  52 // This is needed by the GC and is extracted to a separate type to not
  53 // pollute the OopClosure interface.
  54 class ExtendedOopClosure : public OopClosure {
  55  private:
  56   ReferenceProcessor* _ref_processor;
  57 
  58  protected:
  59   ExtendedOopClosure(ReferenceProcessor* rp) : _ref_processor(rp) { }
  60   ExtendedOopClosure() : _ref_processor(NULL) { }
  61   ~ExtendedOopClosure() { }
  62 
  63   void set_ref_processor_internal(ReferenceProcessor* rp) { _ref_processor = rp; }
  64 
  65  public:
  66   ReferenceProcessor* ref_processor() const { return _ref_processor; }
  67 
  68   // Iteration of InstanceRefKlasses differ depending on the closure,
  69   // the below enum describes the different alternatives.
  70   enum ReferenceIterationMode {
  71     DO_DISCOVERY, // Tries to discover references
  72     DO_FIELDS     // Apply closure to all fields
  73   };
  74 
  75   // The current default iteration mode is to do discovery.
  76   virtual ReferenceIterationMode reference_iteration_mode() { return DO_DISCOVERY; }
  77 
  78   // If the do_metadata functions return "true",
  79   // we invoke the following when running oop_iterate():
  80   //
  81   // 1) do_klass on the header klass pointer.
  82   // 2) do_klass on the klass pointer in the mirrors.
  83   // 3) do_cld   on the class loader data in class loaders.
  84   //
  85   // The virtual (without suffix) and the non-virtual (with _nv suffix) need
  86   // to be updated together, or else the devirtualization will break.
  87   //
  88   // Providing default implementations of the _nv functions unfortunately
  89   // removes the compile-time safeness, but reduces the clutter for the
  90   // ExtendedOopClosures that don't need to walk the metadata.
  91   // Currently, only CMS and G1 need these.
  92 
  93   bool do_metadata_nv()      { return false; }
  94   virtual bool do_metadata() { return do_metadata_nv(); }
  95 




  51 // ExtendedOopClosure adds extra code to be run during oop iterations.
  52 // This is needed by the GC and is extracted to a separate type to not
  53 // pollute the OopClosure interface.
  54 class ExtendedOopClosure : public OopClosure {
  55  private:
  56   ReferenceProcessor* _ref_processor;
  57 
  58  protected:
  59   ExtendedOopClosure(ReferenceProcessor* rp) : _ref_processor(rp) { }
  60   ExtendedOopClosure() : _ref_processor(NULL) { }
  61   ~ExtendedOopClosure() { }
  62 
  63   void set_ref_processor_internal(ReferenceProcessor* rp) { _ref_processor = rp; }
  64 
  65  public:
  66   ReferenceProcessor* ref_processor() const { return _ref_processor; }
  67 
  68   // Iteration of InstanceRefKlasses differ depending on the closure,
  69   // the below enum describes the different alternatives.
  70   enum ReferenceIterationMode {
  71     DO_DISCOVERY, // Apply closure and discover references
  72     DO_FIELDS     // Apply closure to all fields
  73   };
  74 
  75   // The default iteration mode is to do discovery.
  76   virtual ReferenceIterationMode reference_iteration_mode() { return DO_DISCOVERY; }
  77 
  78   // If the do_metadata functions return "true",
  79   // we invoke the following when running oop_iterate():
  80   //
  81   // 1) do_klass on the header klass pointer.
  82   // 2) do_klass on the klass pointer in the mirrors.
  83   // 3) do_cld   on the class loader data in class loaders.
  84   //
  85   // The virtual (without suffix) and the non-virtual (with _nv suffix) need
  86   // to be updated together, or else the devirtualization will break.
  87   //
  88   // Providing default implementations of the _nv functions unfortunately
  89   // removes the compile-time safeness, but reduces the clutter for the
  90   // ExtendedOopClosures that don't need to walk the metadata.
  91   // Currently, only CMS and G1 need these.
  92 
  93   bool do_metadata_nv()      { return false; }
  94   virtual bool do_metadata() { return do_metadata_nv(); }
  95 


< prev index next >