< prev index next >

src/share/vm/classfile/classFileParser.cpp

Print this page
rev 4133 : 8159503: Amend Annotation Actions
Reviewed-by: rprotacio
rev 4134 : 7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
Summary: Change constMethodOop::_exception_table to optionally inlined u2 table.
Reviewed-by: bdelsart, coleenp, kamg


1229         }
1230       }
1231     }
1232     if (dup) {
1233       classfile_parse_error("Duplicate field name&signature in class file %s",
1234                             CHECK_(nullHandle));
1235     }
1236   }
1237 
1238   return fields;
1239 }
1240 
1241 
1242 static void copy_u2_with_conversion(u2* dest, u2* src, int length) {
1243   while (length-- > 0) {
1244     *dest++ = Bytes::get_Java_u2((u1*) (src++));
1245   }
1246 }
1247 
1248 
1249 typeArrayHandle ClassFileParser::parse_exception_table(u4 code_length,
1250                                                        u4 exception_table_length,
1251                                                        constantPoolHandle cp,
1252                                                        TRAPS) {
1253   ClassFileStream* cfs = stream();
1254   typeArrayHandle nullHandle;
1255 
1256   // 4-tuples of ints [start_pc, end_pc, handler_pc, catch_type index]
1257   typeArrayOop eh = oopFactory::new_permanent_intArray(exception_table_length*4, CHECK_(nullHandle));
1258   typeArrayHandle exception_handlers = typeArrayHandle(THREAD, eh);
1259 
1260   int index = 0;
1261   cfs->guarantee_more(8 * exception_table_length, CHECK_(nullHandle)); // start_pc, end_pc, handler_pc, catch_type_index



1262   for (unsigned int i = 0; i < exception_table_length; i++) {
1263     u2 start_pc = cfs->get_u2_fast();
1264     u2 end_pc = cfs->get_u2_fast();
1265     u2 handler_pc = cfs->get_u2_fast();
1266     u2 catch_type_index = cfs->get_u2_fast();
1267     // Will check legal target after parsing code array in verifier.
1268     if (_need_verify) {
1269       guarantee_property((start_pc < end_pc) && (end_pc <= code_length),
1270                          "Illegal exception table range in class file %s", CHECK_(nullHandle));

1271       guarantee_property(handler_pc < code_length,
1272                          "Illegal exception table handler in class file %s", CHECK_(nullHandle));

1273       if (catch_type_index != 0) {
1274         guarantee_property(valid_cp_range(catch_type_index, cp->length()) &&
1275                            is_klass_reference(cp, catch_type_index),
1276                            "Catch type in exception table has bad constant type in class file %s", CHECK_(nullHandle));
1277       }
1278     }
1279     exception_handlers->int_at_put(index++, start_pc);
1280     exception_handlers->int_at_put(index++, end_pc);
1281     exception_handlers->int_at_put(index++, handler_pc);
1282     exception_handlers->int_at_put(index++, catch_type_index);
1283   }
1284   return exception_handlers;
1285 }
1286 
1287 void ClassFileParser::parse_linenumber_table(
1288     u4 code_attribute_length, u4 code_length,
1289     CompressedLineNumberWriteStream** write_stream, TRAPS) {
1290   ClassFileStream* cfs = stream();
1291   unsigned int num_entries = cfs->get_u2(CHECK);
1292 
1293   // Each entry is a u2 start_pc, and a u2 line_number
1294   unsigned int length_in_bytes = num_entries * (sizeof(u2) + sizeof(u2));
1295 
1296   // Verify line number attribute and table length
1297   check_property(
1298     code_attribute_length == sizeof(u2) + length_in_bytes,
1299     "LineNumberTable attribute has wrong length in class file %s", CHECK);
1300 
1301   cfs->guarantee_more(length_in_bytes, CHECK);
1302 
1303   if ((*write_stream) == NULL) {
1304     if (length_in_bytes > fixed_buffer_size) {


1657     verify_legal_method_modifiers(flags, is_interface, name, CHECK_(nullHandle));
1658   }
1659 
1660   int args_size = -1;  // only used when _need_verify is true
1661   if (_need_verify) {
1662     args_size = ((flags & JVM_ACC_STATIC) ? 0 : 1) +
1663                  verify_legal_method_signature(name, signature, CHECK_(nullHandle));
1664     if (args_size > MAX_ARGS_SIZE) {
1665       classfile_parse_error("Too many arguments in method signature in class file %s", CHECK_(nullHandle));
1666     }
1667   }
1668 
1669   access_flags.set_flags(flags & JVM_RECOGNIZED_METHOD_MODIFIERS);
1670 
1671   // Default values for code and exceptions attribute elements
1672   u2 max_stack = 0;
1673   u2 max_locals = 0;
1674   u4 code_length = 0;
1675   u1* code_start = 0;
1676   u2 exception_table_length = 0;

1677   typeArrayHandle exception_handlers(THREAD, Universe::the_empty_int_array());
1678   u2 checked_exceptions_length = 0;
1679   u2* checked_exceptions_start = NULL;
1680   CompressedLineNumberWriteStream* linenumber_table = NULL;
1681   int linenumber_table_length = 0;
1682   int total_lvt_length = 0;
1683   u2 lvt_cnt = 0;
1684   u2 lvtt_cnt = 0;
1685   bool lvt_allocated = false;
1686   u2 max_lvt_cnt = INITIAL_MAX_LVT_NUMBER;
1687   u2 max_lvtt_cnt = INITIAL_MAX_LVT_NUMBER;
1688   u2* localvariable_table_length;
1689   u2** localvariable_table_start;
1690   u2* localvariable_type_table_length;
1691   u2** localvariable_type_table_start;
1692   bool parsed_code_attribute = false;
1693   bool parsed_checked_exceptions_attribute = false;
1694   bool parsed_stackmap_attribute = false;
1695   // stackmap attribute - JDK1.5
1696   typeArrayHandle stackmap_data;


1743         max_locals = cfs->get_u2_fast();
1744         code_length = cfs->get_u4_fast();
1745       }
1746       if (_need_verify) {
1747         guarantee_property(args_size <= max_locals,
1748                            "Arguments can't fit into locals in class file %s", CHECK_(nullHandle));
1749         guarantee_property(code_length > 0 && code_length <= MAX_CODE_SIZE,
1750                            "Invalid method Code length %u in class file %s",
1751                            code_length, CHECK_(nullHandle));
1752       }
1753       // Code pointer
1754       code_start = cfs->get_u1_buffer();
1755       assert(code_start != NULL, "null code start");
1756       cfs->guarantee_more(code_length, CHECK_(nullHandle));
1757       cfs->skip_u1_fast(code_length);
1758 
1759       // Exception handler table
1760       cfs->guarantee_more(2, CHECK_(nullHandle));  // exception_table_length
1761       exception_table_length = cfs->get_u2_fast();
1762       if (exception_table_length > 0) {
1763         exception_handlers =
1764               parse_exception_table(code_length, exception_table_length, cp, CHECK_(nullHandle));
1765       }
1766 
1767       // Parse additional attributes in code attribute
1768       cfs->guarantee_more(2, CHECK_(nullHandle));  // code_attributes_count
1769       u2 code_attributes_count = cfs->get_u2_fast();
1770 
1771       unsigned int calculated_attribute_length = 0;
1772 
1773       if (_major_version > 45 || (_major_version == 45 && _minor_version > 2)) {
1774         calculated_attribute_length =
1775             sizeof(max_stack) + sizeof(max_locals) + sizeof(code_length);
1776       } else {
1777         // max_stack, locals and length are smaller in pre-version 45.2 classes
1778         calculated_attribute_length = sizeof(u1) + sizeof(u1) + sizeof(u2);
1779       }
1780       calculated_attribute_length +=
1781         code_length +
1782         sizeof(exception_table_length) +
1783         sizeof(code_attributes_count) +


1946         cfs->skip_u1(method_attribute_length, CHECK_(nullHandle));
1947       }
1948     } else {
1949       // Skip unknown attributes
1950       cfs->skip_u1(method_attribute_length, CHECK_(nullHandle));
1951     }
1952   }
1953 
1954   if (linenumber_table != NULL) {
1955     linenumber_table->write_terminator();
1956     linenumber_table_length = linenumber_table->position();
1957   }
1958 
1959   // Make sure there's at least one Code attribute in non-native/non-abstract method
1960   if (_need_verify) {
1961     guarantee_property(access_flags.is_native() || access_flags.is_abstract() || parsed_code_attribute,
1962                       "Absent Code attribute in method that is not native or abstract in class file %s", CHECK_(nullHandle));
1963   }
1964 
1965   // All sizing information for a methodOop is finally available, now create it
1966   methodOop m_oop  = oopFactory::new_method(code_length, access_flags, linenumber_table_length,
1967                                             total_lvt_length, checked_exceptions_length,
1968                                             oopDesc::IsSafeConc, CHECK_(nullHandle));




1969   methodHandle m (THREAD, m_oop);
1970 
1971   ClassLoadingService::add_class_method_size(m_oop->size()*HeapWordSize);
1972 
1973   // Fill in information from fixed part (access_flags already set)
1974   m->set_constants(cp());
1975   m->set_name_index(name_index);
1976   m->set_signature_index(signature_index);
1977   m->set_generic_signature_index(generic_signature_index);
1978 
1979   ResultTypeFinder rtf(cp->symbol_at(signature_index));
1980   m->constMethod()->set_result_type(rtf.type());
1981 
1982   if (args_size >= 0) {
1983     m->set_size_of_parameters(args_size);
1984   } else {
1985     m->compute_size_of_parameters(THREAD);
1986   }
1987 #ifdef ASSERT
1988   if (args_size >= 0) {
1989     m->compute_size_of_parameters(THREAD);
1990     assert(args_size == m->size_of_parameters(), "");
1991   }
1992 #endif
1993 
1994   // Fill in code attribute information
1995   m->set_max_stack(max_stack);
1996   m->set_max_locals(max_locals);
1997   m->constMethod()->set_stackmap_data(stackmap_data());
1998 
1999   /**
2000    * The exception_table field is the flag used to indicate
2001    * that the methodOop and it's associated constMethodOop are partially
2002    * initialized and thus are exempt from pre/post GC verification.  Once
2003    * the field is set, the oops are considered fully initialized so make
2004    * sure that the oops can pass verification when this field is set.
2005    */
2006   m->set_exception_table(exception_handlers());
2007 
2008   // Copy byte codes
2009   m->set_code(code_start);
2010 
2011   // Copy line number table
2012   if (linenumber_table != NULL) {
2013     memcpy(m->compressed_linenumber_table(),
2014            linenumber_table->buffer(), linenumber_table_length);
2015   }
2016 








2017   // Copy checked exceptions
2018   if (checked_exceptions_length > 0) {
2019     int size = checked_exceptions_length * sizeof(CheckedExceptionElement) / sizeof(u2);
2020     copy_u2_with_conversion((u2*) m->checked_exceptions_start(), checked_exceptions_start, size);
2021   }
2022 
2023   /* Copy class file LVT's/LVTT's into the HotSpot internal LVT.
2024    *
2025    * Rules for LVT's and LVTT's are:
2026    *   - There can be any number of LVT's and LVTT's.
2027    *   - If there are n LVT's, it is the same as if there was just
2028    *     one LVT containing all the entries from the n LVT's.
2029    *   - There may be no more than one LVT entry per local variable.
2030    *     Two LVT entries are 'equal' if these fields are the same:
2031    *        start_pc, length, name, slot
2032    *   - There may be no more than one LVTT entry per each LVT entry.
2033    *     Each LVTT entry has to match some LVT entry.
2034    *   - HotSpot internal LVT keeps natural ordering of class file LVT entries.
2035    */
2036   if (total_lvt_length > 0) {


2897     bool has_final_method = false;
2898     AccessFlags promoted_flags;
2899     promoted_flags.set_flags(0);
2900     // These need to be oop pointers because they are allocated lazily
2901     // inside parse_methods inside a nested HandleMark
2902     objArrayOop methods_annotations_oop = NULL;
2903     objArrayOop methods_parameter_annotations_oop = NULL;
2904     objArrayOop methods_default_annotations_oop = NULL;
2905     objArrayHandle methods = parse_methods(cp, access_flags.is_interface(),
2906                                            &promoted_flags,
2907                                            &has_final_method,
2908                                            &methods_annotations_oop,
2909                                            &methods_parameter_annotations_oop,
2910                                            &methods_default_annotations_oop,
2911                                            CHECK_(nullHandle));
2912 
2913     objArrayHandle methods_annotations(THREAD, methods_annotations_oop);
2914     objArrayHandle methods_parameter_annotations(THREAD, methods_parameter_annotations_oop);
2915     objArrayHandle methods_default_annotations(THREAD, methods_default_annotations_oop);
2916 





2917     // We check super class after class file is parsed and format is checked
2918     if (super_class_index > 0 && super_klass.is_null()) {
2919       Symbol*  sk  = cp->klass_name_at(super_class_index);
2920       if (access_flags.is_interface()) {
2921         // Before attempting to resolve the superclass, check for class format
2922         // errors not checked yet.
2923         guarantee_property(sk == vmSymbols::java_lang_Object(),
2924                            "Interfaces must have java.lang.Object as superclass in class file %s",
2925                            CHECK_(nullHandle));
2926       }
2927       klassOop k = SystemDictionary::resolve_super_or_fail(class_name,
2928                                                            sk,
2929                                                            class_loader,
2930                                                            protection_domain,
2931                                                            true,
2932                                                            CHECK_(nullHandle));
2933 
2934       KlassHandle kh (THREAD, k);
2935       super_klass = instanceKlassHandle(THREAD, kh());
2936       if (LinkWellKnownClasses)  // my super class is well known to me




1229         }
1230       }
1231     }
1232     if (dup) {
1233       classfile_parse_error("Duplicate field name&signature in class file %s",
1234                             CHECK_(nullHandle));
1235     }
1236   }
1237 
1238   return fields;
1239 }
1240 
1241 
1242 static void copy_u2_with_conversion(u2* dest, u2* src, int length) {
1243   while (length-- > 0) {
1244     *dest++ = Bytes::get_Java_u2((u1*) (src++));
1245   }
1246 }
1247 
1248 
1249 u2* ClassFileParser::parse_exception_table(u4 code_length,
1250                                            u4 exception_table_length,
1251                                            constantPoolHandle cp,
1252                                            TRAPS) {
1253   ClassFileStream* cfs = stream();





1254 
1255   u2* exception_table_start = cfs->get_u2_buffer();
1256   assert(exception_table_start != NULL, "null exception table");
1257   cfs->guarantee_more(8 * exception_table_length, CHECK_NULL); // start_pc, end_pc, handler_pc, catch_type_index
1258   // Will check legal target after parsing code array in verifier.
1259   if (_need_verify) {
1260     for (unsigned int i = 0; i < exception_table_length; i++) {
1261       u2 start_pc = cfs->get_u2_fast();
1262       u2 end_pc = cfs->get_u2_fast();
1263       u2 handler_pc = cfs->get_u2_fast();
1264       u2 catch_type_index = cfs->get_u2_fast();


1265       guarantee_property((start_pc < end_pc) && (end_pc <= code_length),
1266                          "Illegal exception table range in class file %s",
1267                          CHECK_NULL);
1268       guarantee_property(handler_pc < code_length,
1269                          "Illegal exception table handler in class file %s",
1270                          CHECK_NULL);
1271       if (catch_type_index != 0) {
1272         guarantee_property(valid_cp_range(catch_type_index, cp->length()) &&
1273                            is_klass_reference(cp, catch_type_index),
1274                            "Catch type in exception table has bad constant type in class file %s", CHECK_NULL);
1275       }
1276     }
1277   } else {
1278     cfs->skip_u2_fast(exception_table_length * 4);


1279   }
1280   return exception_table_start;
1281 }
1282 
1283 void ClassFileParser::parse_linenumber_table(
1284     u4 code_attribute_length, u4 code_length,
1285     CompressedLineNumberWriteStream** write_stream, TRAPS) {
1286   ClassFileStream* cfs = stream();
1287   unsigned int num_entries = cfs->get_u2(CHECK);
1288 
1289   // Each entry is a u2 start_pc, and a u2 line_number
1290   unsigned int length_in_bytes = num_entries * (sizeof(u2) + sizeof(u2));
1291 
1292   // Verify line number attribute and table length
1293   check_property(
1294     code_attribute_length == sizeof(u2) + length_in_bytes,
1295     "LineNumberTable attribute has wrong length in class file %s", CHECK);
1296 
1297   cfs->guarantee_more(length_in_bytes, CHECK);
1298 
1299   if ((*write_stream) == NULL) {
1300     if (length_in_bytes > fixed_buffer_size) {


1653     verify_legal_method_modifiers(flags, is_interface, name, CHECK_(nullHandle));
1654   }
1655 
1656   int args_size = -1;  // only used when _need_verify is true
1657   if (_need_verify) {
1658     args_size = ((flags & JVM_ACC_STATIC) ? 0 : 1) +
1659                  verify_legal_method_signature(name, signature, CHECK_(nullHandle));
1660     if (args_size > MAX_ARGS_SIZE) {
1661       classfile_parse_error("Too many arguments in method signature in class file %s", CHECK_(nullHandle));
1662     }
1663   }
1664 
1665   access_flags.set_flags(flags & JVM_RECOGNIZED_METHOD_MODIFIERS);
1666 
1667   // Default values for code and exceptions attribute elements
1668   u2 max_stack = 0;
1669   u2 max_locals = 0;
1670   u4 code_length = 0;
1671   u1* code_start = 0;
1672   u2 exception_table_length = 0;
1673   u2* exception_table_start = NULL;
1674   typeArrayHandle exception_handlers(THREAD, Universe::the_empty_int_array());
1675   u2 checked_exceptions_length = 0;
1676   u2* checked_exceptions_start = NULL;
1677   CompressedLineNumberWriteStream* linenumber_table = NULL;
1678   int linenumber_table_length = 0;
1679   int total_lvt_length = 0;
1680   u2 lvt_cnt = 0;
1681   u2 lvtt_cnt = 0;
1682   bool lvt_allocated = false;
1683   u2 max_lvt_cnt = INITIAL_MAX_LVT_NUMBER;
1684   u2 max_lvtt_cnt = INITIAL_MAX_LVT_NUMBER;
1685   u2* localvariable_table_length;
1686   u2** localvariable_table_start;
1687   u2* localvariable_type_table_length;
1688   u2** localvariable_type_table_start;
1689   bool parsed_code_attribute = false;
1690   bool parsed_checked_exceptions_attribute = false;
1691   bool parsed_stackmap_attribute = false;
1692   // stackmap attribute - JDK1.5
1693   typeArrayHandle stackmap_data;


1740         max_locals = cfs->get_u2_fast();
1741         code_length = cfs->get_u4_fast();
1742       }
1743       if (_need_verify) {
1744         guarantee_property(args_size <= max_locals,
1745                            "Arguments can't fit into locals in class file %s", CHECK_(nullHandle));
1746         guarantee_property(code_length > 0 && code_length <= MAX_CODE_SIZE,
1747                            "Invalid method Code length %u in class file %s",
1748                            code_length, CHECK_(nullHandle));
1749       }
1750       // Code pointer
1751       code_start = cfs->get_u1_buffer();
1752       assert(code_start != NULL, "null code start");
1753       cfs->guarantee_more(code_length, CHECK_(nullHandle));
1754       cfs->skip_u1_fast(code_length);
1755 
1756       // Exception handler table
1757       cfs->guarantee_more(2, CHECK_(nullHandle));  // exception_table_length
1758       exception_table_length = cfs->get_u2_fast();
1759       if (exception_table_length > 0) {
1760         exception_table_start =
1761               parse_exception_table(code_length, exception_table_length, cp, CHECK_(nullHandle));
1762       }
1763 
1764       // Parse additional attributes in code attribute
1765       cfs->guarantee_more(2, CHECK_(nullHandle));  // code_attributes_count
1766       u2 code_attributes_count = cfs->get_u2_fast();
1767 
1768       unsigned int calculated_attribute_length = 0;
1769 
1770       if (_major_version > 45 || (_major_version == 45 && _minor_version > 2)) {
1771         calculated_attribute_length =
1772             sizeof(max_stack) + sizeof(max_locals) + sizeof(code_length);
1773       } else {
1774         // max_stack, locals and length are smaller in pre-version 45.2 classes
1775         calculated_attribute_length = sizeof(u1) + sizeof(u1) + sizeof(u2);
1776       }
1777       calculated_attribute_length +=
1778         code_length +
1779         sizeof(exception_table_length) +
1780         sizeof(code_attributes_count) +


1943         cfs->skip_u1(method_attribute_length, CHECK_(nullHandle));
1944       }
1945     } else {
1946       // Skip unknown attributes
1947       cfs->skip_u1(method_attribute_length, CHECK_(nullHandle));
1948     }
1949   }
1950 
1951   if (linenumber_table != NULL) {
1952     linenumber_table->write_terminator();
1953     linenumber_table_length = linenumber_table->position();
1954   }
1955 
1956   // Make sure there's at least one Code attribute in non-native/non-abstract method
1957   if (_need_verify) {
1958     guarantee_property(access_flags.is_native() || access_flags.is_abstract() || parsed_code_attribute,
1959                       "Absent Code attribute in method that is not native or abstract in class file %s", CHECK_(nullHandle));
1960   }
1961 
1962   // All sizing information for a methodOop is finally available, now create it
1963   methodOop m_oop  = oopFactory::new_method(code_length, access_flags,
1964                                             linenumber_table_length,
1965                                             total_lvt_length,
1966                                             exception_table_length,
1967                                             checked_exceptions_length,
1968                                             oopDesc::IsSafeConc,
1969                                             CHECK_(nullHandle));
1970   methodHandle m (THREAD, m_oop);
1971 
1972   ClassLoadingService::add_class_method_size(m_oop->size()*HeapWordSize);
1973 
1974   // Fill in information from fixed part (access_flags already set)
1975   m->set_constants(cp());
1976   m->set_name_index(name_index);
1977   m->set_signature_index(signature_index);
1978   m->set_generic_signature_index(generic_signature_index);
1979 
1980   ResultTypeFinder rtf(cp->symbol_at(signature_index));
1981   m->constMethod()->set_result_type(rtf.type());
1982 
1983   if (args_size >= 0) {
1984     m->set_size_of_parameters(args_size);
1985   } else {
1986     m->compute_size_of_parameters(THREAD);
1987   }
1988 #ifdef ASSERT
1989   if (args_size >= 0) {
1990     m->compute_size_of_parameters(THREAD);
1991     assert(args_size == m->size_of_parameters(), "");
1992   }
1993 #endif
1994 
1995   // Fill in code attribute information
1996   m->set_max_stack(max_stack);
1997   m->set_max_locals(max_locals);

1998 
1999   /**
2000    * The stackmap_data field is the flag used to indicate
2001    * that the methodOop and it's associated constMethodOop are partially
2002    * initialized and thus are exempt from pre/post GC verification.  Once
2003    * the field is set, the oops are considered fully initialized so make
2004    * sure that the oops can pass verification when this field is set.
2005    */
2006   m->constMethod()->set_stackmap_data(stackmap_data());
2007 
2008   // Copy byte codes
2009   m->set_code(code_start);
2010 
2011   // Copy line number table
2012   if (linenumber_table != NULL) {
2013     memcpy(m->compressed_linenumber_table(),
2014            linenumber_table->buffer(), linenumber_table_length);
2015   }
2016 
2017   // Copy exception table
2018   if (exception_table_length > 0) {
2019     int size =
2020       exception_table_length * sizeof(ExceptionTableElement) / sizeof(u2);
2021     copy_u2_with_conversion((u2*) m->exception_table_start(),
2022                              exception_table_start, size);
2023   }
2024 
2025   // Copy checked exceptions
2026   if (checked_exceptions_length > 0) {
2027     int size = checked_exceptions_length * sizeof(CheckedExceptionElement) / sizeof(u2);
2028     copy_u2_with_conversion((u2*) m->checked_exceptions_start(), checked_exceptions_start, size);
2029   }
2030 
2031   /* Copy class file LVT's/LVTT's into the HotSpot internal LVT.
2032    *
2033    * Rules for LVT's and LVTT's are:
2034    *   - There can be any number of LVT's and LVTT's.
2035    *   - If there are n LVT's, it is the same as if there was just
2036    *     one LVT containing all the entries from the n LVT's.
2037    *   - There may be no more than one LVT entry per local variable.
2038    *     Two LVT entries are 'equal' if these fields are the same:
2039    *        start_pc, length, name, slot
2040    *   - There may be no more than one LVTT entry per each LVT entry.
2041    *     Each LVTT entry has to match some LVT entry.
2042    *   - HotSpot internal LVT keeps natural ordering of class file LVT entries.
2043    */
2044   if (total_lvt_length > 0) {


2905     bool has_final_method = false;
2906     AccessFlags promoted_flags;
2907     promoted_flags.set_flags(0);
2908     // These need to be oop pointers because they are allocated lazily
2909     // inside parse_methods inside a nested HandleMark
2910     objArrayOop methods_annotations_oop = NULL;
2911     objArrayOop methods_parameter_annotations_oop = NULL;
2912     objArrayOop methods_default_annotations_oop = NULL;
2913     objArrayHandle methods = parse_methods(cp, access_flags.is_interface(),
2914                                            &promoted_flags,
2915                                            &has_final_method,
2916                                            &methods_annotations_oop,
2917                                            &methods_parameter_annotations_oop,
2918                                            &methods_default_annotations_oop,
2919                                            CHECK_(nullHandle));
2920 
2921     objArrayHandle methods_annotations(THREAD, methods_annotations_oop);
2922     objArrayHandle methods_parameter_annotations(THREAD, methods_parameter_annotations_oop);
2923     objArrayHandle methods_default_annotations(THREAD, methods_default_annotations_oop);
2924 
2925     if (_class_name == vmSymbols::java_lang_Object()) {
2926       check_property(local_interfaces == Universe::the_empty_system_obj_array(),
2927                      "java.lang.Object cannot implement an interface in class file %s",
2928                      CHECK_(nullHandle));
2929     }
2930     // We check super class after class file is parsed and format is checked
2931     if (super_class_index > 0 && super_klass.is_null()) {
2932       Symbol*  sk  = cp->klass_name_at(super_class_index);
2933       if (access_flags.is_interface()) {
2934         // Before attempting to resolve the superclass, check for class format
2935         // errors not checked yet.
2936         guarantee_property(sk == vmSymbols::java_lang_Object(),
2937                            "Interfaces must have java.lang.Object as superclass in class file %s",
2938                            CHECK_(nullHandle));
2939       }
2940       klassOop k = SystemDictionary::resolve_super_or_fail(class_name,
2941                                                            sk,
2942                                                            class_loader,
2943                                                            protection_domain,
2944                                                            true,
2945                                                            CHECK_(nullHandle));
2946 
2947       KlassHandle kh (THREAD, k);
2948       super_klass = instanceKlassHandle(THREAD, kh());
2949       if (LinkWellKnownClasses)  // my super class is well known to me


< prev index next >