提交 aaab39db 编写于 作者: T tschatzl

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
上级 59a0853d
...@@ -86,7 +86,7 @@ ifeq ($(INCLUDE_ALL_GCS), false) ...@@ -86,7 +86,7 @@ ifeq ($(INCLUDE_ALL_GCS), false)
concurrentMark.cpp concurrentMarkThread.cpp dirtyCardQueue.cpp g1AllocRegion.cpp \ concurrentMark.cpp concurrentMarkThread.cpp dirtyCardQueue.cpp g1AllocRegion.cpp \
g1BlockOffsetTable.cpp g1CardCounts.cpp g1CollectedHeap.cpp g1CollectorPolicy.cpp \ g1BlockOffsetTable.cpp g1CardCounts.cpp g1CollectedHeap.cpp g1CollectorPolicy.cpp \
g1ErgoVerbose.cpp g1GCPhaseTimes.cpp g1HRPrinter.cpp g1HotCardCache.cpp g1Log.cpp \ g1ErgoVerbose.cpp g1GCPhaseTimes.cpp g1HRPrinter.cpp g1HotCardCache.cpp g1Log.cpp \
g1MMUTracker.cpp g1MarkSweep.cpp g1MemoryPool.cpp g1MonitoringSupport.cpp \ g1MMUTracker.cpp g1MarkSweep.cpp g1MemoryPool.cpp g1MonitoringSupport.cpp g1OopClosures.cpp \
g1RemSet.cpp g1RemSetSummary.cpp g1SATBCardTableModRefBS.cpp g1_globals.cpp heapRegion.cpp \ g1RemSet.cpp g1RemSetSummary.cpp g1SATBCardTableModRefBS.cpp g1_globals.cpp heapRegion.cpp \
g1BiasedArray.cpp heapRegionRemSet.cpp heapRegionSeq.cpp heapRegionSet.cpp heapRegionSets.cpp \ g1BiasedArray.cpp heapRegionRemSet.cpp heapRegionSeq.cpp heapRegionSet.cpp heapRegionSets.cpp \
ptrQueue.cpp satbQueue.cpp sparsePRT.cpp survRateGroup.cpp vm_operations_g1.cpp \ ptrQueue.cpp satbQueue.cpp sparsePRT.cpp survRateGroup.cpp vm_operations_g1.cpp \
......
...@@ -4658,14 +4658,10 @@ void G1ParScanThreadState::trim_queue() { ...@@ -4658,14 +4658,10 @@ void G1ParScanThreadState::trim_queue() {
G1ParClosureSuper::G1ParClosureSuper(G1CollectedHeap* g1, G1ParClosureSuper::G1ParClosureSuper(G1CollectedHeap* g1,
G1ParScanThreadState* par_scan_state) : G1ParScanThreadState* par_scan_state) :
_g1(g1), _g1_rem(_g1->g1_rem_set()), _cm(_g1->concurrent_mark()), _g1(g1), _par_scan_state(par_scan_state),
_par_scan_state(par_scan_state), _worker_id(par_scan_state->queue_num()) { }
_worker_id(par_scan_state->queue_num()),
_during_initial_mark(_g1->g1_policy()->during_initial_mark_pause()),
_mark_in_progress(_g1->mark_in_progress()) { }
template <G1Barrier barrier, bool do_mark_object> void G1ParCopyHelper::mark_object(oop obj) {
void G1ParCopyClosure<barrier, do_mark_object>::mark_object(oop obj) {
#ifdef ASSERT #ifdef ASSERT
HeapRegion* hr = _g1->heap_region_containing(obj); HeapRegion* hr = _g1->heap_region_containing(obj);
assert(hr != NULL, "sanity"); assert(hr != NULL, "sanity");
...@@ -4676,9 +4672,7 @@ void G1ParCopyClosure<barrier, do_mark_object>::mark_object(oop obj) { ...@@ -4676,9 +4672,7 @@ void G1ParCopyClosure<barrier, do_mark_object>::mark_object(oop obj) {
_cm->grayRoot(obj, (size_t) obj->size(), _worker_id); _cm->grayRoot(obj, (size_t) obj->size(), _worker_id);
} }
template <G1Barrier barrier, bool do_mark_object> void G1ParCopyHelper::mark_forwarded_object(oop from_obj, oop to_obj) {
void G1ParCopyClosure<barrier, do_mark_object>
::mark_forwarded_object(oop from_obj, oop to_obj) {
#ifdef ASSERT #ifdef ASSERT
assert(from_obj->is_forwarded(), "from obj should be forwarded"); assert(from_obj->is_forwarded(), "from obj should be forwarded");
assert(from_obj->forwardee() == to_obj, "to obj should be the forwardee"); assert(from_obj->forwardee() == to_obj, "to obj should be the forwardee");
...@@ -4799,8 +4793,7 @@ void G1ParCopyHelper::do_klass_barrier(T* p, oop new_obj) { ...@@ -4799,8 +4793,7 @@ void G1ParCopyHelper::do_klass_barrier(T* p, oop new_obj) {
template <G1Barrier barrier, bool do_mark_object> template <G1Barrier barrier, bool do_mark_object>
template <class T> template <class T>
void G1ParCopyClosure<barrier, do_mark_object> void G1ParCopyClosure<barrier, do_mark_object>::do_oop_work(T* p) {
::do_oop_work(T* p) {
oop obj = oopDesc::load_decode_heap_oop(p); oop obj = oopDesc::load_decode_heap_oop(p);
assert(_worker_id == _par_scan_state->queue_num(), "sanity"); assert(_worker_id == _par_scan_state->queue_num(), "sanity");
......
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#include "gc_implementation/g1/g1OopClosures.inline.hpp"
G1ParCopyHelper::G1ParCopyHelper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) :
G1ParClosureSuper(g1, par_scan_state), _scanned_klass(NULL),
_cm(_g1->concurrent_mark()) {}
...@@ -48,12 +48,8 @@ public: ...@@ -48,12 +48,8 @@ public:
class G1ParClosureSuper : public OopsInHeapRegionClosure { class G1ParClosureSuper : public OopsInHeapRegionClosure {
protected: protected:
G1CollectedHeap* _g1; G1CollectedHeap* _g1;
G1RemSet* _g1_rem;
ConcurrentMark* _cm;
G1ParScanThreadState* _par_scan_state; G1ParScanThreadState* _par_scan_state;
uint _worker_id; uint _worker_id;
bool _during_initial_mark;
bool _mark_in_progress;
public: public:
G1ParClosureSuper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state); G1ParClosureSuper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state);
bool apply_to_weak_ref_discovered_field() { return true; } bool apply_to_weak_ref_discovered_field() { return true; }
...@@ -133,12 +129,21 @@ public: ...@@ -133,12 +129,21 @@ public:
// Add back base class for metadata // Add back base class for metadata
class G1ParCopyHelper : public G1ParClosureSuper { class G1ParCopyHelper : public G1ParClosureSuper {
protected:
Klass* _scanned_klass; Klass* _scanned_klass;
ConcurrentMark* _cm;
// Mark the object if it's not already marked. This is used to mark
// objects pointed to by roots that are guaranteed not to move
// during the GC (i.e., non-CSet objects). It is MT-safe.
void mark_object(oop obj);
// Mark the object if it's not already marked. This is used to mark
// objects pointed to by roots that have been forwarded during a
// GC. It is MT-safe.
void mark_forwarded_object(oop from_obj, oop to_obj);
public: public:
G1ParCopyHelper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) : G1ParCopyHelper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state);
_scanned_klass(NULL),
G1ParClosureSuper(g1, par_scan_state) {}
void set_scanned_klass(Klass* k) { _scanned_klass = k; } void set_scanned_klass(Klass* k) { _scanned_klass = k; }
template <class T> void do_klass_barrier(T* p, oop new_obj); template <class T> void do_klass_barrier(T* p, oop new_obj);
...@@ -150,16 +155,6 @@ class G1ParCopyClosure : public G1ParCopyHelper { ...@@ -150,16 +155,6 @@ class G1ParCopyClosure : public G1ParCopyHelper {
template <class T> void do_oop_work(T* p); template <class T> void do_oop_work(T* p);
protected: protected:
// Mark the object if it's not already marked. This is used to mark
// objects pointed to by roots that are guaranteed not to move
// during the GC (i.e., non-CSet objects). It is MT-safe.
void mark_object(oop obj);
// Mark the object if it's not already marked. This is used to mark
// objects pointed to by roots that have been forwarded during a
// GC. It is MT-safe.
void mark_forwarded_object(oop from_obj, oop to_obj);
oop copy_to_survivor_space(oop obj); oop copy_to_survivor_space(oop obj);
public: public:
...@@ -172,9 +167,7 @@ public: ...@@ -172,9 +167,7 @@ public:
G1ParScanClosure* scanner() { return &_scanner; } G1ParScanClosure* scanner() { return &_scanner; }
template <class T> void do_oop_nv(T* p) { template <class T> void do_oop_nv(T* p) { do_oop_work(p); }
do_oop_work(p);
}
virtual void do_oop(oop* p) { do_oop_nv(p); } virtual void do_oop(oop* p) { do_oop_nv(p); }
virtual void do_oop(narrowOop* p) { do_oop_nv(p); } virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
}; };
......
...@@ -82,7 +82,7 @@ inline void G1ParScanClosure::do_oop_nv(T* p) { ...@@ -82,7 +82,7 @@ inline void G1ParScanClosure::do_oop_nv(T* p) {
_par_scan_state->push_on_queue(p); _par_scan_state->push_on_queue(p);
} else { } else {
_par_scan_state->update_rs(_from, p, _par_scan_state->queue_num()); _par_scan_state->update_rs(_from, p, _worker_id);
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册