45 class Space;
46 class BlockOffsetArray;
47 class BlockOffsetArrayContigSpace;
48 class Generation;
49 class CompactibleSpace;
50 class BlockOffsetTable;
51 class GenRemSet;
52 class CardTableRS;
53 class DirtyCardToOopClosure;
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 // A sequential tasks done structure. This supports
74 // parallel GC, where we have threads dynamically
75 // claiming sub-tasks from a larger parallel task.
76 SequentialSubTasksDone _par_seq_tasks;
77
78 Space():
79 _bottom(NULL), _end(NULL) { }
80
81 public:
82 // Accessors
83 HeapWord* bottom() const { return _bottom; }
84 HeapWord* end() const { return _end; }
478
479 // Frequently calls adjust_obj_size().
480 template <class SpaceType>
481 static inline void scan_and_adjust_pointers(SpaceType* space);
482
483 // Frequently calls obj_size().
484 template <class SpaceType>
485 static inline void scan_and_compact(SpaceType* space);
486
487 // Frequently calls scanned_block_is_obj() and scanned_block_size().
488 // Requires the scan_limit() function.
489 template <class SpaceType>
490 static inline void scan_and_forward(SpaceType* space, CompactPoint* cp);
491 };
492
493 class GenSpaceMangler;
494
495 // A space in which the free area is contiguous. It therefore supports
496 // faster allocation, and compaction.
497 class ContiguousSpace: public CompactibleSpace {
498 friend class OneContigSpaceCardGeneration;
499 friend class VMStructs;
500 // Allow scan_and_forward function to call (private) overrides for auxiliary functions on this class
501 template <typename SpaceType>
502 friend void CompactibleSpace::scan_and_forward(SpaceType* space, CompactPoint* cp);
503
504 private:
505 // Auxiliary functions for scan_and_forward support.
506 // See comments for CompactibleSpace for more information.
507 inline HeapWord* scan_limit() const {
508 return top();
509 }
510
511 inline bool scanned_block_is_obj(const HeapWord* addr) const {
512 return true; // Always true, since scan_limit is top
513 }
514
515 inline size_t scanned_block_size(const HeapWord* addr) const {
516 return oop(addr)->size();
517 }
518
|
45 class Space;
46 class BlockOffsetArray;
47 class BlockOffsetArrayContigSpace;
48 class Generation;
49 class CompactibleSpace;
50 class BlockOffsetTable;
51 class GenRemSet;
52 class CardTableRS;
53 class DirtyCardToOopClosure;
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 TenuredGeneration;
66 friend class VMStructs;
67 protected:
68 HeapWord* _bottom;
69 HeapWord* _end;
70
71 // Used in support of save_marks()
72 HeapWord* _saved_mark_word;
73
74 // A sequential tasks done structure. This supports
75 // parallel GC, where we have threads dynamically
76 // claiming sub-tasks from a larger parallel task.
77 SequentialSubTasksDone _par_seq_tasks;
78
79 Space():
80 _bottom(NULL), _end(NULL) { }
81
82 public:
83 // Accessors
84 HeapWord* bottom() const { return _bottom; }
85 HeapWord* end() const { return _end; }
479
480 // Frequently calls adjust_obj_size().
481 template <class SpaceType>
482 static inline void scan_and_adjust_pointers(SpaceType* space);
483
484 // Frequently calls obj_size().
485 template <class SpaceType>
486 static inline void scan_and_compact(SpaceType* space);
487
488 // Frequently calls scanned_block_is_obj() and scanned_block_size().
489 // Requires the scan_limit() function.
490 template <class SpaceType>
491 static inline void scan_and_forward(SpaceType* space, CompactPoint* cp);
492 };
493
494 class GenSpaceMangler;
495
496 // A space in which the free area is contiguous. It therefore supports
497 // faster allocation, and compaction.
498 class ContiguousSpace: public CompactibleSpace {
499 friend class VMStructs;
500 // Allow scan_and_forward function to call (private) overrides for auxiliary functions on this class
501 template <typename SpaceType>
502 friend void CompactibleSpace::scan_and_forward(SpaceType* space, CompactPoint* cp);
503
504 private:
505 // Auxiliary functions for scan_and_forward support.
506 // See comments for CompactibleSpace for more information.
507 inline HeapWord* scan_limit() const {
508 return top();
509 }
510
511 inline bool scanned_block_is_obj(const HeapWord* addr) const {
512 return true; // Always true, since scan_limit is top
513 }
514
515 inline size_t scanned_block_size(const HeapWord* addr) const {
516 return oop(addr)->size();
517 }
518
|