src/hotspot/share/gc/shared/space.hpp
changeset 59154 0c2e1808f800
parent 59153 1152339c298a
equal deleted inserted replaced
59153:1152339c298a 59154:0c2e1808f800
    90 
    90 
    91   // Returns true if this object has been allocated since a
    91   // Returns true if this object has been allocated since a
    92   // generation's "save_marks" call.
    92   // generation's "save_marks" call.
    93   virtual bool obj_allocated_since_save_marks(const oop obj) const {
    93   virtual bool obj_allocated_since_save_marks(const oop obj) const {
    94     return (HeapWord*)obj >= saved_mark_word();
    94     return (HeapWord*)obj >= saved_mark_word();
    95   }
       
    96 
       
    97   virtual MemRegionClosure* preconsumptionDirtyCardClosure() const {
       
    98     return NULL;
       
    99   }
    95   }
   100 
    96 
   101   // Returns a subregion of the space containing only the allocated objects in
    97   // Returns a subregion of the space containing only the allocated objects in
   102   // the space.
    98   // the space.
   103   virtual MemRegion used_region() const = 0;
    99   virtual MemRegion used_region() const = 0;
   351 // Additionally, this also means that changes to block_size() or block_is_obj() that
   347 // Additionally, this also means that changes to block_size() or block_is_obj() that
   352 // should be effective during the compaction operations must provide a corresponding
   348 // should be effective during the compaction operations must provide a corresponding
   353 // definition of scanned_block_size/scanned_block_is_obj respectively.
   349 // definition of scanned_block_size/scanned_block_is_obj respectively.
   354 class CompactibleSpace: public Space {
   350 class CompactibleSpace: public Space {
   355   friend class VMStructs;
   351   friend class VMStructs;
   356   friend class CompactibleFreeListSpace;
       
   357 private:
   352 private:
   358   HeapWord* _compaction_top;
   353   HeapWord* _compaction_top;
   359   CompactibleSpace* _next_compaction_space;
   354   CompactibleSpace* _next_compaction_space;
   360 
   355 
   361   // Auxiliary functions for scan_and_{forward,adjust_pointers,compact} support.
   356   // Auxiliary functions for scan_and_{forward,adjust_pointers,compact} support.
   457 protected:
   452 protected:
   458   // Used during compaction.
   453   // Used during compaction.
   459   HeapWord* _first_dead;
   454   HeapWord* _first_dead;
   460   HeapWord* _end_of_live;
   455   HeapWord* _end_of_live;
   461 
   456 
   462   // Minimum size of a free block.
       
   463   virtual size_t minimum_free_block_size() const { return 0; }
       
   464 
       
   465   // This the function is invoked when an allocation of an object covering
   457   // This the function is invoked when an allocation of an object covering
   466   // "start" to "end occurs crosses the threshold; returns the next
   458   // "start" to "end occurs crosses the threshold; returns the next
   467   // threshold.  (The default implementation does nothing.)
   459   // threshold.  (The default implementation does nothing.)
   468   virtual HeapWord* cross_threshold(HeapWord* start, HeapWord* the_end) {
   460   virtual HeapWord* cross_threshold(HeapWord* start, HeapWord* the_end) {
   469     return end();
   461     return end();
   580 
   572 
   581   // Iteration
   573   // Iteration
   582   void oop_iterate(OopIterateClosure* cl);
   574   void oop_iterate(OopIterateClosure* cl);
   583   void object_iterate(ObjectClosure* blk);
   575   void object_iterate(ObjectClosure* blk);
   584 
   576 
   585   // Iterate over as many initialized objects in the space as possible,
       
   586   // calling "cl.do_object_careful" on each. Return NULL if all objects
       
   587   // in the space (at the start of the iteration) were iterated over.
       
   588   // Return an address indicating the extent of the iteration in the
       
   589   // event that the iteration had to return because of finding an
       
   590   // uninitialized object in the space, or if the closure "cl"
       
   591   // signaled early termination.
       
   592   HeapWord* object_iterate_careful(ObjectClosureCareful* cl);
       
   593   HeapWord* concurrent_iteration_safe_limit() {
   577   HeapWord* concurrent_iteration_safe_limit() {
   594     assert(_concurrent_iteration_safe_limit <= top(),
   578     assert(_concurrent_iteration_safe_limit <= top(),
   595            "_concurrent_iteration_safe_limit update missed");
   579            "_concurrent_iteration_safe_limit update missed");
   596     return _concurrent_iteration_safe_limit;
   580     return _concurrent_iteration_safe_limit;
   597   }
   581   }
   599   // limit should be properly initialized
   583   // limit should be properly initialized
   600   void set_concurrent_iteration_safe_limit(HeapWord* new_limit) {
   584   void set_concurrent_iteration_safe_limit(HeapWord* new_limit) {
   601     assert(new_limit <= top(), "uninitialized objects in the safe range");
   585     assert(new_limit <= top(), "uninitialized objects in the safe range");
   602     _concurrent_iteration_safe_limit = new_limit;
   586     _concurrent_iteration_safe_limit = new_limit;
   603   }
   587   }
   604 
       
   605   // In support of parallel oop_iterate.
       
   606   template <typename OopClosureType>
       
   607   void par_oop_iterate(MemRegion mr, OopClosureType* blk);
       
   608 
   588 
   609   // Compaction support
   589   // Compaction support
   610   virtual void reset_after_compaction() {
   590   virtual void reset_after_compaction() {
   611     assert(compaction_top() >= bottom() && compaction_top() <= end(), "should point inside space");
   591     assert(compaction_top() >= bottom() && compaction_top() <= end(), "should point inside space");
   612     set_top(compaction_top());
   592     set_top(compaction_top());