< prev index next >

src/hotspot/share/oops/instanceMirrorKlass.hpp

Print this page

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

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

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