src/share/vm/oops/instanceKlass.cpp

Print this page

        

*** 1130,1139 **** --- 1130,1171 ---- probe = jni_id_for_impl(this->as_klassOop(), offset); } return probe; } + u2 instanceKlass::enclosing_method_data(int offset) { + typeArrayOop inner_class_list = inner_classes(); + if (inner_class_list == NULL) { + return 0; + } + int length = inner_class_list->length(); + if (length % inner_class_next_offset == 0) { + return 0; + } else { + EXCEPTION_MARK; + int index = length - enclosing_method_attribute_size; + typeArrayHandle inner_class_list_h(THREAD, inner_class_list); + assert(offset < enclosing_method_attribute_size, "invalid offset"); + return inner_class_list_h->ushort_at(index + offset); + } + } + + void instanceKlass::set_enclosing_method_indices(u2 class_index, + u2 method_index) { + EXCEPTION_MARK; + typeArrayOop inner_class_list = inner_classes(); + assert (inner_class_list != NULL, "_inner_classes list is not set up"); + int length = inner_class_list->length(); + assert (length % inner_class_next_offset == enclosing_method_attribute_size, + "Incorrect _inner_classes array length"); + int index = length - enclosing_method_attribute_size; + typeArrayHandle inner_class_list_h(THREAD, inner_class_list); + inner_class_list_h->ushort_at_put( + index + enclosing_method_class_index_offset, class_index); + inner_class_list_h->ushort_at_put( + index + enclosing_method_method_index_offset, method_index); + } // Lookup or create a jmethodID. // This code is called by the VMThread and JavaThreads so the // locking has to be done very carefully to avoid deadlocks // and/or other cache consistency problems.
*** 2106,2120 **** jint access = access_flags().as_int(); // But check if it happens to be member class. typeArrayOop inner_class_list = inner_classes(); int length = (inner_class_list == NULL) ? 0 : inner_class_list->length(); ! assert (length % instanceKlass::inner_class_next_offset == 0, "just checking"); if (length > 0) { typeArrayHandle inner_class_list_h(THREAD, inner_class_list); instanceKlassHandle ik(THREAD, k); for (int i = 0; i < length; i += instanceKlass::inner_class_next_offset) { int ioff = inner_class_list_h->ushort_at( i + instanceKlass::inner_class_inner_class_info_offset); // Inner class attribute can be zero, skip it. // Strange but true: JVM spec. allows null inner class refs. --- 2138,2157 ---- jint access = access_flags().as_int(); // But check if it happens to be member class. typeArrayOop inner_class_list = inner_classes(); int length = (inner_class_list == NULL) ? 0 : inner_class_list->length(); ! assert ((length % instanceKlass::inner_class_next_offset == 0 || ! length % instanceKlass::inner_class_next_offset == instanceKlass::enclosing_method_attribute_size), ! "just checking"); if (length > 0) { typeArrayHandle inner_class_list_h(THREAD, inner_class_list); instanceKlassHandle ik(THREAD, k); for (int i = 0; i < length; i += instanceKlass::inner_class_next_offset) { + if (i == length - instanceKlass::enclosing_method_attribute_size) { + break; + } int ioff = inner_class_list_h->ushort_at( i + instanceKlass::inner_class_inner_class_info_offset); // Inner class attribute can be zero, skip it. // Strange but true: JVM spec. allows null inner class refs.