< prev index next >

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

Print this page
rev 10929 : [mq]: 8154838-wrong-calculation-in-livedata


  43   _live_regions(NULL),
  44   _live_regions_size_in_bits(0),
  45   _live_cards(NULL),
  46   _live_cards_size_in_bits(0) {
  47 }
  48 
  49 G1CardLiveData::~G1CardLiveData()  {
  50   free_large_bitmap(_live_cards, _live_cards_size_in_bits);
  51   free_large_bitmap(_live_regions, _live_regions_size_in_bits);
  52 }
  53 
  54 G1CardLiveData::bm_word_t* G1CardLiveData::allocate_large_bitmap(size_t size_in_bits) {
  55   size_t size_in_words = BitMap::calc_size_in_words(size_in_bits);
  56 
  57   bm_word_t* map = MmapArrayAllocator<bm_word_t, mtGC>::allocate(size_in_words);
  58 
  59   return map;
  60 }
  61 
  62 void G1CardLiveData::free_large_bitmap(bm_word_t* bitmap, size_t size_in_bits) {
  63   MmapArrayAllocator<bm_word_t, mtGC>::free(bitmap, size_in_bits / BitsPerWord);
  64 }
  65 
  66 void G1CardLiveData::initialize(size_t max_capacity, uint num_max_regions) {
  67   assert(max_capacity % num_max_regions == 0,
  68          "Given capacity must be evenly divisible by region size.");
  69   size_t region_size = max_capacity / num_max_regions;
  70   assert(region_size % (G1SATBCardTableModRefBS::card_size * BitsPerWord) == 0,
  71          "Region size must be evenly divisible by area covered by a single word.");
  72   _max_capacity = max_capacity;
  73   _cards_per_region = region_size / G1SATBCardTableModRefBS::card_size;
  74 
  75   _live_regions_size_in_bits = live_region_bitmap_size_in_bits();
  76   _live_regions = allocate_large_bitmap(_live_regions_size_in_bits);
  77   _live_cards_size_in_bits = live_card_bitmap_size_in_bits();
  78   _live_cards = allocate_large_bitmap(_live_cards_size_in_bits);
  79 }
  80 
  81 void G1CardLiveData::pretouch() {
  82   live_cards_bm().pretouch();
  83   live_regions_bm().pretouch();




  43   _live_regions(NULL),
  44   _live_regions_size_in_bits(0),
  45   _live_cards(NULL),
  46   _live_cards_size_in_bits(0) {
  47 }
  48 
  49 G1CardLiveData::~G1CardLiveData()  {
  50   free_large_bitmap(_live_cards, _live_cards_size_in_bits);
  51   free_large_bitmap(_live_regions, _live_regions_size_in_bits);
  52 }
  53 
  54 G1CardLiveData::bm_word_t* G1CardLiveData::allocate_large_bitmap(size_t size_in_bits) {
  55   size_t size_in_words = BitMap::calc_size_in_words(size_in_bits);
  56 
  57   bm_word_t* map = MmapArrayAllocator<bm_word_t, mtGC>::allocate(size_in_words);
  58 
  59   return map;
  60 }
  61 
  62 void G1CardLiveData::free_large_bitmap(bm_word_t* bitmap, size_t size_in_bits) {
  63   MmapArrayAllocator<bm_word_t, mtGC>::free(bitmap, BitMap::calc_size_in_words(size_in_bits));
  64 }
  65 
  66 void G1CardLiveData::initialize(size_t max_capacity, uint num_max_regions) {
  67   assert(max_capacity % num_max_regions == 0,
  68          "Given capacity must be evenly divisible by region size.");
  69   size_t region_size = max_capacity / num_max_regions;
  70   assert(region_size % (G1SATBCardTableModRefBS::card_size * BitsPerWord) == 0,
  71          "Region size must be evenly divisible by area covered by a single word.");
  72   _max_capacity = max_capacity;
  73   _cards_per_region = region_size / G1SATBCardTableModRefBS::card_size;
  74 
  75   _live_regions_size_in_bits = live_region_bitmap_size_in_bits();
  76   _live_regions = allocate_large_bitmap(_live_regions_size_in_bits);
  77   _live_cards_size_in_bits = live_card_bitmap_size_in_bits();
  78   _live_cards = allocate_large_bitmap(_live_cards_size_in_bits);
  79 }
  80 
  81 void G1CardLiveData::pretouch() {
  82   live_cards_bm().pretouch();
  83   live_regions_bm().pretouch();


< prev index next >