< prev index next >

src/hotspot/share/gc/serial/tenuredGeneration.cpp

Print this page




 185 
 186   gch->post_full_gc_dump(gc_timer);
 187 
 188   gc_timer->register_gc_end();
 189 
 190   gc_tracer->report_gc_end(gc_timer->gc_end(), gc_timer->time_partitions());
 191 }
 192 
 193 HeapWord*
 194 TenuredGeneration::expand_and_allocate(size_t word_size,
 195                                        bool is_tlab,
 196                                        bool parallel) {
 197   assert(!is_tlab, "TenuredGeneration does not support TLAB allocation");
 198   if (parallel) {
 199     MutexLocker x(ParGCRareEvent_lock);
 200     HeapWord* result = NULL;
 201     size_t byte_size = word_size * HeapWordSize;
 202     while (true) {
 203       expand(byte_size, _min_heap_delta_bytes);
 204       if (GCExpandToAllocateDelayMillis > 0) {
 205         os::sleep(Thread::current(), GCExpandToAllocateDelayMillis, false);
 206       }
 207       result = _the_space->par_allocate(word_size);
 208       if ( result != NULL) {
 209         return result;
 210       } else {
 211         // If there's not enough expansion space available, give up.
 212         if (_virtual_space.uncommitted_size() < byte_size) {
 213           return NULL;
 214         }
 215         // else try again
 216       }
 217     }
 218   } else {
 219     expand(word_size*HeapWordSize, _min_heap_delta_bytes);
 220     return _the_space->allocate(word_size);
 221   }
 222 }
 223 
 224 bool TenuredGeneration::expand(size_t bytes, size_t expand_bytes) {
 225   GCMutexLocker x(ExpandHeap_lock);




 185 
 186   gch->post_full_gc_dump(gc_timer);
 187 
 188   gc_timer->register_gc_end();
 189 
 190   gc_tracer->report_gc_end(gc_timer->gc_end(), gc_timer->time_partitions());
 191 }
 192 
 193 HeapWord*
 194 TenuredGeneration::expand_and_allocate(size_t word_size,
 195                                        bool is_tlab,
 196                                        bool parallel) {
 197   assert(!is_tlab, "TenuredGeneration does not support TLAB allocation");
 198   if (parallel) {
 199     MutexLocker x(ParGCRareEvent_lock);
 200     HeapWord* result = NULL;
 201     size_t byte_size = word_size * HeapWordSize;
 202     while (true) {
 203       expand(byte_size, _min_heap_delta_bytes);
 204       if (GCExpandToAllocateDelayMillis > 0) {
 205         os::naked_sleep(GCExpandToAllocateDelayMillis);
 206       }
 207       result = _the_space->par_allocate(word_size);
 208       if ( result != NULL) {
 209         return result;
 210       } else {
 211         // If there's not enough expansion space available, give up.
 212         if (_virtual_space.uncommitted_size() < byte_size) {
 213           return NULL;
 214         }
 215         // else try again
 216       }
 217     }
 218   } else {
 219     expand(word_size*HeapWordSize, _min_heap_delta_bytes);
 220     return _the_space->allocate(word_size);
 221   }
 222 }
 223 
 224 bool TenuredGeneration::expand(size_t bytes, size_t expand_bytes) {
 225   GCMutexLocker x(ExpandHeap_lock);


< prev index next >