src/hotspot/share/gc/shared/space.hpp
changeset 50752 9d62da00bf15
parent 50035 af1923174c9b
child 51332 c25572739e7c
equal deleted inserted replaced
50751:d9132bdf6c30 50752:9d62da00bf15
   167   virtual size_t free() const = 0;
   167   virtual size_t free() const = 0;
   168 
   168 
   169   // Iterate over all the ref-containing fields of all objects in the
   169   // Iterate over all the ref-containing fields of all objects in the
   170   // space, calling "cl.do_oop" on each.  Fields in objects allocated by
   170   // space, calling "cl.do_oop" on each.  Fields in objects allocated by
   171   // applications of the closure are not included in the iteration.
   171   // applications of the closure are not included in the iteration.
   172   virtual void oop_iterate(ExtendedOopClosure* cl);
   172   virtual void oop_iterate(OopIterateClosure* cl);
   173 
   173 
   174   // Iterate over all objects in the space, calling "cl.do_object" on
   174   // Iterate over all objects in the space, calling "cl.do_object" on
   175   // each.  Objects allocated by applications of the closure are not
   175   // each.  Objects allocated by applications of the closure are not
   176   // included in the iteration.
   176   // included in the iteration.
   177   virtual void object_iterate(ObjectClosure* blk) = 0;
   177   virtual void object_iterate(ObjectClosure* blk) = 0;
   181 
   181 
   182   // Create and return a new dirty card to oop closure. Can be
   182   // Create and return a new dirty card to oop closure. Can be
   183   // overridden to return the appropriate type of closure
   183   // overridden to return the appropriate type of closure
   184   // depending on the type of space in which the closure will
   184   // depending on the type of space in which the closure will
   185   // operate. ResourceArea allocated.
   185   // operate. ResourceArea allocated.
   186   virtual DirtyCardToOopClosure* new_dcto_cl(ExtendedOopClosure* cl,
   186   virtual DirtyCardToOopClosure* new_dcto_cl(OopIterateClosure* cl,
   187                                              CardTable::PrecisionStyle precision,
   187                                              CardTable::PrecisionStyle precision,
   188                                              HeapWord* boundary,
   188                                              HeapWord* boundary,
   189                                              bool parallel);
   189                                              bool parallel);
   190 
   190 
   191   // If "p" is in the space, returns the address of the start of the
   191   // If "p" is in the space, returns the address of the start of the
   254 // to support other space types. See ContiguousDCTOC for a sub-class
   254 // to support other space types. See ContiguousDCTOC for a sub-class
   255 // that works with ContiguousSpaces.
   255 // that works with ContiguousSpaces.
   256 
   256 
   257 class DirtyCardToOopClosure: public MemRegionClosureRO {
   257 class DirtyCardToOopClosure: public MemRegionClosureRO {
   258 protected:
   258 protected:
   259   ExtendedOopClosure* _cl;
   259   OopIterateClosure* _cl;
   260   Space* _sp;
   260   Space* _sp;
   261   CardTable::PrecisionStyle _precision;
   261   CardTable::PrecisionStyle _precision;
   262   HeapWord* _boundary;          // If non-NULL, process only non-NULL oops
   262   HeapWord* _boundary;          // If non-NULL, process only non-NULL oops
   263                                 // pointing below boundary.
   263                                 // pointing below boundary.
   264   HeapWord* _min_done;          // ObjHeadPreciseArray precision requires
   264   HeapWord* _min_done;          // ObjHeadPreciseArray precision requires
   284   // classes should override this to provide more accurate
   284   // classes should override this to provide more accurate
   285   // or possibly more efficient walking.
   285   // or possibly more efficient walking.
   286   virtual void walk_mem_region(MemRegion mr, HeapWord* bottom, HeapWord* top);
   286   virtual void walk_mem_region(MemRegion mr, HeapWord* bottom, HeapWord* top);
   287 
   287 
   288 public:
   288 public:
   289   DirtyCardToOopClosure(Space* sp, ExtendedOopClosure* cl,
   289   DirtyCardToOopClosure(Space* sp, OopIterateClosure* cl,
   290                         CardTable::PrecisionStyle precision,
   290                         CardTable::PrecisionStyle precision,
   291                         HeapWord* boundary) :
   291                         HeapWord* boundary) :
   292     _sp(sp), _cl(cl), _precision(precision), _boundary(boundary),
   292     _sp(sp), _cl(cl), _precision(precision), _boundary(boundary),
   293     _min_done(NULL) {
   293     _min_done(NULL) {
   294     NOT_PRODUCT(_last_bottom = NULL);
   294     NOT_PRODUCT(_last_bottom = NULL);
   580   virtual HeapWord* allocate(size_t word_size);
   580   virtual HeapWord* allocate(size_t word_size);
   581   virtual HeapWord* par_allocate(size_t word_size);
   581   virtual HeapWord* par_allocate(size_t word_size);
   582   HeapWord* allocate_aligned(size_t word_size);
   582   HeapWord* allocate_aligned(size_t word_size);
   583 
   583 
   584   // Iteration
   584   // Iteration
   585   void oop_iterate(ExtendedOopClosure* cl);
   585   void oop_iterate(OopIterateClosure* cl);
   586   void object_iterate(ObjectClosure* blk);
   586   void object_iterate(ObjectClosure* blk);
   587   // For contiguous spaces this method will iterate safely over objects
   587   // For contiguous spaces this method will iterate safely over objects
   588   // in the space (i.e., between bottom and top) when at a safepoint.
   588   // in the space (i.e., between bottom and top) when at a safepoint.
   589   void safe_object_iterate(ObjectClosure* blk);
   589   void safe_object_iterate(ObjectClosure* blk);
   590 
   590 
   619     // set new iteration safe limit
   619     // set new iteration safe limit
   620     set_concurrent_iteration_safe_limit(compaction_top());
   620     set_concurrent_iteration_safe_limit(compaction_top());
   621   }
   621   }
   622 
   622 
   623   // Override.
   623   // Override.
   624   DirtyCardToOopClosure* new_dcto_cl(ExtendedOopClosure* cl,
   624   DirtyCardToOopClosure* new_dcto_cl(OopIterateClosure* cl,
   625                                      CardTable::PrecisionStyle precision,
   625                                      CardTable::PrecisionStyle precision,
   626                                      HeapWord* boundary,
   626                                      HeapWord* boundary,
   627                                      bool parallel);
   627                                      bool parallel);
   628 
   628 
   629   // Apply "blk->do_oop" to the addresses of all reference fields in objects
   629   // Apply "blk->do_oop" to the addresses of all reference fields in objects
   687   // be a filtering closure which makes use of the _boundary.
   687   // be a filtering closure which makes use of the _boundary.
   688   // We offer two signatures, so the FilteringClosure static type is
   688   // We offer two signatures, so the FilteringClosure static type is
   689   // apparent.
   689   // apparent.
   690   virtual void walk_mem_region_with_cl(MemRegion mr,
   690   virtual void walk_mem_region_with_cl(MemRegion mr,
   691                                        HeapWord* bottom, HeapWord* top,
   691                                        HeapWord* bottom, HeapWord* top,
   692                                        ExtendedOopClosure* cl) = 0;
   692                                        OopIterateClosure* cl) = 0;
   693   virtual void walk_mem_region_with_cl(MemRegion mr,
   693   virtual void walk_mem_region_with_cl(MemRegion mr,
   694                                        HeapWord* bottom, HeapWord* top,
   694                                        HeapWord* bottom, HeapWord* top,
   695                                        FilteringClosure* cl) = 0;
   695                                        FilteringClosure* cl) = 0;
   696 
   696 
   697 public:
   697 public:
   698   FilteringDCTOC(Space* sp, ExtendedOopClosure* cl,
   698   FilteringDCTOC(Space* sp, OopIterateClosure* cl,
   699                   CardTable::PrecisionStyle precision,
   699                   CardTable::PrecisionStyle precision,
   700                   HeapWord* boundary) :
   700                   HeapWord* boundary) :
   701     DirtyCardToOopClosure(sp, cl, precision, boundary) {}
   701     DirtyCardToOopClosure(sp, cl, precision, boundary) {}
   702 };
   702 };
   703 
   703 
   716   // Overrides.
   716   // Overrides.
   717   HeapWord* get_actual_top(HeapWord* top, HeapWord* top_obj);
   717   HeapWord* get_actual_top(HeapWord* top, HeapWord* top_obj);
   718 
   718 
   719   virtual void walk_mem_region_with_cl(MemRegion mr,
   719   virtual void walk_mem_region_with_cl(MemRegion mr,
   720                                        HeapWord* bottom, HeapWord* top,
   720                                        HeapWord* bottom, HeapWord* top,
   721                                        ExtendedOopClosure* cl);
   721                                        OopIterateClosure* cl);
   722   virtual void walk_mem_region_with_cl(MemRegion mr,
   722   virtual void walk_mem_region_with_cl(MemRegion mr,
   723                                        HeapWord* bottom, HeapWord* top,
   723                                        HeapWord* bottom, HeapWord* top,
   724                                        FilteringClosure* cl);
   724                                        FilteringClosure* cl);
   725 
   725 
   726 public:
   726 public:
   727   ContiguousSpaceDCTOC(ContiguousSpace* sp, ExtendedOopClosure* cl,
   727   ContiguousSpaceDCTOC(ContiguousSpace* sp, OopIterateClosure* cl,
   728                        CardTable::PrecisionStyle precision,
   728                        CardTable::PrecisionStyle precision,
   729                        HeapWord* boundary) :
   729                        HeapWord* boundary) :
   730     FilteringDCTOC(sp, cl, precision, boundary)
   730     FilteringDCTOC(sp, cl, precision, boundary)
   731   {}
   731   {}
   732 };
   732 };