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

changeset 2495
81668b1f4877
parent 2494
234761c55641
parent 2493
97ba643ea3ed
child 2497
3582bf76420e
     1.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Tue Jan 25 10:56:22 2011 -0800
     1.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Wed Jan 26 09:57:42 2011 -0800
     1.3 @@ -1512,21 +1512,19 @@
     1.4    size_t _max_live_bytes;
     1.5    size_t _regions_claimed;
     1.6    size_t _freed_bytes;
     1.7 -  FreeRegionList _local_cleanup_list;
     1.8 -  HumongousRegionSet _humongous_proxy_set;
     1.9 +  FreeRegionList* _local_cleanup_list;
    1.10 +  HumongousRegionSet* _humongous_proxy_set;
    1.11 +  HRRSCleanupTask* _hrrs_cleanup_task;
    1.12    double _claimed_region_time;
    1.13    double _max_region_time;
    1.14  
    1.15  public:
    1.16    G1NoteEndOfConcMarkClosure(G1CollectedHeap* g1,
    1.17 -                             int worker_num);
    1.18 +                             int worker_num,
    1.19 +                             FreeRegionList* local_cleanup_list,
    1.20 +                             HumongousRegionSet* humongous_proxy_set,
    1.21 +                             HRRSCleanupTask* hrrs_cleanup_task);
    1.22    size_t freed_bytes() { return _freed_bytes; }
    1.23 -  FreeRegionList* local_cleanup_list() {
    1.24 -    return &_local_cleanup_list;
    1.25 -  }
    1.26 -  HumongousRegionSet* humongous_proxy_set() {
    1.27 -    return &_humongous_proxy_set;
    1.28 -  }
    1.29  
    1.30    bool doHeapRegion(HeapRegion *r);
    1.31  
    1.32 @@ -1553,7 +1551,12 @@
    1.33  
    1.34    void work(int i) {
    1.35      double start = os::elapsedTime();
    1.36 -    G1NoteEndOfConcMarkClosure g1_note_end(_g1h, i);
    1.37 +    FreeRegionList local_cleanup_list("Local Cleanup List");
    1.38 +    HumongousRegionSet humongous_proxy_set("Local Cleanup Humongous Proxy Set");
    1.39 +    HRRSCleanupTask hrrs_cleanup_task;
    1.40 +    G1NoteEndOfConcMarkClosure g1_note_end(_g1h, i, &local_cleanup_list,
    1.41 +                                           &humongous_proxy_set,
    1.42 +                                           &hrrs_cleanup_task);
    1.43      if (G1CollectedHeap::use_parallel_gc_threads()) {
    1.44        _g1h->heap_region_par_iterate_chunked(&g1_note_end, i,
    1.45                                              HeapRegion::NoteEndClaimValue);
    1.46 @@ -1565,15 +1568,17 @@
    1.47      // Now update the lists
    1.48      _g1h->update_sets_after_freeing_regions(g1_note_end.freed_bytes(),
    1.49                                              NULL /* free_list */,
    1.50 -                                            g1_note_end.humongous_proxy_set(),
    1.51 +                                            &humongous_proxy_set,
    1.52                                              true /* par */);
    1.53      {
    1.54        MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
    1.55        _max_live_bytes += g1_note_end.max_live_bytes();
    1.56        _freed_bytes += g1_note_end.freed_bytes();
    1.57  
    1.58 -      _cleanup_list->add_as_tail(g1_note_end.local_cleanup_list());
    1.59 -      assert(g1_note_end.local_cleanup_list()->is_empty(), "post-condition");
    1.60 +      _cleanup_list->add_as_tail(&local_cleanup_list);
    1.61 +      assert(local_cleanup_list.is_empty(), "post-condition");
    1.62 +
    1.63 +      HeapRegionRemSet::finish_cleanup_task(&hrrs_cleanup_task);
    1.64      }
    1.65      double end = os::elapsedTime();
    1.66      if (G1PrintParCleanupStats) {
    1.67 @@ -1614,13 +1619,17 @@
    1.68  
    1.69  G1NoteEndOfConcMarkClosure::
    1.70  G1NoteEndOfConcMarkClosure(G1CollectedHeap* g1,
    1.71 -                           int worker_num)
    1.72 +                           int worker_num,
    1.73 +                           FreeRegionList* local_cleanup_list,
    1.74 +                           HumongousRegionSet* humongous_proxy_set,
    1.75 +                           HRRSCleanupTask* hrrs_cleanup_task)
    1.76    : _g1(g1), _worker_num(worker_num),
    1.77      _max_live_bytes(0), _regions_claimed(0),
    1.78      _freed_bytes(0),
    1.79      _claimed_region_time(0.0), _max_region_time(0.0),
    1.80 -    _local_cleanup_list("Local Cleanup List"),
    1.81 -    _humongous_proxy_set("Local Cleanup Humongous Proxy Set") { }
    1.82 +    _local_cleanup_list(local_cleanup_list),
    1.83 +    _humongous_proxy_set(humongous_proxy_set),
    1.84 +    _hrrs_cleanup_task(hrrs_cleanup_task) { }
    1.85  
    1.86  bool G1NoteEndOfConcMarkClosure::doHeapRegion(HeapRegion *hr) {
    1.87    // We use a claim value of zero here because all regions
    1.88 @@ -1631,11 +1640,12 @@
    1.89      _regions_claimed++;
    1.90      hr->note_end_of_marking();
    1.91      _max_live_bytes += hr->max_live_bytes();
    1.92 -    _g1->free_region_if_totally_empty(hr,
    1.93 -                                      &_freed_bytes,
    1.94 -                                      &_local_cleanup_list,
    1.95 -                                      &_humongous_proxy_set,
    1.96 -                                      true /* par */);
    1.97 +    _g1->free_region_if_empty(hr,
    1.98 +                              &_freed_bytes,
    1.99 +                              _local_cleanup_list,
   1.100 +                              _humongous_proxy_set,
   1.101 +                              _hrrs_cleanup_task,
   1.102 +                              true /* par */);
   1.103      double region_time = (os::elapsedTime() - start);
   1.104      _claimed_region_time += region_time;
   1.105      if (region_time > _max_region_time) _max_region_time = region_time;
   1.106 @@ -1671,6 +1681,8 @@
   1.107  
   1.108    double start = os::elapsedTime();
   1.109  
   1.110 +  HeapRegionRemSet::reset_for_cleanup_tasks();
   1.111 +
   1.112    // Do counting once more with the world stopped for good measure.
   1.113    G1ParFinalCountTask g1_par_count_task(g1h, nextMarkBitMap(),
   1.114                                          &_region_bm, &_card_bm);

mercurial