src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp

changeset 1696
0414c1049f15
parent 1680
6484c4ee11cb
child 1717
b81f3572f355
     1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Tue Feb 09 13:56:09 2010 -0800
     1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Thu Feb 11 15:52:19 2010 -0800
     1.3 @@ -2646,6 +2646,13 @@
     1.4  
     1.5  // </NEW PREDICTION>
     1.6  
     1.7 +struct PrepareForRSScanningClosure : public HeapRegionClosure {
     1.8 +  bool doHeapRegion(HeapRegion *r) {
     1.9 +    r->rem_set()->set_iter_claimed(0);
    1.10 +    return false;
    1.11 +  }
    1.12 +};
    1.13 +
    1.14  void
    1.15  G1CollectedHeap::do_collection_pause_at_safepoint() {
    1.16    if (PrintHeapAtGC) {
    1.17 @@ -2784,6 +2791,8 @@
    1.18          gclog_or_tty->print_cr("\nAfter pause, heap:");
    1.19          print();
    1.20  #endif
    1.21 +        PrepareForRSScanningClosure prepare_for_rs_scan;
    1.22 +        collection_set_iterate(&prepare_for_rs_scan);
    1.23  
    1.24          setup_surviving_young_words();
    1.25  
    1.26 @@ -3781,22 +3790,16 @@
    1.27    return obj;
    1.28  }
    1.29  
    1.30 -template <bool do_gen_barrier, G1Barrier barrier, bool do_mark_forwardee, bool skip_cset_test>
    1.31 +template <bool do_gen_barrier, G1Barrier barrier, bool do_mark_forwardee>
    1.32  template <class T>
    1.33 -void G1ParCopyClosure <do_gen_barrier, barrier, do_mark_forwardee, skip_cset_test>
    1.34 +void G1ParCopyClosure <do_gen_barrier, barrier, do_mark_forwardee>
    1.35  ::do_oop_work(T* p) {
    1.36    oop obj = oopDesc::load_decode_heap_oop(p);
    1.37    assert(barrier != G1BarrierRS || obj != NULL,
    1.38           "Precondition: G1BarrierRS implies obj is nonNull");
    1.39  
    1.40 -  // The only time we skip the cset test is when we're scanning
    1.41 -  // references popped from the queue. And we only push on the queue
    1.42 -  // references that we know point into the cset, so no point in
    1.43 -  // checking again. But we'll leave an assert here for peace of mind.
    1.44 -  assert(!skip_cset_test || _g1->obj_in_cs(obj), "invariant");
    1.45 -
    1.46    // here the null check is implicit in the cset_fast_test() test
    1.47 -  if (skip_cset_test || _g1->in_cset_fast_test(obj)) {
    1.48 +  if (_g1->in_cset_fast_test(obj)) {
    1.49  #if G1_REM_SET_LOGGING
    1.50      gclog_or_tty->print_cr("Loc "PTR_FORMAT" contains pointer "PTR_FORMAT" "
    1.51                             "into CS.", p, (void*) obj);
    1.52 @@ -3813,7 +3816,6 @@
    1.53      }
    1.54    }
    1.55  
    1.56 -  // When scanning moved objs, must look at all oops.
    1.57    if (barrier == G1BarrierEvac && obj != NULL) {
    1.58      _par_scan_state->update_rs(_from, p, _par_scan_state->queue_num());
    1.59    }
    1.60 @@ -3823,8 +3825,8 @@
    1.61    }
    1.62  }
    1.63  
    1.64 -template void G1ParCopyClosure<false, G1BarrierEvac, false, true>::do_oop_work(oop* p);
    1.65 -template void G1ParCopyClosure<false, G1BarrierEvac, false, true>::do_oop_work(narrowOop* p);
    1.66 +template void G1ParCopyClosure<false, G1BarrierEvac, false>::do_oop_work(oop* p);
    1.67 +template void G1ParCopyClosure<false, G1BarrierEvac, false>::do_oop_work(narrowOop* p);
    1.68  
    1.69  template <class T> void G1ParScanPartialArrayClosure::do_oop_nv(T* p) {
    1.70    assert(has_partial_array_mask(p), "invariant");
    1.71 @@ -3896,11 +3898,11 @@
    1.72            assert(UseCompressedOops, "Error");
    1.73            narrowOop* p = (narrowOop*) stolen_task;
    1.74            assert(has_partial_array_mask(p) ||
    1.75 -                 _g1h->obj_in_cs(oopDesc::load_decode_heap_oop(p)), "Error");
    1.76 +                 _g1h->is_in_g1_reserved(oopDesc::load_decode_heap_oop(p)), "Error");
    1.77            pss->push_on_queue(p);
    1.78          } else {
    1.79            oop* p = (oop*) stolen_task;
    1.80 -          assert(has_partial_array_mask(p) || _g1h->obj_in_cs(*p), "Error");
    1.81 +          assert(has_partial_array_mask(p) || _g1h->is_in_g1_reserved(*p), "Error");
    1.82            pss->push_on_queue(p);
    1.83          }
    1.84          continue;
    1.85 @@ -3962,6 +3964,7 @@
    1.86      G1ParScanExtRootClosure         only_scan_root_cl(_g1h, &pss);
    1.87      G1ParScanPermClosure            only_scan_perm_cl(_g1h, &pss);
    1.88      G1ParScanHeapRSClosure          only_scan_heap_rs_cl(_g1h, &pss);
    1.89 +    G1ParPushHeapRSClosure          push_heap_rs_cl(_g1h, &pss);
    1.90  
    1.91      G1ParScanAndMarkExtRootClosure  scan_mark_root_cl(_g1h, &pss);
    1.92      G1ParScanAndMarkPermClosure     scan_mark_perm_cl(_g1h, &pss);
    1.93 @@ -3985,7 +3988,7 @@
    1.94      _g1h->g1_process_strong_roots(/* not collecting perm */ false,
    1.95                                    SharedHeap::SO_AllClasses,
    1.96                                    scan_root_cl,
    1.97 -                                  &only_scan_heap_rs_cl,
    1.98 +                                  &push_heap_rs_cl,
    1.99                                    scan_so_cl,
   1.100                                    scan_perm_cl,
   1.101                                    i);

mercurial