105 class G1ParCopyHelper : public OopClosure { |
105 class G1ParCopyHelper : public OopClosure { |
106 protected: |
106 protected: |
107 G1CollectedHeap* _g1; |
107 G1CollectedHeap* _g1; |
108 G1ParScanThreadState* _par_scan_state; |
108 G1ParScanThreadState* _par_scan_state; |
109 uint _worker_id; // Cache value from par_scan_state. |
109 uint _worker_id; // Cache value from par_scan_state. |
110 Klass* _scanned_klass; |
110 ClassLoaderData* _scanned_cld; |
111 G1ConcurrentMark* _cm; |
111 G1ConcurrentMark* _cm; |
112 |
112 |
113 // Mark the object if it's not already marked. This is used to mark |
113 // Mark the object if it's not already marked. This is used to mark |
114 // objects pointed to by roots that are guaranteed not to move |
114 // objects pointed to by roots that are guaranteed not to move |
115 // during the GC (i.e., non-CSet objects). It is MT-safe. |
115 // during the GC (i.e., non-CSet objects). It is MT-safe. |
122 |
122 |
123 G1ParCopyHelper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state); |
123 G1ParCopyHelper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state); |
124 ~G1ParCopyHelper() { } |
124 ~G1ParCopyHelper() { } |
125 |
125 |
126 public: |
126 public: |
127 void set_scanned_klass(Klass* k) { _scanned_klass = k; } |
127 void set_scanned_cld(ClassLoaderData* cld) { _scanned_cld = cld; } |
128 template <class T> inline void do_klass_barrier(T* p, oop new_obj); |
128 inline void do_cld_barrier(oop new_obj); |
129 }; |
129 }; |
130 |
130 |
131 enum G1Barrier { |
131 enum G1Barrier { |
132 G1BarrierNone, |
132 G1BarrierNone, |
133 G1BarrierKlass |
133 G1BarrierCLD |
134 }; |
134 }; |
135 |
135 |
136 enum G1Mark { |
136 enum G1Mark { |
137 G1MarkNone, |
137 G1MarkNone, |
138 G1MarkFromRoot, |
138 G1MarkFromRoot, |
148 template <class T> void do_oop_work(T* p); |
148 template <class T> void do_oop_work(T* p); |
149 virtual void do_oop(oop* p) { do_oop_work(p); } |
149 virtual void do_oop(oop* p) { do_oop_work(p); } |
150 virtual void do_oop(narrowOop* p) { do_oop_work(p); } |
150 virtual void do_oop(narrowOop* p) { do_oop_work(p); } |
151 }; |
151 }; |
152 |
152 |
153 class G1KlassScanClosure : public KlassClosure { |
153 class G1CLDScanClosure : public CLDClosure { |
154 G1ParCopyHelper* _closure; |
154 G1ParCopyHelper* _closure; |
155 bool _process_only_dirty; |
155 bool _process_only_dirty; |
|
156 bool _must_claim; |
156 int _count; |
157 int _count; |
157 public: |
158 public: |
158 G1KlassScanClosure(G1ParCopyHelper* closure, bool process_only_dirty) |
159 G1CLDScanClosure(G1ParCopyHelper* closure, |
159 : _process_only_dirty(process_only_dirty), _closure(closure), _count(0) {} |
160 bool process_only_dirty, bool must_claim) |
160 void do_klass(Klass* klass); |
161 : _process_only_dirty(process_only_dirty), _must_claim(must_claim), _closure(closure), _count(0) {} |
|
162 void do_cld(ClassLoaderData* cld); |
161 }; |
163 }; |
162 |
164 |
163 // Closure for iterating over object fields during concurrent marking |
165 // Closure for iterating over object fields during concurrent marking |
164 class G1CMOopClosure : public MetadataAwareOopClosure { |
166 class G1CMOopClosure : public MetadataAwareOopClosure { |
165 protected: |
167 protected: |