< prev index next >

src/share/vm/gc/g1/heapRegion.hpp

Print this page




  34 #include "gc/shared/watermark.hpp"
  35 #include "utilities/macros.hpp"
  36 
  37 // A HeapRegion is the smallest piece of a G1CollectedHeap that
  38 // can be collected independently.
  39 
  40 // NOTE: Although a HeapRegion is a Space, its
  41 // Space::initDirtyCardClosure method must not be called.
  42 // The problem is that the existence of this method breaks
  43 // the independence of barrier sets from remembered sets.
  44 // The solution is to remove this method from the definition
  45 // of a Space.
  46 
  47 class G1CollectedHeap;
  48 class HeapRegionRemSet;
  49 class HeapRegionRemSetIterator;
  50 class HeapRegion;
  51 class HeapRegionSetBase;
  52 class nmethod;
  53 
  54 #define HR_FORMAT "%u:(%s)["PTR_FORMAT","PTR_FORMAT","PTR_FORMAT"]"
  55 #define HR_FORMAT_PARAMS(_hr_) \
  56                 (_hr_)->hrm_index(), \
  57                 (_hr_)->get_short_type_str(), \
  58                 p2i((_hr_)->bottom()), p2i((_hr_)->top()), p2i((_hr_)->end())
  59 
  60 // sentinel value for hrm_index
  61 #define G1_NO_HRM_INDEX ((uint) -1)
  62 
  63 // A dirty card to oop closure for heap regions. It
  64 // knows how to get the G1 heap and how to use the bitmap
  65 // in the concurrent marker used by G1 to filter remembered
  66 // sets.
  67 
  68 class HeapRegionDCTOC : public DirtyCardToOopClosure {
  69 private:
  70   HeapRegion* _hr;
  71   G1ParPushHeapRSClosure* _rs_scan;
  72   G1CollectedHeap* _g1;
  73 
  74   // Walk the given memory region from bottom to (actual) top


 511   }
 512 
 513   // Methods used by the HeapRegionSetBase class and subclasses.
 514 
 515   // Getter and setter for the next and prev fields used to link regions into
 516   // linked lists.
 517   HeapRegion* next()              { return _next; }
 518   HeapRegion* prev()              { return _prev; }
 519 
 520   void set_next(HeapRegion* next) { _next = next; }
 521   void set_prev(HeapRegion* prev) { _prev = prev; }
 522 
 523   // Every region added to a set is tagged with a reference to that
 524   // set. This is used for doing consistency checking to make sure that
 525   // the contents of a set are as they should be and it's only
 526   // available in non-product builds.
 527 #ifdef ASSERT
 528   void set_containing_set(HeapRegionSetBase* containing_set) {
 529     assert((containing_set == NULL && _containing_set != NULL) ||
 530            (containing_set != NULL && _containing_set == NULL),
 531            err_msg("containing_set: "PTR_FORMAT" "
 532                    "_containing_set: "PTR_FORMAT,
 533                    p2i(containing_set), p2i(_containing_set)));
 534 
 535     _containing_set = containing_set;
 536   }
 537 
 538   HeapRegionSetBase* containing_set() { return _containing_set; }
 539 #else // ASSERT
 540   void set_containing_set(HeapRegionSetBase* containing_set) { }
 541 
 542   // containing_set() is only used in asserts so there's no reason
 543   // to provide a dummy version of it.
 544 #endif // ASSERT
 545 
 546   HeapRegion* get_next_young_region() { return _next_young_region; }
 547   void set_next_young_region(HeapRegion* hr) {
 548     _next_young_region = hr;
 549   }
 550 
 551   HeapRegion* get_next_dirty_cards_region() const { return _next_dirty_cards_region; }
 552   HeapRegion** next_dirty_cards_region_addr() { return &_next_dirty_cards_region; }




  34 #include "gc/shared/watermark.hpp"
  35 #include "utilities/macros.hpp"
  36 
  37 // A HeapRegion is the smallest piece of a G1CollectedHeap that
  38 // can be collected independently.
  39 
  40 // NOTE: Although a HeapRegion is a Space, its
  41 // Space::initDirtyCardClosure method must not be called.
  42 // The problem is that the existence of this method breaks
  43 // the independence of barrier sets from remembered sets.
  44 // The solution is to remove this method from the definition
  45 // of a Space.
  46 
  47 class G1CollectedHeap;
  48 class HeapRegionRemSet;
  49 class HeapRegionRemSetIterator;
  50 class HeapRegion;
  51 class HeapRegionSetBase;
  52 class nmethod;
  53 
  54 #define HR_FORMAT "%u:(%s)[" PTR_FORMAT "," PTR_FORMAT "," PTR_FORMAT "]"
  55 #define HR_FORMAT_PARAMS(_hr_) \
  56                 (_hr_)->hrm_index(), \
  57                 (_hr_)->get_short_type_str(), \
  58                 p2i((_hr_)->bottom()), p2i((_hr_)->top()), p2i((_hr_)->end())
  59 
  60 // sentinel value for hrm_index
  61 #define G1_NO_HRM_INDEX ((uint) -1)
  62 
  63 // A dirty card to oop closure for heap regions. It
  64 // knows how to get the G1 heap and how to use the bitmap
  65 // in the concurrent marker used by G1 to filter remembered
  66 // sets.
  67 
  68 class HeapRegionDCTOC : public DirtyCardToOopClosure {
  69 private:
  70   HeapRegion* _hr;
  71   G1ParPushHeapRSClosure* _rs_scan;
  72   G1CollectedHeap* _g1;
  73 
  74   // Walk the given memory region from bottom to (actual) top


 511   }
 512 
 513   // Methods used by the HeapRegionSetBase class and subclasses.
 514 
 515   // Getter and setter for the next and prev fields used to link regions into
 516   // linked lists.
 517   HeapRegion* next()              { return _next; }
 518   HeapRegion* prev()              { return _prev; }
 519 
 520   void set_next(HeapRegion* next) { _next = next; }
 521   void set_prev(HeapRegion* prev) { _prev = prev; }
 522 
 523   // Every region added to a set is tagged with a reference to that
 524   // set. This is used for doing consistency checking to make sure that
 525   // the contents of a set are as they should be and it's only
 526   // available in non-product builds.
 527 #ifdef ASSERT
 528   void set_containing_set(HeapRegionSetBase* containing_set) {
 529     assert((containing_set == NULL && _containing_set != NULL) ||
 530            (containing_set != NULL && _containing_set == NULL),
 531            err_msg("containing_set: " PTR_FORMAT " "
 532                    "_containing_set: " PTR_FORMAT,
 533                    p2i(containing_set), p2i(_containing_set)));
 534 
 535     _containing_set = containing_set;
 536   }
 537 
 538   HeapRegionSetBase* containing_set() { return _containing_set; }
 539 #else // ASSERT
 540   void set_containing_set(HeapRegionSetBase* containing_set) { }
 541 
 542   // containing_set() is only used in asserts so there's no reason
 543   // to provide a dummy version of it.
 544 #endif // ASSERT
 545 
 546   HeapRegion* get_next_young_region() { return _next_young_region; }
 547   void set_next_young_region(HeapRegion* hr) {
 548     _next_young_region = hr;
 549   }
 550 
 551   HeapRegion* get_next_dirty_cards_region() const { return _next_dirty_cards_region; }
 552   HeapRegion** next_dirty_cards_region_addr() { return &_next_dirty_cards_region; }


< prev index next >