< prev index next >

src/hotspot/share/gc/shared/collectedHeap.cpp

Print this page




 451   guarantee(false, "thread-local allocation buffers not supported");
 452   return NULL;
 453 }
 454 
 455 oop CollectedHeap::obj_allocate(Klass* klass, int size, TRAPS) {
 456   ObjAllocator allocator(klass, size, THREAD);
 457   return allocator.allocate();
 458 }
 459 
 460 oop CollectedHeap::array_allocate(Klass* klass, int size, int length, bool do_zero, TRAPS) {
 461   ObjArrayAllocator allocator(klass, size, length, do_zero, THREAD);
 462   return allocator.allocate();
 463 }
 464 
 465 oop CollectedHeap::class_allocate(Klass* klass, int size, TRAPS) {
 466   ClassAllocator allocator(klass, size, THREAD);
 467   return allocator.allocate();
 468 }
 469 
 470 void CollectedHeap::ensure_parsability(bool retire_tlabs) {
 471   // The second disjunct in the assertion below makes a concession
 472   // for the start-up verification done while the VM is being
 473   // created. Callers be careful that you know that mutators
 474   // aren't going to interfere -- for instance, this is permissible
 475   // if we are still single-threaded and have either not yet
 476   // started allocating (nothing much to verify) or we have
 477   // started allocating but are now a full-fledged JavaThread
 478   // (and have thus made our TLAB's) available for filling.
 479   assert(SafepointSynchronize::is_at_safepoint() || !is_init_completed(),
 480          "Should only be called at a safepoint or at start-up"
 481          " otherwise concurrent mutator activity may make heap "
 482          " unparsable again");
 483 
 484   if (UseTLAB && retire_tlabs) {
 485     // Accumulate statistics before retiring
 486     ThreadLocalAllocBuffer::accumulate_statistics_before_gc();
 487   }
 488 
 489   // The main thread starts allocating via a TLAB even before it
 490   // has added itself to the threads list at vm boot-up.
 491   JavaThreadIteratorWithHandle jtiwh;
 492   assert(jtiwh.length() > 0,
 493          "Attempt to fill tlabs before main thread has been added"
 494          " to threads list is doomed to failure!");
 495   BarrierSet *bs = BarrierSet::barrier_set();
 496   for (; JavaThread *thread = jtiwh.next(); ) {
 497      if (UseTLAB) {
 498        thread->tlab().make_parsable(retire_tlabs);
 499      }
 500      bs->make_parsable(thread);
 501   }


 502 }
 503 
 504 void CollectedHeap::resize_all_tlabs() {
 505   assert(SafepointSynchronize::is_at_safepoint() || !is_init_completed(),
 506          "Should only resize tlabs at safepoint");
 507 
 508   if (UseTLAB && ResizeTLAB) {
 509     for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) {
 510       thread->tlab().resize();
 511     }
 512   }
 513 }
 514 
 515 void CollectedHeap::full_gc_dump(GCTimer* timer, bool before) {
 516   assert(timer != NULL, "timer is null");
 517   if ((HeapDumpBeforeFullGC && before) || (HeapDumpAfterFullGC && !before)) {
 518     GCTraceTime(Info, gc) tm(before ? "Heap Dump (before full gc)" : "Heap Dump (after full gc)", timer);
 519     HeapDumper::dump_heap();
 520   }
 521 




 451   guarantee(false, "thread-local allocation buffers not supported");
 452   return NULL;
 453 }
 454 
 455 oop CollectedHeap::obj_allocate(Klass* klass, int size, TRAPS) {
 456   ObjAllocator allocator(klass, size, THREAD);
 457   return allocator.allocate();
 458 }
 459 
 460 oop CollectedHeap::array_allocate(Klass* klass, int size, int length, bool do_zero, TRAPS) {
 461   ObjArrayAllocator allocator(klass, size, length, do_zero, THREAD);
 462   return allocator.allocate();
 463 }
 464 
 465 oop CollectedHeap::class_allocate(Klass* klass, int size, TRAPS) {
 466   ClassAllocator allocator(klass, size, THREAD);
 467   return allocator.allocate();
 468 }
 469 
 470 void CollectedHeap::ensure_parsability(bool retire_tlabs) {








 471   assert(SafepointSynchronize::is_at_safepoint() || !is_init_completed(),
 472          "Should only be called at a safepoint or at start-up");


 473 
 474   ThreadLocalAllocStats stats;



 475 
 476   for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) {
 477     BarrierSet::barrier_set()->make_parsable(thread);
 478     if (UseTLAB) {
 479       if (retire_tlabs) {
 480         thread->tlab().retire(&stats);
 481       } else {
 482         thread->tlab().make_parsable();
 483       }
 484     }



 485   }
 486 
 487   stats.publish();
 488 }
 489 
 490 void CollectedHeap::resize_all_tlabs() {
 491   assert(SafepointSynchronize::is_at_safepoint() || !is_init_completed(),
 492          "Should only resize tlabs at safepoint");
 493 
 494   if (UseTLAB && ResizeTLAB) {
 495     for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) {
 496       thread->tlab().resize();
 497     }
 498   }
 499 }
 500 
 501 void CollectedHeap::full_gc_dump(GCTimer* timer, bool before) {
 502   assert(timer != NULL, "timer is null");
 503   if ((HeapDumpBeforeFullGC && before) || (HeapDumpAfterFullGC && !before)) {
 504     GCTraceTime(Info, gc) tm(before ? "Heap Dump (before full gc)" : "Heap Dump (after full gc)", timer);
 505     HeapDumper::dump_heap();
 506   }
 507 


< prev index next >