< prev index next >

src/hotspot/share/classfile/classFileParser.cpp

Print this page




2987             dup = true;
2988             break;
2989           }
2990         }
2991       }
2992       if (dup) {
2993         classfile_parse_error("Duplicate method name \"%s\" with signature \"%s\" in class file %s",
2994                                name->as_C_string(), sig->as_klass_external_name(), CHECK);
2995       }
2996     }
2997   }
2998 }
2999 
3000 static const intArray* sort_methods(Array<Method*>* methods) {
3001   const int length = methods->length();
3002   // If JVMTI original method ordering or sharing is enabled we have to
3003   // remember the original class file ordering.
3004   // We temporarily use the vtable_index field in the Method* to store the
3005   // class file index, so we can read in after calling qsort.
3006   // Put the method ordering in the shared archive.
3007   if (JvmtiExport::can_maintain_original_method_order() || DumpSharedSpaces) {
3008     for (int index = 0; index < length; index++) {
3009       Method* const m = methods->at(index);
3010       assert(!m->valid_vtable_index(), "vtable index should not be set");
3011       m->set_vtable_index(index);
3012     }
3013   }
3014   // Sort method array by ascending method name (for faster lookups & vtable construction)
3015   // Note that the ordering is not alphabetical, see Symbol::fast_compare
3016   Method::sort_methods(methods);
3017 
3018   intArray* method_ordering = NULL;
3019   // If JVMTI original method ordering or sharing is enabled construct int
3020   // array remembering the original ordering
3021   if (JvmtiExport::can_maintain_original_method_order() || DumpSharedSpaces) {
3022     method_ordering = new intArray(length, length, -1);
3023     for (int index = 0; index < length; index++) {
3024       Method* const m = methods->at(index);
3025       const int old_index = m->vtable_index();
3026       assert(old_index >= 0 && old_index < length, "invalid method index");
3027       method_ordering->at_put(index, old_index);
3028       m->set_vtable_index(Method::invalid_vtable_index);
3029     }
3030   }
3031   return method_ordering;
3032 }
3033 
3034 // Parse generic_signature attribute for methods and fields
3035 u2 ClassFileParser::parse_generic_signature_attribute(const ClassFileStream* const cfs,
3036                                                       TRAPS) {
3037   assert(cfs != NULL, "invariant");
3038 
3039   cfs->guarantee_more(2, CHECK_0);  // generic_signature_index
3040   const u2 generic_signature_index = cfs->get_u2_fast();
3041   check_property(




2987             dup = true;
2988             break;
2989           }
2990         }
2991       }
2992       if (dup) {
2993         classfile_parse_error("Duplicate method name \"%s\" with signature \"%s\" in class file %s",
2994                                name->as_C_string(), sig->as_klass_external_name(), CHECK);
2995       }
2996     }
2997   }
2998 }
2999 
3000 static const intArray* sort_methods(Array<Method*>* methods) {
3001   const int length = methods->length();
3002   // If JVMTI original method ordering or sharing is enabled we have to
3003   // remember the original class file ordering.
3004   // We temporarily use the vtable_index field in the Method* to store the
3005   // class file index, so we can read in after calling qsort.
3006   // Put the method ordering in the shared archive.
3007   if (JvmtiExport::can_maintain_original_method_order() || Arguments::is_dumping_archive()) {
3008     for (int index = 0; index < length; index++) {
3009       Method* const m = methods->at(index);
3010       assert(!m->valid_vtable_index(), "vtable index should not be set");
3011       m->set_vtable_index(index);
3012     }
3013   }
3014   // Sort method array by ascending method name (for faster lookups & vtable construction)
3015   // Note that the ordering is not alphabetical, see Symbol::fast_compare
3016   Method::sort_methods(methods);
3017 
3018   intArray* method_ordering = NULL;
3019   // If JVMTI original method ordering or sharing is enabled construct int
3020   // array remembering the original ordering
3021   if (JvmtiExport::can_maintain_original_method_order() || Arguments::is_dumping_archive()) {
3022     method_ordering = new intArray(length, length, -1);
3023     for (int index = 0; index < length; index++) {
3024       Method* const m = methods->at(index);
3025       const int old_index = m->vtable_index();
3026       assert(old_index >= 0 && old_index < length, "invalid method index");
3027       method_ordering->at_put(index, old_index);
3028       m->set_vtable_index(Method::invalid_vtable_index);
3029     }
3030   }
3031   return method_ordering;
3032 }
3033 
3034 // Parse generic_signature attribute for methods and fields
3035 u2 ClassFileParser::parse_generic_signature_attribute(const ClassFileStream* const cfs,
3036                                                       TRAPS) {
3037   assert(cfs != NULL, "invariant");
3038 
3039   cfs->guarantee_more(2, CHECK_0);  // generic_signature_index
3040   const u2 generic_signature_index = cfs->get_u2_fast();
3041   check_property(


< prev index next >