< prev index next >

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

Print this page

 33 #include "memory/memRegion.hpp"
 34 #include "oops/markWord.hpp"
 35 #include "runtime/mutexLocker.hpp"
 36 #include "utilities/align.hpp"
 37 #include "utilities/macros.hpp"
 38 
 39 // A space is an abstraction for the "storage units" backing
 40 // up the generation abstraction. It includes specific
 41 // implementations for keeping track of free and used space,
 42 // for iterating over objects and free blocks, etc.
 43 
 44 // Forward decls.
 45 class Space;
 46 class BlockOffsetArray;
 47 class BlockOffsetArrayContigSpace;
 48 class Generation;
 49 class CompactibleSpace;
 50 class BlockOffsetTable;
 51 class CardTableRS;
 52 class DirtyCardToOopClosure;

 53 
 54 // A Space describes a heap area. Class Space is an abstract
 55 // base class.
 56 //
 57 // Space supports allocation, size computation and GC support is provided.
 58 //
 59 // Invariant: bottom() and end() are on page_size boundaries and
 60 // bottom() <= top() <= end()
 61 // top() is inclusive and end() is exclusive.
 62 
 63 class Space: public CHeapObj<mtGC> {
 64   friend class VMStructs;
 65  protected:
 66   HeapWord* _bottom;
 67   HeapWord* _end;
 68 
 69   // Used in support of save_marks()
 70   HeapWord* _saved_mark_word;
 71 
 72   Space():

374   // live part of a compacted space ("deadwood" support.)
375   virtual size_t allowed_dead_ratio() const { return 0; };
376 
377   // Some contiguous spaces may maintain some data structures that should
378   // be updated whenever an allocation crosses a boundary.  This function
379   // initializes these data structures for further updates.
380   virtual void initialize_threshold() { }
381 
382   // "q" is an object of the given "size" that should be forwarded;
383   // "cp" names the generation ("gen") and containing "this" (which must
384   // also equal "cp->space").  "compact_top" is where in "this" the
385   // next object should be forwarded to.  If there is room in "this" for
386   // the object, insert an appropriate forwarding pointer in "q".
387   // If not, go to the next compaction space (there must
388   // be one, since compaction must succeed -- we go to the first space of
389   // the previous generation if necessary, updating "cp"), reset compact_top
390   // and then forward.  In either case, returns the new value of "compact_top".
391   // Invokes the "alloc_block" function of the then-current compaction
392   // space.
393   virtual HeapWord* forward(oop q, size_t size, CompactPoint* cp,
394                     HeapWord* compact_top);
395 
396   // Return a size with adjustments as required of the space.
397   virtual size_t adjust_object_size_v(size_t size) const { return size; }
398 
399   void set_first_dead(HeapWord* value) { _first_dead = value; }
400   void set_end_of_live(HeapWord* value) { _end_of_live = value; }
401 
402 protected:
403   // Used during compaction.
404   HeapWord* _first_dead;
405   HeapWord* _end_of_live;
406 
407   // This the function to invoke when an allocation of an object covering
408   // "start" to "end" occurs to update other internal data structures.
409   virtual void alloc_block(HeapWord* start, HeapWord* the_end) { }
410 };
411 
412 class GenSpaceMangler;
413 
414 // A space in which the free area is contiguous.  It therefore supports

 33 #include "memory/memRegion.hpp"
 34 #include "oops/markWord.hpp"
 35 #include "runtime/mutexLocker.hpp"
 36 #include "utilities/align.hpp"
 37 #include "utilities/macros.hpp"
 38 
 39 // A space is an abstraction for the "storage units" backing
 40 // up the generation abstraction. It includes specific
 41 // implementations for keeping track of free and used space,
 42 // for iterating over objects and free blocks, etc.
 43 
 44 // Forward decls.
 45 class Space;
 46 class BlockOffsetArray;
 47 class BlockOffsetArrayContigSpace;
 48 class Generation;
 49 class CompactibleSpace;
 50 class BlockOffsetTable;
 51 class CardTableRS;
 52 class DirtyCardToOopClosure;
 53 class SlidingForwarding;
 54 
 55 // A Space describes a heap area. Class Space is an abstract
 56 // base class.
 57 //
 58 // Space supports allocation, size computation and GC support is provided.
 59 //
 60 // Invariant: bottom() and end() are on page_size boundaries and
 61 // bottom() <= top() <= end()
 62 // top() is inclusive and end() is exclusive.
 63 
 64 class Space: public CHeapObj<mtGC> {
 65   friend class VMStructs;
 66  protected:
 67   HeapWord* _bottom;
 68   HeapWord* _end;
 69 
 70   // Used in support of save_marks()
 71   HeapWord* _saved_mark_word;
 72 
 73   Space():

375   // live part of a compacted space ("deadwood" support.)
376   virtual size_t allowed_dead_ratio() const { return 0; };
377 
378   // Some contiguous spaces may maintain some data structures that should
379   // be updated whenever an allocation crosses a boundary.  This function
380   // initializes these data structures for further updates.
381   virtual void initialize_threshold() { }
382 
383   // "q" is an object of the given "size" that should be forwarded;
384   // "cp" names the generation ("gen") and containing "this" (which must
385   // also equal "cp->space").  "compact_top" is where in "this" the
386   // next object should be forwarded to.  If there is room in "this" for
387   // the object, insert an appropriate forwarding pointer in "q".
388   // If not, go to the next compaction space (there must
389   // be one, since compaction must succeed -- we go to the first space of
390   // the previous generation if necessary, updating "cp"), reset compact_top
391   // and then forward.  In either case, returns the new value of "compact_top".
392   // Invokes the "alloc_block" function of the then-current compaction
393   // space.
394   virtual HeapWord* forward(oop q, size_t size, CompactPoint* cp,
395                     HeapWord* compact_top, SlidingForwarding* const forwarding);
396 
397   // Return a size with adjustments as required of the space.
398   virtual size_t adjust_object_size_v(size_t size) const { return size; }
399 
400   void set_first_dead(HeapWord* value) { _first_dead = value; }
401   void set_end_of_live(HeapWord* value) { _end_of_live = value; }
402 
403 protected:
404   // Used during compaction.
405   HeapWord* _first_dead;
406   HeapWord* _end_of_live;
407 
408   // This the function to invoke when an allocation of an object covering
409   // "start" to "end" occurs to update other internal data structures.
410   virtual void alloc_block(HeapWord* start, HeapWord* the_end) { }
411 };
412 
413 class GenSpaceMangler;
414 
415 // A space in which the free area is contiguous.  It therefore supports
< prev index next >