< prev index next >

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

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


 134   _survivor_is_full = true;
 135 }
 136 
 137 void G1Allocator::set_old_full() {
 138   _old_is_full = true;
 139 }
 140 
 141 size_t G1Allocator::unsafe_max_tlab_alloc() {
 142   // Return the remaining space in the cur alloc region, but not less than
 143   // the min TLAB size.
 144 
 145   // Also, this value can be at most the humongous object threshold,
 146   // since we can't allow tlabs to grow big enough to accommodate
 147   // humongous objects.
 148 
 149   HeapRegion* hr = mutator_alloc_region()->get();
 150   size_t max_tlab = _g1h->max_tlab_size() * wordSize;
 151   if (hr == NULL) {
 152     return max_tlab;
 153   } else {
 154     return MIN2(MAX2(hr->free(), (size_t) MinTLABSize), max_tlab);
 155   }
 156 }
 157 
 158 size_t G1Allocator::used_in_alloc_regions() {
 159   assert(Heap_lock->owner() != NULL, "Should be owned on this thread's behalf.");
 160   return mutator_alloc_region()->used_in_alloc_regions();
 161 }
 162 
 163 
 164 HeapWord* G1Allocator::par_allocate_during_gc(G1HeapRegionAttr dest,
 165                                               size_t word_size) {
 166   size_t temp = 0;
 167   HeapWord* result = par_allocate_during_gc(dest, word_size, word_size, &temp);
 168   assert(result == NULL || temp == word_size,
 169          "Requested " SIZE_FORMAT " words, but got " SIZE_FORMAT " at " PTR_FORMAT,
 170          word_size, temp, p2i(result));
 171   return result;
 172 }
 173 
 174 HeapWord* G1Allocator::par_allocate_during_gc(G1HeapRegionAttr dest,




 134   _survivor_is_full = true;
 135 }
 136 
 137 void G1Allocator::set_old_full() {
 138   _old_is_full = true;
 139 }
 140 
 141 size_t G1Allocator::unsafe_max_tlab_alloc() {
 142   // Return the remaining space in the cur alloc region, but not less than
 143   // the min TLAB size.
 144 
 145   // Also, this value can be at most the humongous object threshold,
 146   // since we can't allow tlabs to grow big enough to accommodate
 147   // humongous objects.
 148 
 149   HeapRegion* hr = mutator_alloc_region()->get();
 150   size_t max_tlab = _g1h->max_tlab_size() * wordSize;
 151   if (hr == NULL) {
 152     return max_tlab;
 153   } else {
 154     return clamp(hr->free(), MinTLABSize, max_tlab);
 155   }
 156 }
 157 
 158 size_t G1Allocator::used_in_alloc_regions() {
 159   assert(Heap_lock->owner() != NULL, "Should be owned on this thread's behalf.");
 160   return mutator_alloc_region()->used_in_alloc_regions();
 161 }
 162 
 163 
 164 HeapWord* G1Allocator::par_allocate_during_gc(G1HeapRegionAttr dest,
 165                                               size_t word_size) {
 166   size_t temp = 0;
 167   HeapWord* result = par_allocate_during_gc(dest, word_size, word_size, &temp);
 168   assert(result == NULL || temp == word_size,
 169          "Requested " SIZE_FORMAT " words, but got " SIZE_FORMAT " at " PTR_FORMAT,
 170          word_size, temp, p2i(result));
 171   return result;
 172 }
 173 
 174 HeapWord* G1Allocator::par_allocate_during_gc(G1HeapRegionAttr dest,


< prev index next >