Merge

Wed, 26 Feb 2014 18:51:19 +0100

author
sla
date
Wed, 26 Feb 2014 18:51:19 +0100
changeset 6334
caff540c5f75
parent 6333
d6c97434b745
parent 6332
e5c0b296deb2
child 6335
d35df3079834

Merge

     1.1 --- a/make/excludeSrc.make	Thu Jan 23 08:12:12 2014 +0100
     1.2 +++ b/make/excludeSrc.make	Wed Feb 26 18:51:19 2014 +0100
     1.3 @@ -86,7 +86,7 @@
     1.4  	concurrentMark.cpp concurrentMarkThread.cpp dirtyCardQueue.cpp g1AllocRegion.cpp \
     1.5  	g1BlockOffsetTable.cpp g1CardCounts.cpp g1CollectedHeap.cpp g1CollectorPolicy.cpp \
     1.6  	g1ErgoVerbose.cpp g1GCPhaseTimes.cpp g1HRPrinter.cpp g1HotCardCache.cpp g1Log.cpp \
     1.7 -	g1MMUTracker.cpp g1MarkSweep.cpp g1MemoryPool.cpp g1MonitoringSupport.cpp \
     1.8 +	g1MMUTracker.cpp g1MarkSweep.cpp g1MemoryPool.cpp g1MonitoringSupport.cpp g1OopClosures.cpp \
     1.9  	g1RemSet.cpp g1RemSetSummary.cpp g1SATBCardTableModRefBS.cpp g1_globals.cpp heapRegion.cpp \
    1.10  	g1BiasedArray.cpp heapRegionRemSet.cpp heapRegionSeq.cpp heapRegionSet.cpp heapRegionSets.cpp \
    1.11  	ptrQueue.cpp satbQueue.cpp sparsePRT.cpp survRateGroup.cpp vm_operations_g1.cpp \
     2.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Thu Jan 23 08:12:12 2014 +0100
     2.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Wed Feb 26 18:51:19 2014 +0100
     2.3 @@ -4539,7 +4539,7 @@
     2.4  G1ParGCAllocBuffer::G1ParGCAllocBuffer(size_t gclab_word_size) :
     2.5    ParGCAllocBuffer(gclab_word_size), _retired(false) { }
     2.6  
     2.7 -G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num)
     2.8 +G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num, ReferenceProcessor* rp)
     2.9    : _g1h(g1h),
    2.10      _refs(g1h->task_queue(queue_num)),
    2.11      _dcq(&g1h->dirty_card_queue_set()),
    2.12 @@ -4549,7 +4549,7 @@
    2.13      _term_attempts(0),
    2.14      _surviving_alloc_buffer(g1h->desired_plab_sz(GCAllocForSurvived)),
    2.15      _tenured_alloc_buffer(g1h->desired_plab_sz(GCAllocForTenured)),
    2.16 -    _age_table(false),
    2.17 +    _age_table(false), _scanner(g1h, this, rp),
    2.18      _strong_roots_time(0), _term_time(0),
    2.19      _alloc_buffer_waste(0), _undo_waste(0) {
    2.20    // we allocate G1YoungSurvRateNumRegions plus one entries, since
    2.21 @@ -4658,14 +4658,10 @@
    2.22  
    2.23  G1ParClosureSuper::G1ParClosureSuper(G1CollectedHeap* g1,
    2.24                                       G1ParScanThreadState* par_scan_state) :
    2.25 -  _g1(g1), _g1_rem(_g1->g1_rem_set()), _cm(_g1->concurrent_mark()),
    2.26 -  _par_scan_state(par_scan_state),
    2.27 -  _worker_id(par_scan_state->queue_num()),
    2.28 -  _during_initial_mark(_g1->g1_policy()->during_initial_mark_pause()),
    2.29 -  _mark_in_progress(_g1->mark_in_progress()) { }
    2.30 -
    2.31 -template <G1Barrier barrier, bool do_mark_object>
    2.32 -void G1ParCopyClosure<barrier, do_mark_object>::mark_object(oop obj) {
    2.33 +  _g1(g1), _par_scan_state(par_scan_state),
    2.34 +  _worker_id(par_scan_state->queue_num()) { }
    2.35 +
    2.36 +void G1ParCopyHelper::mark_object(oop obj) {
    2.37  #ifdef ASSERT
    2.38    HeapRegion* hr = _g1->heap_region_containing(obj);
    2.39    assert(hr != NULL, "sanity");
    2.40 @@ -4676,9 +4672,7 @@
    2.41    _cm->grayRoot(obj, (size_t) obj->size(), _worker_id);
    2.42  }
    2.43  
    2.44 -template <G1Barrier barrier, bool do_mark_object>
    2.45 -void G1ParCopyClosure<barrier, do_mark_object>
    2.46 -  ::mark_forwarded_object(oop from_obj, oop to_obj) {
    2.47 +void G1ParCopyHelper::mark_forwarded_object(oop from_obj, oop to_obj) {
    2.48  #ifdef ASSERT
    2.49    assert(from_obj->is_forwarded(), "from obj should be forwarded");
    2.50    assert(from_obj->forwardee() == to_obj, "to obj should be the forwardee");
    2.51 @@ -4700,27 +4694,25 @@
    2.52    _cm->grayRoot(to_obj, (size_t) from_obj->size(), _worker_id);
    2.53  }
    2.54  
    2.55 -template <G1Barrier barrier, bool do_mark_object>
    2.56 -oop G1ParCopyClosure<barrier, do_mark_object>
    2.57 -  ::copy_to_survivor_space(oop old) {
    2.58 +oop G1ParScanThreadState::copy_to_survivor_space(oop const old) {
    2.59    size_t word_sz = old->size();
    2.60 -  HeapRegion* from_region = _g1->heap_region_containing_raw(old);
    2.61 +  HeapRegion* from_region = _g1h->heap_region_containing_raw(old);
    2.62    // +1 to make the -1 indexes valid...
    2.63    int       young_index = from_region->young_index_in_cset()+1;
    2.64    assert( (from_region->is_young() && young_index >  0) ||
    2.65           (!from_region->is_young() && young_index == 0), "invariant" );
    2.66 -  G1CollectorPolicy* g1p = _g1->g1_policy();
    2.67 +  G1CollectorPolicy* g1p = _g1h->g1_policy();
    2.68    markOop m = old->mark();
    2.69    int age = m->has_displaced_mark_helper() ? m->displaced_mark_helper()->age()
    2.70                                             : m->age();
    2.71    GCAllocPurpose alloc_purpose = g1p->evacuation_destination(from_region, age,
    2.72                                                               word_sz);
    2.73 -  HeapWord* obj_ptr = _par_scan_state->allocate(alloc_purpose, word_sz);
    2.74 +  HeapWord* obj_ptr = allocate(alloc_purpose, word_sz);
    2.75  #ifndef PRODUCT
    2.76    // Should this evacuation fail?
    2.77 -  if (_g1->evacuation_should_fail()) {
    2.78 +  if (_g1h->evacuation_should_fail()) {
    2.79      if (obj_ptr != NULL) {
    2.80 -      _par_scan_state->undo_allocation(alloc_purpose, obj_ptr, word_sz);
    2.81 +      undo_allocation(alloc_purpose, obj_ptr, word_sz);
    2.82        obj_ptr = NULL;
    2.83      }
    2.84    }
    2.85 @@ -4729,7 +4721,7 @@
    2.86    if (obj_ptr == NULL) {
    2.87      // This will either forward-to-self, or detect that someone else has
    2.88      // installed a forwarding pointer.
    2.89 -    return _g1->handle_evacuation_failure_par(_par_scan_state, old);
    2.90 +    return _g1h->handle_evacuation_failure_par(this, old);
    2.91    }
    2.92  
    2.93    oop obj = oop(obj_ptr);
    2.94 @@ -4762,12 +4754,12 @@
    2.95          m = m->incr_age();
    2.96          obj->set_mark(m);
    2.97        }
    2.98 -      _par_scan_state->age_table()->add(obj, word_sz);
    2.99 +      age_table()->add(obj, word_sz);
   2.100      } else {
   2.101        obj->set_mark(m);
   2.102      }
   2.103  
   2.104 -    size_t* surv_young_words = _par_scan_state->surviving_young_words();
   2.105 +    size_t* surv_young_words = surviving_young_words();
   2.106      surv_young_words[young_index] += word_sz;
   2.107  
   2.108      if (obj->is_objArray() && arrayOop(obj)->length() >= ParGCArrayScanChunk) {
   2.109 @@ -4776,15 +4768,15 @@
   2.110        // length field of the from-space object.
   2.111        arrayOop(obj)->set_length(0);
   2.112        oop* old_p = set_partial_array_mask(old);
   2.113 -      _par_scan_state->push_on_queue(old_p);
   2.114 +      push_on_queue(old_p);
   2.115      } else {
   2.116        // No point in using the slower heap_region_containing() method,
   2.117        // given that we know obj is in the heap.
   2.118 -      _scanner.set_region(_g1->heap_region_containing_raw(obj));
   2.119 +      _scanner.set_region(_g1h->heap_region_containing_raw(obj));
   2.120        obj->oop_iterate_backwards(&_scanner);
   2.121      }
   2.122    } else {
   2.123 -    _par_scan_state->undo_allocation(alloc_purpose, obj_ptr, word_sz);
   2.124 +    undo_allocation(alloc_purpose, obj_ptr, word_sz);
   2.125      obj = forward_ptr;
   2.126    }
   2.127    return obj;
   2.128 @@ -4799,19 +4791,23 @@
   2.129  
   2.130  template <G1Barrier barrier, bool do_mark_object>
   2.131  template <class T>
   2.132 -void G1ParCopyClosure<barrier, do_mark_object>
   2.133 -::do_oop_work(T* p) {
   2.134 -  oop obj = oopDesc::load_decode_heap_oop(p);
   2.135 +void G1ParCopyClosure<barrier, do_mark_object>::do_oop_work(T* p) {
   2.136 +  T heap_oop = oopDesc::load_heap_oop(p);
   2.137 +
   2.138 +  if (oopDesc::is_null(heap_oop)) {
   2.139 +    return;
   2.140 +  }
   2.141 +
   2.142 +  oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
   2.143  
   2.144    assert(_worker_id == _par_scan_state->queue_num(), "sanity");
   2.145  
   2.146 -  // here the null check is implicit in the cset_fast_test() test
   2.147    if (_g1->in_cset_fast_test(obj)) {
   2.148      oop forwardee;
   2.149      if (obj->is_forwarded()) {
   2.150        forwardee = obj->forwardee();
   2.151      } else {
   2.152 -      forwardee = copy_to_survivor_space(obj);
   2.153 +      forwardee = _par_scan_state->copy_to_survivor_space(obj);
   2.154      }
   2.155      assert(forwardee != NULL, "forwardee should not be NULL");
   2.156      oopDesc::encode_store_heap_oop(p, forwardee);
   2.157 @@ -4828,12 +4824,12 @@
   2.158      // The object is not in collection set. If we're a root scanning
   2.159      // closure during an initial mark pause (i.e. do_mark_object will
   2.160      // be true) then attempt to mark the object.
   2.161 -    if (do_mark_object && _g1->is_in_g1_reserved(obj)) {
   2.162 +    if (do_mark_object) {
   2.163        mark_object(obj);
   2.164      }
   2.165    }
   2.166  
   2.167 -  if (barrier == G1BarrierEvac && obj != NULL) {
   2.168 +  if (barrier == G1BarrierEvac) {
   2.169      _par_scan_state->update_rs(_from, p, _worker_id);
   2.170    }
   2.171  }
   2.172 @@ -5030,7 +5026,7 @@
   2.173  
   2.174        ReferenceProcessor*             rp = _g1h->ref_processor_stw();
   2.175  
   2.176 -      G1ParScanThreadState            pss(_g1h, worker_id);
   2.177 +      G1ParScanThreadState            pss(_g1h, worker_id, rp);
   2.178        G1ParScanHeapEvacClosure        scan_evac_cl(_g1h, &pss, rp);
   2.179        G1ParScanHeapEvacFailureClosure evac_failure_cl(_g1h, &pss, rp);
   2.180        G1ParScanPartialArrayClosure    partial_scan_cl(_g1h, &pss, rp);
   2.181 @@ -5473,7 +5469,7 @@
   2.182  
   2.183      G1STWIsAliveClosure is_alive(_g1h);
   2.184  
   2.185 -    G1ParScanThreadState pss(_g1h, worker_id);
   2.186 +    G1ParScanThreadState            pss(_g1h, worker_id, NULL);
   2.187  
   2.188      G1ParScanHeapEvacClosure        scan_evac_cl(_g1h, &pss, NULL);
   2.189      G1ParScanHeapEvacFailureClosure evac_failure_cl(_g1h, &pss, NULL);
   2.190 @@ -5585,7 +5581,7 @@
   2.191      ResourceMark rm;
   2.192      HandleMark   hm;
   2.193  
   2.194 -    G1ParScanThreadState            pss(_g1h, worker_id);
   2.195 +    G1ParScanThreadState            pss(_g1h, worker_id, NULL);
   2.196      G1ParScanHeapEvacClosure        scan_evac_cl(_g1h, &pss, NULL);
   2.197      G1ParScanHeapEvacFailureClosure evac_failure_cl(_g1h, &pss, NULL);
   2.198      G1ParScanPartialArrayClosure    partial_scan_cl(_g1h, &pss, NULL);
   2.199 @@ -5711,7 +5707,7 @@
   2.200    // JNI refs.
   2.201  
   2.202    // Use only a single queue for this PSS.
   2.203 -  G1ParScanThreadState pss(this, 0);
   2.204 +  G1ParScanThreadState            pss(this, 0, NULL);
   2.205  
   2.206    // We do not embed a reference processor in the copying/scanning
   2.207    // closures while we're actually processing the discovered
     3.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Thu Jan 23 08:12:12 2014 +0100
     3.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Wed Feb 26 18:51:19 2014 +0100
     3.3 @@ -606,6 +606,11 @@
     3.4    // may not be a humongous - it must fit into a single heap region.
     3.5    HeapWord* par_allocate_during_gc(GCAllocPurpose purpose, size_t word_size);
     3.6  
     3.7 +  HeapWord* allocate_during_gc_slow(GCAllocPurpose purpose,
     3.8 +                                    HeapRegion*    alloc_region,
     3.9 +                                    bool           par,
    3.10 +                                    size_t         word_size);
    3.11 +
    3.12    // Ensure that no further allocations can happen in "r", bearing in mind
    3.13    // that parallel threads might be attempting allocations.
    3.14    void par_allocate_remaining_space(HeapRegion* r);
    3.15 @@ -698,23 +703,20 @@
    3.16    }
    3.17  
    3.18    // This is a fast test on whether a reference points into the
    3.19 -  // collection set or not. It does not assume that the reference
    3.20 -  // points into the heap; if it doesn't, it will return false.
    3.21 +  // collection set or not. Assume that the reference
    3.22 +  // points into the heap.
    3.23    bool in_cset_fast_test(oop obj) {
    3.24      assert(_in_cset_fast_test != NULL, "sanity");
    3.25 -    if (_g1_committed.contains((HeapWord*) obj)) {
    3.26 -      // no need to subtract the bottom of the heap from obj,
    3.27 -      // _in_cset_fast_test is biased
    3.28 -      uintx index = cast_from_oop<uintx>(obj) >> HeapRegion::LogOfHRGrainBytes;
    3.29 -      bool ret = _in_cset_fast_test[index];
    3.30 -      // let's make sure the result is consistent with what the slower
    3.31 -      // test returns
    3.32 -      assert( ret || !obj_in_cs(obj), "sanity");
    3.33 -      assert(!ret ||  obj_in_cs(obj), "sanity");
    3.34 -      return ret;
    3.35 -    } else {
    3.36 -      return false;
    3.37 -    }
    3.38 +    assert(_g1_committed.contains((HeapWord*) obj), err_msg("Given reference outside of heap, is "PTR_FORMAT, (HeapWord*)obj));
    3.39 +    // no need to subtract the bottom of the heap from obj,
    3.40 +    // _in_cset_fast_test is biased
    3.41 +    uintx index = cast_from_oop<uintx>(obj) >> HeapRegion::LogOfHRGrainBytes;
    3.42 +    bool ret = _in_cset_fast_test[index];
    3.43 +    // let's make sure the result is consistent with what the slower
    3.44 +    // test returns
    3.45 +    assert( ret || !obj_in_cs(obj), "sanity");
    3.46 +    assert(!ret ||  obj_in_cs(obj), "sanity");
    3.47 +    return ret;
    3.48    }
    3.49  
    3.50    void clear_cset_fast_test() {
    3.51 @@ -1786,95 +1788,6 @@
    3.52      ParGCAllocBuffer::retire(end_of_gc, retain);
    3.53      _retired = true;
    3.54    }
    3.55 -
    3.56 -  bool is_retired() {
    3.57 -    return _retired;
    3.58 -  }
    3.59 -};
    3.60 -
    3.61 -class G1ParGCAllocBufferContainer {
    3.62 -protected:
    3.63 -  static int const _priority_max = 2;
    3.64 -  G1ParGCAllocBuffer* _priority_buffer[_priority_max];
    3.65 -
    3.66 -public:
    3.67 -  G1ParGCAllocBufferContainer(size_t gclab_word_size) {
    3.68 -    for (int pr = 0; pr < _priority_max; ++pr) {
    3.69 -      _priority_buffer[pr] = new G1ParGCAllocBuffer(gclab_word_size);
    3.70 -    }
    3.71 -  }
    3.72 -
    3.73 -  ~G1ParGCAllocBufferContainer() {
    3.74 -    for (int pr = 0; pr < _priority_max; ++pr) {
    3.75 -      assert(_priority_buffer[pr]->is_retired(), "alloc buffers should all retire at this point.");
    3.76 -      delete _priority_buffer[pr];
    3.77 -    }
    3.78 -  }
    3.79 -
    3.80 -  HeapWord* allocate(size_t word_sz) {
    3.81 -    HeapWord* obj;
    3.82 -    for (int pr = 0; pr < _priority_max; ++pr) {
    3.83 -      obj = _priority_buffer[pr]->allocate(word_sz);
    3.84 -      if (obj != NULL) return obj;
    3.85 -    }
    3.86 -    return obj;
    3.87 -  }
    3.88 -
    3.89 -  bool contains(void* addr) {
    3.90 -    for (int pr = 0; pr < _priority_max; ++pr) {
    3.91 -      if (_priority_buffer[pr]->contains(addr)) return true;
    3.92 -    }
    3.93 -    return false;
    3.94 -  }
    3.95 -
    3.96 -  void undo_allocation(HeapWord* obj, size_t word_sz) {
    3.97 -    bool finish_undo;
    3.98 -    for (int pr = 0; pr < _priority_max; ++pr) {
    3.99 -      if (_priority_buffer[pr]->contains(obj)) {
   3.100 -        _priority_buffer[pr]->undo_allocation(obj, word_sz);
   3.101 -        finish_undo = true;
   3.102 -      }
   3.103 -    }
   3.104 -    if (!finish_undo) ShouldNotReachHere();
   3.105 -  }
   3.106 -
   3.107 -  size_t words_remaining() {
   3.108 -    size_t result = 0;
   3.109 -    for (int pr = 0; pr < _priority_max; ++pr) {
   3.110 -      result += _priority_buffer[pr]->words_remaining();
   3.111 -    }
   3.112 -    return result;
   3.113 -  }
   3.114 -
   3.115 -  size_t words_remaining_in_retired_buffer() {
   3.116 -    G1ParGCAllocBuffer* retired = _priority_buffer[0];
   3.117 -    return retired->words_remaining();
   3.118 -  }
   3.119 -
   3.120 -  void flush_stats_and_retire(PLABStats* stats, bool end_of_gc, bool retain) {
   3.121 -    for (int pr = 0; pr < _priority_max; ++pr) {
   3.122 -      _priority_buffer[pr]->flush_stats_and_retire(stats, end_of_gc, retain);
   3.123 -    }
   3.124 -  }
   3.125 -
   3.126 -  void update(bool end_of_gc, bool retain, HeapWord* buf, size_t word_sz) {
   3.127 -    G1ParGCAllocBuffer* retired_and_set = _priority_buffer[0];
   3.128 -    retired_and_set->retire(end_of_gc, retain);
   3.129 -    retired_and_set->set_buf(buf);
   3.130 -    retired_and_set->set_word_size(word_sz);
   3.131 -    adjust_priority_order();
   3.132 -  }
   3.133 -
   3.134 -private:
   3.135 -  void adjust_priority_order() {
   3.136 -    G1ParGCAllocBuffer* retired_and_set = _priority_buffer[0];
   3.137 -
   3.138 -    int last = _priority_max - 1;
   3.139 -    for (int pr = 0; pr < last; ++pr) {
   3.140 -      _priority_buffer[pr] = _priority_buffer[pr + 1];
   3.141 -    }
   3.142 -    _priority_buffer[last] = retired_and_set;
   3.143 -  }
   3.144  };
   3.145  
   3.146  class G1ParScanThreadState : public StackObj {
   3.147 @@ -1885,11 +1798,13 @@
   3.148    G1SATBCardTableModRefBS* _ct_bs;
   3.149    G1RemSet* _g1_rem;
   3.150  
   3.151 -  G1ParGCAllocBufferContainer  _surviving_alloc_buffer;
   3.152 -  G1ParGCAllocBufferContainer  _tenured_alloc_buffer;
   3.153 -  G1ParGCAllocBufferContainer* _alloc_buffers[GCAllocPurposeCount];
   3.154 +  G1ParGCAllocBuffer  _surviving_alloc_buffer;
   3.155 +  G1ParGCAllocBuffer  _tenured_alloc_buffer;
   3.156 +  G1ParGCAllocBuffer* _alloc_buffers[GCAllocPurposeCount];
   3.157    ageTable            _age_table;
   3.158  
   3.159 +  G1ParScanClosure    _scanner;
   3.160 +
   3.161    size_t           _alloc_buffer_waste;
   3.162    size_t           _undo_waste;
   3.163  
   3.164 @@ -1942,7 +1857,7 @@
   3.165    }
   3.166  
   3.167  public:
   3.168 -  G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num);
   3.169 +  G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num, ReferenceProcessor* rp);
   3.170  
   3.171    ~G1ParScanThreadState() {
   3.172      FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base, mtGC);
   3.173 @@ -1951,7 +1866,7 @@
   3.174    RefToScanQueue*   refs()            { return _refs;             }
   3.175    ageTable*         age_table()       { return &_age_table;       }
   3.176  
   3.177 -  G1ParGCAllocBufferContainer* alloc_buffer(GCAllocPurpose purpose) {
   3.178 +  G1ParGCAllocBuffer* alloc_buffer(GCAllocPurpose purpose) {
   3.179      return _alloc_buffers[purpose];
   3.180    }
   3.181  
   3.182 @@ -1981,13 +1896,15 @@
   3.183      HeapWord* obj = NULL;
   3.184      size_t gclab_word_size = _g1h->desired_plab_sz(purpose);
   3.185      if (word_sz * 100 < gclab_word_size * ParallelGCBufferWastePct) {
   3.186 -      G1ParGCAllocBufferContainer* alloc_buf = alloc_buffer(purpose);
   3.187 +      G1ParGCAllocBuffer* alloc_buf = alloc_buffer(purpose);
   3.188 +      add_to_alloc_buffer_waste(alloc_buf->words_remaining());
   3.189 +      alloc_buf->retire(false /* end_of_gc */, false /* retain */);
   3.190  
   3.191        HeapWord* buf = _g1h->par_allocate_during_gc(purpose, gclab_word_size);
   3.192        if (buf == NULL) return NULL; // Let caller handle allocation failure.
   3.193 -
   3.194 -      add_to_alloc_buffer_waste(alloc_buf->words_remaining_in_retired_buffer());
   3.195 -      alloc_buf->update(false /* end_of_gc */, false /* retain */, buf, gclab_word_size);
   3.196 +      // Otherwise.
   3.197 +      alloc_buf->set_word_size(gclab_word_size);
   3.198 +      alloc_buf->set_buf(buf);
   3.199  
   3.200        obj = alloc_buf->allocate(word_sz);
   3.201        assert(obj != NULL, "buffer was definitely big enough...");
   3.202 @@ -2077,6 +1994,8 @@
   3.203      }
   3.204    }
   3.205  
   3.206 +  oop copy_to_survivor_space(oop const obj);
   3.207 +
   3.208    template <class T> void deal_with_reference(T* ref_to_scan) {
   3.209      if (has_partial_array_mask(ref_to_scan)) {
   3.210        _partial_scan_cl->do_oop_nv(ref_to_scan);
   3.211 @@ -2099,6 +2018,7 @@
   3.212      }
   3.213    }
   3.214  
   3.215 +public:
   3.216    void trim_queue();
   3.217  };
   3.218  
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/src/share/vm/gc_implementation/g1/g1OopClosures.cpp	Wed Feb 26 18:51:19 2014 +0100
     4.3 @@ -0,0 +1,31 @@
     4.4 +/*
     4.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
     4.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.7 + *
     4.8 + * This code is free software; you can redistribute it and/or modify it
     4.9 + * under the terms of the GNU General Public License version 2 only, as
    4.10 + * published by the Free Software Foundation.
    4.11 + *
    4.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    4.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    4.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    4.15 + * version 2 for more details (a copy is included in the LICENSE file that
    4.16 + * accompanied this code).
    4.17 + *
    4.18 + * You should have received a copy of the GNU General Public License version
    4.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    4.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    4.21 + *
    4.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    4.23 + * or visit www.oracle.com if you need additional information or have any
    4.24 + * questions.
    4.25 + *
    4.26 + */
    4.27 +
    4.28 +#include "precompiled.hpp"
    4.29 +#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
    4.30 +#include "gc_implementation/g1/g1OopClosures.inline.hpp"
    4.31 +
    4.32 +G1ParCopyHelper::G1ParCopyHelper(G1CollectedHeap* g1,  G1ParScanThreadState* par_scan_state) :
    4.33 +  G1ParClosureSuper(g1, par_scan_state), _scanned_klass(NULL),
    4.34 +  _cm(_g1->concurrent_mark()) {}
     5.1 --- a/src/share/vm/gc_implementation/g1/g1OopClosures.hpp	Thu Jan 23 08:12:12 2014 +0100
     5.2 +++ b/src/share/vm/gc_implementation/g1/g1OopClosures.hpp	Wed Feb 26 18:51:19 2014 +0100
     5.3 @@ -48,12 +48,8 @@
     5.4  class G1ParClosureSuper : public OopsInHeapRegionClosure {
     5.5  protected:
     5.6    G1CollectedHeap* _g1;
     5.7 -  G1RemSet* _g1_rem;
     5.8 -  ConcurrentMark* _cm;
     5.9    G1ParScanThreadState* _par_scan_state;
    5.10    uint _worker_id;
    5.11 -  bool _during_initial_mark;
    5.12 -  bool _mark_in_progress;
    5.13  public:
    5.14    G1ParClosureSuper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state);
    5.15    bool apply_to_weak_ref_discovered_field() { return true; }
    5.16 @@ -133,23 +129,10 @@
    5.17  
    5.18  // Add back base class for metadata
    5.19  class G1ParCopyHelper : public G1ParClosureSuper {
    5.20 +protected:
    5.21    Klass* _scanned_klass;
    5.22 +  ConcurrentMark* _cm;
    5.23  
    5.24 - public:
    5.25 -  G1ParCopyHelper(G1CollectedHeap* g1,  G1ParScanThreadState* par_scan_state) :
    5.26 -      _scanned_klass(NULL),
    5.27 -      G1ParClosureSuper(g1, par_scan_state) {}
    5.28 -
    5.29 -  void set_scanned_klass(Klass* k) { _scanned_klass = k; }
    5.30 -  template <class T> void do_klass_barrier(T* p, oop new_obj);
    5.31 -};
    5.32 -
    5.33 -template <G1Barrier barrier, bool do_mark_object>
    5.34 -class G1ParCopyClosure : public G1ParCopyHelper {
    5.35 -  G1ParScanClosure _scanner;
    5.36 -  template <class T> void do_oop_work(T* p);
    5.37 -
    5.38 -protected:
    5.39    // Mark the object if it's not already marked. This is used to mark
    5.40    // objects pointed to by roots that are guaranteed not to move
    5.41    // during the GC (i.e., non-CSet objects). It is MT-safe.
    5.42 @@ -159,22 +142,26 @@
    5.43    // objects pointed to by roots that have been forwarded during a
    5.44    // GC. It is MT-safe.
    5.45    void mark_forwarded_object(oop from_obj, oop to_obj);
    5.46 + public:
    5.47 +  G1ParCopyHelper(G1CollectedHeap* g1,  G1ParScanThreadState* par_scan_state);
    5.48  
    5.49 -  oop copy_to_survivor_space(oop obj);
    5.50 +  void set_scanned_klass(Klass* k) { _scanned_klass = k; }
    5.51 +  template <class T> void do_klass_barrier(T* p, oop new_obj);
    5.52 +};
    5.53 +
    5.54 +template <G1Barrier barrier, bool do_mark_object>
    5.55 +class G1ParCopyClosure : public G1ParCopyHelper {
    5.56 +private:
    5.57 +  template <class T> void do_oop_work(T* p);
    5.58  
    5.59  public:
    5.60    G1ParCopyClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state,
    5.61                     ReferenceProcessor* rp) :
    5.62 -      _scanner(g1, par_scan_state, rp),
    5.63        G1ParCopyHelper(g1, par_scan_state) {
    5.64      assert(_ref_processor == NULL, "sanity");
    5.65    }
    5.66  
    5.67 -  G1ParScanClosure* scanner() { return &_scanner; }
    5.68 -
    5.69 -  template <class T> void do_oop_nv(T* p) {
    5.70 -    do_oop_work(p);
    5.71 -  }
    5.72 +  template <class T> void do_oop_nv(T* p) { do_oop_work(p); }
    5.73    virtual void do_oop(oop* p)       { do_oop_nv(p); }
    5.74    virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
    5.75  };
     6.1 --- a/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp	Thu Jan 23 08:12:12 2014 +0100
     6.2 +++ b/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp	Wed Feb 26 18:51:19 2014 +0100
     6.3 @@ -82,7 +82,7 @@
     6.4  
     6.5        _par_scan_state->push_on_queue(p);
     6.6      } else {
     6.7 -      _par_scan_state->update_rs(_from, p, _par_scan_state->queue_num());
     6.8 +      _par_scan_state->update_rs(_from, p, _worker_id);
     6.9      }
    6.10    }
    6.11  }
     7.1 --- a/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp	Thu Jan 23 08:12:12 2014 +0100
     7.2 +++ b/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp	Wed Feb 26 18:51:19 2014 +0100
     7.3 @@ -158,7 +158,7 @@
     7.4    // Fills in the unallocated portion of the buffer with a garbage object.
     7.5    // If "end_of_gc" is TRUE, is after the last use in the GC.  IF "retain"
     7.6    // is true, attempt to re-use the unused portion in the next GC.
     7.7 -  virtual void retire(bool end_of_gc, bool retain);
     7.8 +  void retire(bool end_of_gc, bool retain);
     7.9  
    7.10    void print() PRODUCT_RETURN;
    7.11  };

mercurial