< prev index next >

src/hotspot/share/cds/classListParser.cpp

Print this page

457   // The only supported platforms are: (1) Linux/64-bit and (2) Solaris/64-bit and
458   // (3) MacOSX/64-bit and (4) Windowss/64-bit
459   // This #if condition should be in sync with the areCustomLoadersSupportedForCDS
460   // method in test/lib/jdk/test/lib/Platform.java.
461   error("AppCDS custom class loaders not supported on this platform");
462 #endif
463 
464   if (!is_super_specified()) {
465     error("If source location is specified, super class must be also specified");
466   }
467   if (!is_id_specified()) {
468     error("If source location is specified, id must be also specified");
469   }
470   if (strncmp(_class_name, "java/", 5) == 0) {
471     log_info(cds)("Prohibited package for non-bootstrap classes: %s.class from %s",
472           _class_name, _source);
473     THROW_NULL(vmSymbols::java_lang_ClassNotFoundException());
474   }
475 
476   InstanceKlass* k = UnregisteredClasses::load_class(class_name, _source, CHECK_NULL);
477   if (k->local_interfaces()->length() != _interfaces->length()) {




478     print_specified_interfaces();
479     print_actual_interfaces(k);
480     error("The number of interfaces (%d) specified in class list does not match the class file (%d)",
481           _interfaces->length(), k->local_interfaces()->length());
482   }
483 
484   assert(k->is_shared_unregistered_class(), "must be");
485 
486   bool added = SystemDictionaryShared::add_unregistered_class(THREAD, k);
487   if (!added) {
488     // We allow only a single unregistered class for each unique name.
489     error("Duplicated class %s", _class_name);
490   }
491 
492   return k;
493 }
494 
495 void ClassListParser::populate_cds_indy_info(const constantPoolHandle &pool, int cp_index, CDSIndyInfo* cii, TRAPS) {
496   // Caller needs to allocate ResourceMark.
497   int type_index = pool->bootstrap_name_and_type_ref_index_at(cp_index);
498   int name_index = pool->name_ref_index_at(type_index);
499   cii->add_item(pool->symbol_at(name_index)->as_C_string());
500   int sig_index = pool->signature_ref_index_at(type_index);
501   cii->add_item(pool->symbol_at(sig_index)->as_C_string());

457   // The only supported platforms are: (1) Linux/64-bit and (2) Solaris/64-bit and
458   // (3) MacOSX/64-bit and (4) Windowss/64-bit
459   // This #if condition should be in sync with the areCustomLoadersSupportedForCDS
460   // method in test/lib/jdk/test/lib/Platform.java.
461   error("AppCDS custom class loaders not supported on this platform");
462 #endif
463 
464   if (!is_super_specified()) {
465     error("If source location is specified, super class must be also specified");
466   }
467   if (!is_id_specified()) {
468     error("If source location is specified, id must be also specified");
469   }
470   if (strncmp(_class_name, "java/", 5) == 0) {
471     log_info(cds)("Prohibited package for non-bootstrap classes: %s.class from %s",
472           _class_name, _source);
473     THROW_NULL(vmSymbols::java_lang_ClassNotFoundException());
474   }
475 
476   InstanceKlass* k = UnregisteredClasses::load_class(class_name, _source, CHECK_NULL);
477   const int actual_num_interfaces = k->local_interfaces()->length();
478   const int specified_num_interfaces = _interfaces->length(); // specified in classlist
479   int expected_num_interfaces = actual_num_interfaces;
480 
481   if (specified_num_interfaces != expected_num_interfaces) {
482     print_specified_interfaces();
483     print_actual_interfaces(k);
484     error("The number of interfaces (%d) specified in class list does not match the class file (%d)",
485           specified_num_interfaces, expected_num_interfaces);
486   }
487 
488   assert(k->is_shared_unregistered_class(), "must be");
489 
490   bool added = SystemDictionaryShared::add_unregistered_class(THREAD, k);
491   if (!added) {
492     // We allow only a single unregistered class for each unique name.
493     error("Duplicated class %s", _class_name);
494   }
495 
496   return k;
497 }
498 
499 void ClassListParser::populate_cds_indy_info(const constantPoolHandle &pool, int cp_index, CDSIndyInfo* cii, TRAPS) {
500   // Caller needs to allocate ResourceMark.
501   int type_index = pool->bootstrap_name_and_type_ref_index_at(cp_index);
502   int name_index = pool->name_ref_index_at(type_index);
503   cii->add_item(pool->symbol_at(name_index)->as_C_string());
504   int sig_index = pool->signature_ref_index_at(type_index);
505   cii->add_item(pool->symbol_at(sig_index)->as_C_string());
< prev index next >