@@ -186,6 +186,8 @@ DefNewGeneration::DefNewGeneration(ReservedSpace rs,
186186 _pretenure_size_threshold_words = PretenureSizeThreshold >> LogHeapWordSize;
187187
188188 _gc_timer = new (ResourceObj::C_HEAP, mtGC) STWGCTimer ();
189+
190+ _gc_tracer = new (ResourceObj::C_HEAP, mtGC) DefNewTracer ();
189191}
190192
191193void DefNewGeneration::compute_space_boundaries (uintx minimum_eden_size,
@@ -528,8 +530,7 @@ void DefNewGeneration::collect(bool full,
528530 SerialHeap* heap = SerialHeap::heap ();
529531
530532 _gc_timer->register_gc_start ();
531- DefNewTracer gc_tracer;
532- gc_tracer.report_gc_start (heap->gc_cause (), _gc_timer->gc_start ());
533+ _gc_tracer->report_gc_start (heap->gc_cause (), _gc_timer->gc_start ());
533534
534535 _old_gen = heap->old_gen ();
535536
@@ -547,7 +548,7 @@ void DefNewGeneration::collect(bool full,
547548
548549 GCTraceTime (Trace, gc, phases) tm (" DefNew" , NULL , heap->gc_cause ());
549550
550- heap->trace_heap_before_gc (&gc_tracer );
551+ heap->trace_heap_before_gc (_gc_tracer );
551552
552553 // These can be shared for all code paths
553554 IsAliveClosure is_alive (this );
@@ -590,8 +591,8 @@ void DefNewGeneration::collect(bool full,
590591 ReferenceProcessorPhaseTimes pt (_gc_timer, rp->max_num_queues ());
591592 SerialGCRefProcProxyTask task (is_alive, keep_alive, evacuate_followers);
592593 const ReferenceProcessorStats& stats = rp->process_discovered_references (task, pt);
593- gc_tracer. report_gc_reference_stats (stats);
594- gc_tracer. report_tenuring_threshold (tenuring_threshold ());
594+ _gc_tracer-> report_gc_reference_stats (stats);
595+ _gc_tracer-> report_tenuring_threshold (tenuring_threshold ());
595596 pt.print_all_references ();
596597
597598 assert (heap->no_allocs_since_save_marks (), " save marks have not been newly set." );
@@ -645,19 +646,19 @@ void DefNewGeneration::collect(bool full,
645646
646647 // Inform the next generation that a promotion failure occurred.
647648 _old_gen->promotion_failure_occurred ();
648- gc_tracer. report_promotion_failed (_promotion_failed_info);
649+ _gc_tracer-> report_promotion_failed (_promotion_failed_info);
649650
650651 // Reset the PromotionFailureALot counters.
651652 NOT_PRODUCT (heap->reset_promotion_should_fail ();)
652653 }
653654 // We should have processed and cleared all the preserved marks.
654655 _preserved_marks_set.reclaim ();
655656
656- heap->trace_heap_after_gc (&gc_tracer );
657+ heap->trace_heap_after_gc (_gc_tracer );
657658
658659 _gc_timer->register_gc_end ();
659660
660- gc_tracer. report_gc_end (_gc_timer->gc_end (), _gc_timer->time_partitions ());
661+ _gc_tracer-> report_gc_end (_gc_timer->gc_end (), _gc_timer->time_partitions ());
661662}
662663
663664void DefNewGeneration::init_assuming_no_promotion_failure () {
0 commit comments