提交 5a65414c 编写于 作者: B brutisso

7130974: G1: Remove G1ParCopyHelper

Reviewed-by: tonyp, johnc
上级 26afc937
...@@ -4355,7 +4355,8 @@ G1ParClosureSuper::G1ParClosureSuper(G1CollectedHeap* g1, ...@@ -4355,7 +4355,8 @@ G1ParClosureSuper::G1ParClosureSuper(G1CollectedHeap* g1,
_during_initial_mark(_g1->g1_policy()->during_initial_mark_pause()), _during_initial_mark(_g1->g1_policy()->during_initial_mark_pause()),
_mark_in_progress(_g1->mark_in_progress()) { } _mark_in_progress(_g1->mark_in_progress()) { }
void G1ParCopyHelper::mark_object(oop obj) { template <bool do_gen_barrier, G1Barrier barrier, bool do_mark_object>
void G1ParCopyClosure<do_gen_barrier, 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");
...@@ -4366,7 +4367,9 @@ void G1ParCopyHelper::mark_object(oop obj) { ...@@ -4366,7 +4367,9 @@ void G1ParCopyHelper::mark_object(oop obj) {
_cm->grayRoot(obj, (size_t) obj->size(), _worker_id); _cm->grayRoot(obj, (size_t) obj->size(), _worker_id);
} }
void G1ParCopyHelper::mark_forwarded_object(oop from_obj, oop to_obj) { template <bool do_gen_barrier, G1Barrier barrier, bool do_mark_object>
void G1ParCopyClosure<do_gen_barrier, 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");
...@@ -4388,7 +4391,9 @@ void G1ParCopyHelper::mark_forwarded_object(oop from_obj, oop to_obj) { ...@@ -4388,7 +4391,9 @@ void G1ParCopyHelper::mark_forwarded_object(oop from_obj, oop to_obj) {
_cm->grayRoot(to_obj, (size_t) from_obj->size(), _worker_id); _cm->grayRoot(to_obj, (size_t) from_obj->size(), _worker_id);
} }
oop G1ParCopyHelper::copy_to_survivor_space(oop old) { template <bool do_gen_barrier, G1Barrier barrier, bool do_mark_object>
oop G1ParCopyClosure<do_gen_barrier, barrier, do_mark_object>
::copy_to_survivor_space(oop old) {
size_t word_sz = old->size(); size_t word_sz = old->size();
HeapRegion* from_region = _g1->heap_region_containing_raw(old); HeapRegion* from_region = _g1->heap_region_containing_raw(old);
// +1 to make the -1 indexes valid... // +1 to make the -1 indexes valid...
...@@ -4457,8 +4462,8 @@ oop G1ParCopyHelper::copy_to_survivor_space(oop old) { ...@@ -4457,8 +4462,8 @@ oop G1ParCopyHelper::copy_to_survivor_space(oop old) {
} else { } else {
// No point in using the slower heap_region_containing() method, // No point in using the slower heap_region_containing() method,
// given that we know obj is in the heap. // given that we know obj is in the heap.
_scanner->set_region(_g1->heap_region_containing_raw(obj)); _scanner.set_region(_g1->heap_region_containing_raw(obj));
obj->oop_iterate_backwards(_scanner); obj->oop_iterate_backwards(&_scanner);
} }
} else { } else {
_par_scan_state->undo_allocation(alloc_purpose, obj_ptr, word_sz); _par_scan_state->undo_allocation(alloc_purpose, obj_ptr, word_sz);
......
...@@ -199,7 +199,8 @@ class G1CollectedHeap : public SharedHeap { ...@@ -199,7 +199,8 @@ class G1CollectedHeap : public SharedHeap {
friend class OldGCAllocRegion; friend class OldGCAllocRegion;
// Closures used in implementation. // Closures used in implementation.
friend class G1ParCopyHelper; template <bool do_gen_barrier, G1Barrier barrier, bool do_mark_object>
friend class G1ParCopyClosure;
friend class G1IsAliveClosure; friend class G1IsAliveClosure;
friend class G1EvacuateFollowersClosure; friend class G1EvacuateFollowersClosure;
friend class G1ParScanThreadState; friend class G1ParScanThreadState;
......
...@@ -118,9 +118,11 @@ public: ...@@ -118,9 +118,11 @@ public:
virtual void do_oop(narrowOop* p) { do_oop_nv(p); } virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
}; };
template <bool do_gen_barrier, G1Barrier barrier, bool do_mark_object>
class G1ParCopyClosure : public G1ParClosureSuper {
G1ParScanClosure _scanner;
template <class T> void do_oop_work(T* p);
class G1ParCopyHelper : public G1ParClosureSuper {
G1ParScanClosure *_scanner;
protected: protected:
// Mark the object if it's not already marked. This is used to mark // 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 // objects pointed to by roots that are guaranteed not to move
...@@ -134,23 +136,11 @@ protected: ...@@ -134,23 +136,11 @@ protected:
oop copy_to_survivor_space(oop obj); oop copy_to_survivor_space(oop obj);
public:
G1ParCopyHelper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state,
G1ParScanClosure *scanner) :
G1ParClosureSuper(g1, par_scan_state), _scanner(scanner) { }
};
template <bool do_gen_barrier, G1Barrier barrier, bool do_mark_object>
class G1ParCopyClosure : public G1ParCopyHelper {
G1ParScanClosure _scanner;
template <class T> void do_oop_work(T* p);
public: public:
G1ParCopyClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state, G1ParCopyClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state,
ReferenceProcessor* rp) : ReferenceProcessor* rp) :
_scanner(g1, par_scan_state, rp), _scanner(g1, par_scan_state, rp),
G1ParCopyHelper(g1, par_scan_state, &_scanner) { G1ParClosureSuper(g1, par_scan_state) {
assert(_ref_processor == NULL, "sanity"); assert(_ref_processor == NULL, "sanity");
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册