src/share/vm/memory/generation.cpp

Print this page
rev 5685 : 8028128: Add a type safe alternative for working with counter based data
Reviewed-by:


 618   }
 619 }
 620 
 621 // Currently nothing to do.
 622 void CardGeneration::prepare_for_verify() {}
 623 
 624 
 625 void OneContigSpaceCardGeneration::collect(bool   full,
 626                                            bool   clear_all_soft_refs,
 627                                            size_t size,
 628                                            bool   is_tlab) {
 629   GenCollectedHeap* gch = GenCollectedHeap::heap();
 630 
 631   SpecializationStats::clear();
 632   // Temporarily expand the span of our ref processor, so
 633   // refs discovery is over the entire heap, not just this generation
 634   ReferenceProcessorSpanMutator
 635     x(ref_processor(), gch->reserved_region());
 636 
 637   STWGCTimer* gc_timer = GenMarkSweep::gc_timer();
 638   gc_timer->register_gc_start(os::elapsed_counter());
 639 
 640   SerialOldTracer* gc_tracer = GenMarkSweep::gc_tracer();
 641   gc_tracer->report_gc_start(gch->gc_cause(), gc_timer->gc_start());
 642 
 643   GenMarkSweep::invoke_at_safepoint(_level, ref_processor(), clear_all_soft_refs);
 644 
 645   gc_timer->register_gc_end(os::elapsed_counter());
 646 
 647   gc_tracer->report_gc_end(os::elapsed_counter(), gc_timer->time_partitions());
 648 
 649   SpecializationStats::print();
 650 }
 651 
 652 HeapWord*
 653 OneContigSpaceCardGeneration::expand_and_allocate(size_t word_size,
 654                                                   bool is_tlab,
 655                                                   bool parallel) {
 656   assert(!is_tlab, "OneContigSpaceCardGeneration does not support TLAB allocation");
 657   if (parallel) {
 658     MutexLocker x(ParGCRareEvent_lock);
 659     HeapWord* result = NULL;
 660     size_t byte_size = word_size * HeapWordSize;
 661     while (true) {
 662       expand(byte_size, _min_heap_delta_bytes);
 663       if (GCExpandToAllocateDelayMillis > 0) {
 664         os::sleep(Thread::current(), GCExpandToAllocateDelayMillis, false);
 665       }
 666       result = _the_space->par_allocate(word_size);
 667       if ( result != NULL) {




 618   }
 619 }
 620 
 621 // Currently nothing to do.
 622 void CardGeneration::prepare_for_verify() {}
 623 
 624 
 625 void OneContigSpaceCardGeneration::collect(bool   full,
 626                                            bool   clear_all_soft_refs,
 627                                            size_t size,
 628                                            bool   is_tlab) {
 629   GenCollectedHeap* gch = GenCollectedHeap::heap();
 630 
 631   SpecializationStats::clear();
 632   // Temporarily expand the span of our ref processor, so
 633   // refs discovery is over the entire heap, not just this generation
 634   ReferenceProcessorSpanMutator
 635     x(ref_processor(), gch->reserved_region());
 636 
 637   STWGCTimer* gc_timer = GenMarkSweep::gc_timer();
 638   gc_timer->register_gc_start();
 639 
 640   SerialOldTracer* gc_tracer = GenMarkSweep::gc_tracer();
 641   gc_tracer->report_gc_start(gch->gc_cause(), gc_timer->gc_start());
 642 
 643   GenMarkSweep::invoke_at_safepoint(_level, ref_processor(), clear_all_soft_refs);
 644 
 645   gc_timer->register_gc_end();
 646 
 647   gc_tracer->report_gc_end(gc_timer->gc_end(), gc_timer->time_partitions());
 648 
 649   SpecializationStats::print();
 650 }
 651 
 652 HeapWord*
 653 OneContigSpaceCardGeneration::expand_and_allocate(size_t word_size,
 654                                                   bool is_tlab,
 655                                                   bool parallel) {
 656   assert(!is_tlab, "OneContigSpaceCardGeneration does not support TLAB allocation");
 657   if (parallel) {
 658     MutexLocker x(ParGCRareEvent_lock);
 659     HeapWord* result = NULL;
 660     size_t byte_size = word_size * HeapWordSize;
 661     while (true) {
 662       expand(byte_size, _min_heap_delta_bytes);
 663       if (GCExpandToAllocateDelayMillis > 0) {
 664         os::sleep(Thread::current(), GCExpandToAllocateDelayMillis, false);
 665       }
 666       result = _the_space->par_allocate(word_size);
 667       if ( result != NULL) {