44 class OopsInHeapRegionClosure: public ExtendedOopClosure {
45 protected:
46 HeapRegion* _from;
47 public:
48 void set_region(HeapRegion* from) { _from = from; }
49 };
50
51 class G1ParClosureSuper : public OopsInHeapRegionClosure {
52 protected:
53 G1CollectedHeap* _g1;
54 G1ParScanThreadState* _par_scan_state;
55 uint _worker_id;
56 public:
57 // Initializes the instance, leaving _par_scan_state uninitialized. Must be done
58 // later using the set_par_scan_thread_state() method.
59 G1ParClosureSuper(G1CollectedHeap* g1);
60 G1ParClosureSuper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state);
61 bool apply_to_weak_ref_discovered_field() { return true; }
62
63 void set_par_scan_thread_state(G1ParScanThreadState* par_scan_state);
64 void set_ref_processor(ReferenceProcessor* ref_processor) { _ref_processor = ref_processor; }
65 };
66
67 class G1ParPushHeapRSClosure : public G1ParClosureSuper {
68 public:
69 G1ParPushHeapRSClosure(G1CollectedHeap* g1,
70 G1ParScanThreadState* par_scan_state):
71 G1ParClosureSuper(g1, par_scan_state) { }
72
73 template <class T> void do_oop_nv(T* p);
74 virtual void do_oop(oop* p) { do_oop_nv(p); }
75 virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
76 };
77
78 class G1ParScanClosure : public G1ParClosureSuper {
79 public:
80 G1ParScanClosure(G1CollectedHeap* g1) : G1ParClosureSuper(g1) { }
81
82 template <class T> void do_oop_nv(T* p);
83 virtual void do_oop(oop* p) { do_oop_nv(p); }
84 virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
85 };
86
87 // Add back base class for metadata
88 class G1ParCopyHelper : public G1ParClosureSuper {
89 protected:
90 Klass* _scanned_klass;
91 ConcurrentMark* _cm;
92
93 // Mark the object if it's not already marked. This is used to mark
94 // objects pointed to by roots that are guaranteed not to move
95 // during the GC (i.e., non-CSet objects). It is MT-safe.
96 void mark_object(oop obj);
97
98 // Mark the object if it's not already marked. This is used to mark
99 // objects pointed to by roots that have been forwarded during a
100 // GC. It is MT-safe.
101 void mark_forwarded_object(oop from_obj, oop to_obj);
102 public:
103 G1ParCopyHelper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state);
104 G1ParCopyHelper(G1CollectedHeap* g1);
|
44 class OopsInHeapRegionClosure: public ExtendedOopClosure {
45 protected:
46 HeapRegion* _from;
47 public:
48 void set_region(HeapRegion* from) { _from = from; }
49 };
50
51 class G1ParClosureSuper : public OopsInHeapRegionClosure {
52 protected:
53 G1CollectedHeap* _g1;
54 G1ParScanThreadState* _par_scan_state;
55 uint _worker_id;
56 public:
57 // Initializes the instance, leaving _par_scan_state uninitialized. Must be done
58 // later using the set_par_scan_thread_state() method.
59 G1ParClosureSuper(G1CollectedHeap* g1);
60 G1ParClosureSuper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state);
61 bool apply_to_weak_ref_discovered_field() { return true; }
62
63 void set_par_scan_thread_state(G1ParScanThreadState* par_scan_state);
64 };
65
66 class G1ParPushHeapRSClosure : public G1ParClosureSuper {
67 public:
68 G1ParPushHeapRSClosure(G1CollectedHeap* g1,
69 G1ParScanThreadState* par_scan_state):
70 G1ParClosureSuper(g1, par_scan_state) { }
71
72 template <class T> void do_oop_nv(T* p);
73 virtual void do_oop(oop* p) { do_oop_nv(p); }
74 virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
75 };
76
77 class G1ParScanClosure : public G1ParClosureSuper {
78 public:
79 G1ParScanClosure(G1CollectedHeap* g1) : G1ParClosureSuper(g1) { }
80
81 template <class T> void do_oop_nv(T* p);
82 virtual void do_oop(oop* p) { do_oop_nv(p); }
83 virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
84
85 void set_ref_processor(ReferenceProcessor* ref_processor) { _ref_processor = ref_processor; }
86 };
87
88 // Add back base class for metadata
89 class G1ParCopyHelper : public G1ParClosureSuper {
90 protected:
91 Klass* _scanned_klass;
92 ConcurrentMark* _cm;
93
94 // Mark the object if it's not already marked. This is used to mark
95 // objects pointed to by roots that are guaranteed not to move
96 // during the GC (i.e., non-CSet objects). It is MT-safe.
97 void mark_object(oop obj);
98
99 // Mark the object if it's not already marked. This is used to mark
100 // objects pointed to by roots that have been forwarded during a
101 // GC. It is MT-safe.
102 void mark_forwarded_object(oop from_obj, oop to_obj);
103 public:
104 G1ParCopyHelper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state);
105 G1ParCopyHelper(G1CollectedHeap* g1);
|