< prev index next >

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

Print this page
rev 10869 : [mq]: 8153170-kim-review


  29 #include "utilities/bitMap.hpp"
  30 #include "utilities/globalDefinitions.hpp"
  31 
  32 class G1CollectedHeap;
  33 class G1CMBitMap;
  34 class WorkGang;
  35 
  36 // Information about object liveness on the Java heap on a "card" basis.
  37 // Can be used for various purposes, like as remembered set for completely
  38 // coarsened remembered sets, scrubbing remembered sets or estimating liveness.
  39 // This information is created as part of the concurrent marking cycle.
  40 class G1CardLiveData VALUE_OBJ_CLASS_SPEC {
  41   friend class G1CardLiveDataHelper;
  42   friend class G1VerifyCardLiveDataTask;
  43 private:
  44   typedef BitMap::bm_word_t bm_word_t;
  45   // Store some additional information about the covered area to be able to test.
  46   size_t _max_capacity;
  47   size_t _cards_per_region;
  48 











  49   // The per-card liveness bitmap.
  50   bm_word_t* _live_cards;
  51   size_t _live_cards_size_in_bits;
  52   // The per-region liveness bitmap.
  53   bm_word_t* _live_regions;
  54   size_t _live_regions_size_in_bits;
  55   // The bits in this bitmap contain for every card whether it contains
  56   // at least part of at least one live object.
  57   BitMap live_cards_bm() const { return BitMap(_live_cards, _live_cards_size_in_bits); }
  58   // The bits in this bitmap indicate that a given region contains some live objects.
  59   BitMap live_regions_bm() const { return BitMap(_live_regions, _live_regions_size_in_bits); }
  60 
  61   // Allocate a "large" bitmap from virtual memory with the given size in bits.
  62   bm_word_t* allocate_large_bitmap(size_t size_in_bits);
  63   void free_large_bitmap(bm_word_t* map, size_t size_in_bits);
  64 
  65   inline BitMap live_card_bitmap(uint region);
  66 
  67   inline bool is_card_live_at(BitMap::idx_t idx) const;
  68 
  69   size_t live_region_bitmap_size_in_bits() const;
  70   size_t live_card_bitmap_size_in_bits() const;
  71 public:


  72   inline bool is_region_live(uint region) const;
  73 
  74   inline void remove_nonlive_cards(uint region, BitMap* bm);
  75   inline void remove_nonlive_regions(BitMap* bm);
  76 
  77   G1CardLiveData();
  78   ~G1CardLiveData();
  79 
  80   void initialize(size_t max_capacity, uint num_max_regions);
  81   void pretouch();
  82 
  83   // Create the initial liveness data based on the marking result from the bottom
  84   // to the ntams of every region in the heap and the marks in the given bitmap.
  85   void create(WorkGang* workers, G1CMBitMap* mark_bitmap);
  86   // Finalize the liveness data.
  87   void finalize(WorkGang* workers, G1CMBitMap* mark_bitmap);
  88 
  89   // Verify that the liveness count data created concurrently matches one created
  90   // during this safepoint.
  91   void verify(WorkGang* workers, G1CMBitMap* actual_bitmap);


  29 #include "utilities/bitMap.hpp"
  30 #include "utilities/globalDefinitions.hpp"
  31 
  32 class G1CollectedHeap;
  33 class G1CMBitMap;
  34 class WorkGang;
  35 
  36 // Information about object liveness on the Java heap on a "card" basis.
  37 // Can be used for various purposes, like as remembered set for completely
  38 // coarsened remembered sets, scrubbing remembered sets or estimating liveness.
  39 // This information is created as part of the concurrent marking cycle.
  40 class G1CardLiveData VALUE_OBJ_CLASS_SPEC {
  41   friend class G1CardLiveDataHelper;
  42   friend class G1VerifyCardLiveDataTask;
  43 private:
  44   typedef BitMap::bm_word_t bm_word_t;
  45   // Store some additional information about the covered area to be able to test.
  46   size_t _max_capacity;
  47   size_t _cards_per_region;
  48 
  49   // Regions may be reclaimed while concurrently creating live data (e.g. due to humongous
  50   // eager reclaim). This results in wrong live data for these regions at the end.
  51   // So we need to somehow detect these regions, and during live data finalization completely
  52   // recreate their information.
  53   // This _gc_timestamp_at_create tracks the global timestamp when live data creation
  54   // has started. Any regions with a higher time stamp have been cleared after that
  55   // point in time, and need re-finalization.
  56   // Unsynchronized access to this variable is okay, since this value is only set during a
  57   // concurrent phase, and read only at the Cleanup safepoint. I.e. there is always
  58   // full memory synchronization inbetween.
  59   uint _gc_timestamp_at_create;
  60   // The per-card liveness bitmap.
  61   bm_word_t* _live_cards;
  62   size_t _live_cards_size_in_bits;
  63   // The per-region liveness bitmap.
  64   bm_word_t* _live_regions;
  65   size_t _live_regions_size_in_bits;
  66   // The bits in this bitmap contain for every card whether it contains
  67   // at least part of at least one live object.
  68   BitMap live_cards_bm() const { return BitMap(_live_cards, _live_cards_size_in_bits); }
  69   // The bits in this bitmap indicate that a given region contains some live objects.
  70   BitMap live_regions_bm() const { return BitMap(_live_regions, _live_regions_size_in_bits); }
  71 
  72   // Allocate a "large" bitmap from virtual memory with the given size in bits.
  73   bm_word_t* allocate_large_bitmap(size_t size_in_bits);
  74   void free_large_bitmap(bm_word_t* map, size_t size_in_bits);
  75 
  76   inline BitMap live_card_bitmap(uint region);
  77 
  78   inline bool is_card_live_at(BitMap::idx_t idx) const;
  79 
  80   size_t live_region_bitmap_size_in_bits() const;
  81   size_t live_card_bitmap_size_in_bits() const;
  82 public:
  83   uint gc_timestamp_at_create() const { return _gc_timestamp_at_create; }
  84 
  85   inline bool is_region_live(uint region) const;
  86 
  87   inline void remove_nonlive_cards(uint region, BitMap* bm);
  88   inline void remove_nonlive_regions(BitMap* bm);
  89 
  90   G1CardLiveData();
  91   ~G1CardLiveData();
  92 
  93   void initialize(size_t max_capacity, uint num_max_regions);
  94   void pretouch();
  95 
  96   // Create the initial liveness data based on the marking result from the bottom
  97   // to the ntams of every region in the heap and the marks in the given bitmap.
  98   void create(WorkGang* workers, G1CMBitMap* mark_bitmap);
  99   // Finalize the liveness data.
 100   void finalize(WorkGang* workers, G1CMBitMap* mark_bitmap);
 101 
 102   // Verify that the liveness count data created concurrently matches one created
 103   // during this safepoint.
 104   void verify(WorkGang* workers, G1CMBitMap* actual_bitmap);
< prev index next >