< prev index next >

src/hotspot/share/oops/instanceMirrorKlass.inline.hpp

Print this page
rev 47865 : [mq]: 8179244-Assert-failed-in-instanceMirrorKlass.inline.hpp


  54 
  55 template <bool nv, class OopClosureType>
  56 void InstanceMirrorKlass::oop_oop_iterate(oop obj, OopClosureType* closure) {
  57   InstanceKlass::oop_oop_iterate<nv>(obj, closure);
  58 
  59   if (Devirtualizer<nv>::do_metadata(closure)) {
  60     Klass* klass = java_lang_Class::as_Klass(obj);
  61     // We'll get NULL for primitive mirrors.
  62     if (klass != NULL) {
  63       if (klass->is_instance_klass() && InstanceKlass::cast(klass)->is_anonymous()) {
  64         // An anonymous class doesn't have its own class loader, so when handling
  65         // the java mirror for an anonymous class we need to make sure its class
  66         // loader data is claimed, this is done by calling do_cld explicitly.
  67         // For non-anonymous classes the call to do_cld is made when the class
  68         // loader itself is handled.
  69         Devirtualizer<nv>::do_cld(closure, klass->class_loader_data());
  70       } else {
  71         Devirtualizer<nv>::do_klass(closure, klass);
  72       }
  73     } else {
  74       // If klass is NULL then this a mirror for a primitive type.
  75       // We don't have to follow them, since they are handled as strong
  76       // roots in Universe::oops_do.
  77       assert(java_lang_Class::is_primitive(obj), "Sanity check");





  78     }
  79   }
  80 
  81   oop_oop_iterate_statics<nv>(obj, closure);
  82 }
  83 
  84 #if INCLUDE_ALL_GCS
  85 template <bool nv, class OopClosureType>
  86 void InstanceMirrorKlass::oop_oop_iterate_reverse(oop obj, OopClosureType* closure) {
  87   InstanceKlass::oop_oop_iterate_reverse<nv>(obj, closure);
  88 
  89   InstanceMirrorKlass::oop_oop_iterate_statics<nv>(obj, closure);
  90 }
  91 #endif
  92 
  93 template <bool nv, typename T, class OopClosureType>
  94 void InstanceMirrorKlass::oop_oop_iterate_statics_specialized_bounded(oop obj,
  95                                                                      OopClosureType* closure,
  96                                                                      MemRegion mr) {
  97   T* p   = (T*)start_of_static_fields(obj);




  54 
  55 template <bool nv, class OopClosureType>
  56 void InstanceMirrorKlass::oop_oop_iterate(oop obj, OopClosureType* closure) {
  57   InstanceKlass::oop_oop_iterate<nv>(obj, closure);
  58 
  59   if (Devirtualizer<nv>::do_metadata(closure)) {
  60     Klass* klass = java_lang_Class::as_Klass(obj);
  61     // We'll get NULL for primitive mirrors.
  62     if (klass != NULL) {
  63       if (klass->is_instance_klass() && InstanceKlass::cast(klass)->is_anonymous()) {
  64         // An anonymous class doesn't have its own class loader, so when handling
  65         // the java mirror for an anonymous class we need to make sure its class
  66         // loader data is claimed, this is done by calling do_cld explicitly.
  67         // For non-anonymous classes the call to do_cld is made when the class
  68         // loader itself is handled.
  69         Devirtualizer<nv>::do_cld(closure, klass->class_loader_data());
  70       } else {
  71         Devirtualizer<nv>::do_klass(closure, klass);
  72       }
  73     } else {
  74       // We would like to assert here (as below) that if klass has been NULL, then
  75       // this has been a mirror for a primitive type that we do not need to follow
  76       // as they are always strong roots.
  77       // However, we might get across a klass that just changed during CMS concurrent
  78       // marking if allocation occurred in the old generation.
  79       // This is benign here, as we keep alive all CLDs that were loaded during the
  80       // CMS concurrent phase in the class loading, i.e. they will be iterated over
  81       // and kept alive during remark.
  82       // assert(java_lang_Class::is_primitive(obj), "Sanity check");
  83     }
  84   }
  85 
  86   oop_oop_iterate_statics<nv>(obj, closure);
  87 }
  88 
  89 #if INCLUDE_ALL_GCS
  90 template <bool nv, class OopClosureType>
  91 void InstanceMirrorKlass::oop_oop_iterate_reverse(oop obj, OopClosureType* closure) {
  92   InstanceKlass::oop_oop_iterate_reverse<nv>(obj, closure);
  93 
  94   InstanceMirrorKlass::oop_oop_iterate_statics<nv>(obj, closure);
  95 }
  96 #endif
  97 
  98 template <bool nv, typename T, class OopClosureType>
  99 void InstanceMirrorKlass::oop_oop_iterate_statics_specialized_bounded(oop obj,
 100                                                                      OopClosureType* closure,
 101                                                                      MemRegion mr) {
 102   T* p   = (T*)start_of_static_fields(obj);


< prev index next >