hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
changeset 24424 2658d7834c6e
parent 24244 2c7a1e5649bd
child 24470 2291d267ff97
child 24487 71ff0bd674eb
equal deleted inserted replaced
24358:8528b67f6562 24424:2658d7834c6e
     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 = " PTR_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;
   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() {
  1422     HeapWord* start = hr->bottom();
  1422     HeapWord* start = hr->bottom();
  1423 
  1423 
  1424     assert(start <= hr->end() && start <= ntams && ntams <= hr->end(),
  1424     assert(start <= hr->end() && start <= ntams && ntams <= hr->end(),
  1425            err_msg("Preconditions not met - "
  1425            err_msg("Preconditions not met - "
  1426                    "start: "PTR_FORMAT", ntams: "PTR_FORMAT", end: "PTR_FORMAT,
  1426                    "start: "PTR_FORMAT", ntams: "PTR_FORMAT", end: "PTR_FORMAT,
  1427                    start, ntams, hr->end()));
  1427                    p2i(start), p2i(ntams), p2i(hr->end())));
  1428 
  1428 
  1429     // Find the first marked object at or after "start".
  1429     // Find the first marked object at or after "start".
  1430     start = _bm->getNextMarkedWordAddress(start, ntams);
  1430     start = _bm->getNextMarkedWordAddress(start, ntams);
  1431 
  1431 
  1432     size_t marked_bytes = 0;
  1432     size_t marked_bytes = 0;
  1607     }
  1607     }
  1608 
  1608 
  1609     if (failures > 0 && _verbose)  {
  1609     if (failures > 0 && _verbose)  {
  1610       gclog_or_tty->print_cr("Region " HR_FORMAT ", ntams: " PTR_FORMAT ", "
  1610       gclog_or_tty->print_cr("Region " HR_FORMAT ", ntams: " PTR_FORMAT ", "
  1611                              "marked_bytes: calc/actual " SIZE_FORMAT "/" SIZE_FORMAT,
  1611                              "marked_bytes: calc/actual " SIZE_FORMAT "/" SIZE_FORMAT,
  1612                              HR_FORMAT_PARAMS(hr), hr->next_top_at_mark_start(),
  1612                              HR_FORMAT_PARAMS(hr), p2i(hr->next_top_at_mark_start()),
  1613                              _calc_cl.region_marked_bytes(), hr->next_marked_bytes());
  1613                              _calc_cl.region_marked_bytes(), hr->next_marked_bytes());
  1614     }
  1614     }
  1615 
  1615 
  1616     _failures += failures;
  1616     _failures += failures;
  1617 
  1617 
  2239     if (!_cm->has_overflown()) {
  2239     if (!_cm->has_overflown()) {
  2240       oop obj = oopDesc::load_decode_heap_oop(p);
  2240       oop obj = oopDesc::load_decode_heap_oop(p);
  2241       if (_cm->verbose_high()) {
  2241       if (_cm->verbose_high()) {
  2242         gclog_or_tty->print_cr("\t[%u] we're looking at location "
  2242         gclog_or_tty->print_cr("\t[%u] we're looking at location "
  2243                                "*"PTR_FORMAT" = "PTR_FORMAT,
  2243                                "*"PTR_FORMAT" = "PTR_FORMAT,
  2244                                _task->worker_id(), p, (void*) obj);
  2244                                _task->worker_id(), p2i(p), p2i((void*) obj));
  2245       }
  2245       }
  2246 
  2246 
  2247       _task->deal_with_reference(obj);
  2247       _task->deal_with_reference(obj);
  2248       _ref_counter--;
  2248       _ref_counter--;
  2249 
  2249 
  2673         str = " NOT";
  2673         str = " NOT";
  2674       }
  2674       }
  2675     }
  2675     }
  2676 
  2676 
  2677     _out->print_cr("  "PTR_FORMAT": "PTR_FORMAT"%s%s",
  2677     _out->print_cr("  "PTR_FORMAT": "PTR_FORMAT"%s%s",
  2678                    p, (void*) obj, str, str2);
  2678                    p2i(p), p2i((void*) obj), str, str2);
  2679   }
  2679   }
  2680 };
  2680 };
  2681 
  2681 
  2682 class PrintReachableObjectClosure : public ObjectClosure {
  2682 class PrintReachableObjectClosure : public ObjectClosure {
  2683 private:
  2683 private:
  2700     bool marked = _g1h->is_marked(o, _vo);
  2700     bool marked = _g1h->is_marked(o, _vo);
  2701     bool print_it = _all || over_tams || marked;
  2701     bool print_it = _all || over_tams || marked;
  2702 
  2702 
  2703     if (print_it) {
  2703     if (print_it) {
  2704       _out->print_cr(" "PTR_FORMAT"%s",
  2704       _out->print_cr(" "PTR_FORMAT"%s",
  2705                      (void *)o, (over_tams) ? " >" : (marked) ? " M" : "");
  2705                      p2i((void *)o), (over_tams) ? " >" : (marked) ? " M" : "");
  2706       PrintReachableOopClosure oopCl(_out, _vo, _all);
  2706       PrintReachableOopClosure oopCl(_out, _vo, _all);
  2707       o->oop_iterate_no_header(&oopCl);
  2707       o->oop_iterate_no_header(&oopCl);
  2708     }
  2708     }
  2709   }
  2709   }
  2710 };
  2710 };
  2721     HeapWord* b = hr->bottom();
  2721     HeapWord* b = hr->bottom();
  2722     HeapWord* e = hr->end();
  2722     HeapWord* e = hr->end();
  2723     HeapWord* t = hr->top();
  2723     HeapWord* t = hr->top();
  2724     HeapWord* p = _g1h->top_at_mark_start(hr, _vo);
  2724     HeapWord* p = _g1h->top_at_mark_start(hr, _vo);
  2725     _out->print_cr("** ["PTR_FORMAT", "PTR_FORMAT"] top: "PTR_FORMAT" "
  2725     _out->print_cr("** ["PTR_FORMAT", "PTR_FORMAT"] top: "PTR_FORMAT" "
  2726                    "TAMS: "PTR_FORMAT, b, e, t, p);
  2726                    "TAMS: " PTR_FORMAT, p2i(b), p2i(e), p2i(t), p2i(p));
  2727     _out->cr();
  2727     _out->cr();
  2728 
  2728 
  2729     HeapWord* from = b;
  2729     HeapWord* from = b;
  2730     HeapWord* to   = t;
  2730     HeapWord* to   = t;
  2731 
  2731 
  2732     if (to > from) {
  2732     if (to > from) {
  2733       _out->print_cr("Objects in ["PTR_FORMAT", "PTR_FORMAT"]", from, to);
  2733       _out->print_cr("Objects in [" PTR_FORMAT ", " PTR_FORMAT "]", p2i(from), p2i(to));
  2734       _out->cr();
  2734       _out->cr();
  2735       PrintReachableObjectClosure ocl(_out, _vo, _all, hr);
  2735       PrintReachableObjectClosure ocl(_out, _vo, _all, hr);
  2736       hr->object_iterate_mem_careful(MemRegion(from, to), &ocl);
  2736       hr->object_iterate_mem_careful(MemRegion(from, to), &ocl);
  2737       _out->cr();
  2737       _out->cr();
  2738     }
  2738     }
  2844 
  2844 
  2845     if (verbose_low()) {
  2845     if (verbose_low()) {
  2846       gclog_or_tty->print_cr("[%u] curr_region = "PTR_FORMAT" "
  2846       gclog_or_tty->print_cr("[%u] curr_region = "PTR_FORMAT" "
  2847                              "["PTR_FORMAT", "PTR_FORMAT"), "
  2847                              "["PTR_FORMAT", "PTR_FORMAT"), "
  2848                              "limit = "PTR_FORMAT,
  2848                              "limit = "PTR_FORMAT,
  2849                              worker_id, curr_region, bottom, end, limit);
  2849                              worker_id, p2i(curr_region), p2i(bottom), p2i(end), p2i(limit));
  2850     }
  2850     }
  2851 
  2851 
  2852     // Is the gap between reading the finger and doing the CAS too long?
  2852     // Is the gap between reading the finger and doing the CAS too long?
  2853     HeapWord* res = (HeapWord*) Atomic::cmpxchg_ptr(end, &_finger, finger);
  2853     HeapWord* res = (HeapWord*) Atomic::cmpxchg_ptr(end, &_finger, finger);
  2854     if (res == finger) {
  2854     if (res == finger) {
  2858       // someone else might have moved the finger even further
  2858       // someone else might have moved the finger even further
  2859       assert(_finger >= end, "the finger should have moved forward");
  2859       assert(_finger >= end, "the finger should have moved forward");
  2860 
  2860 
  2861       if (verbose_low()) {
  2861       if (verbose_low()) {
  2862         gclog_or_tty->print_cr("[%u] we were successful with region = "
  2862         gclog_or_tty->print_cr("[%u] we were successful with region = "
  2863                                PTR_FORMAT, worker_id, curr_region);
  2863                                PTR_FORMAT, worker_id, p2i(curr_region));
  2864       }
  2864       }
  2865 
  2865 
  2866       if (limit > bottom) {
  2866       if (limit > bottom) {
  2867         if (verbose_low()) {
  2867         if (verbose_low()) {
  2868           gclog_or_tty->print_cr("[%u] region "PTR_FORMAT" is not empty, "
  2868           gclog_or_tty->print_cr("[%u] region "PTR_FORMAT" is not empty, "
  2869                                  "returning it ", worker_id, curr_region);
  2869                                  "returning it ", worker_id, p2i(curr_region));
  2870         }
  2870         }
  2871         return curr_region;
  2871         return curr_region;
  2872       } else {
  2872       } else {
  2873         assert(limit == bottom,
  2873         assert(limit == bottom,
  2874                "the region limit should be at bottom");
  2874                "the region limit should be at bottom");
  2875         if (verbose_low()) {
  2875         if (verbose_low()) {
  2876           gclog_or_tty->print_cr("[%u] region "PTR_FORMAT" is empty, "
  2876           gclog_or_tty->print_cr("[%u] region "PTR_FORMAT" is empty, "
  2877                                  "returning NULL", worker_id, curr_region);
  2877                                  "returning NULL", worker_id, p2i(curr_region));
  2878         }
  2878         }
  2879         // we return NULL and the caller should try calling
  2879         // we return NULL and the caller should try calling
  2880         // claim_region() again.
  2880         // claim_region() again.
  2881         return NULL;
  2881         return NULL;
  2882       }
  2882       }
  2884       assert(_finger > finger, "the finger should have moved forward");
  2884       assert(_finger > finger, "the finger should have moved forward");
  2885       if (verbose_low()) {
  2885       if (verbose_low()) {
  2886         gclog_or_tty->print_cr("[%u] somebody else moved the finger, "
  2886         gclog_or_tty->print_cr("[%u] somebody else moved the finger, "
  2887                                "global finger = "PTR_FORMAT", "
  2887                                "global finger = "PTR_FORMAT", "
  2888                                "our finger = "PTR_FORMAT,
  2888                                "our finger = "PTR_FORMAT,
  2889                                worker_id, _finger, finger);
  2889                                worker_id, p2i(_finger), p2i(finger));
  2890       }
  2890       }
  2891 
  2891 
  2892       // read it again
  2892       // read it again
  2893       finger = _finger;
  2893       finger = _finger;
  2894     }
  2894     }
  2923   }
  2923   }
  2924 
  2924 
  2925   void do_object_work(oop obj) {
  2925   void do_object_work(oop obj) {
  2926     guarantee(!_g1h->obj_in_cs(obj),
  2926     guarantee(!_g1h->obj_in_cs(obj),
  2927               err_msg("obj: "PTR_FORMAT" in CSet, phase: %s, info: %d",
  2927               err_msg("obj: "PTR_FORMAT" in CSet, phase: %s, info: %d",
  2928                       (void*) obj, phase_str(), _info));
  2928                       p2i((void*) obj), phase_str(), _info));
  2929   }
  2929   }
  2930 
  2930 
  2931 public:
  2931 public:
  2932   VerifyNoCSetOopsClosure() : _g1h(G1CollectedHeap::heap()) { }
  2932   VerifyNoCSetOopsClosure() : _g1h(G1CollectedHeap::heap()) { }
  2933 
  2933 
  3002       // corresponding starts humongous region and the check below will
  3002       // corresponding starts humongous region and the check below will
  3003       // not hold any more.
  3003       // not hold any more.
  3004       HeapRegion* global_hr = _g1h->heap_region_containing_raw(global_finger);
  3004       HeapRegion* global_hr = _g1h->heap_region_containing_raw(global_finger);
  3005       guarantee(global_finger == global_hr->bottom(),
  3005       guarantee(global_finger == global_hr->bottom(),
  3006                 err_msg("global finger: "PTR_FORMAT" region: "HR_FORMAT,
  3006                 err_msg("global finger: "PTR_FORMAT" region: "HR_FORMAT,
  3007                         global_finger, HR_FORMAT_PARAMS(global_hr)));
  3007                         p2i(global_finger), HR_FORMAT_PARAMS(global_hr)));
  3008     }
  3008     }
  3009 
  3009 
  3010     // Verify the task fingers
  3010     // Verify the task fingers
  3011     assert(parallel_marking_threads() <= _max_worker_id, "sanity");
  3011     assert(parallel_marking_threads() <= _max_worker_id, "sanity");
  3012     for (int i = 0; i < (int) parallel_marking_threads(); i += 1) {
  3012     for (int i = 0; i < (int) parallel_marking_threads(); i += 1) {
  3016         // See above note on the global finger verification.
  3016         // See above note on the global finger verification.
  3017         HeapRegion* task_hr = _g1h->heap_region_containing_raw(task_finger);
  3017         HeapRegion* task_hr = _g1h->heap_region_containing_raw(task_finger);
  3018         guarantee(task_finger == task_hr->bottom() ||
  3018         guarantee(task_finger == task_hr->bottom() ||
  3019                   !task_hr->in_collection_set(),
  3019                   !task_hr->in_collection_set(),
  3020                   err_msg("task finger: "PTR_FORMAT" region: "HR_FORMAT,
  3020                   err_msg("task finger: "PTR_FORMAT" region: "HR_FORMAT,
  3021                           task_finger, HR_FORMAT_PARAMS(task_hr)));
  3021                           p2i(task_finger), HR_FORMAT_PARAMS(task_hr)));
  3022       }
  3022       }
  3023     }
  3023     }
  3024   }
  3024   }
  3025 }
  3025 }
  3026 #endif // PRODUCT
  3026 #endif // PRODUCT
  3060 
  3060 
  3061     assert(start <= limit && limit <= hr->top() && hr->top() <= hr->end(),
  3061     assert(start <= limit && limit <= hr->top() && hr->top() <= hr->end(),
  3062            err_msg("Preconditions not met - "
  3062            err_msg("Preconditions not met - "
  3063                    "start: "PTR_FORMAT", limit: "PTR_FORMAT", "
  3063                    "start: "PTR_FORMAT", limit: "PTR_FORMAT", "
  3064                    "top: "PTR_FORMAT", end: "PTR_FORMAT,
  3064                    "top: "PTR_FORMAT", end: "PTR_FORMAT,
  3065                    start, limit, hr->top(), hr->end()));
  3065                    p2i(start), p2i(limit), p2i(hr->top()), p2i(hr->end())));
  3066 
  3066 
  3067     assert(hr->next_marked_bytes() == 0, "Precondition");
  3067     assert(hr->next_marked_bytes() == 0, "Precondition");
  3068 
  3068 
  3069     if (start == limit) {
  3069     if (start == limit) {
  3070       // NTAMS of this region has not been set so nothing to do.
  3070       // NTAMS of this region has not been set so nothing to do.
  3301   }
  3301   }
  3302 }
  3302 }
  3303 
  3303 
  3304 void ConcurrentMark::print_on_error(outputStream* st) const {
  3304 void ConcurrentMark::print_on_error(outputStream* st) const {
  3305   st->print_cr("Marking Bits (Prev, Next): (CMBitMap*) " PTR_FORMAT ", (CMBitMap*) " PTR_FORMAT,
  3305   st->print_cr("Marking Bits (Prev, Next): (CMBitMap*) " PTR_FORMAT ", (CMBitMap*) " PTR_FORMAT,
  3306       _prevMarkBitMap, _nextMarkBitMap);
  3306       p2i(_prevMarkBitMap), p2i(_nextMarkBitMap));
  3307   _prevMarkBitMap->print_on_error(st, " Prev Bits: ");
  3307   _prevMarkBitMap->print_on_error(st, " Prev Bits: ");
  3308   _nextMarkBitMap->print_on_error(st, " Next Bits: ");
  3308   _nextMarkBitMap->print_on_error(st, " Next Bits: ");
  3309 }
  3309 }
  3310 
  3310 
  3311 // We take a break if someone is trying to stop the world.
  3311 // We take a break if someone is trying to stop the world.
  3334 
  3334 
  3335 #ifndef PRODUCT
  3335 #ifndef PRODUCT
  3336 // for debugging purposes
  3336 // for debugging purposes
  3337 void ConcurrentMark::print_finger() {
  3337 void ConcurrentMark::print_finger() {
  3338   gclog_or_tty->print_cr("heap ["PTR_FORMAT", "PTR_FORMAT"), global finger = "PTR_FORMAT,
  3338   gclog_or_tty->print_cr("heap ["PTR_FORMAT", "PTR_FORMAT"), global finger = "PTR_FORMAT,
  3339                          _heap_start, _heap_end, _finger);
  3339                          p2i(_heap_start), p2i(_heap_end), p2i(_finger));
  3340   for (uint i = 0; i < _max_worker_id; ++i) {
  3340   for (uint i = 0; i < _max_worker_id; ++i) {
  3341     gclog_or_tty->print("   %u: "PTR_FORMAT, i, _tasks[i]->finger());
  3341     gclog_or_tty->print("   %u: " PTR_FORMAT, i, p2i(_tasks[i]->finger()));
  3342   }
  3342   }
  3343   gclog_or_tty->print_cr("");
  3343   gclog_or_tty->cr();
  3344 }
  3344 }
  3345 #endif
  3345 #endif
  3346 
  3346 
  3347 void CMTask::scan_object(oop obj) {
  3347 void CMTask::scan_object(oop obj) {
  3348   assert(_nextMarkBitMap->isMarked((HeapWord*) obj), "invariant");
  3348   assert(_nextMarkBitMap->isMarked((HeapWord*) obj), "invariant");
  3349 
  3349 
  3350   if (_cm->verbose_high()) {
  3350   if (_cm->verbose_high()) {
  3351     gclog_or_tty->print_cr("[%u] we're scanning object "PTR_FORMAT,
  3351     gclog_or_tty->print_cr("[%u] we're scanning object "PTR_FORMAT,
  3352                            _worker_id, (void*) obj);
  3352                            _worker_id, p2i((void*) obj));
  3353   }
  3353   }
  3354 
  3354 
  3355   size_t obj_size = obj->size();
  3355   size_t obj_size = obj->size();
  3356   _words_scanned += obj_size;
  3356   _words_scanned += obj_size;
  3357 
  3357 
  3426   assert(!hr->continuesHumongous(),
  3426   assert(!hr->continuesHumongous(),
  3427         "claim_region() should have filtered out continues humongous regions");
  3427         "claim_region() should have filtered out continues humongous regions");
  3428 
  3428 
  3429   if (_cm->verbose_low()) {
  3429   if (_cm->verbose_low()) {
  3430     gclog_or_tty->print_cr("[%u] setting up for region "PTR_FORMAT,
  3430     gclog_or_tty->print_cr("[%u] setting up for region "PTR_FORMAT,
  3431                            _worker_id, hr);
  3431                            _worker_id, p2i(hr));
  3432   }
  3432   }
  3433 
  3433 
  3434   _curr_region  = hr;
  3434   _curr_region  = hr;
  3435   _finger       = hr->bottom();
  3435   _finger       = hr->bottom();
  3436   update_region_limit();
  3436   update_region_limit();
  3443 
  3443 
  3444   if (limit == bottom) {
  3444   if (limit == bottom) {
  3445     if (_cm->verbose_low()) {
  3445     if (_cm->verbose_low()) {
  3446       gclog_or_tty->print_cr("[%u] found an empty region "
  3446       gclog_or_tty->print_cr("[%u] found an empty region "
  3447                              "["PTR_FORMAT", "PTR_FORMAT")",
  3447                              "["PTR_FORMAT", "PTR_FORMAT")",
  3448                              _worker_id, bottom, limit);
  3448                              _worker_id, p2i(bottom), p2i(limit));
  3449     }
  3449     }
  3450     // The region was collected underneath our feet.
  3450     // The region was collected underneath our feet.
  3451     // We set the finger to bottom to ensure that the bitmap
  3451     // We set the finger to bottom to ensure that the bitmap
  3452     // iteration that will follow this will not do anything.
  3452     // iteration that will follow this will not do anything.
  3453     // (this is not a condition that holds when we set the region up,
  3453     // (this is not a condition that holds when we set the region up,
  3475 
  3475 
  3476 void CMTask::giveup_current_region() {
  3476 void CMTask::giveup_current_region() {
  3477   assert(_curr_region != NULL, "invariant");
  3477   assert(_curr_region != NULL, "invariant");
  3478   if (_cm->verbose_low()) {
  3478   if (_cm->verbose_low()) {
  3479     gclog_or_tty->print_cr("[%u] giving up region "PTR_FORMAT,
  3479     gclog_or_tty->print_cr("[%u] giving up region "PTR_FORMAT,
  3480                            _worker_id, _curr_region);
  3480                            _worker_id, p2i(_curr_region));
  3481   }
  3481   }
  3482   clear_region_fields();
  3482   clear_region_fields();
  3483 }
  3483 }
  3484 
  3484 
  3485 void CMTask::clear_region_fields() {
  3485 void CMTask::clear_region_fields() {
  3766     while (ret) {
  3766     while (ret) {
  3767       statsOnly( ++_local_pops );
  3767       statsOnly( ++_local_pops );
  3768 
  3768 
  3769       if (_cm->verbose_high()) {
  3769       if (_cm->verbose_high()) {
  3770         gclog_or_tty->print_cr("[%u] popped "PTR_FORMAT, _worker_id,
  3770         gclog_or_tty->print_cr("[%u] popped "PTR_FORMAT, _worker_id,
  3771                                (void*) obj);
  3771                                p2i((void*) obj));
  3772       }
  3772       }
  3773 
  3773 
  3774       assert(_g1h->is_in_g1_reserved((HeapWord*) obj), "invariant" );
  3774       assert(_g1h->is_in_g1_reserved((HeapWord*) obj), "invariant" );
  3775       assert(!_g1h->is_on_master_free_list(
  3775       assert(!_g1h->is_on_master_free_list(
  3776                   _g1h->heap_region_containing((HeapWord*) obj)), "invariant");
  3776                   _g1h->heap_region_containing((HeapWord*) obj)), "invariant");
  4151 
  4151 
  4152       if (_cm->verbose_low()) {
  4152       if (_cm->verbose_low()) {
  4153         gclog_or_tty->print_cr("[%u] we're scanning part "
  4153         gclog_or_tty->print_cr("[%u] we're scanning part "
  4154                                "["PTR_FORMAT", "PTR_FORMAT") "
  4154                                "["PTR_FORMAT", "PTR_FORMAT") "
  4155                                "of region "HR_FORMAT,
  4155                                "of region "HR_FORMAT,
  4156                                _worker_id, _finger, _region_limit,
  4156                                _worker_id, p2i(_finger), p2i(_region_limit),
  4157                                HR_FORMAT_PARAMS(_curr_region));
  4157                                HR_FORMAT_PARAMS(_curr_region));
  4158       }
  4158       }
  4159 
  4159 
  4160       assert(!_curr_region->isHumongous() || mr.start() == _curr_region->bottom(),
  4160       assert(!_curr_region->isHumongous() || mr.start() == _curr_region->bottom(),
  4161              "humongous regions should go around loop once only");
  4161              "humongous regions should go around loop once only");
  4238         statsOnly( ++_regions_claimed );
  4238         statsOnly( ++_regions_claimed );
  4239 
  4239 
  4240         if (_cm->verbose_low()) {
  4240         if (_cm->verbose_low()) {
  4241           gclog_or_tty->print_cr("[%u] we successfully claimed "
  4241           gclog_or_tty->print_cr("[%u] we successfully claimed "
  4242                                  "region "PTR_FORMAT,
  4242                                  "region "PTR_FORMAT,
  4243                                  _worker_id, claimed_region);
  4243                                  _worker_id, p2i(claimed_region));
  4244         }
  4244         }
  4245 
  4245 
  4246         setup_for_region(claimed_region);
  4246         setup_for_region(claimed_region);
  4247         assert(_curr_region == claimed_region, "invariant");
  4247         assert(_curr_region == claimed_region, "invariant");
  4248       }
  4248       }
  4299       statsOnly( ++_steal_attempts );
  4299       statsOnly( ++_steal_attempts );
  4300 
  4300 
  4301       if (_cm->try_stealing(_worker_id, &_hash_seed, obj)) {
  4301       if (_cm->try_stealing(_worker_id, &_hash_seed, obj)) {
  4302         if (_cm->verbose_medium()) {
  4302         if (_cm->verbose_medium()) {
  4303           gclog_or_tty->print_cr("[%u] stolen "PTR_FORMAT" successfully",
  4303           gclog_or_tty->print_cr("[%u] stolen "PTR_FORMAT" successfully",
  4304                                  _worker_id, (void*) obj);
  4304                                  _worker_id, p2i((void*) obj));
  4305         }
  4305         }
  4306 
  4306 
  4307         statsOnly( ++_steals );
  4307         statsOnly( ++_steals );
  4308 
  4308 
  4309         assert(_nextMarkBitMap->isMarked((HeapWord*) obj),
  4309         assert(_nextMarkBitMap->isMarked((HeapWord*) obj),
  4547   _out->print_cr(G1PPRL_LINE_PREFIX" PHASE %s @ %1.3f", phase_name, now);
  4547   _out->print_cr(G1PPRL_LINE_PREFIX" PHASE %s @ %1.3f", phase_name, now);
  4548   _out->print_cr(G1PPRL_LINE_PREFIX" HEAP"
  4548   _out->print_cr(G1PPRL_LINE_PREFIX" HEAP"
  4549                  G1PPRL_SUM_ADDR_FORMAT("committed")
  4549                  G1PPRL_SUM_ADDR_FORMAT("committed")
  4550                  G1PPRL_SUM_ADDR_FORMAT("reserved")
  4550                  G1PPRL_SUM_ADDR_FORMAT("reserved")
  4551                  G1PPRL_SUM_BYTE_FORMAT("region-size"),
  4551                  G1PPRL_SUM_BYTE_FORMAT("region-size"),
  4552                  g1_committed.start(), g1_committed.end(),
  4552                  p2i(g1_committed.start()), p2i(g1_committed.end()),
  4553                  g1_reserved.start(), g1_reserved.end(),
  4553                  p2i(g1_reserved.start()), p2i(g1_reserved.end()),
  4554                  HeapRegion::GrainBytes);
  4554                  HeapRegion::GrainBytes);
  4555   _out->print_cr(G1PPRL_LINE_PREFIX);
  4555   _out->print_cr(G1PPRL_LINE_PREFIX);
  4556   _out->print_cr(G1PPRL_LINE_PREFIX
  4556   _out->print_cr(G1PPRL_LINE_PREFIX
  4557                 G1PPRL_TYPE_H_FORMAT
  4557                 G1PPRL_TYPE_H_FORMAT
  4558                 G1PPRL_ADDR_BASE_H_FORMAT
  4558                 G1PPRL_ADDR_BASE_H_FORMAT
  4665                  G1PPRL_BYTE_FORMAT
  4665                  G1PPRL_BYTE_FORMAT
  4666                  G1PPRL_BYTE_FORMAT
  4666                  G1PPRL_BYTE_FORMAT
  4667                  G1PPRL_DOUBLE_FORMAT
  4667                  G1PPRL_DOUBLE_FORMAT
  4668                  G1PPRL_BYTE_FORMAT
  4668                  G1PPRL_BYTE_FORMAT
  4669                  G1PPRL_BYTE_FORMAT,
  4669                  G1PPRL_BYTE_FORMAT,
  4670                  type, bottom, end,
  4670                  type, p2i(bottom), p2i(end),
  4671                  used_bytes, prev_live_bytes, next_live_bytes, gc_eff,
  4671                  used_bytes, prev_live_bytes, next_live_bytes, gc_eff,
  4672                  remset_bytes, strong_code_roots_bytes);
  4672                  remset_bytes, strong_code_roots_bytes);
  4673 
  4673 
  4674   return false;
  4674   return false;
  4675 }
  4675 }