hotspot/src/share/vm/classfile/classFileParser.cpp
changeset 17080 9151a26f5888
parent 17024 49cbeca23983
child 17374 a0b5154f6f6f
child 17380 6246161bd4b6
equal deleted inserted replaced
17079:45dbf28e160b 17080:9151a26f5888
  2025   u2* localvariable_type_table_length;
  2025   u2* localvariable_type_table_length;
  2026   u2** localvariable_type_table_start;
  2026   u2** localvariable_type_table_start;
  2027   u2 method_parameters_length = 0;
  2027   u2 method_parameters_length = 0;
  2028   u1* method_parameters_data = NULL;
  2028   u1* method_parameters_data = NULL;
  2029   bool method_parameters_seen = false;
  2029   bool method_parameters_seen = false;
  2030   bool method_parameters_four_byte_flags;
       
  2031   bool parsed_code_attribute = false;
  2030   bool parsed_code_attribute = false;
  2032   bool parsed_checked_exceptions_attribute = false;
  2031   bool parsed_checked_exceptions_attribute = false;
  2033   bool parsed_stackmap_attribute = false;
  2032   bool parsed_stackmap_attribute = false;
  2034   // stackmap attribute - JDK1.5
  2033   // stackmap attribute - JDK1.5
  2035   u1* stackmap_data = NULL;
  2034   u1* stackmap_data = NULL;
  2239       if (method_parameters_seen) {
  2238       if (method_parameters_seen) {
  2240         classfile_parse_error("Multiple MethodParameters attributes in class file %s", CHECK_(nullHandle));
  2239         classfile_parse_error("Multiple MethodParameters attributes in class file %s", CHECK_(nullHandle));
  2241       }
  2240       }
  2242       method_parameters_seen = true;
  2241       method_parameters_seen = true;
  2243       method_parameters_length = cfs->get_u1_fast();
  2242       method_parameters_length = cfs->get_u1_fast();
  2244       // Track the actual size (note: this is written for clarity; a
  2243       if (method_attribute_length != (method_parameters_length * 4u) + 1u) {
  2245       // decent compiler will CSE and constant-fold this into a single
       
  2246       // expression)
       
  2247       // Use the attribute length to figure out the size of flags
       
  2248       if (method_attribute_length == (method_parameters_length * 6u) + 1u) {
       
  2249         method_parameters_four_byte_flags = true;
       
  2250       } else if (method_attribute_length == (method_parameters_length * 4u) + 1u) {
       
  2251         method_parameters_four_byte_flags = false;
       
  2252       } else {
       
  2253         classfile_parse_error(
  2244         classfile_parse_error(
  2254           "Invalid MethodParameters method attribute length %u in class file",
  2245           "Invalid MethodParameters method attribute length %u in class file",
  2255           method_attribute_length, CHECK_(nullHandle));
  2246           method_attribute_length, CHECK_(nullHandle));
  2256       }
  2247       }
  2257       method_parameters_data = cfs->get_u1_buffer();
  2248       method_parameters_data = cfs->get_u1_buffer();
  2258       cfs->skip_u2_fast(method_parameters_length);
  2249       cfs->skip_u2_fast(method_parameters_length);
  2259       if (method_parameters_four_byte_flags) {
  2250       cfs->skip_u2_fast(method_parameters_length);
  2260         cfs->skip_u4_fast(method_parameters_length);
       
  2261       } else {
       
  2262         cfs->skip_u2_fast(method_parameters_length);
       
  2263       }
       
  2264       // ignore this attribute if it cannot be reflected
  2251       // ignore this attribute if it cannot be reflected
  2265       if (!SystemDictionary::Parameter_klass_loaded())
  2252       if (!SystemDictionary::Parameter_klass_loaded())
  2266         method_parameters_length = 0;
  2253         method_parameters_length = 0;
  2267     } else if (method_attribute_name == vmSymbols::tag_synthetic()) {
  2254     } else if (method_attribute_name == vmSymbols::tag_synthetic()) {
  2268       if (method_attribute_length != 0) {
  2255       if (method_attribute_length != 0) {
  2421   if (method_parameters_length > 0) {
  2408   if (method_parameters_length > 0) {
  2422     MethodParametersElement* elem = m->constMethod()->method_parameters_start();
  2409     MethodParametersElement* elem = m->constMethod()->method_parameters_start();
  2423     for (int i = 0; i < method_parameters_length; i++) {
  2410     for (int i = 0; i < method_parameters_length; i++) {
  2424       elem[i].name_cp_index = Bytes::get_Java_u2(method_parameters_data);
  2411       elem[i].name_cp_index = Bytes::get_Java_u2(method_parameters_data);
  2425       method_parameters_data += 2;
  2412       method_parameters_data += 2;
  2426       if (method_parameters_four_byte_flags) {
  2413       elem[i].flags = Bytes::get_Java_u2(method_parameters_data);
  2427         elem[i].flags = Bytes::get_Java_u4(method_parameters_data);
  2414       method_parameters_data += 2;
  2428         method_parameters_data += 4;
       
  2429       } else {
       
  2430         elem[i].flags = Bytes::get_Java_u2(method_parameters_data);
       
  2431         method_parameters_data += 2;
       
  2432       }
       
  2433     }
  2415     }
  2434   }
  2416   }
  2435 
  2417 
  2436   // Copy checked exceptions
  2418   // Copy checked exceptions
  2437   if (checked_exceptions_length > 0) {
  2419   if (checked_exceptions_length > 0) {