492 // The only supported platforms are: (1) Linux/64-bit and (2) Solaris/64-bit and
493 // (3) MacOSX/64-bit and (4) Windowss/64-bit
494 // This #if condition should be in sync with the areCustomLoadersSupportedForCDS
495 // method in test/lib/jdk/test/lib/Platform.java.
496 error("AppCDS custom class loaders not supported on this platform");
497 #endif
498
499 if (!is_super_specified()) {
500 error("If source location is specified, super class must be also specified");
501 }
502 if (!is_id_specified()) {
503 error("If source location is specified, id must be also specified");
504 }
505 if (strncmp(_class_name, "java/", 5) == 0) {
506 log_info(cds)("Prohibited package for non-bootstrap classes: %s.class from %s",
507 _class_name, _source);
508 THROW_NULL(vmSymbols::java_lang_ClassNotFoundException());
509 }
510
511 InstanceKlass* k = UnregisteredClasses::load_class(class_name, _source, CHECK_NULL);
512 if (k->local_interfaces()->length() != _interfaces->length()) {
513 print_specified_interfaces();
514 print_actual_interfaces(k);
515 error("The number of interfaces (%d) specified in class list does not match the class file (%d)",
516 _interfaces->length(), k->local_interfaces()->length());
517 }
518
519 assert(k->is_shared_unregistered_class(), "must be");
520
521 bool added = SystemDictionaryShared::add_unregistered_class(THREAD, k);
522 if (!added) {
523 // We allow only a single unregistered class for each unique name.
524 error("Duplicated class %s", _class_name);
525 }
526
527 return k;
528 }
529
530 void ClassListParser::populate_cds_indy_info(const constantPoolHandle &pool, int cp_index, CDSIndyInfo* cii, TRAPS) {
531 // Caller needs to allocate ResourceMark.
532 int type_index = pool->bootstrap_name_and_type_ref_index_at(cp_index);
533 int name_index = pool->name_ref_index_at(type_index);
534 cii->add_item(pool->symbol_at(name_index)->as_C_string());
535 int sig_index = pool->signature_ref_index_at(type_index);
536 cii->add_item(pool->symbol_at(sig_index)->as_C_string());
|
492 // The only supported platforms are: (1) Linux/64-bit and (2) Solaris/64-bit and
493 // (3) MacOSX/64-bit and (4) Windowss/64-bit
494 // This #if condition should be in sync with the areCustomLoadersSupportedForCDS
495 // method in test/lib/jdk/test/lib/Platform.java.
496 error("AppCDS custom class loaders not supported on this platform");
497 #endif
498
499 if (!is_super_specified()) {
500 error("If source location is specified, super class must be also specified");
501 }
502 if (!is_id_specified()) {
503 error("If source location is specified, id must be also specified");
504 }
505 if (strncmp(_class_name, "java/", 5) == 0) {
506 log_info(cds)("Prohibited package for non-bootstrap classes: %s.class from %s",
507 _class_name, _source);
508 THROW_NULL(vmSymbols::java_lang_ClassNotFoundException());
509 }
510
511 InstanceKlass* k = UnregisteredClasses::load_class(class_name, _source, CHECK_NULL);
512 const int actual_num_interfaces = k->local_interfaces()->length();
513 const int specified_num_interfaces = _interfaces->length(); // specified in classlist
514 int expected_num_interfaces = actual_num_interfaces;
515
516 if (specified_num_interfaces != expected_num_interfaces) {
517 print_specified_interfaces();
518 print_actual_interfaces(k);
519 error("The number of interfaces (%d) specified in class list does not match the class file (%d)",
520 specified_num_interfaces, expected_num_interfaces);
521 }
522
523 assert(k->is_shared_unregistered_class(), "must be");
524
525 bool added = SystemDictionaryShared::add_unregistered_class(THREAD, k);
526 if (!added) {
527 // We allow only a single unregistered class for each unique name.
528 error("Duplicated class %s", _class_name);
529 }
530
531 return k;
532 }
533
534 void ClassListParser::populate_cds_indy_info(const constantPoolHandle &pool, int cp_index, CDSIndyInfo* cii, TRAPS) {
535 // Caller needs to allocate ResourceMark.
536 int type_index = pool->bootstrap_name_and_type_ref_index_at(cp_index);
537 int name_index = pool->name_ref_index_at(type_index);
538 cii->add_item(pool->symbol_at(name_index)->as_C_string());
539 int sig_index = pool->signature_ref_index_at(type_index);
540 cii->add_item(pool->symbol_at(sig_index)->as_C_string());
|