1923 g1h->verify_region_sets_optional(); 1924 1925 if (VerifyDuringGC) { 1926 HandleMark hm; // handle scope 1927 g1h->prepare_for_verify(); 1928 Universe::verify(VerifyOption_G1UsePrevMarking, 1929 " VerifyDuringGC:(before)"); 1930 } 1931 g1h->check_bitmaps("Cleanup Start"); 1932 1933 G1CollectorPolicy* g1p = g1h->g1_policy(); 1934 g1p->record_concurrent_mark_cleanup_start(); 1935 1936 double start = os::elapsedTime(); 1937 1938 HeapRegionRemSet::reset_for_cleanup_tasks(); 1939 1940 // Do counting once more with the world stopped for good measure. 1941 G1ParFinalCountTask g1_par_count_task(g1h, &_region_bm, &_card_bm); 1942 1943 uint n_workers = _g1h->workers()->active_workers(); 1944 1945 g1h->workers()->run_task(&g1_par_count_task); 1946 1947 if (VerifyDuringGC) { 1948 // Verify that the counting data accumulated during marking matches 1949 // that calculated by walking the marking bitmap. 1950 1951 // Bitmaps to hold expected values 1952 BitMap expected_region_bm(_region_bm.size(), true); 1953 BitMap expected_card_bm(_card_bm.size(), true); 1954 1955 G1ParVerifyFinalCountTask g1_par_verify_task(g1h, 1956 &_region_bm, 1957 &_card_bm, 1958 &expected_region_bm, 1959 &expected_card_bm); 1960 1961 g1h->workers()->run_task(&g1_par_verify_task); 1962 1963 guarantee(g1_par_verify_task.failures() == 0, "Unexpected accounting failures"); 1964 } 1965 1966 size_t start_used_bytes = g1h->used(); 1967 g1h->set_marking_complete(); 1968 1969 double count_end = os::elapsedTime(); 1970 double this_final_counting_time = (count_end - start); 1971 _total_counting_time += this_final_counting_time; 1972 1973 if (G1PrintRegionLivenessInfo) { 1974 G1PrintRegionLivenessInfoClosure cl(gclog_or_tty, "Post-Marking"); 1975 _g1h->heap_region_iterate(&cl); 1976 } 1977 1978 // Install newly created mark bitMap as "prev". 1979 swapMarkBitMaps(); 1980 1981 g1h->reset_gc_time_stamp(); 1982 1983 // Note end of marking in all heap regions. 1984 G1ParNoteEndTask g1_par_note_end_task(g1h, &_cleanup_list, n_workers); 1985 g1h->workers()->run_task(&g1_par_note_end_task); 1986 g1h->check_gc_time_stamps(); 1987 1988 if (!cleanup_list_is_empty()) { 1989 // The cleanup list is not empty, so we'll have to process it 1990 // concurrently. Notify anyone else that might be wanting free 1991 // regions that there will be more free regions coming soon. 1992 g1h->set_free_regions_coming(); 1993 } 1994 1995 // call below, since it affects the metric by which we sort the heap 1996 // regions. 1997 if (G1ScrubRemSets) { 1998 double rs_scrub_start = os::elapsedTime(); 1999 G1ParScrubRemSetTask g1_par_scrub_rs_task(g1h, &_region_bm, &_card_bm, n_workers); 2000 g1h->workers()->run_task(&g1_par_scrub_rs_task); 2001 | 1923 g1h->verify_region_sets_optional(); 1924 1925 if (VerifyDuringGC) { 1926 HandleMark hm; // handle scope 1927 g1h->prepare_for_verify(); 1928 Universe::verify(VerifyOption_G1UsePrevMarking, 1929 " VerifyDuringGC:(before)"); 1930 } 1931 g1h->check_bitmaps("Cleanup Start"); 1932 1933 G1CollectorPolicy* g1p = g1h->g1_policy(); 1934 g1p->record_concurrent_mark_cleanup_start(); 1935 1936 double start = os::elapsedTime(); 1937 1938 HeapRegionRemSet::reset_for_cleanup_tasks(); 1939 1940 // Do counting once more with the world stopped for good measure. 1941 G1ParFinalCountTask g1_par_count_task(g1h, &_region_bm, &_card_bm); 1942 1943 g1h->workers()->run_task(&g1_par_count_task); 1944 1945 if (VerifyDuringGC) { 1946 // Verify that the counting data accumulated during marking matches 1947 // that calculated by walking the marking bitmap. 1948 1949 // Bitmaps to hold expected values 1950 BitMap expected_region_bm(_region_bm.size(), true); 1951 BitMap expected_card_bm(_card_bm.size(), true); 1952 1953 G1ParVerifyFinalCountTask g1_par_verify_task(g1h, 1954 &_region_bm, 1955 &_card_bm, 1956 &expected_region_bm, 1957 &expected_card_bm); 1958 1959 g1h->workers()->run_task(&g1_par_verify_task); 1960 1961 guarantee(g1_par_verify_task.failures() == 0, "Unexpected accounting failures"); 1962 } 1963 1964 size_t start_used_bytes = g1h->used(); 1965 g1h->set_marking_complete(); 1966 1967 double count_end = os::elapsedTime(); 1968 double this_final_counting_time = (count_end - start); 1969 _total_counting_time += this_final_counting_time; 1970 1971 if (G1PrintRegionLivenessInfo) { 1972 G1PrintRegionLivenessInfoClosure cl(gclog_or_tty, "Post-Marking"); 1973 _g1h->heap_region_iterate(&cl); 1974 } 1975 1976 // Install newly created mark bitMap as "prev". 1977 swapMarkBitMaps(); 1978 1979 g1h->reset_gc_time_stamp(); 1980 1981 uint n_workers = _g1h->workers()->active_workers(); 1982 1983 // Note end of marking in all heap regions. 1984 G1ParNoteEndTask g1_par_note_end_task(g1h, &_cleanup_list, n_workers); 1985 g1h->workers()->run_task(&g1_par_note_end_task); 1986 g1h->check_gc_time_stamps(); 1987 1988 if (!cleanup_list_is_empty()) { 1989 // The cleanup list is not empty, so we'll have to process it 1990 // concurrently. Notify anyone else that might be wanting free 1991 // regions that there will be more free regions coming soon. 1992 g1h->set_free_regions_coming(); 1993 } 1994 1995 // call below, since it affects the metric by which we sort the heap 1996 // regions. 1997 if (G1ScrubRemSets) { 1998 double rs_scrub_start = os::elapsedTime(); 1999 G1ParScrubRemSetTask g1_par_scrub_rs_task(g1h, &_region_bm, &_card_bm, n_workers); 2000 g1h->workers()->run_task(&g1_par_scrub_rs_task); 2001 |