< prev index next >

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

Print this page




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_MEMORY_ITERATOR_INLINE_HPP
  26 #define SHARE_VM_MEMORY_ITERATOR_INLINE_HPP
  27 
  28 #include "classfile/classLoaderData.hpp"
  29 #include "memory/iterator.hpp"


  30 #include "oops/klass.hpp"
  31 #include "oops/instanceKlass.inline.hpp"
  32 #include "oops/instanceMirrorKlass.inline.hpp"
  33 #include "oops/instanceClassLoaderKlass.inline.hpp"
  34 #include "oops/instanceRefKlass.inline.hpp"
  35 #include "oops/objArrayKlass.inline.hpp"
  36 #include "oops/typeArrayKlass.inline.hpp"
  37 #include "utilities/debug.hpp"
  38 
  39 inline void MetadataAwareOopClosure::do_cld_nv(ClassLoaderData* cld) {
  40   bool claim = true;  // Must claim the class loader data before processing.
  41   cld->oops_do(this, claim);
  42 }
  43 
  44 inline void MetadataAwareOopClosure::do_klass_nv(Klass* k) {
  45   ClassLoaderData* cld = k->class_loader_data();
  46   do_cld_nv(cld);
  47 }
  48 
  49 #ifdef ASSERT
  50 // This verification is applied to all visited oops.
  51 // The closures can turn is off by overriding should_verify_oops().
  52 template <typename T>
  53 void ExtendedOopClosure::verify(T* p) {
  54   if (should_verify_oops()) {
  55     T heap_oop = oopDesc::load_heap_oop(p);
  56     if (!oopDesc::is_null(heap_oop)) {
  57       oop o = oopDesc::decode_heap_oop_not_null(heap_oop);
  58       assert(Universe::heap()->is_in_closed_subset(o),
  59              "should be in closed *p " PTR_FORMAT " " PTR_FORMAT, p2i(p), p2i(o));
  60     }
  61   }
  62 }
  63 #endif
  64 
  65 // Implementation of the non-virtual do_oop dispatch.
  66 
  67 template <class OopClosureType, typename T>
  68 inline void Devirtualizer<true>::do_oop(OopClosureType* closure, T* p) {
  69   debug_only(closure->verify(p));
  70   closure->do_oop_nv(p);
  71 }
  72 template <class OopClosureType>
  73 inline void Devirtualizer<true>::do_klass(OopClosureType* closure, Klass* k) {
  74   closure->do_klass_nv(k);
  75 }
  76 template <class OopClosureType>
  77 void Devirtualizer<true>::do_cld(OopClosureType* closure, ClassLoaderData* cld) {




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_MEMORY_ITERATOR_INLINE_HPP
  26 #define SHARE_VM_MEMORY_ITERATOR_INLINE_HPP
  27 
  28 #include "classfile/classLoaderData.hpp"
  29 #include "memory/iterator.hpp"
  30 #include "oops/access.inline.hpp"
  31 #include "oops/compressedOops.inline.hpp"
  32 #include "oops/klass.hpp"
  33 #include "oops/instanceKlass.inline.hpp"
  34 #include "oops/instanceMirrorKlass.inline.hpp"
  35 #include "oops/instanceClassLoaderKlass.inline.hpp"
  36 #include "oops/instanceRefKlass.inline.hpp"
  37 #include "oops/objArrayKlass.inline.hpp"
  38 #include "oops/typeArrayKlass.inline.hpp"
  39 #include "utilities/debug.hpp"
  40 
  41 inline void MetadataAwareOopClosure::do_cld_nv(ClassLoaderData* cld) {
  42   bool claim = true;  // Must claim the class loader data before processing.
  43   cld->oops_do(this, claim);
  44 }
  45 
  46 inline void MetadataAwareOopClosure::do_klass_nv(Klass* k) {
  47   ClassLoaderData* cld = k->class_loader_data();
  48   do_cld_nv(cld);
  49 }
  50 
  51 #ifdef ASSERT
  52 // This verification is applied to all visited oops.
  53 // The closures can turn is off by overriding should_verify_oops().
  54 template <typename T>
  55 void ExtendedOopClosure::verify(T* p) {
  56   if (should_verify_oops()) {
  57     T heap_oop = RawAccess<>::oop_load(p);
  58     if (!CompressedOops::is_null(heap_oop)) {
  59       oop o = CompressedOops::decode_not_null(heap_oop);
  60       assert(Universe::heap()->is_in_closed_subset(o),
  61              "should be in closed *p " PTR_FORMAT " " PTR_FORMAT, p2i(p), p2i(o));
  62     }
  63   }
  64 }
  65 #endif
  66 
  67 // Implementation of the non-virtual do_oop dispatch.
  68 
  69 template <class OopClosureType, typename T>
  70 inline void Devirtualizer<true>::do_oop(OopClosureType* closure, T* p) {
  71   debug_only(closure->verify(p));
  72   closure->do_oop_nv(p);
  73 }
  74 template <class OopClosureType>
  75 inline void Devirtualizer<true>::do_klass(OopClosureType* closure, Klass* k) {
  76   closure->do_klass_nv(k);
  77 }
  78 template <class OopClosureType>
  79 void Devirtualizer<true>::do_cld(OopClosureType* closure, ClassLoaderData* cld) {


< prev index next >