src/hotspot/share/gc/g1/g1CollectionSet.cpp
changeset 59321 5775e4825e58
parent 59319 9ee940f1de90
equal deleted inserted replaced
59320:11ff4e485670 59321:5775e4825e58
   276 
   276 
   277 void G1CollectionSet::add_young_region_common(HeapRegion* hr) {
   277 void G1CollectionSet::add_young_region_common(HeapRegion* hr) {
   278   assert(hr->is_young(), "invariant");
   278   assert(hr->is_young(), "invariant");
   279   assert(_inc_build_state == Active, "Precondition");
   279   assert(_inc_build_state == Active, "Precondition");
   280 
   280 
   281   size_t collection_set_length = _collection_set_cur_length;
       
   282   // We use UINT_MAX as "invalid" marker in verification.
       
   283   assert(collection_set_length < (UINT_MAX - 1),
       
   284          "Collection set is too large with " SIZE_FORMAT " entries", collection_set_length);
       
   285   hr->set_young_index_in_cset((uint)collection_set_length + 1);
       
   286 
       
   287   _collection_set_regions[collection_set_length] = hr->hrm_index();
       
   288   // Concurrent readers must observe the store of the value in the array before an
       
   289   // update to the length field.
       
   290   OrderAccess::storestore();
       
   291   _collection_set_cur_length++;
       
   292   assert(_collection_set_cur_length <= _collection_set_max_length, "Collection set larger than maximum allowed.");
       
   293 
       
   294   // This routine is used when:
   281   // This routine is used when:
   295   // * adding survivor regions to the incremental cset at the end of an
   282   // * adding survivor regions to the incremental cset at the end of an
   296   //   evacuation pause or
   283   //   evacuation pause or
   297   // * adding the current allocation region to the incremental cset
   284   // * adding the current allocation region to the incremental cset
   298   //   when it is retired.
   285   //   when it is retired.
   323     _inc_bytes_used_before += hr->used();
   310     _inc_bytes_used_before += hr->used();
   324   }
   311   }
   325 
   312 
   326   assert(!hr->in_collection_set(), "invariant");
   313   assert(!hr->in_collection_set(), "invariant");
   327   _g1h->register_young_region_with_region_attr(hr);
   314   _g1h->register_young_region_with_region_attr(hr);
       
   315 
       
   316   size_t collection_set_length = _collection_set_cur_length;
       
   317   // We use UINT_MAX as "invalid" marker in verification.
       
   318   assert(collection_set_length < (UINT_MAX - 1),
       
   319          "Collection set is too large with " SIZE_FORMAT " entries", collection_set_length);
       
   320   hr->set_young_index_in_cset((uint)collection_set_length + 1);
       
   321 
       
   322   _collection_set_regions[collection_set_length] = hr->hrm_index();
       
   323   // Concurrent readers must observe the store of the value in the array before an
       
   324   // update to the length field.
       
   325   OrderAccess::storestore();
       
   326   _collection_set_cur_length++;
       
   327   assert(_collection_set_cur_length <= _collection_set_max_length, "Collection set larger than maximum allowed.");
   328 }
   328 }
   329 
   329 
   330 void G1CollectionSet::add_survivor_regions(HeapRegion* hr) {
   330 void G1CollectionSet::add_survivor_regions(HeapRegion* hr) {
   331   assert(hr->is_survivor(), "Must only add survivor regions, but is %s", hr->get_type_str());
   331   assert(hr->is_survivor(), "Must only add survivor regions, but is %s", hr->get_type_str());
   332   add_young_region_common(hr);
   332   add_young_region_common(hr);