< prev index next >

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

Print this page
rev 9771 : imported patch 8145667-move-fromcardcache-into-separate-files
rev 9772 : imported patch 8145671-rename-fromcardcache-to-g1fromcardcache
rev 9773 : imported patch 8145672-remove-dependency-of-g1fromcardcache-to-heapregionremset
rev 9774 : [mq]: 8145672-jmasa-comments


  31 int**  G1FromCardCache::_cache = NULL;
  32 uint   G1FromCardCache::_max_regions = 0;
  33 size_t G1FromCardCache::_static_mem_size = 0;
  34 
  35 void G1FromCardCache::initialize(uint num_par_rem_sets, uint max_num_regions) {
  36   guarantee(max_num_regions > 0, "Heap size must be valid");
  37   guarantee(_cache == NULL, "Should not call this multiple times");
  38 
  39   _max_regions = max_num_regions;
  40   _cache = Padded2DArray<int, mtGC>::create_unfreeable(num_par_rem_sets,
  41                                                        _max_regions,
  42                                                        &_static_mem_size);
  43 
  44   invalidate(0, _max_regions);
  45 }
  46 
  47 void G1FromCardCache::invalidate(uint start_idx, size_t new_num_regions) {
  48   guarantee((size_t)start_idx + new_num_regions <= max_uintx,
  49             "Trying to invalidate beyond maximum region, from %u size " SIZE_FORMAT,
  50             start_idx, new_num_regions);
  51   for (uint i = 0; i < G1RemSet::num_par_rem_sets(); i++) {
  52     uint end_idx = (start_idx + (uint)new_num_regions);
  53     assert(end_idx <= _max_regions, "Must be within max.");


  54     for (uint j = start_idx; j < end_idx; j++) {
  55       set(i, j, InvalidCard);
  56     }
  57   }
  58 }
  59 
  60 #ifndef PRODUCT
  61 void G1FromCardCache::print(outputStream* out) {
  62   for (uint i = 0; i < G1RemSet::num_par_rem_sets(); i++) {
  63     for (uint j = 0; j < _max_regions; j++) {
  64       out->print_cr("_from_card_cache[%u][%u] = %d.",
  65                     i, j, at(i, j));
  66     }
  67   }
  68 }
  69 #endif
  70 
  71 void G1FromCardCache::clear(uint region_idx) {
  72   uint num_par_remsets = G1RemSet::num_par_rem_sets();
  73   for (uint i = 0; i < num_par_remsets; i++) {


  31 int**  G1FromCardCache::_cache = NULL;
  32 uint   G1FromCardCache::_max_regions = 0;
  33 size_t G1FromCardCache::_static_mem_size = 0;
  34 
  35 void G1FromCardCache::initialize(uint num_par_rem_sets, uint max_num_regions) {
  36   guarantee(max_num_regions > 0, "Heap size must be valid");
  37   guarantee(_cache == NULL, "Should not call this multiple times");
  38 
  39   _max_regions = max_num_regions;
  40   _cache = Padded2DArray<int, mtGC>::create_unfreeable(num_par_rem_sets,
  41                                                        _max_regions,
  42                                                        &_static_mem_size);
  43 
  44   invalidate(0, _max_regions);
  45 }
  46 
  47 void G1FromCardCache::invalidate(uint start_idx, size_t new_num_regions) {
  48   guarantee((size_t)start_idx + new_num_regions <= max_uintx,
  49             "Trying to invalidate beyond maximum region, from %u size " SIZE_FORMAT,
  50             start_idx, new_num_regions);

  51   uint end_idx = (start_idx + (uint)new_num_regions);
  52   assert(end_idx <= _max_regions, "Must be within max.");
  53 
  54   for (uint i = 0; i < G1RemSet::num_par_rem_sets(); i++) {
  55     for (uint j = start_idx; j < end_idx; j++) {
  56       set(i, j, InvalidCard);
  57     }
  58   }
  59 }
  60 
  61 #ifndef PRODUCT
  62 void G1FromCardCache::print(outputStream* out) {
  63   for (uint i = 0; i < G1RemSet::num_par_rem_sets(); i++) {
  64     for (uint j = 0; j < _max_regions; j++) {
  65       out->print_cr("_from_card_cache[%u][%u] = %d.",
  66                     i, j, at(i, j));
  67     }
  68   }
  69 }
  70 #endif
  71 
  72 void G1FromCardCache::clear(uint region_idx) {
  73   uint num_par_remsets = G1RemSet::num_par_rem_sets();
  74   for (uint i = 0; i < num_par_remsets; i++) {
< prev index next >