Mercurial > hg > graal-compiler
comparison src/share/vm/gc_implementation/g1/concurrentMark.cpp @ 18041:52b4284cb496
Merge with jdk8u20-b26
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Wed, 15 Oct 2014 16:02:50 +0200 |
parents | 4ca6dc0799b6 8a140676873f |
children | 7848fc12602b |
comparison
equal
deleted
inserted
replaced
17606:45d7b2c7029d | 18041:52b4284cb496 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
535 } | 535 } |
536 _verbose_level = verbose_level; | 536 _verbose_level = verbose_level; |
537 | 537 |
538 if (verbose_low()) { | 538 if (verbose_low()) { |
539 gclog_or_tty->print_cr("[global] init, heap start = "PTR_FORMAT", " | 539 gclog_or_tty->print_cr("[global] init, heap start = "PTR_FORMAT", " |
540 "heap end = "PTR_FORMAT, _heap_start, _heap_end); | 540 "heap end = " INTPTR_FORMAT, p2i(_heap_start), p2i(_heap_end)); |
541 } | 541 } |
542 | 542 |
543 if (!_markBitMap1.allocate(heap_rs)) { | 543 if (!_markBitMap1.allocate(heap_rs)) { |
544 warning("Failed to allocate first CM bit map"); | 544 warning("Failed to allocate first CM bit map"); |
545 return; | 545 return; |
565 satb_qs.set_buffer_size(G1SATBBufferSize); | 565 satb_qs.set_buffer_size(G1SATBBufferSize); |
566 | 566 |
567 _root_regions.init(_g1h, this); | 567 _root_regions.init(_g1h, this); |
568 | 568 |
569 if (ConcGCThreads > ParallelGCThreads) { | 569 if (ConcGCThreads > ParallelGCThreads) { |
570 warning("Can't have more ConcGCThreads (" UINT32_FORMAT ") " | 570 warning("Can't have more ConcGCThreads (" UINTX_FORMAT ") " |
571 "than ParallelGCThreads (" UINT32_FORMAT ").", | 571 "than ParallelGCThreads (" UINTX_FORMAT ").", |
572 ConcGCThreads, ParallelGCThreads); | 572 ConcGCThreads, ParallelGCThreads); |
573 return; | 573 return; |
574 } | 574 } |
575 if (ParallelGCThreads == 0) { | 575 if (ParallelGCThreads == 0) { |
576 // if we are not running with any parallel GC threads we will not | 576 // if we are not running with any parallel GC threads we will not |
649 // Verify that the calculated value for MarkStackSize is in range. | 649 // Verify that the calculated value for MarkStackSize is in range. |
650 // It would be nice to use the private utility routine from Arguments. | 650 // It would be nice to use the private utility routine from Arguments. |
651 if (!(mark_stack_size >= 1 && mark_stack_size <= MarkStackSizeMax)) { | 651 if (!(mark_stack_size >= 1 && mark_stack_size <= MarkStackSizeMax)) { |
652 warning("Invalid value calculated for MarkStackSize (" UINTX_FORMAT "): " | 652 warning("Invalid value calculated for MarkStackSize (" UINTX_FORMAT "): " |
653 "must be between " UINTX_FORMAT " and " UINTX_FORMAT, | 653 "must be between " UINTX_FORMAT " and " UINTX_FORMAT, |
654 mark_stack_size, 1, MarkStackSizeMax); | 654 mark_stack_size, (uintx) 1, MarkStackSizeMax); |
655 return; | 655 return; |
656 } | 656 } |
657 FLAG_SET_ERGO(uintx, MarkStackSize, mark_stack_size); | 657 FLAG_SET_ERGO(uintx, MarkStackSize, mark_stack_size); |
658 } else { | 658 } else { |
659 // Verify MarkStackSize is in range. | 659 // Verify MarkStackSize is in range. |
660 if (FLAG_IS_CMDLINE(MarkStackSize)) { | 660 if (FLAG_IS_CMDLINE(MarkStackSize)) { |
661 if (FLAG_IS_DEFAULT(MarkStackSizeMax)) { | 661 if (FLAG_IS_DEFAULT(MarkStackSizeMax)) { |
662 if (!(MarkStackSize >= 1 && MarkStackSize <= MarkStackSizeMax)) { | 662 if (!(MarkStackSize >= 1 && MarkStackSize <= MarkStackSizeMax)) { |
663 warning("Invalid value specified for MarkStackSize (" UINTX_FORMAT "): " | 663 warning("Invalid value specified for MarkStackSize (" UINTX_FORMAT "): " |
664 "must be between " UINTX_FORMAT " and " UINTX_FORMAT, | 664 "must be between " UINTX_FORMAT " and " UINTX_FORMAT, |
665 MarkStackSize, 1, MarkStackSizeMax); | 665 MarkStackSize, (uintx) 1, MarkStackSizeMax); |
666 return; | 666 return; |
667 } | 667 } |
668 } else if (FLAG_IS_CMDLINE(MarkStackSizeMax)) { | 668 } else if (FLAG_IS_CMDLINE(MarkStackSizeMax)) { |
669 if (!(MarkStackSize >= 1 && MarkStackSize <= MarkStackSizeMax)) { | 669 if (!(MarkStackSize >= 1 && MarkStackSize <= MarkStackSizeMax)) { |
670 warning("Invalid value specified for MarkStackSize (" UINTX_FORMAT ")" | 670 warning("Invalid value specified for MarkStackSize (" UINTX_FORMAT ")" |
817 } else { | 817 } else { |
818 // We currently assume that the concurrent flag has been set to | 818 // We currently assume that the concurrent flag has been set to |
819 // false before we start remark. At this point we should also be | 819 // false before we start remark. At this point we should also be |
820 // in a STW phase. | 820 // in a STW phase. |
821 assert(!concurrent_marking_in_progress(), "invariant"); | 821 assert(!concurrent_marking_in_progress(), "invariant"); |
822 assert(_finger == _heap_end, | 822 assert(out_of_regions(), |
823 err_msg("only way to get here: _finger: "PTR_FORMAT", _heap_end: "PTR_FORMAT, | 823 err_msg("only way to get here: _finger: "PTR_FORMAT", _heap_end: "PTR_FORMAT, |
824 _finger, _heap_end)); | 824 p2i(_finger), p2i(_heap_end))); |
825 update_g1_committed(true); | 825 update_g1_committed(true); |
826 } | 826 } |
827 } | 827 } |
828 | 828 |
829 void ConcurrentMark::set_non_marking_state() { | 829 void ConcurrentMark::set_non_marking_state() { |
976 } | 976 } |
977 | 977 |
978 if (concurrent()) { | 978 if (concurrent()) { |
979 ConcurrentGCThread::stsLeave(); | 979 ConcurrentGCThread::stsLeave(); |
980 } | 980 } |
981 _first_overflow_barrier_sync.enter(); | 981 |
982 bool barrier_aborted = !_first_overflow_barrier_sync.enter(); | |
983 | |
982 if (concurrent()) { | 984 if (concurrent()) { |
983 ConcurrentGCThread::stsJoin(); | 985 ConcurrentGCThread::stsJoin(); |
984 } | 986 } |
985 // at this point everyone should have synced up and not be doing any | 987 // at this point everyone should have synced up and not be doing any |
986 // more work | 988 // more work |
987 | 989 |
988 if (verbose_low()) { | 990 if (verbose_low()) { |
989 gclog_or_tty->print_cr("[%u] leaving first barrier", worker_id); | 991 if (barrier_aborted) { |
992 gclog_or_tty->print_cr("[%u] aborted first barrier", worker_id); | |
993 } else { | |
994 gclog_or_tty->print_cr("[%u] leaving first barrier", worker_id); | |
995 } | |
996 } | |
997 | |
998 if (barrier_aborted) { | |
999 // If the barrier aborted we ignore the overflow condition and | |
1000 // just abort the whole marking phase as quickly as possible. | |
1001 return; | |
990 } | 1002 } |
991 | 1003 |
992 // If we're executing the concurrent phase of marking, reset the marking | 1004 // If we're executing the concurrent phase of marking, reset the marking |
993 // state; otherwise the marking state is reset after reference processing, | 1005 // state; otherwise the marking state is reset after reference processing, |
994 // during the remark pause. | 1006 // during the remark pause. |
1024 } | 1036 } |
1025 | 1037 |
1026 if (concurrent()) { | 1038 if (concurrent()) { |
1027 ConcurrentGCThread::stsLeave(); | 1039 ConcurrentGCThread::stsLeave(); |
1028 } | 1040 } |
1029 _second_overflow_barrier_sync.enter(); | 1041 |
1042 bool barrier_aborted = !_second_overflow_barrier_sync.enter(); | |
1043 | |
1030 if (concurrent()) { | 1044 if (concurrent()) { |
1031 ConcurrentGCThread::stsJoin(); | 1045 ConcurrentGCThread::stsJoin(); |
1032 } | 1046 } |
1033 // at this point everything should be re-initialized and ready to go | 1047 // at this point everything should be re-initialized and ready to go |
1034 | 1048 |
1035 if (verbose_low()) { | 1049 if (verbose_low()) { |
1036 gclog_or_tty->print_cr("[%u] leaving second barrier", worker_id); | 1050 if (barrier_aborted) { |
1051 gclog_or_tty->print_cr("[%u] aborted second barrier", worker_id); | |
1052 } else { | |
1053 gclog_or_tty->print_cr("[%u] leaving second barrier", worker_id); | |
1054 } | |
1037 } | 1055 } |
1038 } | 1056 } |
1039 | 1057 |
1040 #ifndef PRODUCT | 1058 #ifndef PRODUCT |
1041 void ForceOverflowSettings::init() { | 1059 void ForceOverflowSettings::init() { |
1420 HeapWord* start = hr->bottom(); | 1438 HeapWord* start = hr->bottom(); |
1421 | 1439 |
1422 assert(start <= hr->end() && start <= ntams && ntams <= hr->end(), | 1440 assert(start <= hr->end() && start <= ntams && ntams <= hr->end(), |
1423 err_msg("Preconditions not met - " | 1441 err_msg("Preconditions not met - " |
1424 "start: "PTR_FORMAT", ntams: "PTR_FORMAT", end: "PTR_FORMAT, | 1442 "start: "PTR_FORMAT", ntams: "PTR_FORMAT", end: "PTR_FORMAT, |
1425 start, ntams, hr->end())); | 1443 p2i(start), p2i(ntams), p2i(hr->end()))); |
1426 | 1444 |
1427 // Find the first marked object at or after "start". | 1445 // Find the first marked object at or after "start". |
1428 start = _bm->getNextMarkedWordAddress(start, ntams); | 1446 start = _bm->getNextMarkedWordAddress(start, ntams); |
1429 | 1447 |
1430 size_t marked_bytes = 0; | 1448 size_t marked_bytes = 0; |
1605 } | 1623 } |
1606 | 1624 |
1607 if (failures > 0 && _verbose) { | 1625 if (failures > 0 && _verbose) { |
1608 gclog_or_tty->print_cr("Region " HR_FORMAT ", ntams: " PTR_FORMAT ", " | 1626 gclog_or_tty->print_cr("Region " HR_FORMAT ", ntams: " PTR_FORMAT ", " |
1609 "marked_bytes: calc/actual " SIZE_FORMAT "/" SIZE_FORMAT, | 1627 "marked_bytes: calc/actual " SIZE_FORMAT "/" SIZE_FORMAT, |
1610 HR_FORMAT_PARAMS(hr), hr->next_top_at_mark_start(), | 1628 HR_FORMAT_PARAMS(hr), p2i(hr->next_top_at_mark_start()), |
1611 _calc_cl.region_marked_bytes(), hr->next_marked_bytes()); | 1629 _calc_cl.region_marked_bytes(), hr->next_marked_bytes()); |
1612 } | 1630 } |
1613 | 1631 |
1614 _failures += failures; | 1632 _failures += failures; |
1615 | 1633 |
1616 // We could stop iteration over the heap when we | 1634 // We could stop iteration over the heap when we |
1617 // find the first violating region by returning true. | 1635 // find the first violating region by returning true. |
1618 return false; | 1636 return false; |
1619 } | 1637 } |
1620 }; | 1638 }; |
1621 | |
1622 | 1639 |
1623 class G1ParVerifyFinalCountTask: public AbstractGangTask { | 1640 class G1ParVerifyFinalCountTask: public AbstractGangTask { |
1624 protected: | 1641 protected: |
1625 G1CollectedHeap* _g1h; | 1642 G1CollectedHeap* _g1h; |
1626 ConcurrentMark* _cm; | 1643 ConcurrentMark* _cm; |
1803 | 1820 |
1804 class G1ParNoteEndTask; | 1821 class G1ParNoteEndTask; |
1805 | 1822 |
1806 class G1NoteEndOfConcMarkClosure : public HeapRegionClosure { | 1823 class G1NoteEndOfConcMarkClosure : public HeapRegionClosure { |
1807 G1CollectedHeap* _g1; | 1824 G1CollectedHeap* _g1; |
1808 int _worker_num; | |
1809 size_t _max_live_bytes; | 1825 size_t _max_live_bytes; |
1810 uint _regions_claimed; | 1826 uint _regions_claimed; |
1811 size_t _freed_bytes; | 1827 size_t _freed_bytes; |
1812 FreeRegionList* _local_cleanup_list; | 1828 FreeRegionList* _local_cleanup_list; |
1813 OldRegionSet* _old_proxy_set; | 1829 HeapRegionSetCount _old_regions_removed; |
1814 HumongousRegionSet* _humongous_proxy_set; | 1830 HeapRegionSetCount _humongous_regions_removed; |
1815 HRRSCleanupTask* _hrrs_cleanup_task; | 1831 HRRSCleanupTask* _hrrs_cleanup_task; |
1816 double _claimed_region_time; | 1832 double _claimed_region_time; |
1817 double _max_region_time; | 1833 double _max_region_time; |
1818 | 1834 |
1819 public: | 1835 public: |
1820 G1NoteEndOfConcMarkClosure(G1CollectedHeap* g1, | 1836 G1NoteEndOfConcMarkClosure(G1CollectedHeap* g1, |
1821 int worker_num, | |
1822 FreeRegionList* local_cleanup_list, | 1837 FreeRegionList* local_cleanup_list, |
1823 OldRegionSet* old_proxy_set, | |
1824 HumongousRegionSet* humongous_proxy_set, | |
1825 HRRSCleanupTask* hrrs_cleanup_task) : | 1838 HRRSCleanupTask* hrrs_cleanup_task) : |
1826 _g1(g1), _worker_num(worker_num), | 1839 _g1(g1), |
1827 _max_live_bytes(0), _regions_claimed(0), | 1840 _max_live_bytes(0), _regions_claimed(0), |
1828 _freed_bytes(0), | 1841 _freed_bytes(0), |
1829 _claimed_region_time(0.0), _max_region_time(0.0), | 1842 _claimed_region_time(0.0), _max_region_time(0.0), |
1830 _local_cleanup_list(local_cleanup_list), | 1843 _local_cleanup_list(local_cleanup_list), |
1831 _old_proxy_set(old_proxy_set), | 1844 _old_regions_removed(), |
1832 _humongous_proxy_set(humongous_proxy_set), | 1845 _humongous_regions_removed(), |
1833 _hrrs_cleanup_task(hrrs_cleanup_task) { } | 1846 _hrrs_cleanup_task(hrrs_cleanup_task) { } |
1834 | 1847 |
1835 size_t freed_bytes() { return _freed_bytes; } | 1848 size_t freed_bytes() { return _freed_bytes; } |
1849 const HeapRegionSetCount& old_regions_removed() { return _old_regions_removed; } | |
1850 const HeapRegionSetCount& humongous_regions_removed() { return _humongous_regions_removed; } | |
1836 | 1851 |
1837 bool doHeapRegion(HeapRegion *hr) { | 1852 bool doHeapRegion(HeapRegion *hr) { |
1838 if (hr->continuesHumongous()) { | 1853 if (hr->continuesHumongous()) { |
1839 return false; | 1854 return false; |
1840 } | 1855 } |
1843 _g1->reset_gc_time_stamps(hr); | 1858 _g1->reset_gc_time_stamps(hr); |
1844 double start = os::elapsedTime(); | 1859 double start = os::elapsedTime(); |
1845 _regions_claimed++; | 1860 _regions_claimed++; |
1846 hr->note_end_of_marking(); | 1861 hr->note_end_of_marking(); |
1847 _max_live_bytes += hr->max_live_bytes(); | 1862 _max_live_bytes += hr->max_live_bytes(); |
1848 _g1->free_region_if_empty(hr, | 1863 |
1849 &_freed_bytes, | 1864 if (hr->used() > 0 && hr->max_live_bytes() == 0 && !hr->is_young()) { |
1850 _local_cleanup_list, | 1865 _freed_bytes += hr->used(); |
1851 _old_proxy_set, | 1866 hr->set_containing_set(NULL); |
1852 _humongous_proxy_set, | 1867 if (hr->isHumongous()) { |
1853 _hrrs_cleanup_task, | 1868 assert(hr->startsHumongous(), "we should only see starts humongous"); |
1854 true /* par */); | 1869 _humongous_regions_removed.increment(1u, hr->capacity()); |
1870 _g1->free_humongous_region(hr, _local_cleanup_list, true); | |
1871 } else { | |
1872 _old_regions_removed.increment(1u, hr->capacity()); | |
1873 _g1->free_region(hr, _local_cleanup_list, true); | |
1874 } | |
1875 } else { | |
1876 hr->rem_set()->do_cleanup_work(_hrrs_cleanup_task); | |
1877 } | |
1878 | |
1855 double region_time = (os::elapsedTime() - start); | 1879 double region_time = (os::elapsedTime() - start); |
1856 _claimed_region_time += region_time; | 1880 _claimed_region_time += region_time; |
1857 if (region_time > _max_region_time) { | 1881 if (region_time > _max_region_time) { |
1858 _max_region_time = region_time; | 1882 _max_region_time = region_time; |
1859 } | 1883 } |
1882 _max_live_bytes(0), _freed_bytes(0), _cleanup_list(cleanup_list) { } | 1906 _max_live_bytes(0), _freed_bytes(0), _cleanup_list(cleanup_list) { } |
1883 | 1907 |
1884 void work(uint worker_id) { | 1908 void work(uint worker_id) { |
1885 double start = os::elapsedTime(); | 1909 double start = os::elapsedTime(); |
1886 FreeRegionList local_cleanup_list("Local Cleanup List"); | 1910 FreeRegionList local_cleanup_list("Local Cleanup List"); |
1887 OldRegionSet old_proxy_set("Local Cleanup Old Proxy Set"); | |
1888 HumongousRegionSet humongous_proxy_set("Local Cleanup Humongous Proxy Set"); | |
1889 HRRSCleanupTask hrrs_cleanup_task; | 1911 HRRSCleanupTask hrrs_cleanup_task; |
1890 G1NoteEndOfConcMarkClosure g1_note_end(_g1h, worker_id, &local_cleanup_list, | 1912 G1NoteEndOfConcMarkClosure g1_note_end(_g1h, &local_cleanup_list, |
1891 &old_proxy_set, | |
1892 &humongous_proxy_set, | |
1893 &hrrs_cleanup_task); | 1913 &hrrs_cleanup_task); |
1894 if (G1CollectedHeap::use_parallel_gc_threads()) { | 1914 if (G1CollectedHeap::use_parallel_gc_threads()) { |
1895 _g1h->heap_region_par_iterate_chunked(&g1_note_end, worker_id, | 1915 _g1h->heap_region_par_iterate_chunked(&g1_note_end, worker_id, |
1896 _g1h->workers()->active_workers(), | 1916 _g1h->workers()->active_workers(), |
1897 HeapRegion::NoteEndClaimValue); | 1917 HeapRegion::NoteEndClaimValue); |
1899 _g1h->heap_region_iterate(&g1_note_end); | 1919 _g1h->heap_region_iterate(&g1_note_end); |
1900 } | 1920 } |
1901 assert(g1_note_end.complete(), "Shouldn't have yielded!"); | 1921 assert(g1_note_end.complete(), "Shouldn't have yielded!"); |
1902 | 1922 |
1903 // Now update the lists | 1923 // Now update the lists |
1904 _g1h->update_sets_after_freeing_regions(g1_note_end.freed_bytes(), | 1924 _g1h->remove_from_old_sets(g1_note_end.old_regions_removed(), g1_note_end.humongous_regions_removed()); |
1905 NULL /* free_list */, | |
1906 &old_proxy_set, | |
1907 &humongous_proxy_set, | |
1908 true /* par */); | |
1909 { | 1925 { |
1910 MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag); | 1926 MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag); |
1927 _g1h->decrement_summary_bytes(g1_note_end.freed_bytes()); | |
1911 _max_live_bytes += g1_note_end.max_live_bytes(); | 1928 _max_live_bytes += g1_note_end.max_live_bytes(); |
1912 _freed_bytes += g1_note_end.freed_bytes(); | 1929 _freed_bytes += g1_note_end.freed_bytes(); |
1913 | 1930 |
1914 // If we iterate over the global cleanup list at the end of | 1931 // If we iterate over the global cleanup list at the end of |
1915 // cleanup to do this printing we will not guarantee to only | 1932 // cleanup to do this printing we will not guarantee to only |
1919 // printing here, before we append the new regions to the global | 1936 // printing here, before we append the new regions to the global |
1920 // cleanup list. | 1937 // cleanup list. |
1921 | 1938 |
1922 G1HRPrinter* hr_printer = _g1h->hr_printer(); | 1939 G1HRPrinter* hr_printer = _g1h->hr_printer(); |
1923 if (hr_printer->is_active()) { | 1940 if (hr_printer->is_active()) { |
1924 HeapRegionLinkedListIterator iter(&local_cleanup_list); | 1941 FreeRegionListIterator iter(&local_cleanup_list); |
1925 while (iter.more_available()) { | 1942 while (iter.more_available()) { |
1926 HeapRegion* hr = iter.get_next(); | 1943 HeapRegion* hr = iter.get_next(); |
1927 hr_printer->cleanup(hr); | 1944 hr_printer->cleanup(hr); |
1928 } | 1945 } |
1929 } | 1946 } |
1930 | 1947 |
1931 _cleanup_list->add_as_tail(&local_cleanup_list); | 1948 _cleanup_list->add_ordered(&local_cleanup_list); |
1932 assert(local_cleanup_list.is_empty(), "post-condition"); | 1949 assert(local_cleanup_list.is_empty(), "post-condition"); |
1933 | 1950 |
1934 HeapRegionRemSet::finish_cleanup_task(&hrrs_cleanup_task); | 1951 HeapRegionRemSet::finish_cleanup_task(&hrrs_cleanup_task); |
1935 } | 1952 } |
1936 } | 1953 } |
1970 if (has_aborted()) { | 1987 if (has_aborted()) { |
1971 g1h->set_marking_complete(); // So bitmap clearing isn't confused | 1988 g1h->set_marking_complete(); // So bitmap clearing isn't confused |
1972 return; | 1989 return; |
1973 } | 1990 } |
1974 | 1991 |
1975 HRSPhaseSetter x(HRSPhaseCleanup); | |
1976 g1h->verify_region_sets_optional(); | 1992 g1h->verify_region_sets_optional(); |
1977 | 1993 |
1978 if (VerifyDuringGC) { | 1994 if (VerifyDuringGC) { |
1979 HandleMark hm; // handle scope | 1995 HandleMark hm; // handle scope |
1980 Universe::heap()->prepare_for_verify(); | 1996 Universe::heap()->prepare_for_verify(); |
2156 | 2172 |
2157 // Noone else should be accessing the _cleanup_list at this point, | 2173 // Noone else should be accessing the _cleanup_list at this point, |
2158 // so it's not necessary to take any locks | 2174 // so it's not necessary to take any locks |
2159 while (!_cleanup_list.is_empty()) { | 2175 while (!_cleanup_list.is_empty()) { |
2160 HeapRegion* hr = _cleanup_list.remove_head(); | 2176 HeapRegion* hr = _cleanup_list.remove_head(); |
2161 assert(hr != NULL, "the list was not empty"); | 2177 assert(hr != NULL, "Got NULL from a non-empty list"); |
2162 hr->par_clear(); | 2178 hr->par_clear(); |
2163 tmp_free_list.add_as_tail(hr); | 2179 tmp_free_list.add_ordered(hr); |
2164 | 2180 |
2165 // Instead of adding one region at a time to the secondary_free_list, | 2181 // Instead of adding one region at a time to the secondary_free_list, |
2166 // we accumulate them in the local list and move them a few at a | 2182 // we accumulate them in the local list and move them a few at a |
2167 // time. This also cuts down on the number of notify_all() calls | 2183 // time. This also cuts down on the number of notify_all() calls |
2168 // we do during this process. We'll also append the local list when | 2184 // we do during this process. We'll also append the local list when |
2178 _cleanup_list.length()); | 2194 _cleanup_list.length()); |
2179 } | 2195 } |
2180 | 2196 |
2181 { | 2197 { |
2182 MutexLockerEx x(SecondaryFreeList_lock, Mutex::_no_safepoint_check_flag); | 2198 MutexLockerEx x(SecondaryFreeList_lock, Mutex::_no_safepoint_check_flag); |
2183 g1h->secondary_free_list_add_as_tail(&tmp_free_list); | 2199 g1h->secondary_free_list_add(&tmp_free_list); |
2184 SecondaryFreeList_lock->notify_all(); | 2200 SecondaryFreeList_lock->notify_all(); |
2185 } | 2201 } |
2186 | 2202 |
2187 if (G1StressConcRegionFreeing) { | 2203 if (G1StressConcRegionFreeing) { |
2188 for (uintx i = 0; i < G1StressConcRegionFreeingDelayMillis; ++i) { | 2204 for (uintx i = 0; i < G1StressConcRegionFreeingDelayMillis; ++i) { |
2237 if (!_cm->has_overflown()) { | 2253 if (!_cm->has_overflown()) { |
2238 oop obj = oopDesc::load_decode_heap_oop(p); | 2254 oop obj = oopDesc::load_decode_heap_oop(p); |
2239 if (_cm->verbose_high()) { | 2255 if (_cm->verbose_high()) { |
2240 gclog_or_tty->print_cr("\t[%u] we're looking at location " | 2256 gclog_or_tty->print_cr("\t[%u] we're looking at location " |
2241 "*"PTR_FORMAT" = "PTR_FORMAT, | 2257 "*"PTR_FORMAT" = "PTR_FORMAT, |
2242 _task->worker_id(), p, (void*) obj); | 2258 _task->worker_id(), p2i(p), p2i((void*) obj)); |
2243 } | 2259 } |
2244 | 2260 |
2245 _task->deal_with_reference(obj); | 2261 _task->deal_with_reference(obj); |
2246 _ref_counter--; | 2262 _ref_counter--; |
2247 | 2263 |
2527 | 2543 |
2528 rp->verify_no_references_recorded(); | 2544 rp->verify_no_references_recorded(); |
2529 assert(!rp->discovery_enabled(), "Post condition"); | 2545 assert(!rp->discovery_enabled(), "Post condition"); |
2530 } | 2546 } |
2531 | 2547 |
2532 // Now clean up stale oops in StringTable | 2548 if (has_overflown()) { |
2533 StringTable::unlink(&g1_is_alive); | 2549 // We can not trust g1_is_alive if the marking stack overflowed |
2534 // Clean up unreferenced symbols in symbol table. | 2550 return; |
2535 SymbolTable::unlink(); | 2551 } |
2552 | |
2553 g1h->unlink_string_and_symbol_table(&g1_is_alive, | |
2554 /* process_strings */ false, // currently strings are always roots | |
2555 /* process_symbols */ true); | |
2536 } | 2556 } |
2537 | 2557 |
2538 void ConcurrentMark::swapMarkBitMaps() { | 2558 void ConcurrentMark::swapMarkBitMaps() { |
2539 CMBitMapRO* temp = _prevMarkBitMap; | 2559 CMBitMapRO* temp = _prevMarkBitMap; |
2540 _prevMarkBitMap = (CMBitMapRO*)_nextMarkBitMap; | 2560 _prevMarkBitMap = (CMBitMapRO*)_nextMarkBitMap; |
2668 str = " NOT"; | 2688 str = " NOT"; |
2669 } | 2689 } |
2670 } | 2690 } |
2671 | 2691 |
2672 _out->print_cr(" "PTR_FORMAT": "PTR_FORMAT"%s%s", | 2692 _out->print_cr(" "PTR_FORMAT": "PTR_FORMAT"%s%s", |
2673 p, (void*) obj, str, str2); | 2693 p2i(p), p2i((void*) obj), str, str2); |
2674 } | 2694 } |
2675 }; | 2695 }; |
2676 | 2696 |
2677 class PrintReachableObjectClosure : public ObjectClosure { | 2697 class PrintReachableObjectClosure : public ObjectClosure { |
2678 private: | 2698 private: |
2695 bool marked = _g1h->is_marked(o, _vo); | 2715 bool marked = _g1h->is_marked(o, _vo); |
2696 bool print_it = _all || over_tams || marked; | 2716 bool print_it = _all || over_tams || marked; |
2697 | 2717 |
2698 if (print_it) { | 2718 if (print_it) { |
2699 _out->print_cr(" "PTR_FORMAT"%s", | 2719 _out->print_cr(" "PTR_FORMAT"%s", |
2700 (void *)o, (over_tams) ? " >" : (marked) ? " M" : ""); | 2720 p2i((void *)o), (over_tams) ? " >" : (marked) ? " M" : ""); |
2701 PrintReachableOopClosure oopCl(_out, _vo, _all); | 2721 PrintReachableOopClosure oopCl(_out, _vo, _all); |
2702 o->oop_iterate_no_header(&oopCl); | 2722 o->oop_iterate_no_header(&oopCl); |
2703 } | 2723 } |
2704 } | 2724 } |
2705 }; | 2725 }; |
2716 HeapWord* b = hr->bottom(); | 2736 HeapWord* b = hr->bottom(); |
2717 HeapWord* e = hr->end(); | 2737 HeapWord* e = hr->end(); |
2718 HeapWord* t = hr->top(); | 2738 HeapWord* t = hr->top(); |
2719 HeapWord* p = _g1h->top_at_mark_start(hr, _vo); | 2739 HeapWord* p = _g1h->top_at_mark_start(hr, _vo); |
2720 _out->print_cr("** ["PTR_FORMAT", "PTR_FORMAT"] top: "PTR_FORMAT" " | 2740 _out->print_cr("** ["PTR_FORMAT", "PTR_FORMAT"] top: "PTR_FORMAT" " |
2721 "TAMS: "PTR_FORMAT, b, e, t, p); | 2741 "TAMS: " PTR_FORMAT, p2i(b), p2i(e), p2i(t), p2i(p)); |
2722 _out->cr(); | 2742 _out->cr(); |
2723 | 2743 |
2724 HeapWord* from = b; | 2744 HeapWord* from = b; |
2725 HeapWord* to = t; | 2745 HeapWord* to = t; |
2726 | 2746 |
2727 if (to > from) { | 2747 if (to > from) { |
2728 _out->print_cr("Objects in ["PTR_FORMAT", "PTR_FORMAT"]", from, to); | 2748 _out->print_cr("Objects in [" PTR_FORMAT ", " PTR_FORMAT "]", p2i(from), p2i(to)); |
2729 _out->cr(); | 2749 _out->cr(); |
2730 PrintReachableObjectClosure ocl(_out, _vo, _all, hr); | 2750 PrintReachableObjectClosure ocl(_out, _vo, _all, hr); |
2731 hr->object_iterate_mem_careful(MemRegion(from, to), &ocl); | 2751 hr->object_iterate_mem_careful(MemRegion(from, to), &ocl); |
2732 _out->cr(); | 2752 _out->cr(); |
2733 } | 2753 } |
2839 | 2859 |
2840 if (verbose_low()) { | 2860 if (verbose_low()) { |
2841 gclog_or_tty->print_cr("[%u] curr_region = "PTR_FORMAT" " | 2861 gclog_or_tty->print_cr("[%u] curr_region = "PTR_FORMAT" " |
2842 "["PTR_FORMAT", "PTR_FORMAT"), " | 2862 "["PTR_FORMAT", "PTR_FORMAT"), " |
2843 "limit = "PTR_FORMAT, | 2863 "limit = "PTR_FORMAT, |
2844 worker_id, curr_region, bottom, end, limit); | 2864 worker_id, p2i(curr_region), p2i(bottom), p2i(end), p2i(limit)); |
2845 } | 2865 } |
2846 | 2866 |
2847 // Is the gap between reading the finger and doing the CAS too long? | 2867 // Is the gap between reading the finger and doing the CAS too long? |
2848 HeapWord* res = (HeapWord*) Atomic::cmpxchg_ptr(end, &_finger, finger); | 2868 HeapWord* res = (HeapWord*) Atomic::cmpxchg_ptr(end, &_finger, finger); |
2849 if (res == finger) { | 2869 if (res == finger) { |
2853 // someone else might have moved the finger even further | 2873 // someone else might have moved the finger even further |
2854 assert(_finger >= end, "the finger should have moved forward"); | 2874 assert(_finger >= end, "the finger should have moved forward"); |
2855 | 2875 |
2856 if (verbose_low()) { | 2876 if (verbose_low()) { |
2857 gclog_or_tty->print_cr("[%u] we were successful with region = " | 2877 gclog_or_tty->print_cr("[%u] we were successful with region = " |
2858 PTR_FORMAT, worker_id, curr_region); | 2878 PTR_FORMAT, worker_id, p2i(curr_region)); |
2859 } | 2879 } |
2860 | 2880 |
2861 if (limit > bottom) { | 2881 if (limit > bottom) { |
2862 if (verbose_low()) { | 2882 if (verbose_low()) { |
2863 gclog_or_tty->print_cr("[%u] region "PTR_FORMAT" is not empty, " | 2883 gclog_or_tty->print_cr("[%u] region "PTR_FORMAT" is not empty, " |
2864 "returning it ", worker_id, curr_region); | 2884 "returning it ", worker_id, p2i(curr_region)); |
2865 } | 2885 } |
2866 return curr_region; | 2886 return curr_region; |
2867 } else { | 2887 } else { |
2868 assert(limit == bottom, | 2888 assert(limit == bottom, |
2869 "the region limit should be at bottom"); | 2889 "the region limit should be at bottom"); |
2870 if (verbose_low()) { | 2890 if (verbose_low()) { |
2871 gclog_or_tty->print_cr("[%u] region "PTR_FORMAT" is empty, " | 2891 gclog_or_tty->print_cr("[%u] region "PTR_FORMAT" is empty, " |
2872 "returning NULL", worker_id, curr_region); | 2892 "returning NULL", worker_id, p2i(curr_region)); |
2873 } | 2893 } |
2874 // we return NULL and the caller should try calling | 2894 // we return NULL and the caller should try calling |
2875 // claim_region() again. | 2895 // claim_region() again. |
2876 return NULL; | 2896 return NULL; |
2877 } | 2897 } |
2879 assert(_finger > finger, "the finger should have moved forward"); | 2899 assert(_finger > finger, "the finger should have moved forward"); |
2880 if (verbose_low()) { | 2900 if (verbose_low()) { |
2881 gclog_or_tty->print_cr("[%u] somebody else moved the finger, " | 2901 gclog_or_tty->print_cr("[%u] somebody else moved the finger, " |
2882 "global finger = "PTR_FORMAT", " | 2902 "global finger = "PTR_FORMAT", " |
2883 "our finger = "PTR_FORMAT, | 2903 "our finger = "PTR_FORMAT, |
2884 worker_id, _finger, finger); | 2904 worker_id, p2i(_finger), p2i(finger)); |
2885 } | 2905 } |
2886 | 2906 |
2887 // read it again | 2907 // read it again |
2888 finger = _finger; | 2908 finger = _finger; |
2889 } | 2909 } |
2918 } | 2938 } |
2919 | 2939 |
2920 void do_object_work(oop obj) { | 2940 void do_object_work(oop obj) { |
2921 guarantee(!_g1h->obj_in_cs(obj), | 2941 guarantee(!_g1h->obj_in_cs(obj), |
2922 err_msg("obj: "PTR_FORMAT" in CSet, phase: %s, info: %d", | 2942 err_msg("obj: "PTR_FORMAT" in CSet, phase: %s, info: %d", |
2923 (void*) obj, phase_str(), _info)); | 2943 p2i((void*) obj), phase_str(), _info)); |
2924 } | 2944 } |
2925 | 2945 |
2926 public: | 2946 public: |
2927 VerifyNoCSetOopsClosure() : _g1h(G1CollectedHeap::heap()) { } | 2947 VerifyNoCSetOopsClosure() : _g1h(G1CollectedHeap::heap()) { } |
2928 | 2948 |
2997 // corresponding starts humongous region and the check below will | 3017 // corresponding starts humongous region and the check below will |
2998 // not hold any more. | 3018 // not hold any more. |
2999 HeapRegion* global_hr = _g1h->heap_region_containing_raw(global_finger); | 3019 HeapRegion* global_hr = _g1h->heap_region_containing_raw(global_finger); |
3000 guarantee(global_finger == global_hr->bottom(), | 3020 guarantee(global_finger == global_hr->bottom(), |
3001 err_msg("global finger: "PTR_FORMAT" region: "HR_FORMAT, | 3021 err_msg("global finger: "PTR_FORMAT" region: "HR_FORMAT, |
3002 global_finger, HR_FORMAT_PARAMS(global_hr))); | 3022 p2i(global_finger), HR_FORMAT_PARAMS(global_hr))); |
3003 } | 3023 } |
3004 | 3024 |
3005 // Verify the task fingers | 3025 // Verify the task fingers |
3006 assert(parallel_marking_threads() <= _max_worker_id, "sanity"); | 3026 assert(parallel_marking_threads() <= _max_worker_id, "sanity"); |
3007 for (int i = 0; i < (int) parallel_marking_threads(); i += 1) { | 3027 for (int i = 0; i < (int) parallel_marking_threads(); i += 1) { |
3011 // See above note on the global finger verification. | 3031 // See above note on the global finger verification. |
3012 HeapRegion* task_hr = _g1h->heap_region_containing_raw(task_finger); | 3032 HeapRegion* task_hr = _g1h->heap_region_containing_raw(task_finger); |
3013 guarantee(task_finger == task_hr->bottom() || | 3033 guarantee(task_finger == task_hr->bottom() || |
3014 !task_hr->in_collection_set(), | 3034 !task_hr->in_collection_set(), |
3015 err_msg("task finger: "PTR_FORMAT" region: "HR_FORMAT, | 3035 err_msg("task finger: "PTR_FORMAT" region: "HR_FORMAT, |
3016 task_finger, HR_FORMAT_PARAMS(task_hr))); | 3036 p2i(task_finger), HR_FORMAT_PARAMS(task_hr))); |
3017 } | 3037 } |
3018 } | 3038 } |
3019 } | 3039 } |
3020 } | 3040 } |
3021 #endif // PRODUCT | 3041 #endif // PRODUCT |
3055 | 3075 |
3056 assert(start <= limit && limit <= hr->top() && hr->top() <= hr->end(), | 3076 assert(start <= limit && limit <= hr->top() && hr->top() <= hr->end(), |
3057 err_msg("Preconditions not met - " | 3077 err_msg("Preconditions not met - " |
3058 "start: "PTR_FORMAT", limit: "PTR_FORMAT", " | 3078 "start: "PTR_FORMAT", limit: "PTR_FORMAT", " |
3059 "top: "PTR_FORMAT", end: "PTR_FORMAT, | 3079 "top: "PTR_FORMAT", end: "PTR_FORMAT, |
3060 start, limit, hr->top(), hr->end())); | 3080 p2i(start), p2i(limit), p2i(hr->top()), p2i(hr->end()))); |
3061 | 3081 |
3062 assert(hr->next_marked_bytes() == 0, "Precondition"); | 3082 assert(hr->next_marked_bytes() == 0, "Precondition"); |
3063 | 3083 |
3064 if (start == limit) { | 3084 if (start == limit) { |
3065 // NTAMS of this region has not been set so nothing to do. | 3085 // NTAMS of this region has not been set so nothing to do. |
3228 // Empty mark stack | 3248 // Empty mark stack |
3229 reset_marking_state(); | 3249 reset_marking_state(); |
3230 for (uint i = 0; i < _max_worker_id; ++i) { | 3250 for (uint i = 0; i < _max_worker_id; ++i) { |
3231 _tasks[i]->clear_region_fields(); | 3251 _tasks[i]->clear_region_fields(); |
3232 } | 3252 } |
3253 _first_overflow_barrier_sync.abort(); | |
3254 _second_overflow_barrier_sync.abort(); | |
3233 _has_aborted = true; | 3255 _has_aborted = true; |
3234 | 3256 |
3235 SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set(); | 3257 SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set(); |
3236 satb_mq_set.abandon_partial_marking(); | 3258 satb_mq_set.abandon_partial_marking(); |
3237 // This can be called either during or outside marking, we'll read | 3259 // This can be called either during or outside marking, we'll read |
3291 } | 3313 } |
3292 } | 3314 } |
3293 | 3315 |
3294 void ConcurrentMark::print_on_error(outputStream* st) const { | 3316 void ConcurrentMark::print_on_error(outputStream* st) const { |
3295 st->print_cr("Marking Bits (Prev, Next): (CMBitMap*) " PTR_FORMAT ", (CMBitMap*) " PTR_FORMAT, | 3317 st->print_cr("Marking Bits (Prev, Next): (CMBitMap*) " PTR_FORMAT ", (CMBitMap*) " PTR_FORMAT, |
3296 _prevMarkBitMap, _nextMarkBitMap); | 3318 p2i(_prevMarkBitMap), p2i(_nextMarkBitMap)); |
3297 _prevMarkBitMap->print_on_error(st, " Prev Bits: "); | 3319 _prevMarkBitMap->print_on_error(st, " Prev Bits: "); |
3298 _nextMarkBitMap->print_on_error(st, " Next Bits: "); | 3320 _nextMarkBitMap->print_on_error(st, " Next Bits: "); |
3299 } | 3321 } |
3300 | 3322 |
3301 // We take a break if someone is trying to stop the world. | 3323 // We take a break if someone is trying to stop the world. |
3328 | 3350 |
3329 #ifndef PRODUCT | 3351 #ifndef PRODUCT |
3330 // for debugging purposes | 3352 // for debugging purposes |
3331 void ConcurrentMark::print_finger() { | 3353 void ConcurrentMark::print_finger() { |
3332 gclog_or_tty->print_cr("heap ["PTR_FORMAT", "PTR_FORMAT"), global finger = "PTR_FORMAT, | 3354 gclog_or_tty->print_cr("heap ["PTR_FORMAT", "PTR_FORMAT"), global finger = "PTR_FORMAT, |
3333 _heap_start, _heap_end, _finger); | 3355 p2i(_heap_start), p2i(_heap_end), p2i(_finger)); |
3334 for (uint i = 0; i < _max_worker_id; ++i) { | 3356 for (uint i = 0; i < _max_worker_id; ++i) { |
3335 gclog_or_tty->print(" %u: "PTR_FORMAT, i, _tasks[i]->finger()); | 3357 gclog_or_tty->print(" %u: " PTR_FORMAT, i, p2i(_tasks[i]->finger())); |
3336 } | 3358 } |
3337 gclog_or_tty->print_cr(""); | 3359 gclog_or_tty->cr(); |
3338 } | 3360 } |
3339 #endif | 3361 #endif |
3340 | 3362 |
3341 void CMTask::scan_object(oop obj) { | 3363 void CMTask::scan_object(oop obj) { |
3342 assert(_nextMarkBitMap->isMarked((HeapWord*) obj), "invariant"); | 3364 assert(_nextMarkBitMap->isMarked((HeapWord*) obj), "invariant"); |
3343 | 3365 |
3344 if (_cm->verbose_high()) { | 3366 if (_cm->verbose_high()) { |
3345 gclog_or_tty->print_cr("[%u] we're scanning object "PTR_FORMAT, | 3367 gclog_or_tty->print_cr("[%u] we're scanning object "PTR_FORMAT, |
3346 _worker_id, (void*) obj); | 3368 _worker_id, p2i((void*) obj)); |
3347 } | 3369 } |
3348 | 3370 |
3349 size_t obj_size = obj->size(); | 3371 size_t obj_size = obj->size(); |
3350 _words_scanned += obj_size; | 3372 _words_scanned += obj_size; |
3351 | 3373 |
3421 assert(!hr->continuesHumongous(), | 3443 assert(!hr->continuesHumongous(), |
3422 "claim_region() should have filtered out continues humongous regions"); | 3444 "claim_region() should have filtered out continues humongous regions"); |
3423 | 3445 |
3424 if (_cm->verbose_low()) { | 3446 if (_cm->verbose_low()) { |
3425 gclog_or_tty->print_cr("[%u] setting up for region "PTR_FORMAT, | 3447 gclog_or_tty->print_cr("[%u] setting up for region "PTR_FORMAT, |
3426 _worker_id, hr); | 3448 _worker_id, p2i(hr)); |
3427 } | 3449 } |
3428 | 3450 |
3429 _curr_region = hr; | 3451 _curr_region = hr; |
3430 _finger = hr->bottom(); | 3452 _finger = hr->bottom(); |
3431 update_region_limit(); | 3453 update_region_limit(); |
3438 | 3460 |
3439 if (limit == bottom) { | 3461 if (limit == bottom) { |
3440 if (_cm->verbose_low()) { | 3462 if (_cm->verbose_low()) { |
3441 gclog_or_tty->print_cr("[%u] found an empty region " | 3463 gclog_or_tty->print_cr("[%u] found an empty region " |
3442 "["PTR_FORMAT", "PTR_FORMAT")", | 3464 "["PTR_FORMAT", "PTR_FORMAT")", |
3443 _worker_id, bottom, limit); | 3465 _worker_id, p2i(bottom), p2i(limit)); |
3444 } | 3466 } |
3445 // The region was collected underneath our feet. | 3467 // The region was collected underneath our feet. |
3446 // We set the finger to bottom to ensure that the bitmap | 3468 // We set the finger to bottom to ensure that the bitmap |
3447 // iteration that will follow this will not do anything. | 3469 // iteration that will follow this will not do anything. |
3448 // (this is not a condition that holds when we set the region up, | 3470 // (this is not a condition that holds when we set the region up, |
3470 | 3492 |
3471 void CMTask::giveup_current_region() { | 3493 void CMTask::giveup_current_region() { |
3472 assert(_curr_region != NULL, "invariant"); | 3494 assert(_curr_region != NULL, "invariant"); |
3473 if (_cm->verbose_low()) { | 3495 if (_cm->verbose_low()) { |
3474 gclog_or_tty->print_cr("[%u] giving up region "PTR_FORMAT, | 3496 gclog_or_tty->print_cr("[%u] giving up region "PTR_FORMAT, |
3475 _worker_id, _curr_region); | 3497 _worker_id, p2i(_curr_region)); |
3476 } | 3498 } |
3477 clear_region_fields(); | 3499 clear_region_fields(); |
3478 } | 3500 } |
3479 | 3501 |
3480 void CMTask::clear_region_fields() { | 3502 void CMTask::clear_region_fields() { |
3750 target_size = 0; | 3772 target_size = 0; |
3751 } | 3773 } |
3752 | 3774 |
3753 if (_task_queue->size() > target_size) { | 3775 if (_task_queue->size() > target_size) { |
3754 if (_cm->verbose_high()) { | 3776 if (_cm->verbose_high()) { |
3755 gclog_or_tty->print_cr("[%u] draining local queue, target size = %d", | 3777 gclog_or_tty->print_cr("[%u] draining local queue, target size = " SIZE_FORMAT, |
3756 _worker_id, target_size); | 3778 _worker_id, target_size); |
3757 } | 3779 } |
3758 | 3780 |
3759 oop obj; | 3781 oop obj; |
3760 bool ret = _task_queue->pop_local(obj); | 3782 bool ret = _task_queue->pop_local(obj); |
3761 while (ret) { | 3783 while (ret) { |
3762 statsOnly( ++_local_pops ); | 3784 statsOnly( ++_local_pops ); |
3763 | 3785 |
3764 if (_cm->verbose_high()) { | 3786 if (_cm->verbose_high()) { |
3765 gclog_or_tty->print_cr("[%u] popped "PTR_FORMAT, _worker_id, | 3787 gclog_or_tty->print_cr("[%u] popped "PTR_FORMAT, _worker_id, |
3766 (void*) obj); | 3788 p2i((void*) obj)); |
3767 } | 3789 } |
3768 | 3790 |
3769 assert(_g1h->is_in_g1_reserved((HeapWord*) obj), "invariant" ); | 3791 assert(_g1h->is_in_g1_reserved((HeapWord*) obj), "invariant" ); |
3770 assert(!_g1h->is_on_master_free_list( | 3792 assert(!_g1h->is_on_master_free_list( |
3771 _g1h->heap_region_containing((HeapWord*) obj)), "invariant"); | 3793 _g1h->heap_region_containing((HeapWord*) obj)), "invariant"); |
3806 target_size = 0; | 3828 target_size = 0; |
3807 } | 3829 } |
3808 | 3830 |
3809 if (_cm->mark_stack_size() > target_size) { | 3831 if (_cm->mark_stack_size() > target_size) { |
3810 if (_cm->verbose_low()) { | 3832 if (_cm->verbose_low()) { |
3811 gclog_or_tty->print_cr("[%u] draining global_stack, target size %d", | 3833 gclog_or_tty->print_cr("[%u] draining global_stack, target size " SIZE_FORMAT, |
3812 _worker_id, target_size); | 3834 _worker_id, target_size); |
3813 } | 3835 } |
3814 | 3836 |
3815 while (!has_aborted() && _cm->mark_stack_size() > target_size) { | 3837 while (!has_aborted() && _cm->mark_stack_size() > target_size) { |
3816 get_entries_from_global_stack(); | 3838 get_entries_from_global_stack(); |
3817 drain_local_queue(partially); | 3839 drain_local_queue(partially); |
3818 } | 3840 } |
3819 | 3841 |
3820 if (_cm->verbose_low()) { | 3842 if (_cm->verbose_low()) { |
3821 gclog_or_tty->print_cr("[%u] drained global stack, size = %d", | 3843 gclog_or_tty->print_cr("[%u] drained global stack, size = " SIZE_FORMAT, |
3822 _worker_id, _cm->mark_stack_size()); | 3844 _worker_id, _cm->mark_stack_size()); |
3823 } | 3845 } |
3824 } | 3846 } |
3825 } | 3847 } |
3826 | 3848 |
4146 | 4168 |
4147 if (_cm->verbose_low()) { | 4169 if (_cm->verbose_low()) { |
4148 gclog_or_tty->print_cr("[%u] we're scanning part " | 4170 gclog_or_tty->print_cr("[%u] we're scanning part " |
4149 "["PTR_FORMAT", "PTR_FORMAT") " | 4171 "["PTR_FORMAT", "PTR_FORMAT") " |
4150 "of region "HR_FORMAT, | 4172 "of region "HR_FORMAT, |
4151 _worker_id, _finger, _region_limit, | 4173 _worker_id, p2i(_finger), p2i(_region_limit), |
4152 HR_FORMAT_PARAMS(_curr_region)); | 4174 HR_FORMAT_PARAMS(_curr_region)); |
4153 } | 4175 } |
4154 | 4176 |
4155 assert(!_curr_region->isHumongous() || mr.start() == _curr_region->bottom(), | 4177 assert(!_curr_region->isHumongous() || mr.start() == _curr_region->bottom(), |
4156 "humongous regions should go around loop once only"); | 4178 "humongous regions should go around loop once only"); |
4233 statsOnly( ++_regions_claimed ); | 4255 statsOnly( ++_regions_claimed ); |
4234 | 4256 |
4235 if (_cm->verbose_low()) { | 4257 if (_cm->verbose_low()) { |
4236 gclog_or_tty->print_cr("[%u] we successfully claimed " | 4258 gclog_or_tty->print_cr("[%u] we successfully claimed " |
4237 "region "PTR_FORMAT, | 4259 "region "PTR_FORMAT, |
4238 _worker_id, claimed_region); | 4260 _worker_id, p2i(claimed_region)); |
4239 } | 4261 } |
4240 | 4262 |
4241 setup_for_region(claimed_region); | 4263 setup_for_region(claimed_region); |
4242 assert(_curr_region == claimed_region, "invariant"); | 4264 assert(_curr_region == claimed_region, "invariant"); |
4243 } | 4265 } |
4294 statsOnly( ++_steal_attempts ); | 4316 statsOnly( ++_steal_attempts ); |
4295 | 4317 |
4296 if (_cm->try_stealing(_worker_id, &_hash_seed, obj)) { | 4318 if (_cm->try_stealing(_worker_id, &_hash_seed, obj)) { |
4297 if (_cm->verbose_medium()) { | 4319 if (_cm->verbose_medium()) { |
4298 gclog_or_tty->print_cr("[%u] stolen "PTR_FORMAT" successfully", | 4320 gclog_or_tty->print_cr("[%u] stolen "PTR_FORMAT" successfully", |
4299 _worker_id, (void*) obj); | 4321 _worker_id, p2i((void*) obj)); |
4300 } | 4322 } |
4301 | 4323 |
4302 statsOnly( ++_steals ); | 4324 statsOnly( ++_steals ); |
4303 | 4325 |
4304 assert(_nextMarkBitMap->isMarked((HeapWord*) obj), | 4326 assert(_nextMarkBitMap->isMarked((HeapWord*) obj), |
4542 _out->print_cr(G1PPRL_LINE_PREFIX" PHASE %s @ %1.3f", phase_name, now); | 4564 _out->print_cr(G1PPRL_LINE_PREFIX" PHASE %s @ %1.3f", phase_name, now); |
4543 _out->print_cr(G1PPRL_LINE_PREFIX" HEAP" | 4565 _out->print_cr(G1PPRL_LINE_PREFIX" HEAP" |
4544 G1PPRL_SUM_ADDR_FORMAT("committed") | 4566 G1PPRL_SUM_ADDR_FORMAT("committed") |
4545 G1PPRL_SUM_ADDR_FORMAT("reserved") | 4567 G1PPRL_SUM_ADDR_FORMAT("reserved") |
4546 G1PPRL_SUM_BYTE_FORMAT("region-size"), | 4568 G1PPRL_SUM_BYTE_FORMAT("region-size"), |
4547 g1_committed.start(), g1_committed.end(), | 4569 p2i(g1_committed.start()), p2i(g1_committed.end()), |
4548 g1_reserved.start(), g1_reserved.end(), | 4570 p2i(g1_reserved.start()), p2i(g1_reserved.end()), |
4549 HeapRegion::GrainBytes); | 4571 HeapRegion::GrainBytes); |
4550 _out->print_cr(G1PPRL_LINE_PREFIX); | 4572 _out->print_cr(G1PPRL_LINE_PREFIX); |
4551 _out->print_cr(G1PPRL_LINE_PREFIX | 4573 _out->print_cr(G1PPRL_LINE_PREFIX |
4552 G1PPRL_TYPE_H_FORMAT | 4574 G1PPRL_TYPE_H_FORMAT |
4553 G1PPRL_ADDR_BASE_H_FORMAT | 4575 G1PPRL_ADDR_BASE_H_FORMAT |
4660 G1PPRL_BYTE_FORMAT | 4682 G1PPRL_BYTE_FORMAT |
4661 G1PPRL_BYTE_FORMAT | 4683 G1PPRL_BYTE_FORMAT |
4662 G1PPRL_DOUBLE_FORMAT | 4684 G1PPRL_DOUBLE_FORMAT |
4663 G1PPRL_BYTE_FORMAT | 4685 G1PPRL_BYTE_FORMAT |
4664 G1PPRL_BYTE_FORMAT, | 4686 G1PPRL_BYTE_FORMAT, |
4665 type, bottom, end, | 4687 type, p2i(bottom), p2i(end), |
4666 used_bytes, prev_live_bytes, next_live_bytes, gc_eff, | 4688 used_bytes, prev_live_bytes, next_live_bytes, gc_eff, |
4667 remset_bytes, strong_code_roots_bytes); | 4689 remset_bytes, strong_code_roots_bytes); |
4668 | 4690 |
4669 return false; | 4691 return false; |
4670 } | 4692 } |