Merge

Thu, 12 Mar 2009 11:34:44 -0400

author
tonyp
date
Thu, 12 Mar 2009 11:34:44 -0400
changeset 1062
fcf566137dbf
parent 1060
2f2f54ed12ce
parent 1061
87fa6e083d82
child 1063
7bb995fbd3c0
child 1068
4018e98c778a

Merge

     1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Tue Mar 10 08:52:16 2009 -0700
     1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Thu Mar 12 11:34:44 2009 -0400
     1.3 @@ -820,6 +820,40 @@
     1.4    }
     1.5  };
     1.6  
     1.7 +class RebuildRSOutOfRegionClosure: public HeapRegionClosure {
     1.8 +  G1CollectedHeap*   _g1h;
     1.9 +  UpdateRSOopClosure _cl;
    1.10 +  int                _worker_i;
    1.11 +public:
    1.12 +  RebuildRSOutOfRegionClosure(G1CollectedHeap* g1, int worker_i = 0) :
    1.13 +    _cl(g1->g1_rem_set()->as_HRInto_G1RemSet(), worker_i),
    1.14 +    _worker_i(worker_i),
    1.15 +    _g1h(g1)
    1.16 +  { }
    1.17 +  bool doHeapRegion(HeapRegion* r) {
    1.18 +    if (!r->continuesHumongous()) {
    1.19 +      _cl.set_from(r);
    1.20 +      r->oop_iterate(&_cl);
    1.21 +    }
    1.22 +    return false;
    1.23 +  }
    1.24 +};
    1.25 +
    1.26 +class ParRebuildRSTask: public AbstractGangTask {
    1.27 +  G1CollectedHeap* _g1;
    1.28 +public:
    1.29 +  ParRebuildRSTask(G1CollectedHeap* g1)
    1.30 +    : AbstractGangTask("ParRebuildRSTask"),
    1.31 +      _g1(g1)
    1.32 +  { }
    1.33 +
    1.34 +  void work(int i) {
    1.35 +    RebuildRSOutOfRegionClosure rebuild_rs(_g1, i);
    1.36 +    _g1->heap_region_par_iterate_chunked(&rebuild_rs, i,
    1.37 +                                         HeapRegion::RebuildRSClaimValue);
    1.38 +  }
    1.39 +};
    1.40 +
    1.41  void G1CollectedHeap::do_collection(bool full, bool clear_all_soft_refs,
    1.42                                      size_t word_size) {
    1.43    ResourceMark rm;
    1.44 @@ -926,24 +960,35 @@
    1.45  
    1.46      reset_gc_time_stamp();
    1.47      // Since everything potentially moved, we will clear all remembered
    1.48 -    // sets, and clear all cards.  Later we will also cards in the used
    1.49 -    // portion of the heap after the resizing (which could be a shrinking.)
    1.50 -    // We will also reset the GC time stamps of the regions.
    1.51 +    // sets, and clear all cards.  Later we will rebuild remebered
    1.52 +    // sets. We will also reset the GC time stamps of the regions.
    1.53      PostMCRemSetClearClosure rs_clear(mr_bs());
    1.54      heap_region_iterate(&rs_clear);
    1.55  
    1.56      // Resize the heap if necessary.
    1.57      resize_if_necessary_after_full_collection(full ? 0 : word_size);
    1.58  
    1.59 -    // Since everything potentially moved, we will clear all remembered
    1.60 -    // sets, but also dirty all cards corresponding to used regions.
    1.61 -    PostMCRemSetInvalidateClosure rs_invalidate(mr_bs());
    1.62 -    heap_region_iterate(&rs_invalidate);
    1.63      if (_cg1r->use_cache()) {
    1.64        _cg1r->clear_and_record_card_counts();
    1.65        _cg1r->clear_hot_cache();
    1.66      }
    1.67  
    1.68 +    // Rebuild remembered sets of all regions.
    1.69 +    if (ParallelGCThreads > 0) {
    1.70 +      ParRebuildRSTask rebuild_rs_task(this);
    1.71 +      assert(check_heap_region_claim_values(
    1.72 +             HeapRegion::InitialClaimValue), "sanity check");
    1.73 +      set_par_threads(workers()->total_workers());
    1.74 +      workers()->run_task(&rebuild_rs_task);
    1.75 +      set_par_threads(0);
    1.76 +      assert(check_heap_region_claim_values(
    1.77 +             HeapRegion::RebuildRSClaimValue), "sanity check");
    1.78 +      reset_heap_region_claim_values();
    1.79 +    } else {
    1.80 +      RebuildRSOutOfRegionClosure rebuild_rs(this);
    1.81 +      heap_region_iterate(&rebuild_rs);
    1.82 +    }
    1.83 +
    1.84      if (PrintGC) {
    1.85        print_size_transition(gclog_or_tty, g1h_prev_used, used(), capacity());
    1.86      }
     2.1 --- a/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Tue Mar 10 08:52:16 2009 -0700
     2.2 +++ b/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Thu Mar 12 11:34:44 2009 -0400
     2.3 @@ -105,33 +105,6 @@
     2.4    _g1->heap_region_iterate(&rc);
     2.5  }
     2.6  
     2.7 -class UpdateRSOopClosure: public OopClosure {
     2.8 -  HeapRegion* _from;
     2.9 -  HRInto_G1RemSet* _rs;
    2.10 -  int _worker_i;
    2.11 -public:
    2.12 -  UpdateRSOopClosure(HRInto_G1RemSet* rs, int worker_i = 0) :
    2.13 -    _from(NULL), _rs(rs), _worker_i(worker_i) {
    2.14 -    guarantee(_rs != NULL, "Requires an HRIntoG1RemSet");
    2.15 -  }
    2.16 -
    2.17 -  void set_from(HeapRegion* from) {
    2.18 -    assert(from != NULL, "from region must be non-NULL");
    2.19 -    _from = from;
    2.20 -  }
    2.21 -
    2.22 -  virtual void do_oop(narrowOop* p) {
    2.23 -    guarantee(false, "NYI");
    2.24 -  }
    2.25 -  virtual void do_oop(oop* p) {
    2.26 -    assert(_from != NULL, "from region must be non-NULL");
    2.27 -    _rs->par_write_ref(_from, p, _worker_i);
    2.28 -  }
    2.29 -  // Override: this closure is idempotent.
    2.30 -  //  bool idempotent() { return true; }
    2.31 -  bool apply_to_weak_ref_discovered_field() { return true; }
    2.32 -};
    2.33 -
    2.34  class UpdateRSOutOfRegionClosure: public HeapRegionClosure {
    2.35    G1CollectedHeap*    _g1h;
    2.36    ModRefBarrierSet*   _mr_bs;
     3.1 --- a/src/share/vm/gc_implementation/g1/g1RemSet.hpp	Tue Mar 10 08:52:16 2009 -0700
     3.2 +++ b/src/share/vm/gc_implementation/g1/g1RemSet.hpp	Thu Mar 12 11:34:44 2009 -0400
     3.3 @@ -215,3 +215,27 @@
     3.4    int n() { return _n; };
     3.5    HeapWord* start_first() { return _start_first; }
     3.6  };
     3.7 +
     3.8 +class UpdateRSOopClosure: public OopClosure {
     3.9 +  HeapRegion* _from;
    3.10 +  HRInto_G1RemSet* _rs;
    3.11 +  int _worker_i;
    3.12 +public:
    3.13 +  UpdateRSOopClosure(HRInto_G1RemSet* rs, int worker_i = 0) :
    3.14 +    _from(NULL), _rs(rs), _worker_i(worker_i) {
    3.15 +    guarantee(_rs != NULL, "Requires an HRIntoG1RemSet");
    3.16 +  }
    3.17 +
    3.18 +  void set_from(HeapRegion* from) {
    3.19 +    assert(from != NULL, "from region must be non-NULL");
    3.20 +    _from = from;
    3.21 +  }
    3.22 +
    3.23 +  virtual void do_oop(narrowOop* p);
    3.24 +  virtual void do_oop(oop* p);
    3.25 +
    3.26 +  // Override: this closure is idempotent.
    3.27 +  //  bool idempotent() { return true; }
    3.28 +  bool apply_to_weak_ref_discovered_field() { return true; }
    3.29 +};
    3.30 +
     4.1 --- a/src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp	Tue Mar 10 08:52:16 2009 -0700
     4.2 +++ b/src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp	Thu Mar 12 11:34:44 2009 -0400
     4.3 @@ -94,3 +94,12 @@
     4.4      }
     4.5    }
     4.6  }
     4.7 +
     4.8 +inline void UpdateRSOopClosure::do_oop(narrowOop* p) {
     4.9 +  guarantee(false, "NYI");
    4.10 +}
    4.11 +
    4.12 +inline void UpdateRSOopClosure::do_oop(oop* p) {
    4.13 +  assert(_from != NULL, "from region must be non-NULL");
    4.14 +  _rs->par_write_ref(_from, p, _worker_i);
    4.15 +}
     5.1 --- a/src/share/vm/gc_implementation/g1/heapRegion.hpp	Tue Mar 10 08:52:16 2009 -0700
     5.2 +++ b/src/share/vm/gc_implementation/g1/heapRegion.hpp	Thu Mar 12 11:34:44 2009 -0400
     5.3 @@ -318,7 +318,8 @@
     5.4      FinalCountClaimValue  = 1,
     5.5      NoteEndClaimValue     = 2,
     5.6      ScrubRemSetClaimValue = 3,
     5.7 -    ParVerifyClaimValue   = 4
     5.8 +    ParVerifyClaimValue   = 4,
     5.9 +    RebuildRSClaimValue   = 5
    5.10    };
    5.11  
    5.12    // Concurrent refinement requires contiguous heap regions (in which TLABs

mercurial