< prev index next >

src/hotspot/share/memory/iterator.inline.hpp

Print this page




  39 #include "utilities/debug.hpp"
  40 
  41 inline void MetadataVisitingOopIterateClosure::do_cld(ClassLoaderData* cld) {
  42   cld->oops_do(this, ClassLoaderData::_claim_strong);
  43 }
  44 
  45 inline void MetadataVisitingOopIterateClosure::do_klass(Klass* k) {
  46   ClassLoaderData* cld = k->class_loader_data();
  47   MetadataVisitingOopIterateClosure::do_cld(cld);
  48 }
  49 
  50 #ifdef ASSERT
  51 // This verification is applied to all visited oops.
  52 // The closures can turn is off by overriding should_verify_oops().
  53 template <typename T>
  54 void OopIterateClosure::verify(T* p) {
  55   if (should_verify_oops()) {
  56     T heap_oop = RawAccess<>::oop_load(p);
  57     if (!CompressedOops::is_null(heap_oop)) {
  58       oop o = CompressedOops::decode_not_null(heap_oop);
  59       assert(Universe::heap()->is_in_closed_subset(o),
  60              "should be in closed *p " PTR_FORMAT " " PTR_FORMAT, p2i(p), p2i(o));
  61     }
  62   }
  63 }
  64 #endif
  65 
  66 // Implementation of the non-virtual do_oop dispatch.
  67 //
  68 // The same implementation is used for do_metadata, do_klass, and do_cld.
  69 //
  70 // Preconditions:
  71 //  - Base has a pure virtual do_oop
  72 //  - Only one of the classes in the inheritance chain from OopClosureType to
  73 //    Base implements do_oop.
  74 //
  75 // Given the preconditions:
  76 //  - If &OopClosureType::do_oop is resolved to &Base::do_oop, then there is no
  77 //    implementation of do_oop between Base and OopClosureType. However, there
  78 //    must be one implementation in one of the subclasses of OopClosureType.
  79 //    In this case we take the virtual call.




  39 #include "utilities/debug.hpp"
  40 
  41 inline void MetadataVisitingOopIterateClosure::do_cld(ClassLoaderData* cld) {
  42   cld->oops_do(this, ClassLoaderData::_claim_strong);
  43 }
  44 
  45 inline void MetadataVisitingOopIterateClosure::do_klass(Klass* k) {
  46   ClassLoaderData* cld = k->class_loader_data();
  47   MetadataVisitingOopIterateClosure::do_cld(cld);
  48 }
  49 
  50 #ifdef ASSERT
  51 // This verification is applied to all visited oops.
  52 // The closures can turn is off by overriding should_verify_oops().
  53 template <typename T>
  54 void OopIterateClosure::verify(T* p) {
  55   if (should_verify_oops()) {
  56     T heap_oop = RawAccess<>::oop_load(p);
  57     if (!CompressedOops::is_null(heap_oop)) {
  58       oop o = CompressedOops::decode_not_null(heap_oop);
  59       assert(Universe::heap()->is_in(o),
  60              "should be in closed *p " PTR_FORMAT " " PTR_FORMAT, p2i(p), p2i(o));
  61     }
  62   }
  63 }
  64 #endif
  65 
  66 // Implementation of the non-virtual do_oop dispatch.
  67 //
  68 // The same implementation is used for do_metadata, do_klass, and do_cld.
  69 //
  70 // Preconditions:
  71 //  - Base has a pure virtual do_oop
  72 //  - Only one of the classes in the inheritance chain from OopClosureType to
  73 //    Base implements do_oop.
  74 //
  75 // Given the preconditions:
  76 //  - If &OopClosureType::do_oop is resolved to &Base::do_oop, then there is no
  77 //    implementation of do_oop between Base and OopClosureType. However, there
  78 //    must be one implementation in one of the subclasses of OopClosureType.
  79 //    In this case we take the virtual call.


< prev index next >