src/hotspot/share/oops/instanceMirrorKlass.hpp
changeset 50752 9d62da00bf15
parent 49982 9042ffe5b7fe
child 51491 187c84a5efe1
equal deleted inserted replaced
50751:d9132bdf6c30 50752:9d62da00bf15
    24 
    24 
    25 #ifndef SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP
    25 #ifndef SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP
    26 #define SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP
    26 #define SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP
    27 
    27 
    28 #include "classfile/systemDictionary.hpp"
    28 #include "classfile/systemDictionary.hpp"
    29 #include "gc/shared/specialized_oop_closures.hpp"
       
    30 #include "oops/instanceKlass.hpp"
    29 #include "oops/instanceKlass.hpp"
    31 #include "runtime/handles.hpp"
    30 #include "runtime/handles.hpp"
    32 #include "utilities/macros.hpp"
    31 #include "utilities/macros.hpp"
    33 
    32 
    34 class ClassFileParser;
    33 class ClassFileParser;
    43 
    42 
    44 class InstanceMirrorKlass: public InstanceKlass {
    43 class InstanceMirrorKlass: public InstanceKlass {
    45   friend class VMStructs;
    44   friend class VMStructs;
    46   friend class InstanceKlass;
    45   friend class InstanceKlass;
    47 
    46 
       
    47  public:
       
    48   static const KlassID ID = InstanceMirrorKlassID;
       
    49 
    48  private:
    50  private:
    49   static int _offset_of_static_fields;
    51   static int _offset_of_static_fields;
    50 
    52 
    51   InstanceMirrorKlass(const ClassFileParser& parser) : InstanceKlass(parser, InstanceKlass::_misc_kind_mirror) {}
    53   InstanceMirrorKlass(const ClassFileParser& parser) : InstanceKlass(parser, InstanceKlass::_misc_kind_mirror, ID) {}
    52 
    54 
    53  public:
    55  public:
    54   InstanceMirrorKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); }
    56   InstanceMirrorKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); }
    55 
    57 
    56   // Casting from Klass*
    58   // Casting from Klass*
    96   void oop_pc_follow_contents(oop obj, ParCompactionManager* cm);
    98   void oop_pc_follow_contents(oop obj, ParCompactionManager* cm);
    97   void oop_pc_update_pointers(oop obj, ParCompactionManager* cm);
    99   void oop_pc_update_pointers(oop obj, ParCompactionManager* cm);
    98 #endif
   100 #endif
    99 
   101 
   100   // Oop fields (and metadata) iterators
   102   // Oop fields (and metadata) iterators
   101   //  [nv = true]  Use non-virtual calls to do_oop_nv.
       
   102   //  [nv = false] Use virtual calls to do_oop.
       
   103   //
   103   //
   104   // The InstanceMirrorKlass iterators also visit the hidden Klass pointer.
   104   // The InstanceMirrorKlass iterators also visit the hidden Klass pointer.
   105 
   105 
   106  public:
       
   107   // Iterate over the static fields.
   106   // Iterate over the static fields.
   108   template <bool nv, class OopClosureType>
   107   template <typename T, class OopClosureType>
   109   inline void oop_oop_iterate_statics(oop obj, OopClosureType* closure);
   108   inline void oop_oop_iterate_statics(oop obj, OopClosureType* closure);
   110 
       
   111  private:
       
   112   // Iterate over the static fields.
       
   113   // Specialized for [T = oop] or [T = narrowOop].
       
   114   template <bool nv, typename T, class OopClosureType>
       
   115   inline void oop_oop_iterate_statics_specialized(oop obj, OopClosureType* closure);
       
   116 
   109 
   117   // Forward iteration
   110   // Forward iteration
   118   // Iterate over the oop fields and metadata.
   111   // Iterate over the oop fields and metadata.
   119   template <bool nv, class OopClosureType>
   112   template <typename T, class OopClosureType>
   120   inline void oop_oop_iterate(oop obj, OopClosureType* closure);
   113   inline void oop_oop_iterate(oop obj, OopClosureType* closure);
   121 
   114 
   122 
       
   123   // Reverse iteration
   115   // Reverse iteration
   124 #if INCLUDE_OOP_OOP_ITERATE_BACKWARDS
       
   125   // Iterate over the oop fields and metadata.
   116   // Iterate over the oop fields and metadata.
   126   template <bool nv, class OopClosureType>
   117   template <typename T, class OopClosureType>
   127   inline void oop_oop_iterate_reverse(oop obj, OopClosureType* closure);
   118   inline void oop_oop_iterate_reverse(oop obj, OopClosureType* closure);
   128 #endif
       
   129 
       
   130 
   119 
   131   // Bounded range iteration
   120   // Bounded range iteration
   132   // Iterate over the oop fields and metadata.
   121   // Iterate over the oop fields and metadata.
   133   template <bool nv, class OopClosureType>
   122   template <typename T, class OopClosureType>
   134   inline void oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr);
   123   inline void oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr);
   135 
   124 
   136   // Iterate over the static fields.
   125  private:
   137   template <bool nv, class OopClosureType>
       
   138   inline void oop_oop_iterate_statics_bounded(oop obj, OopClosureType* closure, MemRegion mr);
       
   139 
   126 
   140   // Iterate over the static fields.
   127   // Iterate over the static fields.
   141   // Specialized for [T = oop] or [T = narrowOop].
   128   template <typename T, class OopClosureType>
   142   template <bool nv, typename T, class OopClosureType>
   129   inline void oop_oop_iterate_statics_bounded(oop obj, OopClosureType* closure, MemRegion mr);
   143   inline void oop_oop_iterate_statics_specialized_bounded(oop obj, OopClosureType* closure, MemRegion mr);
       
   144 
       
   145 
       
   146  public:
       
   147 
       
   148   ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_OOP_ITERATE_DECL)
       
   149   ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_OOP_ITERATE_DECL)
       
   150 
       
   151 #if INCLUDE_OOP_OOP_ITERATE_BACKWARDS
       
   152   ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_OOP_ITERATE_DECL_BACKWARDS)
       
   153   ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_OOP_ITERATE_DECL_BACKWARDS)
       
   154 #endif
       
   155 };
   130 };
   156 
   131 
   157 #endif // SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP
   132 #endif // SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP