46 inline int InstanceKlass::java_fields_count() const { return FieldInfoStream::num_java_fields(fieldinfo_stream()); }
47 inline int InstanceKlass::total_fields_count() const { return FieldInfoStream::num_total_fields(fieldinfo_stream()); }
48
49 inline OopMapBlock* InstanceKlass::start_of_nonstatic_oop_maps() const {
50 return (OopMapBlock*)(start_of_itable() + itable_length());
51 }
52
53 inline Klass** InstanceKlass::end_of_nonstatic_oop_maps() const {
54 return (Klass**)(start_of_nonstatic_oop_maps() +
55 nonstatic_oop_map_count());
56 }
57
58 inline InstanceKlass* volatile* InstanceKlass::adr_implementor() const {
59 if (is_interface()) {
60 return (InstanceKlass* volatile*)end_of_nonstatic_oop_maps();
61 } else {
62 return nullptr;
63 }
64 }
65
66 inline ObjArrayKlass* InstanceKlass::array_klasses_acquire() const {
67 return Atomic::load_acquire(&_array_klasses);
68 }
69
70 inline void InstanceKlass::release_set_array_klasses(ObjArrayKlass* k) {
71 Atomic::release_store(&_array_klasses, k);
72 }
73
74 inline jmethodID* InstanceKlass::methods_jmethod_ids_acquire() const {
75 return Atomic::load_acquire(&_methods_jmethod_ids);
76 }
77
78 inline void InstanceKlass::release_set_methods_jmethod_ids(jmethodID* jmeths) {
79 Atomic::release_store(&_methods_jmethod_ids, jmeths);
80 }
81
82 // The iteration over the oops in objects is a hot path in the GC code.
83 // By force inlining the following functions, we get similar GC performance
84 // as the previous macro based implementation.
85
86 template <typename T, class OopClosureType>
87 ALWAYSINLINE void InstanceKlass::oop_oop_iterate_oop_map(OopMapBlock* map, oop obj, OopClosureType* closure) {
88 T* p = obj->field_addr<T>(map->offset());
89 T* const end = p + map->count();
90
|
46 inline int InstanceKlass::java_fields_count() const { return FieldInfoStream::num_java_fields(fieldinfo_stream()); }
47 inline int InstanceKlass::total_fields_count() const { return FieldInfoStream::num_total_fields(fieldinfo_stream()); }
48
49 inline OopMapBlock* InstanceKlass::start_of_nonstatic_oop_maps() const {
50 return (OopMapBlock*)(start_of_itable() + itable_length());
51 }
52
53 inline Klass** InstanceKlass::end_of_nonstatic_oop_maps() const {
54 return (Klass**)(start_of_nonstatic_oop_maps() +
55 nonstatic_oop_map_count());
56 }
57
58 inline InstanceKlass* volatile* InstanceKlass::adr_implementor() const {
59 if (is_interface()) {
60 return (InstanceKlass* volatile*)end_of_nonstatic_oop_maps();
61 } else {
62 return nullptr;
63 }
64 }
65
66 inline InlineKlass* InstanceKlass::get_inline_type_field_klass(int idx) const {
67 assert(has_inline_type_fields(), "Sanity checking");
68 assert(idx < java_fields_count(), "IOOB");
69 InlineKlass* k = inline_layout_info(idx).klass();
70 assert(k != nullptr, "Should always be set before being read");
71 return k;
72 }
73
74 inline InlineKlass* InstanceKlass::get_inline_type_field_klass_or_null(int idx) const {
75 assert(has_inline_type_fields(), "Sanity checking");
76 assert(idx < java_fields_count(), "IOOB");
77 InlineKlass* k = inline_layout_info(idx).klass();
78 return k;
79 }
80
81 inline ArrayKlass* InstanceKlass::array_klasses_acquire() const {
82 return Atomic::load_acquire(&_array_klasses);
83 }
84
85 inline void InstanceKlass::release_set_array_klasses(ArrayKlass* k) {
86 Atomic::release_store(&_array_klasses, k);
87 }
88
89 inline jmethodID* InstanceKlass::methods_jmethod_ids_acquire() const {
90 return Atomic::load_acquire(&_methods_jmethod_ids);
91 }
92
93 inline void InstanceKlass::release_set_methods_jmethod_ids(jmethodID* jmeths) {
94 Atomic::release_store(&_methods_jmethod_ids, jmeths);
95 }
96
97 // The iteration over the oops in objects is a hot path in the GC code.
98 // By force inlining the following functions, we get similar GC performance
99 // as the previous macro based implementation.
100
101 template <typename T, class OopClosureType>
102 ALWAYSINLINE void InstanceKlass::oop_oop_iterate_oop_map(OopMapBlock* map, oop obj, OopClosureType* closure) {
103 T* p = obj->field_addr<T>(map->offset());
104 T* const end = p + map->count();
105
|