comparison src/share/vm/classfile/classFileParser.cpp @ 17595:3eed8712d410

Merge with jdk8u11-b12
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 12:09:28 +0200
parents 562643f42b65 f0d759a6a230
children 52b4284cb496
comparison
equal deleted inserted replaced
17560:562643f42b65 17595:3eed8712d410
929 if (attribute_length != 2) { 929 if (attribute_length != 2) {
930 classfile_parse_error( 930 classfile_parse_error(
931 "Wrong size %u for field's Signature attribute in class file %s", 931 "Wrong size %u for field's Signature attribute in class file %s",
932 attribute_length, CHECK); 932 attribute_length, CHECK);
933 } 933 }
934 generic_signature_index = cfs->get_u2(CHECK); 934 generic_signature_index = parse_generic_signature_attribute(CHECK);
935 } else if (attribute_name == vmSymbols::tag_runtime_visible_annotations()) { 935 } else if (attribute_name == vmSymbols::tag_runtime_visible_annotations()) {
936 runtime_visible_annotations_length = attribute_length; 936 runtime_visible_annotations_length = attribute_length;
937 runtime_visible_annotations = cfs->get_u1_buffer(); 937 runtime_visible_annotations = cfs->get_u1_buffer();
938 assert(runtime_visible_annotations != NULL, "null visible annotations"); 938 assert(runtime_visible_annotations != NULL, "null visible annotations");
939 parse_annotations(runtime_visible_annotations, 939 parse_annotations(runtime_visible_annotations,
2309 if (method_attribute_length != 2) { 2309 if (method_attribute_length != 2) {
2310 classfile_parse_error( 2310 classfile_parse_error(
2311 "Invalid Signature attribute length %u in class file %s", 2311 "Invalid Signature attribute length %u in class file %s",
2312 method_attribute_length, CHECK_(nullHandle)); 2312 method_attribute_length, CHECK_(nullHandle));
2313 } 2313 }
2314 cfs->guarantee_more(2, CHECK_(nullHandle)); // generic_signature_index 2314 generic_signature_index = parse_generic_signature_attribute(CHECK_(nullHandle));
2315 generic_signature_index = cfs->get_u2_fast();
2316 } else if (method_attribute_name == vmSymbols::tag_runtime_visible_annotations()) { 2315 } else if (method_attribute_name == vmSymbols::tag_runtime_visible_annotations()) {
2317 runtime_visible_annotations_length = method_attribute_length; 2316 runtime_visible_annotations_length = method_attribute_length;
2318 runtime_visible_annotations = cfs->get_u1_buffer(); 2317 runtime_visible_annotations = cfs->get_u1_buffer();
2319 assert(runtime_visible_annotations != NULL, "null visible annotations"); 2318 assert(runtime_visible_annotations != NULL, "null visible annotations");
2320 parse_annotations(runtime_visible_annotations, 2319 parse_annotations(runtime_visible_annotations,
2620 } 2619 }
2621 } 2620 }
2622 return method_ordering; 2621 return method_ordering;
2623 } 2622 }
2624 2623
2624 // Parse generic_signature attribute for methods and fields
2625 u2 ClassFileParser::parse_generic_signature_attribute(TRAPS) {
2626 ClassFileStream* cfs = stream();
2627 cfs->guarantee_more(2, CHECK_0); // generic_signature_index
2628 u2 generic_signature_index = cfs->get_u2_fast();
2629 check_property(
2630 valid_symbol_at(generic_signature_index),
2631 "Invalid Signature attribute at constant pool index %u in class file %s",
2632 generic_signature_index, CHECK_0);
2633 return generic_signature_index;
2634 }
2625 2635
2626 void ClassFileParser::parse_classfile_sourcefile_attribute(TRAPS) { 2636 void ClassFileParser::parse_classfile_sourcefile_attribute(TRAPS) {
2627 ClassFileStream* cfs = stream(); 2637 ClassFileStream* cfs = stream();
2628 cfs->guarantee_more(2, CHECK); // sourcefile_index 2638 cfs->guarantee_more(2, CHECK); // sourcefile_index
2629 u2 sourcefile_index = cfs->get_u2_fast(); 2639 u2 sourcefile_index = cfs->get_u2_fast();
2774 2784
2775 void ClassFileParser::parse_classfile_bootstrap_methods_attribute(u4 attribute_byte_length, TRAPS) { 2785 void ClassFileParser::parse_classfile_bootstrap_methods_attribute(u4 attribute_byte_length, TRAPS) {
2776 ClassFileStream* cfs = stream(); 2786 ClassFileStream* cfs = stream();
2777 u1* current_start = cfs->current(); 2787 u1* current_start = cfs->current();
2778 2788
2779 cfs->guarantee_more(2, CHECK); // length
2780 int attribute_array_length = cfs->get_u2_fast();
2781
2782 guarantee_property(_max_bootstrap_specifier_index < attribute_array_length,
2783 "Short length on BootstrapMethods in class file %s",
2784 CHECK);
2785
2786 guarantee_property(attribute_byte_length > sizeof(u2), 2789 guarantee_property(attribute_byte_length > sizeof(u2),
2787 "Invalid BootstrapMethods attribute length %u in class file %s", 2790 "Invalid BootstrapMethods attribute length %u in class file %s",
2788 attribute_byte_length, 2791 attribute_byte_length,
2792 CHECK);
2793
2794 cfs->guarantee_more(attribute_byte_length, CHECK);
2795
2796 int attribute_array_length = cfs->get_u2_fast();
2797
2798 guarantee_property(_max_bootstrap_specifier_index < attribute_array_length,
2799 "Short length on BootstrapMethods in class file %s",
2789 CHECK); 2800 CHECK);
2790 2801
2791 // The attribute contains a counted array of counted tuples of shorts, 2802 // The attribute contains a counted array of counted tuples of shorts,
2792 // represending bootstrap specifiers: 2803 // represending bootstrap specifiers:
2793 // length*{bootstrap_method_index, argument_count*{argument_index}} 2804 // length*{bootstrap_method_index, argument_count*{argument_index}}