< prev index next >

src/hotspot/share/gc/g1/heapRegionRemSet.cpp

Print this page
rev 58017 : [mq]: 8238854-remove-superfluous-alloc-checks


  75   _n_fine_entries(0),
  76   _first_all_fine_prts(NULL),
  77   _last_all_fine_prts(NULL),
  78   _fine_eviction_start(0),
  79   _sparse_table()
  80 {
  81   typedef PerRegionTable* PerRegionTablePtr;
  82 
  83   if (_max_fine_entries == 0) {
  84     assert(_mod_max_fine_entries_mask == 0, "Both or none.");
  85     size_t max_entries_log = (size_t)log2_long((jlong)G1RSetRegionEntries);
  86     _max_fine_entries = (size_t)1 << max_entries_log;
  87     _mod_max_fine_entries_mask = _max_fine_entries - 1;
  88 
  89     assert(_fine_eviction_sample_size == 0
  90            && _fine_eviction_stride == 0, "All init at same time.");
  91     _fine_eviction_sample_size = MAX2((size_t)4, max_entries_log);
  92     _fine_eviction_stride = _max_fine_entries / _fine_eviction_sample_size;
  93   }
  94 
  95   _fine_grain_regions = NEW_C_HEAP_ARRAY3(PerRegionTablePtr, _max_fine_entries,
  96                         mtGC, CURRENT_PC, AllocFailStrategy::RETURN_NULL);
  97 
  98   if (_fine_grain_regions == NULL) {
  99     vm_exit_out_of_memory(sizeof(void*)*_max_fine_entries, OOM_MALLOC_ERROR,
 100                           "Failed to allocate _fine_grain_entries.");
 101   }
 102 
 103   for (size_t i = 0; i < _max_fine_entries; i++) {
 104     _fine_grain_regions[i] = NULL;
 105   }
 106 }
 107 
 108 void OtherRegionsTable::link_to_all(PerRegionTable* prt) {
 109   // We always append to the beginning of the list for convenience;
 110   // the order of entries in this list does not matter.
 111   if (_first_all_fine_prts != NULL) {
 112     assert(_first_all_fine_prts->prev() == NULL, "invariant");
 113     _first_all_fine_prts->set_prev(prt);
 114     prt->set_next(_first_all_fine_prts);
 115   } else {
 116     // this is the first element we insert. Adjust the "last" pointer
 117     _last_all_fine_prts = prt;
 118     assert(prt->next() == NULL, "just checking");
 119   }
 120   // the new element is always the first element without a predecessor
 121   prt->set_prev(NULL);
 122   _first_all_fine_prts = prt;




  75   _n_fine_entries(0),
  76   _first_all_fine_prts(NULL),
  77   _last_all_fine_prts(NULL),
  78   _fine_eviction_start(0),
  79   _sparse_table()
  80 {
  81   typedef PerRegionTable* PerRegionTablePtr;
  82 
  83   if (_max_fine_entries == 0) {
  84     assert(_mod_max_fine_entries_mask == 0, "Both or none.");
  85     size_t max_entries_log = (size_t)log2_long((jlong)G1RSetRegionEntries);
  86     _max_fine_entries = (size_t)1 << max_entries_log;
  87     _mod_max_fine_entries_mask = _max_fine_entries - 1;
  88 
  89     assert(_fine_eviction_sample_size == 0
  90            && _fine_eviction_stride == 0, "All init at same time.");
  91     _fine_eviction_sample_size = MAX2((size_t)4, max_entries_log);
  92     _fine_eviction_stride = _max_fine_entries / _fine_eviction_sample_size;
  93   }
  94 
  95   _fine_grain_regions = NEW_C_HEAP_ARRAY(PerRegionTablePtr, _max_fine_entries, mtGC);







  96   for (size_t i = 0; i < _max_fine_entries; i++) {
  97     _fine_grain_regions[i] = NULL;
  98   }
  99 }
 100 
 101 void OtherRegionsTable::link_to_all(PerRegionTable* prt) {
 102   // We always append to the beginning of the list for convenience;
 103   // the order of entries in this list does not matter.
 104   if (_first_all_fine_prts != NULL) {
 105     assert(_first_all_fine_prts->prev() == NULL, "invariant");
 106     _first_all_fine_prts->set_prev(prt);
 107     prt->set_next(_first_all_fine_prts);
 108   } else {
 109     // this is the first element we insert. Adjust the "last" pointer
 110     _last_all_fine_prts = prt;
 111     assert(prt->next() == NULL, "just checking");
 112   }
 113   // the new element is always the first element without a predecessor
 114   prt->set_prev(NULL);
 115   _first_all_fine_prts = prt;


< prev index next >