Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/g1/concurrentMark.cpp @ 17937:78bbf4d43a14
8037816: Fix for 8036122 breaks build with Xcode5/clang
8043029: Change 8037816 breaks HS build with older GCC versions which don't support diagnostic pragmas
8043164: Format warning in traceStream.hpp
Summary: Backport of main fix + two corrections, enables clang compilation, turns on format attributes, corrects/mutes warnings
Reviewed-by: kvn, coleenp, iveresov, twisti
author | drchase |
---|---|
date | Thu, 22 May 2014 15:52:41 -0400 |
parents | 8847586c9037 |
children | 487f09bf44e0 |
comparison
equal
deleted
inserted
replaced
17935:7384f6a12fc1 | 17937:78bbf4d43a14 |
---|---|
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 ")" |
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(_finger == _heap_end, |
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() { |
1420 HeapWord* start = hr->bottom(); | 1420 HeapWord* start = hr->bottom(); |
1421 | 1421 |
1422 assert(start <= hr->end() && start <= ntams && ntams <= hr->end(), | 1422 assert(start <= hr->end() && start <= ntams && ntams <= hr->end(), |
1423 err_msg("Preconditions not met - " | 1423 err_msg("Preconditions not met - " |
1424 "start: "PTR_FORMAT", ntams: "PTR_FORMAT", end: "PTR_FORMAT, | 1424 "start: "PTR_FORMAT", ntams: "PTR_FORMAT", end: "PTR_FORMAT, |
1425 start, ntams, hr->end())); | 1425 p2i(start), p2i(ntams), p2i(hr->end()))); |
1426 | 1426 |
1427 // Find the first marked object at or after "start". | 1427 // Find the first marked object at or after "start". |
1428 start = _bm->getNextMarkedWordAddress(start, ntams); | 1428 start = _bm->getNextMarkedWordAddress(start, ntams); |
1429 | 1429 |
1430 size_t marked_bytes = 0; | 1430 size_t marked_bytes = 0; |
1605 } | 1605 } |
1606 | 1606 |
1607 if (failures > 0 && _verbose) { | 1607 if (failures > 0 && _verbose) { |
1608 gclog_or_tty->print_cr("Region " HR_FORMAT ", ntams: " PTR_FORMAT ", " | 1608 gclog_or_tty->print_cr("Region " HR_FORMAT ", ntams: " PTR_FORMAT ", " |
1609 "marked_bytes: calc/actual " SIZE_FORMAT "/" SIZE_FORMAT, | 1609 "marked_bytes: calc/actual " SIZE_FORMAT "/" SIZE_FORMAT, |
1610 HR_FORMAT_PARAMS(hr), hr->next_top_at_mark_start(), | 1610 HR_FORMAT_PARAMS(hr), p2i(hr->next_top_at_mark_start()), |
1611 _calc_cl.region_marked_bytes(), hr->next_marked_bytes()); | 1611 _calc_cl.region_marked_bytes(), hr->next_marked_bytes()); |
1612 } | 1612 } |
1613 | 1613 |
1614 _failures += failures; | 1614 _failures += failures; |
1615 | 1615 |
2235 if (!_cm->has_overflown()) { | 2235 if (!_cm->has_overflown()) { |
2236 oop obj = oopDesc::load_decode_heap_oop(p); | 2236 oop obj = oopDesc::load_decode_heap_oop(p); |
2237 if (_cm->verbose_high()) { | 2237 if (_cm->verbose_high()) { |
2238 gclog_or_tty->print_cr("\t[%u] we're looking at location " | 2238 gclog_or_tty->print_cr("\t[%u] we're looking at location " |
2239 "*"PTR_FORMAT" = "PTR_FORMAT, | 2239 "*"PTR_FORMAT" = "PTR_FORMAT, |
2240 _task->worker_id(), p, (void*) obj); | 2240 _task->worker_id(), p2i(p), p2i((void*) obj)); |
2241 } | 2241 } |
2242 | 2242 |
2243 _task->deal_with_reference(obj); | 2243 _task->deal_with_reference(obj); |
2244 _ref_counter--; | 2244 _ref_counter--; |
2245 | 2245 |
2670 str = " NOT"; | 2670 str = " NOT"; |
2671 } | 2671 } |
2672 } | 2672 } |
2673 | 2673 |
2674 _out->print_cr(" "PTR_FORMAT": "PTR_FORMAT"%s%s", | 2674 _out->print_cr(" "PTR_FORMAT": "PTR_FORMAT"%s%s", |
2675 p, (void*) obj, str, str2); | 2675 p2i(p), p2i((void*) obj), str, str2); |
2676 } | 2676 } |
2677 }; | 2677 }; |
2678 | 2678 |
2679 class PrintReachableObjectClosure : public ObjectClosure { | 2679 class PrintReachableObjectClosure : public ObjectClosure { |
2680 private: | 2680 private: |
2697 bool marked = _g1h->is_marked(o, _vo); | 2697 bool marked = _g1h->is_marked(o, _vo); |
2698 bool print_it = _all || over_tams || marked; | 2698 bool print_it = _all || over_tams || marked; |
2699 | 2699 |
2700 if (print_it) { | 2700 if (print_it) { |
2701 _out->print_cr(" "PTR_FORMAT"%s", | 2701 _out->print_cr(" "PTR_FORMAT"%s", |
2702 (void *)o, (over_tams) ? " >" : (marked) ? " M" : ""); | 2702 p2i((void *)o), (over_tams) ? " >" : (marked) ? " M" : ""); |
2703 PrintReachableOopClosure oopCl(_out, _vo, _all); | 2703 PrintReachableOopClosure oopCl(_out, _vo, _all); |
2704 o->oop_iterate_no_header(&oopCl); | 2704 o->oop_iterate_no_header(&oopCl); |
2705 } | 2705 } |
2706 } | 2706 } |
2707 }; | 2707 }; |
2718 HeapWord* b = hr->bottom(); | 2718 HeapWord* b = hr->bottom(); |
2719 HeapWord* e = hr->end(); | 2719 HeapWord* e = hr->end(); |
2720 HeapWord* t = hr->top(); | 2720 HeapWord* t = hr->top(); |
2721 HeapWord* p = _g1h->top_at_mark_start(hr, _vo); | 2721 HeapWord* p = _g1h->top_at_mark_start(hr, _vo); |
2722 _out->print_cr("** ["PTR_FORMAT", "PTR_FORMAT"] top: "PTR_FORMAT" " | 2722 _out->print_cr("** ["PTR_FORMAT", "PTR_FORMAT"] top: "PTR_FORMAT" " |
2723 "TAMS: "PTR_FORMAT, b, e, t, p); | 2723 "TAMS: " PTR_FORMAT, p2i(b), p2i(e), p2i(t), p2i(p)); |
2724 _out->cr(); | 2724 _out->cr(); |
2725 | 2725 |
2726 HeapWord* from = b; | 2726 HeapWord* from = b; |
2727 HeapWord* to = t; | 2727 HeapWord* to = t; |
2728 | 2728 |
2729 if (to > from) { | 2729 if (to > from) { |
2730 _out->print_cr("Objects in ["PTR_FORMAT", "PTR_FORMAT"]", from, to); | 2730 _out->print_cr("Objects in [" PTR_FORMAT ", " PTR_FORMAT "]", p2i(from), p2i(to)); |
2731 _out->cr(); | 2731 _out->cr(); |
2732 PrintReachableObjectClosure ocl(_out, _vo, _all, hr); | 2732 PrintReachableObjectClosure ocl(_out, _vo, _all, hr); |
2733 hr->object_iterate_mem_careful(MemRegion(from, to), &ocl); | 2733 hr->object_iterate_mem_careful(MemRegion(from, to), &ocl); |
2734 _out->cr(); | 2734 _out->cr(); |
2735 } | 2735 } |
2841 | 2841 |
2842 if (verbose_low()) { | 2842 if (verbose_low()) { |
2843 gclog_or_tty->print_cr("[%u] curr_region = "PTR_FORMAT" " | 2843 gclog_or_tty->print_cr("[%u] curr_region = "PTR_FORMAT" " |
2844 "["PTR_FORMAT", "PTR_FORMAT"), " | 2844 "["PTR_FORMAT", "PTR_FORMAT"), " |
2845 "limit = "PTR_FORMAT, | 2845 "limit = "PTR_FORMAT, |
2846 worker_id, curr_region, bottom, end, limit); | 2846 worker_id, p2i(curr_region), p2i(bottom), p2i(end), p2i(limit)); |
2847 } | 2847 } |
2848 | 2848 |
2849 // Is the gap between reading the finger and doing the CAS too long? | 2849 // Is the gap between reading the finger and doing the CAS too long? |
2850 HeapWord* res = (HeapWord*) Atomic::cmpxchg_ptr(end, &_finger, finger); | 2850 HeapWord* res = (HeapWord*) Atomic::cmpxchg_ptr(end, &_finger, finger); |
2851 if (res == finger) { | 2851 if (res == finger) { |
2855 // someone else might have moved the finger even further | 2855 // someone else might have moved the finger even further |
2856 assert(_finger >= end, "the finger should have moved forward"); | 2856 assert(_finger >= end, "the finger should have moved forward"); |
2857 | 2857 |
2858 if (verbose_low()) { | 2858 if (verbose_low()) { |
2859 gclog_or_tty->print_cr("[%u] we were successful with region = " | 2859 gclog_or_tty->print_cr("[%u] we were successful with region = " |
2860 PTR_FORMAT, worker_id, curr_region); | 2860 PTR_FORMAT, worker_id, p2i(curr_region)); |
2861 } | 2861 } |
2862 | 2862 |
2863 if (limit > bottom) { | 2863 if (limit > bottom) { |
2864 if (verbose_low()) { | 2864 if (verbose_low()) { |
2865 gclog_or_tty->print_cr("[%u] region "PTR_FORMAT" is not empty, " | 2865 gclog_or_tty->print_cr("[%u] region "PTR_FORMAT" is not empty, " |
2866 "returning it ", worker_id, curr_region); | 2866 "returning it ", worker_id, p2i(curr_region)); |
2867 } | 2867 } |
2868 return curr_region; | 2868 return curr_region; |
2869 } else { | 2869 } else { |
2870 assert(limit == bottom, | 2870 assert(limit == bottom, |
2871 "the region limit should be at bottom"); | 2871 "the region limit should be at bottom"); |
2872 if (verbose_low()) { | 2872 if (verbose_low()) { |
2873 gclog_or_tty->print_cr("[%u] region "PTR_FORMAT" is empty, " | 2873 gclog_or_tty->print_cr("[%u] region "PTR_FORMAT" is empty, " |
2874 "returning NULL", worker_id, curr_region); | 2874 "returning NULL", worker_id, p2i(curr_region)); |
2875 } | 2875 } |
2876 // we return NULL and the caller should try calling | 2876 // we return NULL and the caller should try calling |
2877 // claim_region() again. | 2877 // claim_region() again. |
2878 return NULL; | 2878 return NULL; |
2879 } | 2879 } |
2881 assert(_finger > finger, "the finger should have moved forward"); | 2881 assert(_finger > finger, "the finger should have moved forward"); |
2882 if (verbose_low()) { | 2882 if (verbose_low()) { |
2883 gclog_or_tty->print_cr("[%u] somebody else moved the finger, " | 2883 gclog_or_tty->print_cr("[%u] somebody else moved the finger, " |
2884 "global finger = "PTR_FORMAT", " | 2884 "global finger = "PTR_FORMAT", " |
2885 "our finger = "PTR_FORMAT, | 2885 "our finger = "PTR_FORMAT, |
2886 worker_id, _finger, finger); | 2886 worker_id, p2i(_finger), p2i(finger)); |
2887 } | 2887 } |
2888 | 2888 |
2889 // read it again | 2889 // read it again |
2890 finger = _finger; | 2890 finger = _finger; |
2891 } | 2891 } |
2920 } | 2920 } |
2921 | 2921 |
2922 void do_object_work(oop obj) { | 2922 void do_object_work(oop obj) { |
2923 guarantee(!_g1h->obj_in_cs(obj), | 2923 guarantee(!_g1h->obj_in_cs(obj), |
2924 err_msg("obj: "PTR_FORMAT" in CSet, phase: %s, info: %d", | 2924 err_msg("obj: "PTR_FORMAT" in CSet, phase: %s, info: %d", |
2925 (void*) obj, phase_str(), _info)); | 2925 p2i((void*) obj), phase_str(), _info)); |
2926 } | 2926 } |
2927 | 2927 |
2928 public: | 2928 public: |
2929 VerifyNoCSetOopsClosure() : _g1h(G1CollectedHeap::heap()) { } | 2929 VerifyNoCSetOopsClosure() : _g1h(G1CollectedHeap::heap()) { } |
2930 | 2930 |
2999 // corresponding starts humongous region and the check below will | 2999 // corresponding starts humongous region and the check below will |
3000 // not hold any more. | 3000 // not hold any more. |
3001 HeapRegion* global_hr = _g1h->heap_region_containing_raw(global_finger); | 3001 HeapRegion* global_hr = _g1h->heap_region_containing_raw(global_finger); |
3002 guarantee(global_finger == global_hr->bottom(), | 3002 guarantee(global_finger == global_hr->bottom(), |
3003 err_msg("global finger: "PTR_FORMAT" region: "HR_FORMAT, | 3003 err_msg("global finger: "PTR_FORMAT" region: "HR_FORMAT, |
3004 global_finger, HR_FORMAT_PARAMS(global_hr))); | 3004 p2i(global_finger), HR_FORMAT_PARAMS(global_hr))); |
3005 } | 3005 } |
3006 | 3006 |
3007 // Verify the task fingers | 3007 // Verify the task fingers |
3008 assert(parallel_marking_threads() <= _max_worker_id, "sanity"); | 3008 assert(parallel_marking_threads() <= _max_worker_id, "sanity"); |
3009 for (int i = 0; i < (int) parallel_marking_threads(); i += 1) { | 3009 for (int i = 0; i < (int) parallel_marking_threads(); i += 1) { |
3013 // See above note on the global finger verification. | 3013 // See above note on the global finger verification. |
3014 HeapRegion* task_hr = _g1h->heap_region_containing_raw(task_finger); | 3014 HeapRegion* task_hr = _g1h->heap_region_containing_raw(task_finger); |
3015 guarantee(task_finger == task_hr->bottom() || | 3015 guarantee(task_finger == task_hr->bottom() || |
3016 !task_hr->in_collection_set(), | 3016 !task_hr->in_collection_set(), |
3017 err_msg("task finger: "PTR_FORMAT" region: "HR_FORMAT, | 3017 err_msg("task finger: "PTR_FORMAT" region: "HR_FORMAT, |
3018 task_finger, HR_FORMAT_PARAMS(task_hr))); | 3018 p2i(task_finger), HR_FORMAT_PARAMS(task_hr))); |
3019 } | 3019 } |
3020 } | 3020 } |
3021 } | 3021 } |
3022 } | 3022 } |
3023 #endif // PRODUCT | 3023 #endif // PRODUCT |
3057 | 3057 |
3058 assert(start <= limit && limit <= hr->top() && hr->top() <= hr->end(), | 3058 assert(start <= limit && limit <= hr->top() && hr->top() <= hr->end(), |
3059 err_msg("Preconditions not met - " | 3059 err_msg("Preconditions not met - " |
3060 "start: "PTR_FORMAT", limit: "PTR_FORMAT", " | 3060 "start: "PTR_FORMAT", limit: "PTR_FORMAT", " |
3061 "top: "PTR_FORMAT", end: "PTR_FORMAT, | 3061 "top: "PTR_FORMAT", end: "PTR_FORMAT, |
3062 start, limit, hr->top(), hr->end())); | 3062 p2i(start), p2i(limit), p2i(hr->top()), p2i(hr->end()))); |
3063 | 3063 |
3064 assert(hr->next_marked_bytes() == 0, "Precondition"); | 3064 assert(hr->next_marked_bytes() == 0, "Precondition"); |
3065 | 3065 |
3066 if (start == limit) { | 3066 if (start == limit) { |
3067 // NTAMS of this region has not been set so nothing to do. | 3067 // NTAMS of this region has not been set so nothing to do. |
3293 } | 3293 } |
3294 } | 3294 } |
3295 | 3295 |
3296 void ConcurrentMark::print_on_error(outputStream* st) const { | 3296 void ConcurrentMark::print_on_error(outputStream* st) const { |
3297 st->print_cr("Marking Bits (Prev, Next): (CMBitMap*) " PTR_FORMAT ", (CMBitMap*) " PTR_FORMAT, | 3297 st->print_cr("Marking Bits (Prev, Next): (CMBitMap*) " PTR_FORMAT ", (CMBitMap*) " PTR_FORMAT, |
3298 _prevMarkBitMap, _nextMarkBitMap); | 3298 p2i(_prevMarkBitMap), p2i(_nextMarkBitMap)); |
3299 _prevMarkBitMap->print_on_error(st, " Prev Bits: "); | 3299 _prevMarkBitMap->print_on_error(st, " Prev Bits: "); |
3300 _nextMarkBitMap->print_on_error(st, " Next Bits: "); | 3300 _nextMarkBitMap->print_on_error(st, " Next Bits: "); |
3301 } | 3301 } |
3302 | 3302 |
3303 // We take a break if someone is trying to stop the world. | 3303 // We take a break if someone is trying to stop the world. |
3330 | 3330 |
3331 #ifndef PRODUCT | 3331 #ifndef PRODUCT |
3332 // for debugging purposes | 3332 // for debugging purposes |
3333 void ConcurrentMark::print_finger() { | 3333 void ConcurrentMark::print_finger() { |
3334 gclog_or_tty->print_cr("heap ["PTR_FORMAT", "PTR_FORMAT"), global finger = "PTR_FORMAT, | 3334 gclog_or_tty->print_cr("heap ["PTR_FORMAT", "PTR_FORMAT"), global finger = "PTR_FORMAT, |
3335 _heap_start, _heap_end, _finger); | 3335 p2i(_heap_start), p2i(_heap_end), p2i(_finger)); |
3336 for (uint i = 0; i < _max_worker_id; ++i) { | 3336 for (uint i = 0; i < _max_worker_id; ++i) { |
3337 gclog_or_tty->print(" %u: "PTR_FORMAT, i, _tasks[i]->finger()); | 3337 gclog_or_tty->print(" %u: " PTR_FORMAT, i, p2i(_tasks[i]->finger())); |
3338 } | 3338 } |
3339 gclog_or_tty->print_cr(""); | 3339 gclog_or_tty->cr(); |
3340 } | 3340 } |
3341 #endif | 3341 #endif |
3342 | 3342 |
3343 void CMTask::scan_object(oop obj) { | 3343 void CMTask::scan_object(oop obj) { |
3344 assert(_nextMarkBitMap->isMarked((HeapWord*) obj), "invariant"); | 3344 assert(_nextMarkBitMap->isMarked((HeapWord*) obj), "invariant"); |
3345 | 3345 |
3346 if (_cm->verbose_high()) { | 3346 if (_cm->verbose_high()) { |
3347 gclog_or_tty->print_cr("[%u] we're scanning object "PTR_FORMAT, | 3347 gclog_or_tty->print_cr("[%u] we're scanning object "PTR_FORMAT, |
3348 _worker_id, (void*) obj); | 3348 _worker_id, p2i((void*) obj)); |
3349 } | 3349 } |
3350 | 3350 |
3351 size_t obj_size = obj->size(); | 3351 size_t obj_size = obj->size(); |
3352 _words_scanned += obj_size; | 3352 _words_scanned += obj_size; |
3353 | 3353 |
3423 assert(!hr->continuesHumongous(), | 3423 assert(!hr->continuesHumongous(), |
3424 "claim_region() should have filtered out continues humongous regions"); | 3424 "claim_region() should have filtered out continues humongous regions"); |
3425 | 3425 |
3426 if (_cm->verbose_low()) { | 3426 if (_cm->verbose_low()) { |
3427 gclog_or_tty->print_cr("[%u] setting up for region "PTR_FORMAT, | 3427 gclog_or_tty->print_cr("[%u] setting up for region "PTR_FORMAT, |
3428 _worker_id, hr); | 3428 _worker_id, p2i(hr)); |
3429 } | 3429 } |
3430 | 3430 |
3431 _curr_region = hr; | 3431 _curr_region = hr; |
3432 _finger = hr->bottom(); | 3432 _finger = hr->bottom(); |
3433 update_region_limit(); | 3433 update_region_limit(); |
3440 | 3440 |
3441 if (limit == bottom) { | 3441 if (limit == bottom) { |
3442 if (_cm->verbose_low()) { | 3442 if (_cm->verbose_low()) { |
3443 gclog_or_tty->print_cr("[%u] found an empty region " | 3443 gclog_or_tty->print_cr("[%u] found an empty region " |
3444 "["PTR_FORMAT", "PTR_FORMAT")", | 3444 "["PTR_FORMAT", "PTR_FORMAT")", |
3445 _worker_id, bottom, limit); | 3445 _worker_id, p2i(bottom), p2i(limit)); |
3446 } | 3446 } |
3447 // The region was collected underneath our feet. | 3447 // The region was collected underneath our feet. |
3448 // We set the finger to bottom to ensure that the bitmap | 3448 // We set the finger to bottom to ensure that the bitmap |
3449 // iteration that will follow this will not do anything. | 3449 // iteration that will follow this will not do anything. |
3450 // (this is not a condition that holds when we set the region up, | 3450 // (this is not a condition that holds when we set the region up, |
3472 | 3472 |
3473 void CMTask::giveup_current_region() { | 3473 void CMTask::giveup_current_region() { |
3474 assert(_curr_region != NULL, "invariant"); | 3474 assert(_curr_region != NULL, "invariant"); |
3475 if (_cm->verbose_low()) { | 3475 if (_cm->verbose_low()) { |
3476 gclog_or_tty->print_cr("[%u] giving up region "PTR_FORMAT, | 3476 gclog_or_tty->print_cr("[%u] giving up region "PTR_FORMAT, |
3477 _worker_id, _curr_region); | 3477 _worker_id, p2i(_curr_region)); |
3478 } | 3478 } |
3479 clear_region_fields(); | 3479 clear_region_fields(); |
3480 } | 3480 } |
3481 | 3481 |
3482 void CMTask::clear_region_fields() { | 3482 void CMTask::clear_region_fields() { |
3752 target_size = 0; | 3752 target_size = 0; |
3753 } | 3753 } |
3754 | 3754 |
3755 if (_task_queue->size() > target_size) { | 3755 if (_task_queue->size() > target_size) { |
3756 if (_cm->verbose_high()) { | 3756 if (_cm->verbose_high()) { |
3757 gclog_or_tty->print_cr("[%u] draining local queue, target size = %d", | 3757 gclog_or_tty->print_cr("[%u] draining local queue, target size = " SIZE_FORMAT, |
3758 _worker_id, target_size); | 3758 _worker_id, target_size); |
3759 } | 3759 } |
3760 | 3760 |
3761 oop obj; | 3761 oop obj; |
3762 bool ret = _task_queue->pop_local(obj); | 3762 bool ret = _task_queue->pop_local(obj); |
3763 while (ret) { | 3763 while (ret) { |
3764 statsOnly( ++_local_pops ); | 3764 statsOnly( ++_local_pops ); |
3765 | 3765 |
3766 if (_cm->verbose_high()) { | 3766 if (_cm->verbose_high()) { |
3767 gclog_or_tty->print_cr("[%u] popped "PTR_FORMAT, _worker_id, | 3767 gclog_or_tty->print_cr("[%u] popped "PTR_FORMAT, _worker_id, |
3768 (void*) obj); | 3768 p2i((void*) obj)); |
3769 } | 3769 } |
3770 | 3770 |
3771 assert(_g1h->is_in_g1_reserved((HeapWord*) obj), "invariant" ); | 3771 assert(_g1h->is_in_g1_reserved((HeapWord*) obj), "invariant" ); |
3772 assert(!_g1h->is_on_master_free_list( | 3772 assert(!_g1h->is_on_master_free_list( |
3773 _g1h->heap_region_containing((HeapWord*) obj)), "invariant"); | 3773 _g1h->heap_region_containing((HeapWord*) obj)), "invariant"); |
3808 target_size = 0; | 3808 target_size = 0; |
3809 } | 3809 } |
3810 | 3810 |
3811 if (_cm->mark_stack_size() > target_size) { | 3811 if (_cm->mark_stack_size() > target_size) { |
3812 if (_cm->verbose_low()) { | 3812 if (_cm->verbose_low()) { |
3813 gclog_or_tty->print_cr("[%u] draining global_stack, target size %d", | 3813 gclog_or_tty->print_cr("[%u] draining global_stack, target size " SIZE_FORMAT, |
3814 _worker_id, target_size); | 3814 _worker_id, target_size); |
3815 } | 3815 } |
3816 | 3816 |
3817 while (!has_aborted() && _cm->mark_stack_size() > target_size) { | 3817 while (!has_aborted() && _cm->mark_stack_size() > target_size) { |
3818 get_entries_from_global_stack(); | 3818 get_entries_from_global_stack(); |
3819 drain_local_queue(partially); | 3819 drain_local_queue(partially); |
3820 } | 3820 } |
3821 | 3821 |
3822 if (_cm->verbose_low()) { | 3822 if (_cm->verbose_low()) { |
3823 gclog_or_tty->print_cr("[%u] drained global stack, size = %d", | 3823 gclog_or_tty->print_cr("[%u] drained global stack, size = " SIZE_FORMAT, |
3824 _worker_id, _cm->mark_stack_size()); | 3824 _worker_id, _cm->mark_stack_size()); |
3825 } | 3825 } |
3826 } | 3826 } |
3827 } | 3827 } |
3828 | 3828 |
4148 | 4148 |
4149 if (_cm->verbose_low()) { | 4149 if (_cm->verbose_low()) { |
4150 gclog_or_tty->print_cr("[%u] we're scanning part " | 4150 gclog_or_tty->print_cr("[%u] we're scanning part " |
4151 "["PTR_FORMAT", "PTR_FORMAT") " | 4151 "["PTR_FORMAT", "PTR_FORMAT") " |
4152 "of region "HR_FORMAT, | 4152 "of region "HR_FORMAT, |
4153 _worker_id, _finger, _region_limit, | 4153 _worker_id, p2i(_finger), p2i(_region_limit), |
4154 HR_FORMAT_PARAMS(_curr_region)); | 4154 HR_FORMAT_PARAMS(_curr_region)); |
4155 } | 4155 } |
4156 | 4156 |
4157 assert(!_curr_region->isHumongous() || mr.start() == _curr_region->bottom(), | 4157 assert(!_curr_region->isHumongous() || mr.start() == _curr_region->bottom(), |
4158 "humongous regions should go around loop once only"); | 4158 "humongous regions should go around loop once only"); |
4235 statsOnly( ++_regions_claimed ); | 4235 statsOnly( ++_regions_claimed ); |
4236 | 4236 |
4237 if (_cm->verbose_low()) { | 4237 if (_cm->verbose_low()) { |
4238 gclog_or_tty->print_cr("[%u] we successfully claimed " | 4238 gclog_or_tty->print_cr("[%u] we successfully claimed " |
4239 "region "PTR_FORMAT, | 4239 "region "PTR_FORMAT, |
4240 _worker_id, claimed_region); | 4240 _worker_id, p2i(claimed_region)); |
4241 } | 4241 } |
4242 | 4242 |
4243 setup_for_region(claimed_region); | 4243 setup_for_region(claimed_region); |
4244 assert(_curr_region == claimed_region, "invariant"); | 4244 assert(_curr_region == claimed_region, "invariant"); |
4245 } | 4245 } |
4296 statsOnly( ++_steal_attempts ); | 4296 statsOnly( ++_steal_attempts ); |
4297 | 4297 |
4298 if (_cm->try_stealing(_worker_id, &_hash_seed, obj)) { | 4298 if (_cm->try_stealing(_worker_id, &_hash_seed, obj)) { |
4299 if (_cm->verbose_medium()) { | 4299 if (_cm->verbose_medium()) { |
4300 gclog_or_tty->print_cr("[%u] stolen "PTR_FORMAT" successfully", | 4300 gclog_or_tty->print_cr("[%u] stolen "PTR_FORMAT" successfully", |
4301 _worker_id, (void*) obj); | 4301 _worker_id, p2i((void*) obj)); |
4302 } | 4302 } |
4303 | 4303 |
4304 statsOnly( ++_steals ); | 4304 statsOnly( ++_steals ); |
4305 | 4305 |
4306 assert(_nextMarkBitMap->isMarked((HeapWord*) obj), | 4306 assert(_nextMarkBitMap->isMarked((HeapWord*) obj), |
4544 _out->print_cr(G1PPRL_LINE_PREFIX" PHASE %s @ %1.3f", phase_name, now); | 4544 _out->print_cr(G1PPRL_LINE_PREFIX" PHASE %s @ %1.3f", phase_name, now); |
4545 _out->print_cr(G1PPRL_LINE_PREFIX" HEAP" | 4545 _out->print_cr(G1PPRL_LINE_PREFIX" HEAP" |
4546 G1PPRL_SUM_ADDR_FORMAT("committed") | 4546 G1PPRL_SUM_ADDR_FORMAT("committed") |
4547 G1PPRL_SUM_ADDR_FORMAT("reserved") | 4547 G1PPRL_SUM_ADDR_FORMAT("reserved") |
4548 G1PPRL_SUM_BYTE_FORMAT("region-size"), | 4548 G1PPRL_SUM_BYTE_FORMAT("region-size"), |
4549 g1_committed.start(), g1_committed.end(), | 4549 p2i(g1_committed.start()), p2i(g1_committed.end()), |
4550 g1_reserved.start(), g1_reserved.end(), | 4550 p2i(g1_reserved.start()), p2i(g1_reserved.end()), |
4551 HeapRegion::GrainBytes); | 4551 HeapRegion::GrainBytes); |
4552 _out->print_cr(G1PPRL_LINE_PREFIX); | 4552 _out->print_cr(G1PPRL_LINE_PREFIX); |
4553 _out->print_cr(G1PPRL_LINE_PREFIX | 4553 _out->print_cr(G1PPRL_LINE_PREFIX |
4554 G1PPRL_TYPE_H_FORMAT | 4554 G1PPRL_TYPE_H_FORMAT |
4555 G1PPRL_ADDR_BASE_H_FORMAT | 4555 G1PPRL_ADDR_BASE_H_FORMAT |
4662 G1PPRL_BYTE_FORMAT | 4662 G1PPRL_BYTE_FORMAT |
4663 G1PPRL_BYTE_FORMAT | 4663 G1PPRL_BYTE_FORMAT |
4664 G1PPRL_DOUBLE_FORMAT | 4664 G1PPRL_DOUBLE_FORMAT |
4665 G1PPRL_BYTE_FORMAT | 4665 G1PPRL_BYTE_FORMAT |
4666 G1PPRL_BYTE_FORMAT, | 4666 G1PPRL_BYTE_FORMAT, |
4667 type, bottom, end, | 4667 type, p2i(bottom), p2i(end), |
4668 used_bytes, prev_live_bytes, next_live_bytes, gc_eff, | 4668 used_bytes, prev_live_bytes, next_live_bytes, gc_eff, |
4669 remset_bytes, strong_code_roots_bytes); | 4669 remset_bytes, strong_code_roots_bytes); |
4670 | 4670 |
4671 return false; | 4671 return false; |
4672 } | 4672 } |