< prev index next >

src/hotspot/share/gc/shared/space.hpp

Print this page




 158 
 159   // Test whether p is double-aligned
 160   static bool is_aligned(void* p) {
 161     return ::is_aligned(p, sizeof(double));
 162   }
 163 
 164   // Size computations.  Sizes are in bytes.
 165   size_t capacity()     const { return byte_size(bottom(), end()); }
 166   virtual size_t used() const = 0;
 167   virtual size_t free() const = 0;
 168 
 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
 171   // applications of the closure are not included in the iteration.
 172   virtual void oop_iterate(OopIterateClosure* cl);
 173 
 174   // Iterate over all objects in the space, calling "cl.do_object" on
 175   // each.  Objects allocated by applications of the closure are not
 176   // included in the iteration.
 177   virtual void object_iterate(ObjectClosure* blk) = 0;
 178   // Similar to object_iterate() except only iterates over
 179   // objects whose internal references point to objects in the space.
 180   virtual void safe_object_iterate(ObjectClosure* blk) = 0;
 181 
 182   // Create and return a new dirty card to oop closure. Can be
 183   // overridden to return the appropriate type of closure
 184   // depending on the type of space in which the closure will
 185   // operate. ResourceArea allocated.
 186   virtual DirtyCardToOopClosure* new_dcto_cl(OopIterateClosure* cl,
 187                                              CardTable::PrecisionStyle precision,
 188                                              HeapWord* boundary,
 189                                              bool parallel);
 190 
 191   // If "p" is in the space, returns the address of the start of the
 192   // "block" that contains "p".  We say "block" instead of "object" since
 193   // some heaps may not pack objects densely; a chunk may either be an
 194   // object or a non-object.  If "p" is not in the space, return NULL.
 195   virtual HeapWord* block_start_const(const void* p) const = 0;
 196 
 197   // The non-const version may have benevolent side effects on the data
 198   // structure supporting these calls, possibly speeding up future calls.
 199   // The default implementation, however, is simply to call the const
 200   // version.


 567 
 568   // Size computations: sizes in bytes.
 569   size_t capacity() const        { return byte_size(bottom(), end()); }
 570   size_t used() const            { return byte_size(bottom(), top()); }
 571   size_t free() const            { return byte_size(top(),    end()); }
 572 
 573   virtual bool is_free_block(const HeapWord* p) const;
 574 
 575   // In a contiguous space we have a more obvious bound on what parts
 576   // contain objects.
 577   MemRegion used_region() const { return MemRegion(bottom(), top()); }
 578 
 579   // Allocation (return NULL if full)
 580   virtual HeapWord* allocate(size_t word_size);
 581   virtual HeapWord* par_allocate(size_t word_size);
 582   HeapWord* allocate_aligned(size_t word_size);
 583 
 584   // Iteration
 585   void oop_iterate(OopIterateClosure* cl);
 586   void object_iterate(ObjectClosure* blk);
 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.
 589   void safe_object_iterate(ObjectClosure* blk);
 590 
 591   // Iterate over as many initialized objects in the space as possible,
 592   // calling "cl.do_object_careful" on each. Return NULL if all objects
 593   // in the space (at the start of the iteration) were iterated over.
 594   // Return an address indicating the extent of the iteration in the
 595   // event that the iteration had to return because of finding an
 596   // uninitialized object in the space, or if the closure "cl"
 597   // signaled early termination.
 598   HeapWord* object_iterate_careful(ObjectClosureCareful* cl);
 599   HeapWord* concurrent_iteration_safe_limit() {
 600     assert(_concurrent_iteration_safe_limit <= top(),
 601            "_concurrent_iteration_safe_limit update missed");
 602     return _concurrent_iteration_safe_limit;
 603   }
 604   // changes the safe limit, all objects from bottom() to the new
 605   // limit should be properly initialized
 606   void set_concurrent_iteration_safe_limit(HeapWord* new_limit) {
 607     assert(new_limit <= top(), "uninitialized objects in the safe range");
 608     _concurrent_iteration_safe_limit = new_limit;
 609   }




 158 
 159   // Test whether p is double-aligned
 160   static bool is_aligned(void* p) {
 161     return ::is_aligned(p, sizeof(double));
 162   }
 163 
 164   // Size computations.  Sizes are in bytes.
 165   size_t capacity()     const { return byte_size(bottom(), end()); }
 166   virtual size_t used() const = 0;
 167   virtual size_t free() const = 0;
 168 
 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
 171   // applications of the closure are not included in the iteration.
 172   virtual void oop_iterate(OopIterateClosure* cl);
 173 
 174   // Iterate over all objects in the space, calling "cl.do_object" on
 175   // each.  Objects allocated by applications of the closure are not
 176   // included in the iteration.
 177   virtual void object_iterate(ObjectClosure* blk) = 0;



 178 
 179   // Create and return a new dirty card to oop closure. Can be
 180   // overridden to return the appropriate type of closure
 181   // depending on the type of space in which the closure will
 182   // operate. ResourceArea allocated.
 183   virtual DirtyCardToOopClosure* new_dcto_cl(OopIterateClosure* cl,
 184                                              CardTable::PrecisionStyle precision,
 185                                              HeapWord* boundary,
 186                                              bool parallel);
 187 
 188   // If "p" is in the space, returns the address of the start of the
 189   // "block" that contains "p".  We say "block" instead of "object" since
 190   // some heaps may not pack objects densely; a chunk may either be an
 191   // object or a non-object.  If "p" is not in the space, return NULL.
 192   virtual HeapWord* block_start_const(const void* p) const = 0;
 193 
 194   // The non-const version may have benevolent side effects on the data
 195   // structure supporting these calls, possibly speeding up future calls.
 196   // The default implementation, however, is simply to call the const
 197   // version.


 564 
 565   // Size computations: sizes in bytes.
 566   size_t capacity() const        { return byte_size(bottom(), end()); }
 567   size_t used() const            { return byte_size(bottom(), top()); }
 568   size_t free() const            { return byte_size(top(),    end()); }
 569 
 570   virtual bool is_free_block(const HeapWord* p) const;
 571 
 572   // In a contiguous space we have a more obvious bound on what parts
 573   // contain objects.
 574   MemRegion used_region() const { return MemRegion(bottom(), top()); }
 575 
 576   // Allocation (return NULL if full)
 577   virtual HeapWord* allocate(size_t word_size);
 578   virtual HeapWord* par_allocate(size_t word_size);
 579   HeapWord* allocate_aligned(size_t word_size);
 580 
 581   // Iteration
 582   void oop_iterate(OopIterateClosure* cl);
 583   void object_iterate(ObjectClosure* blk);



 584 
 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() {
 594     assert(_concurrent_iteration_safe_limit <= top(),
 595            "_concurrent_iteration_safe_limit update missed");
 596     return _concurrent_iteration_safe_limit;
 597   }
 598   // changes the safe limit, all objects from bottom() to the new
 599   // limit should be properly initialized
 600   void set_concurrent_iteration_safe_limit(HeapWord* new_limit) {
 601     assert(new_limit <= top(), "uninitialized objects in the safe range");
 602     _concurrent_iteration_safe_limit = new_limit;
 603   }


< prev index next >