< prev index next >

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

Print this page
rev 56944 : imported patch 8233702-function-to-clamp-value-to-range


 177 }
 178 
 179 void G1Allocator::set_old_full() {
 180   _old_is_full = true;
 181 }
 182 
 183 size_t G1Allocator::unsafe_max_tlab_alloc() {
 184   // Return the remaining space in the cur alloc region, but not less than
 185   // the min TLAB size.
 186 
 187   // Also, this value can be at most the humongous object threshold,
 188   // since we can't allow tlabs to grow big enough to accommodate
 189   // humongous objects.
 190 
 191   uint node_index = current_node_index();
 192   HeapRegion* hr = mutator_alloc_region(node_index)->get();
 193   size_t max_tlab = _g1h->max_tlab_size() * wordSize;
 194   if (hr == NULL) {
 195     return max_tlab;
 196   } else {
 197     return MIN2(MAX2(hr->free(), (size_t) MinTLABSize), max_tlab);
 198   }
 199 }
 200 
 201 size_t G1Allocator::used_in_alloc_regions() {
 202   assert(Heap_lock->owner() != NULL, "Should be owned on this thread's behalf.");
 203   size_t used = 0;
 204   for (uint i = 0; i < _num_alloc_regions; i++) {
 205     used += mutator_alloc_region(i)->used_in_alloc_regions();
 206   }
 207   return used;
 208 }
 209 
 210 
 211 HeapWord* G1Allocator::par_allocate_during_gc(G1HeapRegionAttr dest,
 212                                               size_t word_size,
 213                                               uint node_index) {
 214   size_t temp = 0;
 215   HeapWord* result = par_allocate_during_gc(dest, word_size, word_size, &temp, node_index);
 216   assert(result == NULL || temp == word_size,
 217          "Requested " SIZE_FORMAT " words, but got " SIZE_FORMAT " at " PTR_FORMAT,




 177 }
 178 
 179 void G1Allocator::set_old_full() {
 180   _old_is_full = true;
 181 }
 182 
 183 size_t G1Allocator::unsafe_max_tlab_alloc() {
 184   // Return the remaining space in the cur alloc region, but not less than
 185   // the min TLAB size.
 186 
 187   // Also, this value can be at most the humongous object threshold,
 188   // since we can't allow tlabs to grow big enough to accommodate
 189   // humongous objects.
 190 
 191   uint node_index = current_node_index();
 192   HeapRegion* hr = mutator_alloc_region(node_index)->get();
 193   size_t max_tlab = _g1h->max_tlab_size() * wordSize;
 194   if (hr == NULL) {
 195     return max_tlab;
 196   } else {
 197     return clamp(hr->free(), MinTLABSize, max_tlab);
 198   }
 199 }
 200 
 201 size_t G1Allocator::used_in_alloc_regions() {
 202   assert(Heap_lock->owner() != NULL, "Should be owned on this thread's behalf.");
 203   size_t used = 0;
 204   for (uint i = 0; i < _num_alloc_regions; i++) {
 205     used += mutator_alloc_region(i)->used_in_alloc_regions();
 206   }
 207   return used;
 208 }
 209 
 210 
 211 HeapWord* G1Allocator::par_allocate_during_gc(G1HeapRegionAttr dest,
 212                                               size_t word_size,
 213                                               uint node_index) {
 214   size_t temp = 0;
 215   HeapWord* result = par_allocate_during_gc(dest, word_size, word_size, &temp, node_index);
 216   assert(result == NULL || temp == word_size,
 217          "Requested " SIZE_FORMAT " words, but got " SIZE_FORMAT " at " PTR_FORMAT,


< prev index next >