8027559: Decrease code size and templatizing in G1ParCopyClosure::do_oop_work

Wed, 26 Feb 2014 15:32:40 +0100

author
tschatzl
date
Wed, 26 Feb 2014 15:32:40 +0100
changeset 6329
86b64209f715
parent 6328
d69952503db0
child 6330
2c2ae9e5f65d

8027559: Decrease code size and templatizing in G1ParCopyClosure::do_oop_work
Summary: Move methods that are not dependent on any of G1ParCopyClosure's template parameters into G1ParCopyHelper. Further remove unused methods and members of the class hierarchy.
Reviewed-by: mgerdin, stefank

make/excludeSrc.make file | annotate | diff | comparison | revisions
src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp file | annotate | diff | comparison | revisions
src/share/vm/gc_implementation/g1/g1OopClosures.cpp file | annotate | diff | comparison | revisions
src/share/vm/gc_implementation/g1/g1OopClosures.hpp file | annotate | diff | comparison | revisions
src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp file | annotate | diff | comparison | revisions
     1.1 --- a/make/excludeSrc.make	Wed Jan 08 13:20:33 2014 +0100
     1.2 +++ b/make/excludeSrc.make	Wed Feb 26 15:32:40 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	Wed Jan 08 13:20:33 2014 +0100
     2.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Wed Feb 26 15:32:40 2014 +0100
     2.3 @@ -4658,14 +4658,10 @@
     2.4  
     2.5  G1ParClosureSuper::G1ParClosureSuper(G1CollectedHeap* g1,
     2.6                                       G1ParScanThreadState* par_scan_state) :
     2.7 -  _g1(g1), _g1_rem(_g1->g1_rem_set()), _cm(_g1->concurrent_mark()),
     2.8 -  _par_scan_state(par_scan_state),
     2.9 -  _worker_id(par_scan_state->queue_num()),
    2.10 -  _during_initial_mark(_g1->g1_policy()->during_initial_mark_pause()),
    2.11 -  _mark_in_progress(_g1->mark_in_progress()) { }
    2.12 -
    2.13 -template <G1Barrier barrier, bool do_mark_object>
    2.14 -void G1ParCopyClosure<barrier, do_mark_object>::mark_object(oop obj) {
    2.15 +  _g1(g1), _par_scan_state(par_scan_state),
    2.16 +  _worker_id(par_scan_state->queue_num()) { }
    2.17 +
    2.18 +void G1ParCopyHelper::mark_object(oop obj) {
    2.19  #ifdef ASSERT
    2.20    HeapRegion* hr = _g1->heap_region_containing(obj);
    2.21    assert(hr != NULL, "sanity");
    2.22 @@ -4676,9 +4672,7 @@
    2.23    _cm->grayRoot(obj, (size_t) obj->size(), _worker_id);
    2.24  }
    2.25  
    2.26 -template <G1Barrier barrier, bool do_mark_object>
    2.27 -void G1ParCopyClosure<barrier, do_mark_object>
    2.28 -  ::mark_forwarded_object(oop from_obj, oop to_obj) {
    2.29 +void G1ParCopyHelper::mark_forwarded_object(oop from_obj, oop to_obj) {
    2.30  #ifdef ASSERT
    2.31    assert(from_obj->is_forwarded(), "from obj should be forwarded");
    2.32    assert(from_obj->forwardee() == to_obj, "to obj should be the forwardee");
    2.33 @@ -4799,8 +4793,7 @@
    2.34  
    2.35  template <G1Barrier barrier, bool do_mark_object>
    2.36  template <class T>
    2.37 -void G1ParCopyClosure<barrier, do_mark_object>
    2.38 -::do_oop_work(T* p) {
    2.39 +void G1ParCopyClosure<barrier, do_mark_object>::do_oop_work(T* p) {
    2.40    oop obj = oopDesc::load_decode_heap_oop(p);
    2.41  
    2.42    assert(_worker_id == _par_scan_state->queue_num(), "sanity");
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/src/share/vm/gc_implementation/g1/g1OopClosures.cpp	Wed Feb 26 15:32:40 2014 +0100
     3.3 @@ -0,0 +1,31 @@
     3.4 +/*
     3.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
     3.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.7 + *
     3.8 + * This code is free software; you can redistribute it and/or modify it
     3.9 + * under the terms of the GNU General Public License version 2 only, as
    3.10 + * published by the Free Software Foundation.
    3.11 + *
    3.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    3.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    3.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    3.15 + * version 2 for more details (a copy is included in the LICENSE file that
    3.16 + * accompanied this code).
    3.17 + *
    3.18 + * You should have received a copy of the GNU General Public License version
    3.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    3.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    3.21 + *
    3.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    3.23 + * or visit www.oracle.com if you need additional information or have any
    3.24 + * questions.
    3.25 + *
    3.26 + */
    3.27 +
    3.28 +#include "precompiled.hpp"
    3.29 +#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
    3.30 +#include "gc_implementation/g1/g1OopClosures.inline.hpp"
    3.31 +
    3.32 +G1ParCopyHelper::G1ParCopyHelper(G1CollectedHeap* g1,  G1ParScanThreadState* par_scan_state) :
    3.33 +  G1ParClosureSuper(g1, par_scan_state), _scanned_klass(NULL),
    3.34 +  _cm(_g1->concurrent_mark()) {}
     4.1 --- a/src/share/vm/gc_implementation/g1/g1OopClosures.hpp	Wed Jan 08 13:20:33 2014 +0100
     4.2 +++ b/src/share/vm/gc_implementation/g1/g1OopClosures.hpp	Wed Feb 26 15:32:40 2014 +0100
     4.3 @@ -48,12 +48,8 @@
     4.4  class G1ParClosureSuper : public OopsInHeapRegionClosure {
     4.5  protected:
     4.6    G1CollectedHeap* _g1;
     4.7 -  G1RemSet* _g1_rem;
     4.8 -  ConcurrentMark* _cm;
     4.9    G1ParScanThreadState* _par_scan_state;
    4.10    uint _worker_id;
    4.11 -  bool _during_initial_mark;
    4.12 -  bool _mark_in_progress;
    4.13  public:
    4.14    G1ParClosureSuper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state);
    4.15    bool apply_to_weak_ref_discovered_field() { return true; }
    4.16 @@ -133,12 +129,21 @@
    4.17  
    4.18  // Add back base class for metadata
    4.19  class G1ParCopyHelper : public G1ParClosureSuper {
    4.20 +protected:
    4.21    Klass* _scanned_klass;
    4.22 +  ConcurrentMark* _cm;
    4.23  
    4.24 +  // Mark the object if it's not already marked. This is used to mark
    4.25 +  // objects pointed to by roots that are guaranteed not to move
    4.26 +  // during the GC (i.e., non-CSet objects). It is MT-safe.
    4.27 +  void mark_object(oop obj);
    4.28 +
    4.29 +  // Mark the object if it's not already marked. This is used to mark
    4.30 +  // objects pointed to by roots that have been forwarded during a
    4.31 +  // GC. It is MT-safe.
    4.32 +  void mark_forwarded_object(oop from_obj, oop to_obj);
    4.33   public:
    4.34 -  G1ParCopyHelper(G1CollectedHeap* g1,  G1ParScanThreadState* par_scan_state) :
    4.35 -      _scanned_klass(NULL),
    4.36 -      G1ParClosureSuper(g1, par_scan_state) {}
    4.37 +  G1ParCopyHelper(G1CollectedHeap* g1,  G1ParScanThreadState* par_scan_state);
    4.38  
    4.39    void set_scanned_klass(Klass* k) { _scanned_klass = k; }
    4.40    template <class T> void do_klass_barrier(T* p, oop new_obj);
    4.41 @@ -150,16 +155,6 @@
    4.42    template <class T> void do_oop_work(T* p);
    4.43  
    4.44  protected:
    4.45 -  // Mark the object if it's not already marked. This is used to mark
    4.46 -  // objects pointed to by roots that are guaranteed not to move
    4.47 -  // during the GC (i.e., non-CSet objects). It is MT-safe.
    4.48 -  void mark_object(oop obj);
    4.49 -
    4.50 -  // Mark the object if it's not already marked. This is used to mark
    4.51 -  // objects pointed to by roots that have been forwarded during a
    4.52 -  // GC. It is MT-safe.
    4.53 -  void mark_forwarded_object(oop from_obj, oop to_obj);
    4.54 -
    4.55    oop copy_to_survivor_space(oop obj);
    4.56  
    4.57  public:
    4.58 @@ -172,9 +167,7 @@
    4.59  
    4.60    G1ParScanClosure* scanner() { return &_scanner; }
    4.61  
    4.62 -  template <class T> void do_oop_nv(T* p) {
    4.63 -    do_oop_work(p);
    4.64 -  }
    4.65 +  template <class T> void do_oop_nv(T* p) { do_oop_work(p); }
    4.66    virtual void do_oop(oop* p)       { do_oop_nv(p); }
    4.67    virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
    4.68  };
     5.1 --- a/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp	Wed Jan 08 13:20:33 2014 +0100
     5.2 +++ b/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp	Wed Feb 26 15:32:40 2014 +0100
     5.3 @@ -82,7 +82,7 @@
     5.4  
     5.5        _par_scan_state->push_on_queue(p);
     5.6      } else {
     5.7 -      _par_scan_state->update_rs(_from, p, _par_scan_state->queue_num());
     5.8 +      _par_scan_state->update_rs(_from, p, _worker_id);
     5.9      }
    5.10    }
    5.11  }

mercurial