72 static void init_offset_of_static_fields() { 73 // Cache the offset of the static fields in the Class instance 74 assert(_offset_of_static_fields == 0, "once"); 75 _offset_of_static_fields = InstanceMirrorKlass::cast(SystemDictionary::Class_klass())->size_helper() << LogHeapWordSize; 76 } 77 78 static int offset_of_static_fields() { 79 return _offset_of_static_fields; 80 } 81 82 int compute_static_oop_field_count(oop obj); 83 84 // Given a Klass return the size of the instance 85 int instance_size(Klass* k); 86 87 // allocation 88 instanceOop allocate_instance(Klass* k, TRAPS); 89 90 // GC specific object visitors 91 // 92 #if INCLUDE_ALL_GCS 93 // Parallel Scavenge 94 void oop_ps_push_contents( oop obj, PSPromotionManager* pm); 95 // Parallel Compact 96 void oop_pc_follow_contents(oop obj, ParCompactionManager* cm); 97 void oop_pc_update_pointers(oop obj, ParCompactionManager* cm); 98 #endif 99 100 // 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 // 104 // The InstanceMirrorKlass iterators also visit the hidden Klass pointer. 105 106 public: 107 // Iterate over the static fields. 108 template <bool nv, class OopClosureType> 109 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 117 // Forward iteration 118 // Iterate over the oop fields and metadata. 119 template <bool nv, class OopClosureType> 120 inline void oop_oop_iterate(oop obj, OopClosureType* closure); 121 122 123 // Reverse iteration 124 #if INCLUDE_ALL_GCS 125 // Iterate over the oop fields and metadata. 126 template <bool nv, class OopClosureType> 127 inline void oop_oop_iterate_reverse(oop obj, OopClosureType* closure); 128 #endif 129 130 131 // Bounded range iteration 132 // Iterate over the oop fields and metadata. 133 template <bool nv, class OopClosureType> 134 inline void oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr); 135 136 // Iterate over the static fields. 137 template <bool nv, class OopClosureType> 138 inline void oop_oop_iterate_statics_bounded(oop obj, OopClosureType* closure, MemRegion mr); 139 140 // Iterate over the static fields. 141 // Specialized for [T = oop] or [T = narrowOop]. 142 template <bool nv, typename T, class OopClosureType> 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_ALL_GCS 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 // INCLUDE_ALL_GCS 155 }; 156 157 #endif // SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP | 72 static void init_offset_of_static_fields() { 73 // Cache the offset of the static fields in the Class instance 74 assert(_offset_of_static_fields == 0, "once"); 75 _offset_of_static_fields = InstanceMirrorKlass::cast(SystemDictionary::Class_klass())->size_helper() << LogHeapWordSize; 76 } 77 78 static int offset_of_static_fields() { 79 return _offset_of_static_fields; 80 } 81 82 int compute_static_oop_field_count(oop obj); 83 84 // Given a Klass return the size of the instance 85 int instance_size(Klass* k); 86 87 // allocation 88 instanceOop allocate_instance(Klass* k, TRAPS); 89 90 // GC specific object visitors 91 // 92 #if INCLUDE_PARALLELGC 93 // Parallel Scavenge 94 void oop_ps_push_contents( oop obj, PSPromotionManager* pm); 95 // Parallel Compact 96 void oop_pc_follow_contents(oop obj, ParCompactionManager* cm); 97 void oop_pc_update_pointers(oop obj, ParCompactionManager* cm); 98 #endif 99 100 // 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 // 104 // The InstanceMirrorKlass iterators also visit the hidden Klass pointer. 105 106 public: 107 // Iterate over the static fields. 108 template <bool nv, class OopClosureType> 109 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 117 // Forward iteration 118 // Iterate over the oop fields and metadata. 119 template <bool nv, class OopClosureType> 120 inline void oop_oop_iterate(oop obj, OopClosureType* closure); 121 122 123 // Reverse iteration 124 #if INCLUDE_OOP_OOP_ITERATE_BACKWARDS 125 // Iterate over the oop fields and metadata. 126 template <bool nv, class OopClosureType> 127 inline void oop_oop_iterate_reverse(oop obj, OopClosureType* closure); 128 #endif 129 130 131 // Bounded range iteration 132 // Iterate over the oop fields and metadata. 133 template <bool nv, class OopClosureType> 134 inline void oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr); 135 136 // Iterate over the static fields. 137 template <bool nv, class OopClosureType> 138 inline void oop_oop_iterate_statics_bounded(oop obj, OopClosureType* closure, MemRegion mr); 139 140 // Iterate over the static fields. 141 // Specialized for [T = oop] or [T = narrowOop]. 142 template <bool nv, typename T, class OopClosureType> 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 }; 156 157 #endif // SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP |