1400 ref_processor_stw()->enable_discovery(true /*verify_disabled*/, true /*verify_no_refs*/);
1401 ref_processor_stw()->setup_policy(do_clear_all_soft_refs);
1402
1403 // Do collection work
1404 {
1405 HandleMark hm; // Discard invalid handles created during gc
1406 G1MarkSweep::invoke_at_safepoint(ref_processor_stw(), do_clear_all_soft_refs);
1407 }
1408
1409 assert(free_regions() == 0, "we should not have added any free regions");
1410 rebuild_region_sets(false /* free_list_only */);
1411
1412 // Enqueue any discovered reference objects that have
1413 // not been removed from the discovered lists.
1414 ref_processor_stw()->enqueue_discovered_references();
1415
1416 COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
1417
1418 MemoryService::track_memory_usage();
1419
1420 verify_after_gc();
1421
1422 assert(!ref_processor_stw()->discovery_enabled(), "Postcondition");
1423 ref_processor_stw()->verify_no_references_recorded();
1424
1425 // Delete metaspaces for unloaded class loaders and clean up loader_data graph
1426 ClassLoaderDataGraph::purge();
1427 MetaspaceAux::verify_metrics();
1428
1429 // Note: since we've just done a full GC, concurrent
1430 // marking is no longer active. Therefore we need not
1431 // re-enable reference discovery for the CM ref processor.
1432 // That will be done at the start of the next marking cycle.
1433 assert(!ref_processor_cm()->discovery_enabled(), "Postcondition");
1434 ref_processor_cm()->verify_no_references_recorded();
1435
1436 reset_gc_time_stamp();
1437 // Since everything potentially moved, we will clear all remembered
1438 // sets, and clear all cards. Later we will rebuild remebered
1439 // sets. We will also reset the GC time stamps of the regions.
1440 clear_rsets_post_compaction();
1441 check_gc_time_stamps();
1504 #endif
1505
1506 // Discard all rset updates
1507 JavaThread::dirty_card_queue_set().abandon_logs();
1508 assert(!G1DeferredRSUpdate
1509 || (G1DeferredRSUpdate &&
1510 (dirty_card_queue_set().completed_buffers_num() == 0)), "Should not be any");
1511
1512 _young_list->reset_sampled_info();
1513 // At this point there should be no regions in the
1514 // entire heap tagged as young.
1515 assert(check_young_list_empty(true /* check_heap */),
1516 "young list should be empty at this point");
1517
1518 // Update the number of full collections that have been completed.
1519 increment_old_marking_cycles_completed(false /* concurrent */);
1520
1521 _hrs.verify_optional();
1522 verify_region_sets_optional();
1523
1524 // Start a new incremental collection set for the next pause
1525 assert(g1_policy()->collection_set() == NULL, "must be");
1526 g1_policy()->start_incremental_cset_building();
1527
1528 // Clear the _cset_fast_test bitmap in anticipation of adding
1529 // regions to the incremental collection set for the next
1530 // evacuation pause.
1531 clear_cset_fast_test();
1532
1533 init_mutator_alloc_region();
1534
1535 double end = os::elapsedTime();
1536 g1_policy()->record_full_collection_end();
1537
1538 if (G1Log::fine()) {
1539 g1_policy()->print_heap_transition();
1540 }
1541
1542 // We must call G1MonitoringSupport::update_sizes() in the same scoping level
1543 // as an active TraceMemoryManagerStats object (i.e. before the destructor for the
|
1400 ref_processor_stw()->enable_discovery(true /*verify_disabled*/, true /*verify_no_refs*/);
1401 ref_processor_stw()->setup_policy(do_clear_all_soft_refs);
1402
1403 // Do collection work
1404 {
1405 HandleMark hm; // Discard invalid handles created during gc
1406 G1MarkSweep::invoke_at_safepoint(ref_processor_stw(), do_clear_all_soft_refs);
1407 }
1408
1409 assert(free_regions() == 0, "we should not have added any free regions");
1410 rebuild_region_sets(false /* free_list_only */);
1411
1412 // Enqueue any discovered reference objects that have
1413 // not been removed from the discovered lists.
1414 ref_processor_stw()->enqueue_discovered_references();
1415
1416 COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
1417
1418 MemoryService::track_memory_usage();
1419
1420 assert(!ref_processor_stw()->discovery_enabled(), "Postcondition");
1421 ref_processor_stw()->verify_no_references_recorded();
1422
1423 // Delete metaspaces for unloaded class loaders and clean up loader_data graph
1424 ClassLoaderDataGraph::purge();
1425 MetaspaceAux::verify_metrics();
1426
1427 // Note: since we've just done a full GC, concurrent
1428 // marking is no longer active. Therefore we need not
1429 // re-enable reference discovery for the CM ref processor.
1430 // That will be done at the start of the next marking cycle.
1431 assert(!ref_processor_cm()->discovery_enabled(), "Postcondition");
1432 ref_processor_cm()->verify_no_references_recorded();
1433
1434 reset_gc_time_stamp();
1435 // Since everything potentially moved, we will clear all remembered
1436 // sets, and clear all cards. Later we will rebuild remebered
1437 // sets. We will also reset the GC time stamps of the regions.
1438 clear_rsets_post_compaction();
1439 check_gc_time_stamps();
1502 #endif
1503
1504 // Discard all rset updates
1505 JavaThread::dirty_card_queue_set().abandon_logs();
1506 assert(!G1DeferredRSUpdate
1507 || (G1DeferredRSUpdate &&
1508 (dirty_card_queue_set().completed_buffers_num() == 0)), "Should not be any");
1509
1510 _young_list->reset_sampled_info();
1511 // At this point there should be no regions in the
1512 // entire heap tagged as young.
1513 assert(check_young_list_empty(true /* check_heap */),
1514 "young list should be empty at this point");
1515
1516 // Update the number of full collections that have been completed.
1517 increment_old_marking_cycles_completed(false /* concurrent */);
1518
1519 _hrs.verify_optional();
1520 verify_region_sets_optional();
1521
1522 verify_after_gc();
1523
1524 // Start a new incremental collection set for the next pause
1525 assert(g1_policy()->collection_set() == NULL, "must be");
1526 g1_policy()->start_incremental_cset_building();
1527
1528 // Clear the _cset_fast_test bitmap in anticipation of adding
1529 // regions to the incremental collection set for the next
1530 // evacuation pause.
1531 clear_cset_fast_test();
1532
1533 init_mutator_alloc_region();
1534
1535 double end = os::elapsedTime();
1536 g1_policy()->record_full_collection_end();
1537
1538 if (G1Log::fine()) {
1539 g1_policy()->print_heap_transition();
1540 }
1541
1542 // We must call G1MonitoringSupport::update_sizes() in the same scoping level
1543 // as an active TraceMemoryManagerStats object (i.e. before the destructor for the
|