< prev index next >

src/hotspot/share/oops/instanceKlass.inline.hpp

Print this page

 45 
 46 inline oop InstanceKlass::static_field_base_raw() { return java_mirror(); }
 47 
 48 inline OopMapBlock* InstanceKlass::start_of_nonstatic_oop_maps() const {
 49   return (OopMapBlock*)(start_of_itable() + itable_length());
 50 }
 51 
 52 inline Klass** InstanceKlass::end_of_nonstatic_oop_maps() const {
 53   return (Klass**)(start_of_nonstatic_oop_maps() +
 54                    nonstatic_oop_map_count());
 55 }
 56 
 57 inline InstanceKlass* volatile* InstanceKlass::adr_implementor() const {
 58   if (is_interface()) {
 59     return (InstanceKlass* volatile*)end_of_nonstatic_oop_maps();
 60   } else {
 61     return NULL;
 62   }
 63 }
 64 
 65 inline ObjArrayKlass* InstanceKlass::array_klasses_acquire() const {













































 66   return Atomic::load_acquire(&_array_klasses);
 67 }
 68 
 69 inline void InstanceKlass::release_set_array_klasses(ObjArrayKlass* k) {
 70   Atomic::release_store(&_array_klasses, k);
 71 }
 72 
 73 inline jmethodID* InstanceKlass::methods_jmethod_ids_acquire() const {
 74   return Atomic::load_acquire(&_methods_jmethod_ids);
 75 }
 76 
 77 inline void InstanceKlass::release_set_methods_jmethod_ids(jmethodID* jmeths) {
 78   Atomic::release_store(&_methods_jmethod_ids, jmeths);
 79 }
 80 
 81 // The iteration over the oops in objects is a hot path in the GC code.
 82 // By force inlining the following functions, we get similar GC performance
 83 // as the previous macro based implementation.
 84 
 85 template <typename T, class OopClosureType>
 86 ALWAYSINLINE void InstanceKlass::oop_oop_iterate_oop_map(OopMapBlock* map, oop obj, OopClosureType* closure) {
 87   T* p         = (T*)obj->obj_field_addr<T>(map->offset());
 88   T* const end = p + map->count();
 89 

 45 
 46 inline oop InstanceKlass::static_field_base_raw() { return java_mirror(); }
 47 
 48 inline OopMapBlock* InstanceKlass::start_of_nonstatic_oop_maps() const {
 49   return (OopMapBlock*)(start_of_itable() + itable_length());
 50 }
 51 
 52 inline Klass** InstanceKlass::end_of_nonstatic_oop_maps() const {
 53   return (Klass**)(start_of_nonstatic_oop_maps() +
 54                    nonstatic_oop_map_count());
 55 }
 56 
 57 inline InstanceKlass* volatile* InstanceKlass::adr_implementor() const {
 58   if (is_interface()) {
 59     return (InstanceKlass* volatile*)end_of_nonstatic_oop_maps();
 60   } else {
 61     return NULL;
 62   }
 63 }
 64 
 65 inline address InstanceKlass::adr_inline_type_field_klasses() const {
 66   if (has_inline_type_fields()) {
 67     InstanceKlass* volatile* adr_impl = adr_implementor();
 68     if (adr_impl != NULL) {
 69       return (address)(adr_impl + 1);
 70     }
 71 
 72     return (address)end_of_nonstatic_oop_maps();
 73   } else {
 74     return NULL;
 75   }
 76 }
 77 
 78 inline Klass* InstanceKlass::get_inline_type_field_klass(int idx) const {
 79   assert(has_inline_type_fields(), "Sanity checking");
 80   assert(idx < java_fields_count(), "IOOB");
 81   Klass* k = ((Klass**)adr_inline_type_field_klasses())[idx];
 82   assert(k != NULL, "Should always be set before being read");
 83   assert(k->is_inline_klass(), "Must be an inline type");
 84   return k;
 85 }
 86 
 87 inline Klass* InstanceKlass::get_inline_type_field_klass_or_null(int idx) const {
 88   assert(has_inline_type_fields(), "Sanity checking");
 89   assert(idx < java_fields_count(), "IOOB");
 90   Klass* k = ((Klass**)adr_inline_type_field_klasses())[idx];
 91   assert(k == NULL || k->is_inline_klass(), "Must be an inline type");
 92   return k;
 93 }
 94 
 95 inline void InstanceKlass::set_inline_type_field_klass(int idx, Klass* k) {
 96   assert(has_inline_type_fields(), "Sanity checking");
 97   assert(idx < java_fields_count(), "IOOB");
 98   assert(k != NULL, "Should not be set to NULL");
 99   assert(((Klass**)adr_inline_type_field_klasses())[idx] == NULL, "Should not be set twice");
100   ((Klass**)adr_inline_type_field_klasses())[idx] = k;
101 }
102 
103 inline void InstanceKlass::reset_inline_type_field_klass(int idx) {
104   assert(has_inline_type_fields(), "Sanity checking");
105   assert(idx < java_fields_count(), "IOOB");
106   ((Klass**)adr_inline_type_field_klasses())[idx] = NULL;
107 }
108 
109 
110 inline ArrayKlass* InstanceKlass::array_klasses_acquire() const {
111   return Atomic::load_acquire(&_array_klasses);
112 }
113 
114 inline void InstanceKlass::release_set_array_klasses(ArrayKlass* k) {
115   Atomic::release_store(&_array_klasses, k);
116 }
117 
118 inline jmethodID* InstanceKlass::methods_jmethod_ids_acquire() const {
119   return Atomic::load_acquire(&_methods_jmethod_ids);
120 }
121 
122 inline void InstanceKlass::release_set_methods_jmethod_ids(jmethodID* jmeths) {
123   Atomic::release_store(&_methods_jmethod_ids, jmeths);
124 }
125 
126 // The iteration over the oops in objects is a hot path in the GC code.
127 // By force inlining the following functions, we get similar GC performance
128 // as the previous macro based implementation.
129 
130 template <typename T, class OopClosureType>
131 ALWAYSINLINE void InstanceKlass::oop_oop_iterate_oop_map(OopMapBlock* map, oop obj, OopClosureType* closure) {
132   T* p         = (T*)obj->obj_field_addr<T>(map->offset());
133   T* const end = p + map->count();
134 
< prev index next >