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