comparison src/share/vm/oops/instanceKlass.cpp @ 5969:6522ad563f99

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