177 } |
177 } |
178 |
178 |
179 void InstanceKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) { |
179 void InstanceKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) { |
180 assert(obj != NULL, "can't follow the content of NULL object"); |
180 assert(obj != NULL, "can't follow the content of NULL object"); |
181 |
181 |
182 PSParallelCompact::follow_klass(cm, this); |
182 cm->follow_klass(this); |
183 // Only mark the header and let the scan of the meta-data mark |
183 // Only mark the header and let the scan of the meta-data mark |
184 // everything else. |
184 // everything else. |
185 |
185 |
186 PSParallelCompact::MarkAndPushClosure cl(cm); |
186 ParCompactionManager::MarkAndPushClosure cl(cm); |
187 InstanceKlass::oop_oop_iterate_oop_maps<true>(obj, &cl); |
187 InstanceKlass::oop_oop_iterate_oop_maps<true>(obj, &cl); |
188 } |
188 } |
189 |
189 |
190 void InstanceMirrorKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) { |
190 void InstanceMirrorKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) { |
191 InstanceKlass::oop_pc_follow_contents(obj, cm); |
191 InstanceKlass::oop_pc_follow_contents(obj, cm); |
199 // we need to make sure its class loader data is claimed, this is done |
199 // we need to make sure its class loader data is claimed, this is done |
200 // by calling follow_class_loader explicitly. For non-anonymous classes |
200 // by calling follow_class_loader explicitly. For non-anonymous classes |
201 // the call to follow_class_loader is made when the class loader itself |
201 // the call to follow_class_loader is made when the class loader itself |
202 // is handled. |
202 // is handled. |
203 if (klass->oop_is_instance() && InstanceKlass::cast(klass)->is_anonymous()) { |
203 if (klass->oop_is_instance() && InstanceKlass::cast(klass)->is_anonymous()) { |
204 PSParallelCompact::follow_class_loader(cm, klass->class_loader_data()); |
204 cm->follow_class_loader(klass->class_loader_data()); |
205 } else { |
205 } else { |
206 PSParallelCompact::follow_klass(cm, klass); |
206 cm->follow_klass(klass); |
207 } |
207 } |
208 } else { |
208 } else { |
209 // If klass is NULL then this a mirror for a primitive type. |
209 // If klass is NULL then this a mirror for a primitive type. |
210 // We don't have to follow them, since they are handled as strong |
210 // We don't have to follow them, since they are handled as strong |
211 // roots in Universe::oops_do. |
211 // roots in Universe::oops_do. |
212 assert(java_lang_Class::is_primitive(obj), "Sanity check"); |
212 assert(java_lang_Class::is_primitive(obj), "Sanity check"); |
213 } |
213 } |
214 |
214 |
215 PSParallelCompact::MarkAndPushClosure cl(cm); |
215 ParCompactionManager::MarkAndPushClosure cl(cm); |
216 oop_oop_iterate_statics<true>(obj, &cl); |
216 oop_oop_iterate_statics<true>(obj, &cl); |
217 } |
217 } |
218 |
218 |
219 void InstanceClassLoaderKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) { |
219 void InstanceClassLoaderKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) { |
220 InstanceKlass::oop_pc_follow_contents(obj, cm); |
220 InstanceKlass::oop_pc_follow_contents(obj, cm); |
221 |
221 |
222 ClassLoaderData * const loader_data = java_lang_ClassLoader::loader_data(obj); |
222 ClassLoaderData * const loader_data = java_lang_ClassLoader::loader_data(obj); |
223 if (loader_data != NULL) { |
223 if (loader_data != NULL) { |
224 PSParallelCompact::follow_class_loader(cm, loader_data); |
224 cm->follow_class_loader(loader_data); |
225 } |
225 } |
226 } |
226 } |
227 |
227 |
228 template <class T> |
228 template <class T> |
229 static void oop_pc_follow_contents_specialized(InstanceRefKlass* klass, oop obj, ParCompactionManager* cm) { |
229 static void oop_pc_follow_contents_specialized(InstanceRefKlass* klass, oop obj, ParCompactionManager* cm) { |
251 debug_only( |
251 debug_only( |
252 if(TraceReferenceGC && PrintGCDetails) { |
252 if(TraceReferenceGC && PrintGCDetails) { |
253 gclog_or_tty->print_cr(" Non NULL normal " PTR_FORMAT, p2i(obj)); |
253 gclog_or_tty->print_cr(" Non NULL normal " PTR_FORMAT, p2i(obj)); |
254 } |
254 } |
255 ) |
255 ) |
256 PSParallelCompact::mark_and_push(cm, referent_addr); |
256 cm->mark_and_push(referent_addr); |
257 } |
257 } |
258 } |
258 } |
259 T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj); |
259 T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj); |
260 if (ReferenceProcessor::pending_list_uses_discovered_field()) { |
260 if (ReferenceProcessor::pending_list_uses_discovered_field()) { |
261 // Treat discovered as normal oop, if ref is not "active", |
261 // Treat discovered as normal oop, if ref is not "active", |
267 if(TraceReferenceGC && PrintGCDetails) { |
267 if(TraceReferenceGC && PrintGCDetails) { |
268 gclog_or_tty->print_cr(" Process discovered as normal " |
268 gclog_or_tty->print_cr(" Process discovered as normal " |
269 PTR_FORMAT, p2i(discovered_addr)); |
269 PTR_FORMAT, p2i(discovered_addr)); |
270 } |
270 } |
271 ) |
271 ) |
272 PSParallelCompact::mark_and_push(cm, discovered_addr); |
272 cm->mark_and_push(discovered_addr); |
273 } |
273 } |
274 } else { |
274 } else { |
275 #ifdef ASSERT |
275 #ifdef ASSERT |
276 // In the case of older JDKs which do not use the discovered |
276 // In the case of older JDKs which do not use the discovered |
277 // field for the pending list, an inactive ref (next != NULL) |
277 // field for the pending list, an inactive ref (next != NULL) |
281 assert(oopDesc::is_null(next) || oopDesc::is_null(discovered), |
281 assert(oopDesc::is_null(next) || oopDesc::is_null(discovered), |
282 err_msg("Found an inactive reference " PTR_FORMAT " with a non-NULL discovered field", |
282 err_msg("Found an inactive reference " PTR_FORMAT " with a non-NULL discovered field", |
283 p2i(obj))); |
283 p2i(obj))); |
284 #endif |
284 #endif |
285 } |
285 } |
286 PSParallelCompact::mark_and_push(cm, next_addr); |
286 cm->mark_and_push(next_addr); |
287 klass->InstanceKlass::oop_pc_follow_contents(obj, cm); |
287 klass->InstanceKlass::oop_pc_follow_contents(obj, cm); |
288 } |
288 } |
289 |
289 |
290 |
290 |
291 void InstanceRefKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) { |
291 void InstanceRefKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) { |
295 oop_pc_follow_contents_specialized<oop>(this, obj, cm); |
295 oop_pc_follow_contents_specialized<oop>(this, obj, cm); |
296 } |
296 } |
297 } |
297 } |
298 |
298 |
299 void ObjArrayKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) { |
299 void ObjArrayKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) { |
300 PSParallelCompact::follow_klass(cm, this); |
300 cm->follow_klass(this); |
301 |
301 |
302 if (UseCompressedOops) { |
302 if (UseCompressedOops) { |
303 oop_pc_follow_contents_specialized<narrowOop>(objArrayOop(obj), 0, cm); |
303 oop_pc_follow_contents_specialized<narrowOop>(objArrayOop(obj), 0, cm); |
304 } else { |
304 } else { |
305 oop_pc_follow_contents_specialized<oop>(objArrayOop(obj), 0, cm); |
305 oop_pc_follow_contents_specialized<oop>(objArrayOop(obj), 0, cm); |