71 } 72 73 static void init_offset_of_static_fields() { 74 // Cache the offset of the static fields in the Class instance 75 assert(_offset_of_static_fields == 0, "once"); 76 _offset_of_static_fields = InstanceMirrorKlass::cast(SystemDictionary::Class_klass())->size_helper() << LogHeapWordSize; 77 } 78 79 static int offset_of_static_fields() { 80 return _offset_of_static_fields; 81 } 82 83 int compute_static_oop_field_count(oop obj); 84 85 // Given a Klass return the size of the instance 86 int instance_size(KlassHandle k); 87 88 // allocation 89 instanceOop allocate_instance(KlassHandle k, TRAPS); 90 91 // Garbage collection 92 int oop_adjust_pointers(oop obj); 93 void oop_follow_contents(oop obj); 94 95 // Parallel Scavenge and Parallel Old 96 PARALLEL_GC_DECLS 97 98 int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) { 99 return oop_oop_iterate_v(obj, blk); 100 } 101 int oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr) { 102 return oop_oop_iterate_v_m(obj, blk, mr); 103 } 104 105 #define InstanceMirrorKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \ 106 int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \ 107 int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, MemRegion mr); 108 109 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceMirrorKlass_OOP_OOP_ITERATE_DECL) 110 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceMirrorKlass_OOP_OOP_ITERATE_DECL) 111 112 #if INCLUDE_ALL_GCS 113 #define InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \ 114 int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* blk); 115 116 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DECL) 117 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DECL) 118 #endif // INCLUDE_ALL_GCS 119 }; 120 121 #endif // SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP | 71 } 72 73 static void init_offset_of_static_fields() { 74 // Cache the offset of the static fields in the Class instance 75 assert(_offset_of_static_fields == 0, "once"); 76 _offset_of_static_fields = InstanceMirrorKlass::cast(SystemDictionary::Class_klass())->size_helper() << LogHeapWordSize; 77 } 78 79 static int offset_of_static_fields() { 80 return _offset_of_static_fields; 81 } 82 83 int compute_static_oop_field_count(oop obj); 84 85 // Given a Klass return the size of the instance 86 int instance_size(KlassHandle k); 87 88 // allocation 89 instanceOop allocate_instance(KlassHandle k, TRAPS); 90 91 // GC specific object visitors 92 // 93 // Mark Sweep 94 void oop_ms_follow_contents(oop obj); 95 int oop_ms_adjust_pointers(oop obj); 96 #if INCLUDE_ALL_GCS 97 // Parallel Scavenge 98 void oop_ps_push_contents( oop obj, PSPromotionManager* pm); 99 // Parallel Compact 100 void oop_pc_follow_contents(oop obj, ParCompactionManager* cm); 101 void oop_pc_update_pointers(oop obj); 102 #endif 103 104 // Oop fields (and metadata) iterators 105 // [nv = true] Use non-virtual calls to do_oop_nv. 106 // [nv = false] Use virtual calls to do_oop. 107 // 108 // The InstanceMirrorKlass iterators also visit the hidden Klass pointer. 109 110 public: 111 // Iterate over the static fields. 112 template <bool nv, class OopClosureType> 113 inline void oop_oop_iterate_statics(oop obj, OopClosureType* closure); 114 115 private: 116 // Iterate over the static fields. 117 // Specialized for [T = oop] or [T = narrowOop]. 118 template <bool nv, typename T, class OopClosureType> 119 inline void oop_oop_iterate_statics_specialized(oop obj, OopClosureType* closure); 120 121 // Forward iteration 122 // Iterate over the oop fields and metadata. 123 template <bool nv, class OopClosureType> 124 inline int oop_oop_iterate(oop obj, OopClosureType* closure); 125 126 127 // Reverse iteration 128 #if INCLUDE_ALL_GCS 129 // Iterate over the oop fields and metadata. 130 template <bool nv, class OopClosureType> 131 inline int oop_oop_iterate_reverse(oop obj, OopClosureType* closure); 132 #endif 133 134 135 // Bounded range iteration 136 // Iterate over the oop fields and metadata. 137 template <bool nv, class OopClosureType> 138 inline int oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr); 139 140 // Iterate over the static fields. 141 template <bool nv, class OopClosureType> 142 inline void oop_oop_iterate_statics_bounded(oop obj, OopClosureType* closure, MemRegion mr); 143 144 // Iterate over the static fields. 145 // Specialized for [T = oop] or [T = narrowOop]. 146 template <bool nv, typename T, class OopClosureType> 147 inline void oop_oop_iterate_statics_specialized_bounded(oop obj, OopClosureType* closure, MemRegion mr); 148 149 150 public: 151 152 #define InstanceMirrorKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \ 153 int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \ 154 int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, MemRegion mr); 155 156 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceMirrorKlass_OOP_OOP_ITERATE_DECL) 157 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceMirrorKlass_OOP_OOP_ITERATE_DECL) 158 159 #if INCLUDE_ALL_GCS 160 #define InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \ 161 int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* blk); 162 163 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DECL) 164 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceMirrorKlass_OOP_OOP_ITERATE_BACKWARDS_DECL) 165 #endif // INCLUDE_ALL_GCS 166 }; 167 168 #endif // SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP |