< prev index next >

src/share/vm/gc/serial/markSweep.cpp

Print this page




 282 int InstanceKlass::oop_ms_adjust_pointers(oop obj) {
 283   int size = size_helper();
 284   oop_oop_iterate_oop_maps<true>(obj, &MarkSweep::adjust_pointer_closure);
 285   return size;
 286 }
 287 
 288 int InstanceMirrorKlass::oop_ms_adjust_pointers(oop obj) {
 289   int size = oop_size(obj);
 290   InstanceKlass::oop_ms_adjust_pointers(obj);
 291 
 292   oop_oop_iterate_statics<true>(obj, &MarkSweep::adjust_pointer_closure);
 293   return size;
 294 }
 295 
 296 int InstanceClassLoaderKlass::oop_ms_adjust_pointers(oop obj) {
 297   return InstanceKlass::oop_ms_adjust_pointers(obj);
 298 }
 299 
 300 #ifdef ASSERT
 301 template <class T> static void trace_reference_gc(const char *s, oop obj,

 302                                                   T* referent_addr,
 303                                                   T* next_addr,
 304                                                   T* discovered_addr) {

 305   log_develop_trace(gc, ref)("%s obj " PTR_FORMAT, s, p2i(obj));
 306   log_develop_trace(gc, ref)("     referent_addr/* " PTR_FORMAT " / " PTR_FORMAT,
 307                              p2i(referent_addr), p2i(referent_addr ? (address)oopDesc::load_decode_heap_oop(referent_addr) : NULL));
 308   log_develop_trace(gc, ref)("     next_addr/* " PTR_FORMAT " / " PTR_FORMAT,
 309                              p2i(next_addr), p2i(next_addr ? (address)oopDesc::load_decode_heap_oop(next_addr) : NULL));
 310   log_develop_trace(gc, ref)("     discovered_addr/* " PTR_FORMAT " / " PTR_FORMAT,
 311                              p2i(discovered_addr), p2i(discovered_addr ? (address)oopDesc::load_decode_heap_oop(discovered_addr) : NULL));




 312 }
 313 #endif
 314 
 315 template <class T> void static adjust_object_specialized(oop obj) {
 316   T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj);
 317   MarkSweep::adjust_pointer(referent_addr);
 318   T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj);
 319   MarkSweep::adjust_pointer(next_addr);
 320   T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr(obj);
 321   MarkSweep::adjust_pointer(discovered_addr);
 322   debug_only(trace_reference_gc("InstanceRefKlass::oop_ms_adjust_pointers", obj,
 323                                 referent_addr, next_addr, discovered_addr);)







 324 }
 325 
 326 int InstanceRefKlass::oop_ms_adjust_pointers(oop obj) {
 327   int size = size_helper();
 328   InstanceKlass::oop_ms_adjust_pointers(obj);
 329 
 330   if (UseCompressedOops) {
 331     adjust_object_specialized<narrowOop>(obj);
 332   } else {
 333     adjust_object_specialized<oop>(obj);
 334   }
 335   return size;
 336 }
 337 
 338 int ObjArrayKlass::oop_ms_adjust_pointers(oop obj) {
 339   assert(obj->is_objArray(), "obj must be obj array");
 340   objArrayOop a = objArrayOop(obj);
 341   // Get size before changing pointers.
 342   // Don't call size() or oop_size() since that is a virtual call.
 343   int size = a->object_size();
 344   oop_oop_iterate_elements<true>(a, &MarkSweep::adjust_pointer_closure);
 345   return size;
 346 }
 347 
 348 int TypeArrayKlass::oop_ms_adjust_pointers(oop obj) {
 349   assert(obj->is_typeArray(), "must be a type array");
 350   typeArrayOop t = typeArrayOop(obj);
 351   // Performance tweak: We skip iterating over the klass pointer since we
 352   // know that Universe::TypeArrayKlass never moves.
 353   return t->object_size();


 282 int InstanceKlass::oop_ms_adjust_pointers(oop obj) {
 283   int size = size_helper();
 284   oop_oop_iterate_oop_maps<true>(obj, &MarkSweep::adjust_pointer_closure);
 285   return size;
 286 }
 287 
 288 int InstanceMirrorKlass::oop_ms_adjust_pointers(oop obj) {
 289   int size = oop_size(obj);
 290   InstanceKlass::oop_ms_adjust_pointers(obj);
 291 
 292   oop_oop_iterate_statics<true>(obj, &MarkSweep::adjust_pointer_closure);
 293   return size;
 294 }
 295 
 296 int InstanceClassLoaderKlass::oop_ms_adjust_pointers(oop obj) {
 297   return InstanceKlass::oop_ms_adjust_pointers(obj);
 298 }
 299 
 300 #ifdef ASSERT
 301 template <class T> static void trace_reference_gc(const char *s, oop obj,
 302                                                   bool is_ephemeron,
 303                                                   T* referent_addr,
 304                                                   T* next_addr,
 305                                                   T* discovered_addr,
 306                                                   T* value_addr) {
 307   log_develop_trace(gc, ref)("%s obj " PTR_FORMAT, s, p2i(obj));
 308   log_develop_trace(gc, ref)("     referent_addr/* " PTR_FORMAT " / " PTR_FORMAT,
 309                              p2i(referent_addr), p2i(referent_addr ? (address)oopDesc::load_decode_heap_oop(referent_addr) : NULL));
 310   log_develop_trace(gc, ref)("     next_addr/* " PTR_FORMAT " / " PTR_FORMAT,
 311                              p2i(next_addr), p2i(next_addr ? (address)oopDesc::load_decode_heap_oop(next_addr) : NULL));
 312   log_develop_trace(gc, ref)("     discovered_addr/* " PTR_FORMAT " / " PTR_FORMAT,
 313                              p2i(discovered_addr), p2i(discovered_addr ? (address)oopDesc::load_decode_heap_oop(discovered_addr) : NULL));
 314   if (is_ephemeron) {
 315     log_develop_trace(gc, ref)("     value_addr/* " PTR_FORMAT " / " PTR_FORMAT,
 316                                p2i(value_addr), p2i(value_addr ? (address)oopDesc::load_decode_heap_oop(value_addr) : NULL));
 317   }
 318 }
 319 #endif
 320 
 321 template <class T> void static adjust_object_specialized(oop obj, InstanceRefKlass* klass) {
 322   T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj);
 323   MarkSweep::adjust_pointer(referent_addr);
 324   T* next_addr = (T*)java_lang_ref_Reference::next_addr(obj);
 325   MarkSweep::adjust_pointer(next_addr);
 326   T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr(obj);
 327   MarkSweep::adjust_pointer(discovered_addr);
 328   if (klass->reference_type() == REF_EPHEMERON) {
 329     T* value_addr = (T*) java_lang_ref_Ephemeron::value_addr(obj);
 330     MarkSweep::adjust_pointer(value_addr);
 331     debug_only(trace_reference_gc("InstanceRefKlass<Ephemeron>::oop_ms_adjust_pointers", obj, true,
 332                                   referent_addr, next_addr, discovered_addr, value_addr);)
 333   } else {
 334     debug_only(trace_reference_gc("InstanceRefKlass::oop_ms_adjust_pointers", obj, false,
 335                                   referent_addr, next_addr, discovered_addr, (T*)NULL);)
 336   }
 337 }
 338 
 339 int InstanceRefKlass::oop_ms_adjust_pointers(oop obj) {
 340   int size = size_helper();
 341   InstanceKlass::oop_ms_adjust_pointers(obj);
 342 
 343   if (UseCompressedOops) {
 344     adjust_object_specialized<narrowOop>(obj, this);
 345   } else {
 346     adjust_object_specialized<oop>(obj, this);
 347   }
 348   return size;
 349 }
 350 
 351 int ObjArrayKlass::oop_ms_adjust_pointers(oop obj) {
 352   assert(obj->is_objArray(), "obj must be obj array");
 353   objArrayOop a = objArrayOop(obj);
 354   // Get size before changing pointers.
 355   // Don't call size() or oop_size() since that is a virtual call.
 356   int size = a->object_size();
 357   oop_oop_iterate_elements<true>(a, &MarkSweep::adjust_pointer_closure);
 358   return size;
 359 }
 360 
 361 int TypeArrayKlass::oop_ms_adjust_pointers(oop obj) {
 362   assert(obj->is_typeArray(), "must be a type array");
 363   typeArrayOop t = typeArrayOop(obj);
 364   // Performance tweak: We skip iterating over the klass pointer since we
 365   // know that Universe::TypeArrayKlass never moves.
 366   return t->object_size();
< prev index next >