< prev index next >

src/hotspot/share/gc/epsilon/epsilonHeap.cpp

Print this page




 139       assert(expand, "Should be able to expand");
 140     } else if (size < space_left) {
 141       // No space to expand in bulk, and this allocation is still possible,
 142       // take all the remaining space:
 143       bool expand = _virtual_space.expand_by(space_left);
 144       assert(expand, "Should be able to expand");
 145     } else {
 146       // No space left:
 147       return NULL;
 148     }
 149 
 150     _space->set_end((HeapWord *) _virtual_space.high());
 151     res = _space->par_allocate(size);
 152   }
 153 
 154   size_t used = _space->used();
 155 
 156   // Allocation successful, update counters
 157   {
 158     size_t last = _last_counter_update;
 159     if ((used - last >= _step_counter_update) && Atomic::cmpxchg(used, &_last_counter_update, last) == last) {
 160       _monitoring_support->update_counters();
 161     }
 162   }
 163 
 164   // ...and print the occupancy line, if needed
 165   {
 166     size_t last = _last_heap_print;
 167     if ((used - last >= _step_heap_print) && Atomic::cmpxchg(used, &_last_heap_print, last) == last) {
 168       print_heap_info(used);
 169       print_metaspace_info();
 170     }
 171   }
 172 
 173   assert(is_object_aligned(res), "Object should be aligned: " PTR_FORMAT, p2i(res));
 174   return res;
 175 }
 176 
 177 HeapWord* EpsilonHeap::allocate_new_tlab(size_t min_size,
 178                                          size_t requested_size,
 179                                          size_t* actual_size) {
 180   Thread* thread = Thread::current();
 181 
 182   // Defaults in case elastic paths are not taken
 183   bool fits = true;
 184   size_t size = requested_size;
 185   size_t ergo_tlab = requested_size;
 186   int64_t time = 0;
 187 




 139       assert(expand, "Should be able to expand");
 140     } else if (size < space_left) {
 141       // No space to expand in bulk, and this allocation is still possible,
 142       // take all the remaining space:
 143       bool expand = _virtual_space.expand_by(space_left);
 144       assert(expand, "Should be able to expand");
 145     } else {
 146       // No space left:
 147       return NULL;
 148     }
 149 
 150     _space->set_end((HeapWord *) _virtual_space.high());
 151     res = _space->par_allocate(size);
 152   }
 153 
 154   size_t used = _space->used();
 155 
 156   // Allocation successful, update counters
 157   {
 158     size_t last = _last_counter_update;
 159     if ((used - last >= _step_counter_update) && Atomic::cmpxchg(&_last_counter_update, last, used) == last) {
 160       _monitoring_support->update_counters();
 161     }
 162   }
 163 
 164   // ...and print the occupancy line, if needed
 165   {
 166     size_t last = _last_heap_print;
 167     if ((used - last >= _step_heap_print) && Atomic::cmpxchg(&_last_heap_print, last, used) == last) {
 168       print_heap_info(used);
 169       print_metaspace_info();
 170     }
 171   }
 172 
 173   assert(is_object_aligned(res), "Object should be aligned: " PTR_FORMAT, p2i(res));
 174   return res;
 175 }
 176 
 177 HeapWord* EpsilonHeap::allocate_new_tlab(size_t min_size,
 178                                          size_t requested_size,
 179                                          size_t* actual_size) {
 180   Thread* thread = Thread::current();
 181 
 182   // Defaults in case elastic paths are not taken
 183   bool fits = true;
 184   size_t size = requested_size;
 185   size_t ergo_tlab = requested_size;
 186   int64_t time = 0;
 187 


< prev index next >