317
318 // Fill in TLABs
319 heap->accumulate_statistics_all_tlabs();
320 heap->ensure_parsability(true); // retire TLABs
321
322 if (VerifyBeforeGC && heap->total_collections() >= VerifyGCStartAt) {
323 HandleMark hm; // Discard invalid handles created during verification
324 Universe::verify(" VerifyBeforeGC:");
325 }
326
327 {
328 ResourceMark rm;
329 HandleMark hm;
330
331 gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
332 TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
333 GCTraceTime t1(GCCauseString("GC", gc_cause), PrintGC, !PrintGCDetails, NULL);
334 TraceCollectorStats tcs(counters());
335 TraceMemoryManagerStats tms(false /* not full GC */,gc_cause);
336
337 if (TraceGen0Time) accumulated_time()->start();
338
339 // Let the size policy know we're starting
340 size_policy->minor_collection_begin();
341
342 // Verify the object start arrays.
343 if (VerifyObjectStartArray &&
344 VerifyBeforeGC) {
345 old_gen->verify_object_start_array();
346 }
347
348 // Verify no unmarked old->young roots
349 if (VerifyRememberedSets) {
350 CardTableExtension::verify_all_young_refs_imprecise();
351 }
352
353 if (!ScavengeWithObjectsInToSpace) {
354 assert(young_gen->to_space()->is_empty(),
355 "Attempt to scavenge with live objects in to_space");
356 young_gen->to_space()->clear(SpaceDecorator::Mangle);
357 } else if (ZapUnusedHeapArea) {
641 {
642 GCTraceTime tm("Prune Scavenge Root Methods", false, false, &_gc_timer);
643
644 CodeCache::prune_scavenge_root_nmethods();
645 }
646
647 // Re-verify object start arrays
648 if (VerifyObjectStartArray &&
649 VerifyAfterGC) {
650 old_gen->verify_object_start_array();
651 }
652
653 // Verify all old -> young cards are now precise
654 if (VerifyRememberedSets) {
655 // Precise verification will give false positives. Until this is fixed,
656 // use imprecise verification.
657 // CardTableExtension::verify_all_young_refs_precise();
658 CardTableExtension::verify_all_young_refs_imprecise();
659 }
660
661 if (TraceGen0Time) accumulated_time()->stop();
662
663 if (PrintGC) {
664 if (PrintGCDetails) {
665 // Don't print a GC timestamp here. This is after the GC so
666 // would be confusing.
667 young_gen->print_used_change(young_gen_used_before);
668 }
669 heap->print_heap_change(prev_used);
670 }
671
672 // Track memory usage and detect low memory
673 MemoryService::track_memory_usage();
674 heap->update_counters();
675
676 gc_task_manager()->release_idle_workers();
677 }
678
679 if (VerifyAfterGC && heap->total_collections() >= VerifyGCStartAt) {
680 HandleMark hm; // Discard invalid handles created during verification
681 Universe::verify(" VerifyAfterGC:");
|
317
318 // Fill in TLABs
319 heap->accumulate_statistics_all_tlabs();
320 heap->ensure_parsability(true); // retire TLABs
321
322 if (VerifyBeforeGC && heap->total_collections() >= VerifyGCStartAt) {
323 HandleMark hm; // Discard invalid handles created during verification
324 Universe::verify(" VerifyBeforeGC:");
325 }
326
327 {
328 ResourceMark rm;
329 HandleMark hm;
330
331 gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
332 TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
333 GCTraceTime t1(GCCauseString("GC", gc_cause), PrintGC, !PrintGCDetails, NULL);
334 TraceCollectorStats tcs(counters());
335 TraceMemoryManagerStats tms(false /* not full GC */,gc_cause);
336
337 if (TraceYoungGenTime) accumulated_time()->start();
338
339 // Let the size policy know we're starting
340 size_policy->minor_collection_begin();
341
342 // Verify the object start arrays.
343 if (VerifyObjectStartArray &&
344 VerifyBeforeGC) {
345 old_gen->verify_object_start_array();
346 }
347
348 // Verify no unmarked old->young roots
349 if (VerifyRememberedSets) {
350 CardTableExtension::verify_all_young_refs_imprecise();
351 }
352
353 if (!ScavengeWithObjectsInToSpace) {
354 assert(young_gen->to_space()->is_empty(),
355 "Attempt to scavenge with live objects in to_space");
356 young_gen->to_space()->clear(SpaceDecorator::Mangle);
357 } else if (ZapUnusedHeapArea) {
641 {
642 GCTraceTime tm("Prune Scavenge Root Methods", false, false, &_gc_timer);
643
644 CodeCache::prune_scavenge_root_nmethods();
645 }
646
647 // Re-verify object start arrays
648 if (VerifyObjectStartArray &&
649 VerifyAfterGC) {
650 old_gen->verify_object_start_array();
651 }
652
653 // Verify all old -> young cards are now precise
654 if (VerifyRememberedSets) {
655 // Precise verification will give false positives. Until this is fixed,
656 // use imprecise verification.
657 // CardTableExtension::verify_all_young_refs_precise();
658 CardTableExtension::verify_all_young_refs_imprecise();
659 }
660
661 if (TraceYoungGenTime) accumulated_time()->stop();
662
663 if (PrintGC) {
664 if (PrintGCDetails) {
665 // Don't print a GC timestamp here. This is after the GC so
666 // would be confusing.
667 young_gen->print_used_change(young_gen_used_before);
668 }
669 heap->print_heap_change(prev_used);
670 }
671
672 // Track memory usage and detect low memory
673 MemoryService::track_memory_usage();
674 heap->update_counters();
675
676 gc_task_manager()->release_idle_workers();
677 }
678
679 if (VerifyAfterGC && heap->total_collections() >= VerifyGCStartAt) {
680 HandleMark hm; // Discard invalid handles created during verification
681 Universe::verify(" VerifyAfterGC:");
|