1130 probe = jni_id_for_impl(this->as_klassOop(), offset); |
1130 probe = jni_id_for_impl(this->as_klassOop(), offset); |
1131 } |
1131 } |
1132 return probe; |
1132 return probe; |
1133 } |
1133 } |
1134 |
1134 |
|
1135 u2 instanceKlass::enclosing_method_data(int offset) { |
|
1136 typeArrayOop inner_class_list = inner_classes(); |
|
1137 if (inner_class_list == NULL) { |
|
1138 return 0; |
|
1139 } |
|
1140 int length = inner_class_list->length(); |
|
1141 if (length % inner_class_next_offset == 0) { |
|
1142 return 0; |
|
1143 } else { |
|
1144 int index = length - enclosing_method_attribute_size; |
|
1145 typeArrayHandle inner_class_list_h(inner_class_list); |
|
1146 assert(offset < enclosing_method_attribute_size, "invalid offset"); |
|
1147 return inner_class_list_h->ushort_at(index + offset); |
|
1148 } |
|
1149 } |
|
1150 |
|
1151 void instanceKlass::set_enclosing_method_indices(u2 class_index, |
|
1152 u2 method_index) { |
|
1153 typeArrayOop inner_class_list = inner_classes(); |
|
1154 assert (inner_class_list != NULL, "_inner_classes list is not set up"); |
|
1155 int length = inner_class_list->length(); |
|
1156 if (length % inner_class_next_offset == enclosing_method_attribute_size) { |
|
1157 int index = length - enclosing_method_attribute_size; |
|
1158 typeArrayHandle inner_class_list_h(inner_class_list); |
|
1159 inner_class_list_h->ushort_at_put( |
|
1160 index + enclosing_method_class_index_offset, class_index); |
|
1161 inner_class_list_h->ushort_at_put( |
|
1162 index + enclosing_method_method_index_offset, method_index); |
|
1163 } |
|
1164 } |
1135 |
1165 |
1136 // Lookup or create a jmethodID. |
1166 // Lookup or create a jmethodID. |
1137 // This code is called by the VMThread and JavaThreads so the |
1167 // This code is called by the VMThread and JavaThreads so the |
1138 // locking has to be done very carefully to avoid deadlocks |
1168 // locking has to be done very carefully to avoid deadlocks |
1139 // and/or other cache consistency problems. |
1169 // and/or other cache consistency problems. |
2104 jint instanceKlass::compute_modifier_flags(TRAPS) const { |
2134 jint instanceKlass::compute_modifier_flags(TRAPS) const { |
2105 klassOop k = as_klassOop(); |
2135 klassOop k = as_klassOop(); |
2106 jint access = access_flags().as_int(); |
2136 jint access = access_flags().as_int(); |
2107 |
2137 |
2108 // But check if it happens to be member class. |
2138 // But check if it happens to be member class. |
2109 typeArrayOop inner_class_list = inner_classes(); |
2139 instanceKlassHandle ik(THREAD, k); |
2110 int length = (inner_class_list == NULL) ? 0 : inner_class_list->length(); |
2140 InnerClassesIterator iter(ik); |
2111 assert (length % instanceKlass::inner_class_next_offset == 0, "just checking"); |
2141 for (; !iter.done(); iter.next()) { |
2112 if (length > 0) { |
2142 int ioff = iter.inner_class_info_index(); |
2113 typeArrayHandle inner_class_list_h(THREAD, inner_class_list); |
2143 // Inner class attribute can be zero, skip it. |
2114 instanceKlassHandle ik(THREAD, k); |
2144 // Strange but true: JVM spec. allows null inner class refs. |
2115 for (int i = 0; i < length; i += instanceKlass::inner_class_next_offset) { |
2145 if (ioff == 0) continue; |
2116 int ioff = inner_class_list_h->ushort_at( |
2146 |
2117 i + instanceKlass::inner_class_inner_class_info_offset); |
2147 // only look at classes that are already loaded |
2118 |
2148 // since we are looking for the flags for our self. |
2119 // Inner class attribute can be zero, skip it. |
2149 Symbol* inner_name = ik->constants()->klass_name_at(ioff); |
2120 // Strange but true: JVM spec. allows null inner class refs. |
2150 if ((ik->name() == inner_name)) { |
2121 if (ioff == 0) continue; |
2151 // This is really a member class. |
2122 |
2152 access = iter.inner_access_flags(); |
2123 // only look at classes that are already loaded |
2153 break; |
2124 // since we are looking for the flags for our self. |
|
2125 Symbol* inner_name = ik->constants()->klass_name_at(ioff); |
|
2126 if ((ik->name() == inner_name)) { |
|
2127 // This is really a member class. |
|
2128 access = inner_class_list_h->ushort_at(i + instanceKlass::inner_class_access_flags_offset); |
|
2129 break; |
|
2130 } |
|
2131 } |
2154 } |
2132 } |
2155 } |
2133 // Remember to strip ACC_SUPER bit |
2156 // Remember to strip ACC_SUPER bit |
2134 return (access & (~JVM_ACC_SUPER)) & JVM_ACC_WRITTEN_FLAGS; |
2157 return (access & (~JVM_ACC_SUPER)) & JVM_ACC_WRITTEN_FLAGS; |
2135 } |
2158 } |