< prev index next >

src/hotspot/share/oops/instanceMirrorKlass.hpp

Print this page

 48   static const KlassKind Kind = InstanceMirrorKlassKind;
 49 
 50  private:
 51   static int _offset_of_static_fields;
 52 
 53   InstanceMirrorKlass(const ClassFileParser& parser) : InstanceKlass(parser, Kind) {}
 54 
 55  public:
 56   InstanceMirrorKlass();
 57 
 58   static InstanceMirrorKlass* cast(Klass* k) {
 59     return const_cast<InstanceMirrorKlass*>(cast(const_cast<const Klass*>(k)));
 60   }
 61 
 62   static const InstanceMirrorKlass* cast(const Klass* k) {
 63     assert(k->is_mirror_instance_klass(), "cast to InstanceMirrorKlass");
 64     return static_cast<const InstanceMirrorKlass*>(k);
 65   }
 66 
 67   // Returns the size of the instance including the extra static fields.
 68   virtual size_t oop_size(oop obj) const;

 69 
 70   // Static field offset is an offset into the Heap, should be converted by
 71   // based on UseCompressedOop for traversal
 72   static HeapWord* start_of_static_fields(oop obj) {
 73     return (HeapWord*)(cast_from_oop<intptr_t>(obj) + offset_of_static_fields());
 74   }
 75 
 76   static void init_offset_of_static_fields() {
 77     // Cache the offset of the static fields in the Class instance
 78     assert(_offset_of_static_fields == 0, "once");
 79     _offset_of_static_fields = InstanceMirrorKlass::cast(vmClasses::Class_klass())->size_helper() << LogHeapWordSize;
 80   }
 81 
 82   static int offset_of_static_fields() {
 83     return _offset_of_static_fields;
 84   }
 85 
 86   int compute_static_oop_field_count(oop obj);
 87 
 88   // Given a Klass return the size of the instance
 89   size_t instance_size(Klass* k);
 90 
 91   // allocation
 92   instanceOop allocate_instance(Klass* k, TRAPS);
 93 
 94   static void serialize_offsets(class SerializeClosure* f) NOT_CDS_RETURN;
 95 
 96   // Oop fields (and metadata) iterators
 97   //
 98   // The InstanceMirrorKlass iterators also visit the hidden Klass pointer.
 99 
100   // Iterate over the static fields.
101   template <typename T, class OopClosureType>
102   inline void oop_oop_iterate_statics(oop obj, OopClosureType* closure);
103 
104   // Forward iteration
105   // Iterate over the oop fields and metadata.
106   template <typename T, class OopClosureType>
107   inline void oop_oop_iterate(oop obj, OopClosureType* closure);
108 
109   // Reverse iteration
110   // Iterate over the oop fields and metadata.
111   template <typename T, class OopClosureType>
112   inline void oop_oop_iterate_reverse(oop obj, OopClosureType* closure);

 48   static const KlassKind Kind = InstanceMirrorKlassKind;
 49 
 50  private:
 51   static int _offset_of_static_fields;
 52 
 53   InstanceMirrorKlass(const ClassFileParser& parser) : InstanceKlass(parser, Kind) {}
 54 
 55  public:
 56   InstanceMirrorKlass();
 57 
 58   static InstanceMirrorKlass* cast(Klass* k) {
 59     return const_cast<InstanceMirrorKlass*>(cast(const_cast<const Klass*>(k)));
 60   }
 61 
 62   static const InstanceMirrorKlass* cast(const Klass* k) {
 63     assert(k->is_mirror_instance_klass(), "cast to InstanceMirrorKlass");
 64     return static_cast<const InstanceMirrorKlass*>(k);
 65   }
 66 
 67   // Returns the size of the instance including the extra static fields.
 68   size_t oop_size(oop obj, markWord mark) const;
 69   int hash_offset_in_bytes(oop obj) const;
 70 
 71   // Static field offset is an offset into the Heap, should be converted by
 72   // based on UseCompressedOop for traversal
 73   static HeapWord* start_of_static_fields(oop obj) {
 74     return (HeapWord*)(cast_from_oop<intptr_t>(obj) + offset_of_static_fields());
 75   }
 76 
 77   static void init_offset_of_static_fields() {
 78     // Cache the offset of the static fields in the Class instance
 79     assert(_offset_of_static_fields == 0, "once");
 80     _offset_of_static_fields = InstanceMirrorKlass::cast(vmClasses::Class_klass())->size_helper() << LogHeapWordSize;
 81   }
 82 
 83   static int offset_of_static_fields() {
 84     return _offset_of_static_fields;
 85   }
 86 
 87   int compute_static_oop_field_count(oop obj);
 88 
 89   // Given a Klass return the size of the instance
 90   size_t instance_size(Klass* k);
 91 
 92   // allocation
 93   instanceOop allocate_instance(Klass* k, bool extend, TRAPS);
 94 
 95   static void serialize_offsets(class SerializeClosure* f) NOT_CDS_RETURN;
 96 
 97   // Oop fields (and metadata) iterators
 98   //
 99   // The InstanceMirrorKlass iterators also visit the hidden Klass pointer.
100 
101   // Iterate over the static fields.
102   template <typename T, class OopClosureType>
103   inline void oop_oop_iterate_statics(oop obj, OopClosureType* closure);
104 
105   // Forward iteration
106   // Iterate over the oop fields and metadata.
107   template <typename T, class OopClosureType>
108   inline void oop_oop_iterate(oop obj, OopClosureType* closure);
109 
110   // Reverse iteration
111   // Iterate over the oop fields and metadata.
112   template <typename T, class OopClosureType>
113   inline void oop_oop_iterate_reverse(oop obj, OopClosureType* closure);
< prev index next >