src/hotspot/share/classfile/systemDictionaryShared.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File open Sdiff src/hotspot/share/classfile

src/hotspot/share/classfile/systemDictionaryShared.cpp

Print this page
rev 49528 : [mq]: module_path


  75   }
  76 }
  77 
  78 oop SystemDictionaryShared::shared_protection_domain(int index) {
  79   return _shared_protection_domains->obj_at(index);
  80 }
  81 
  82 oop SystemDictionaryShared::shared_jar_url(int index) {
  83   return _shared_jar_urls->obj_at(index);
  84 }
  85 
  86 oop SystemDictionaryShared::shared_jar_manifest(int index) {
  87   return _shared_jar_manifests->obj_at(index);
  88 }
  89 
  90 
  91 Handle SystemDictionaryShared::get_shared_jar_manifest(int shared_path_index, TRAPS) {
  92   Handle empty;
  93   Handle manifest ;
  94   if (shared_jar_manifest(shared_path_index) == NULL) {
  95     SharedClassPathEntryExt* ent = (SharedClassPathEntryExt*)FileMapInfo::shared_classpath(shared_path_index);
  96     long size = ent->manifest_size();
  97     if (size <= 0) {
  98       return empty; // No manifest - return NULL handle
  99     }
 100 
 101     // ByteArrayInputStream bais = new ByteArrayInputStream(buf);
 102     InstanceKlass* bais_klass = SystemDictionary::ByteArrayInputStream_klass();
 103     Handle bais = bais_klass->allocate_instance_handle(CHECK_(empty));
 104     {
 105       const char* src = ent->manifest();
 106       assert(src != NULL, "No Manifest data");
 107       typeArrayOop buf = oopFactory::new_byteArray(size, CHECK_(empty));
 108       typeArrayHandle bufhandle(THREAD, buf);
 109       char* dst = (char*)(buf->byte_at_addr(0));
 110       memcpy(dst, src, (size_t)size);
 111 
 112       JavaValue result(T_VOID);
 113       JavaCalls::call_special(&result, bais, bais_klass,
 114                               vmSymbols::object_initializer_name(),
 115                               vmSymbols::byte_array_void_signature(),


 121     manifest = manifest_klass->allocate_instance_handle(CHECK_(empty));
 122     {
 123       JavaValue result(T_VOID);
 124       JavaCalls::call_special(&result, manifest, manifest_klass,
 125                               vmSymbols::object_initializer_name(),
 126                               vmSymbols::input_stream_void_signature(),
 127                               bais, CHECK_(empty));
 128     }
 129     atomic_set_shared_jar_manifest(shared_path_index, manifest());
 130   }
 131 
 132   manifest = Handle(THREAD, shared_jar_manifest(shared_path_index));
 133   assert(manifest.not_null(), "sanity");
 134   return manifest;
 135 }
 136 
 137 Handle SystemDictionaryShared::get_shared_jar_url(int shared_path_index, TRAPS) {
 138   Handle url_h;
 139   if (shared_jar_url(shared_path_index) == NULL) {
 140     JavaValue result(T_OBJECT);
 141     const char* path = FileMapInfo::shared_classpath_name(shared_path_index);
 142     Handle path_string = java_lang_String::create_from_str(path, CHECK_(url_h));
 143     Klass* classLoaders_klass =
 144         SystemDictionary::jdk_internal_loader_ClassLoaders_klass();
 145         JavaCalls::call_static(&result, classLoaders_klass,
 146                                vmSymbols::toFileURL_name(),
 147                                vmSymbols::toFileURL_signature(),
 148                                path_string, CHECK_(url_h));
 149 
 150     atomic_set_shared_jar_url(shared_path_index, (oop)result.get_jobject());
 151   }
 152 
 153   url_h = Handle(THREAD, shared_jar_url(shared_path_index));
 154   assert(url_h.not_null(), "sanity");
 155   return url_h;
 156 }
 157 
 158 Handle SystemDictionaryShared::get_package_name(Symbol* class_name, TRAPS) {
 159   ResourceMark rm(THREAD);
 160   Handle pkgname_string;
 161   char* pkgname = (char*) ClassLoader::package_from_name((const char*) class_name->as_C_string());


 287       Handle pd = get_protection_domain_from_classloader(class_loader, url, THREAD);
 288       mod->set_shared_protection_domain(loader_data, pd);
 289     }
 290   }
 291 
 292   protection_domain = Handle(THREAD, mod->shared_protection_domain());
 293   assert(protection_domain.not_null(), "sanity");
 294   return protection_domain;
 295 }
 296 
 297 // Initializes the java.lang.Package and java.security.ProtectionDomain objects associated with
 298 // the given InstanceKlass.
 299 // Returns the ProtectionDomain for the InstanceKlass.
 300 Handle SystemDictionaryShared::init_security_info(Handle class_loader, InstanceKlass* ik, TRAPS) {
 301   Handle pd;
 302 
 303   if (ik != NULL) {
 304     int index = ik->shared_classpath_index();
 305     assert(index >= 0, "Sanity");
 306     SharedClassPathEntryExt* ent =
 307             (SharedClassPathEntryExt*)FileMapInfo::shared_classpath(index);
 308     Symbol* class_name = ik->name();
 309 
 310     if (ent->is_modules_image()) {
 311       // For shared app/platform classes originated from the run-time image:
 312       //   The ProtectionDomains are cached in the corresponding ModuleEntries
 313       //   for fast access by the VM.
 314       ResourceMark rm;
 315       ClassLoaderData *loader_data =
 316                 ClassLoaderData::class_loader_data(class_loader());
 317       PackageEntryTable* pkgEntryTable = loader_data->packages();
 318       TempNewSymbol pkg_name = InstanceKlass::package_from_name(class_name, CHECK_(pd));
 319       if (pkg_name != NULL) {
 320         PackageEntry* pkg_entry = pkgEntryTable->lookup_only(pkg_name);
 321         if (pkg_entry != NULL) {
 322           ModuleEntry* mod_entry = pkg_entry->module();
 323           pd = get_shared_protection_domain(class_loader, mod_entry, THREAD);
 324           define_shared_package(class_name, class_loader, mod_entry, CHECK_(pd));
 325         }
 326       }
 327     } else {
 328       // For shared app/platform classes originated from JAR files on the class path:
 329       //   Each of the 3 SystemDictionaryShared::_shared_xxx arrays has the same length
 330       //   as the shared classpath table in the shared archive (see
 331       //   FileMap::_classpath_entry_table in filemap.hpp for details).
 332       //
 333       //   If a shared InstanceKlass k is loaded from the class path, let
 334       //
 335       //     index = k->shared_classpath_index():
 336       //
 337       //   FileMap::_classpath_entry_table[index] identifies the JAR file that contains k.
 338       //
 339       //   k's protection domain is:
 340       //
 341       //     ProtectionDomain pd = _shared_protection_domains[index];
 342       //
 343       //   and k's Package is initialized using
 344       //
 345       //     manifest = _shared_jar_manifests[index];
 346       //     url = _shared_jar_urls[index];
 347       //     define_shared_package(class_name, class_loader, manifest, url, CHECK_(pd));
 348       //
 349       //   Note that if an element of these 3 _shared_xxx arrays is NULL, it will be initialized by
 350       //   the corresponding SystemDictionaryShared::get_shared_xxx() function.
 351       Handle manifest = get_shared_jar_manifest(index, CHECK_(pd));
 352       Handle url = get_shared_jar_url(index, CHECK_(pd));
 353       define_shared_package(class_name, class_loader, manifest, url, CHECK_(pd));
 354       pd = get_shared_protection_domain(class_loader, index, url, CHECK_(pd));
 355     }
 356   }
 357   return pd;
 358 }
 359 
 360 // Currently AppCDS only archives classes from the run-time image, the
 361 // -Xbootclasspath/a path, and the class path. The following rules need to be
 362 // revised when AppCDS is changed to archive classes from other code sources
 363 // in the future, for example the module path (specified by -p).
 364 //
 365 // Check if a shared class can be loaded by the specific classloader. Following
 366 // are the "visible" archived classes for different classloaders.
 367 //
 368 // NULL classloader:
 369 //   - see SystemDictionary::is_shared_class_visible()
 370 // Platform classloader:
 371 //   - Module class from "modules" jimage. ModuleEntry must be defined in the
 372 //     classloader.
 373 // App Classloader:
 374 //   - Module class from "modules" jimage. ModuleEntry must be defined in the
 375 //     classloader.
 376 //   - Class from -cp. The class must have no PackageEntry defined in any of the
 377 //     boot/platform/app classloader, or must be in the unnamed module defined in the
 378 //     AppClassLoader.
 379 bool SystemDictionaryShared::is_shared_class_visible_for_classloader(
 380                                                      InstanceKlass* ik,
 381                                                      Handle class_loader,
 382                                                      const char* pkg_string,
 383                                                      Symbol* pkg_name,
 384                                                      PackageEntry* pkg_entry,
 385                                                      ModuleEntry* mod_entry,
 386                                                      TRAPS) {
 387   assert(class_loader.not_null(), "Class loader should not be NULL");
 388   assert(Universe::is_module_initialized(), "Module system is not initialized");

 389 
 390   int path_index = ik->shared_classpath_index();
 391   SharedClassPathEntry* ent =
 392             (SharedClassPathEntry*)FileMapInfo::shared_classpath(path_index);
 393 
 394   if (SystemDictionary::is_platform_class_loader(class_loader())) {
 395     assert(ent != NULL, "shared class for PlatformClassLoader should have valid SharedClassPathEntry");
 396     // The PlatformClassLoader can only load archived class originated from the
 397     // run-time image. The class' PackageEntry/ModuleEntry must be
 398     // defined by the PlatformClassLoader.
 399     if (mod_entry != NULL) {
 400       // PackageEntry/ModuleEntry is found in the classloader. Check if the
 401       // ModuleEntry's location agrees with the archived class' origination.
 402       if (ent->is_modules_image() && mod_entry->location()->starts_with("jrt:")) {
 403         return true; // Module class from the "modules" jimage
 404       }
 405     }
 406   } else if (SystemDictionary::is_system_class_loader(class_loader())) {
 407     assert(ent != NULL, "shared class for system loader should have valid SharedClassPathEntry");
 408     if (pkg_string == NULL) {
 409       // The archived class is in the unnamed package. Currently, the boot image
 410       // does not contain any class in the unnamed package.
 411       assert(!ent->is_modules_image(), "Class in the unnamed package must be from the classpath");
 412       if (path_index >= ClassLoaderExt::app_paths_start_index()) {

 413         return true;
 414       }
 415     } else {
 416       // Check if this is from a PackageEntry/ModuleEntry defined in the AppClassloader.
 417       if (pkg_entry == NULL) {
 418         // It's not guaranteed that the class is from the classpath if the
 419         // PackageEntry cannot be found from the AppClassloader. Need to check
 420         // the boot and platform classloader as well.
 421         if (get_package_entry(pkg_name, ClassLoaderData::class_loader_data_or_null(SystemDictionary::java_platform_loader())) == NULL &&
 422             get_package_entry(pkg_name, ClassLoaderData::the_null_class_loader_data()) == NULL) {
 423           // The PackageEntry is not defined in any of the boot/platform/app classloaders.
 424           // The archived class must from -cp path and not from the run-time image.
 425           if (!ent->is_modules_image() && path_index >= ClassLoaderExt::app_paths_start_index()) {

 426             return true;
 427           }
 428         }
 429       } else if (mod_entry != NULL) {
 430         // The package/module is defined in the AppClassLoader. Currently we only
 431         // support archiving application module class from the run-time image.

 432         // Packages from the -cp path are in the unnamed_module.
 433         if ((ent->is_modules_image() && mod_entry->location()->starts_with("jrt:")) ||
 434             (pkg_entry->in_unnamed_module() && path_index >= ClassLoaderExt::app_paths_start_index())) {




 435           DEBUG_ONLY( \
 436             ClassLoaderData* loader_data = class_loader_data(class_loader); \
 437             if (pkg_entry->in_unnamed_module()) \
 438               assert(mod_entry == loader_data->unnamed_module(), "the unnamed module is not defined in the classloader");)
 439 
 440           return true;










 441         }
 442       }
 443     }
 444   } else {
 445     // TEMP: if a shared class can be found by a custom loader, consider it visible now.
 446     // FIXME: is this actually correct?
 447     return true;
 448   }
 449   return false;
 450 }
 451 
 452 // The following stack shows how this code is reached:
 453 //
 454 //   [0] SystemDictionaryShared::find_or_load_shared_class()
 455 //   [1] JVM_FindLoadedClass
 456 //   [2] java.lang.ClassLoader.findLoadedClass0()
 457 //   [3] java.lang.ClassLoader.findLoadedClass()
 458 //   [4] java.lang.ClassLoader.loadClass()
 459 //   [5] jdk.internal.loader.ClassLoaders$AppClassLoader_klass.loadClass()
 460 //




  75   }
  76 }
  77 
  78 oop SystemDictionaryShared::shared_protection_domain(int index) {
  79   return _shared_protection_domains->obj_at(index);
  80 }
  81 
  82 oop SystemDictionaryShared::shared_jar_url(int index) {
  83   return _shared_jar_urls->obj_at(index);
  84 }
  85 
  86 oop SystemDictionaryShared::shared_jar_manifest(int index) {
  87   return _shared_jar_manifests->obj_at(index);
  88 }
  89 
  90 
  91 Handle SystemDictionaryShared::get_shared_jar_manifest(int shared_path_index, TRAPS) {
  92   Handle empty;
  93   Handle manifest ;
  94   if (shared_jar_manifest(shared_path_index) == NULL) {
  95     SharedClassPathEntryExt* ent = (SharedClassPathEntryExt*)FileMapInfo::shared_path(shared_path_index);
  96     long size = ent->manifest_size();
  97     if (size <= 0) {
  98       return empty; // No manifest - return NULL handle
  99     }
 100 
 101     // ByteArrayInputStream bais = new ByteArrayInputStream(buf);
 102     InstanceKlass* bais_klass = SystemDictionary::ByteArrayInputStream_klass();
 103     Handle bais = bais_klass->allocate_instance_handle(CHECK_(empty));
 104     {
 105       const char* src = ent->manifest();
 106       assert(src != NULL, "No Manifest data");
 107       typeArrayOop buf = oopFactory::new_byteArray(size, CHECK_(empty));
 108       typeArrayHandle bufhandle(THREAD, buf);
 109       char* dst = (char*)(buf->byte_at_addr(0));
 110       memcpy(dst, src, (size_t)size);
 111 
 112       JavaValue result(T_VOID);
 113       JavaCalls::call_special(&result, bais, bais_klass,
 114                               vmSymbols::object_initializer_name(),
 115                               vmSymbols::byte_array_void_signature(),


 121     manifest = manifest_klass->allocate_instance_handle(CHECK_(empty));
 122     {
 123       JavaValue result(T_VOID);
 124       JavaCalls::call_special(&result, manifest, manifest_klass,
 125                               vmSymbols::object_initializer_name(),
 126                               vmSymbols::input_stream_void_signature(),
 127                               bais, CHECK_(empty));
 128     }
 129     atomic_set_shared_jar_manifest(shared_path_index, manifest());
 130   }
 131 
 132   manifest = Handle(THREAD, shared_jar_manifest(shared_path_index));
 133   assert(manifest.not_null(), "sanity");
 134   return manifest;
 135 }
 136 
 137 Handle SystemDictionaryShared::get_shared_jar_url(int shared_path_index, TRAPS) {
 138   Handle url_h;
 139   if (shared_jar_url(shared_path_index) == NULL) {
 140     JavaValue result(T_OBJECT);
 141     const char* path = FileMapInfo::shared_path_name(shared_path_index);
 142     Handle path_string = java_lang_String::create_from_str(path, CHECK_(url_h));
 143     Klass* classLoaders_klass =
 144         SystemDictionary::jdk_internal_loader_ClassLoaders_klass();
 145         JavaCalls::call_static(&result, classLoaders_klass,
 146                                vmSymbols::toFileURL_name(),
 147                                vmSymbols::toFileURL_signature(),
 148                                path_string, CHECK_(url_h));
 149 
 150     atomic_set_shared_jar_url(shared_path_index, (oop)result.get_jobject());
 151   }
 152 
 153   url_h = Handle(THREAD, shared_jar_url(shared_path_index));
 154   assert(url_h.not_null(), "sanity");
 155   return url_h;
 156 }
 157 
 158 Handle SystemDictionaryShared::get_package_name(Symbol* class_name, TRAPS) {
 159   ResourceMark rm(THREAD);
 160   Handle pkgname_string;
 161   char* pkgname = (char*) ClassLoader::package_from_name((const char*) class_name->as_C_string());


 287       Handle pd = get_protection_domain_from_classloader(class_loader, url, THREAD);
 288       mod->set_shared_protection_domain(loader_data, pd);
 289     }
 290   }
 291 
 292   protection_domain = Handle(THREAD, mod->shared_protection_domain());
 293   assert(protection_domain.not_null(), "sanity");
 294   return protection_domain;
 295 }
 296 
 297 // Initializes the java.lang.Package and java.security.ProtectionDomain objects associated with
 298 // the given InstanceKlass.
 299 // Returns the ProtectionDomain for the InstanceKlass.
 300 Handle SystemDictionaryShared::init_security_info(Handle class_loader, InstanceKlass* ik, TRAPS) {
 301   Handle pd;
 302 
 303   if (ik != NULL) {
 304     int index = ik->shared_classpath_index();
 305     assert(index >= 0, "Sanity");
 306     SharedClassPathEntryExt* ent =
 307             (SharedClassPathEntryExt*)FileMapInfo::shared_path(index);
 308     Symbol* class_name = ik->name();
 309 
 310     if (ent->is_modules_image()) {
 311       // For shared app/platform classes originated from the run-time image:
 312       //   The ProtectionDomains are cached in the corresponding ModuleEntries
 313       //   for fast access by the VM.
 314       ResourceMark rm;
 315       ClassLoaderData *loader_data =
 316                 ClassLoaderData::class_loader_data(class_loader());
 317       PackageEntryTable* pkgEntryTable = loader_data->packages();
 318       TempNewSymbol pkg_name = InstanceKlass::package_from_name(class_name, CHECK_(pd));
 319       if (pkg_name != NULL) {
 320         PackageEntry* pkg_entry = pkgEntryTable->lookup_only(pkg_name);
 321         if (pkg_entry != NULL) {
 322           ModuleEntry* mod_entry = pkg_entry->module();
 323           pd = get_shared_protection_domain(class_loader, mod_entry, THREAD);
 324           define_shared_package(class_name, class_loader, mod_entry, CHECK_(pd));
 325         }
 326       }
 327     } else {
 328       // For shared app/platform classes originated from JAR files on the class path:
 329       //   Each of the 3 SystemDictionaryShared::_shared_xxx arrays has the same length
 330       //   as the shared classpath table in the shared archive (see
 331       //   FileMap::_shared_path_table in filemap.hpp for details).
 332       //
 333       //   If a shared InstanceKlass k is loaded from the class path, let
 334       //
 335       //     index = k->shared_classpath_index():
 336       //
 337       //   FileMap::_shared_path_table[index] identifies the JAR file that contains k.
 338       //
 339       //   k's protection domain is:
 340       //
 341       //     ProtectionDomain pd = _shared_protection_domains[index];
 342       //
 343       //   and k's Package is initialized using
 344       //
 345       //     manifest = _shared_jar_manifests[index];
 346       //     url = _shared_jar_urls[index];
 347       //     define_shared_package(class_name, class_loader, manifest, url, CHECK_(pd));
 348       //
 349       //   Note that if an element of these 3 _shared_xxx arrays is NULL, it will be initialized by
 350       //   the corresponding SystemDictionaryShared::get_shared_xxx() function.
 351       Handle manifest = get_shared_jar_manifest(index, CHECK_(pd));
 352       Handle url = get_shared_jar_url(index, CHECK_(pd));
 353       define_shared_package(class_name, class_loader, manifest, url, CHECK_(pd));
 354       pd = get_shared_protection_domain(class_loader, index, url, CHECK_(pd));
 355     }
 356   }
 357   return pd;
 358 }
 359 
 360 // Currently AppCDS only archives classes from the run-time image, the
 361 // -Xbootclasspath/a path, the class path, and the module path.


 362 //
 363 // Check if a shared class can be loaded by the specific classloader. Following
 364 // are the "visible" archived classes for different classloaders.
 365 //
 366 // NULL classloader:
 367 //   - see SystemDictionary::is_shared_class_visible()
 368 // Platform classloader:
 369 //   - Module class from runtime image. ModuleEntry must be defined in the
 370 //     classloader.
 371 // App classloader:
 372 //   - Module Class from runtime image and module path. ModuleEntry must be defined in the
 373 //     classloader.
 374 //   - Class from -cp. The class must have no PackageEntry defined in any of the
 375 //     boot/platform/app classloader, or must be in the unnamed module defined in the
 376 //     AppClassLoader.
 377 bool SystemDictionaryShared::is_shared_class_visible_for_classloader(
 378                                                      InstanceKlass* ik,
 379                                                      Handle class_loader,
 380                                                      const char* pkg_string,
 381                                                      Symbol* pkg_name,
 382                                                      PackageEntry* pkg_entry,
 383                                                      ModuleEntry* mod_entry,
 384                                                      TRAPS) {
 385   assert(class_loader.not_null(), "Class loader should not be NULL");
 386   assert(Universe::is_module_initialized(), "Module system is not initialized");
 387   ResourceMark rm(THREAD);
 388 
 389   int path_index = ik->shared_classpath_index();
 390   SharedClassPathEntry* ent =
 391             (SharedClassPathEntry*)FileMapInfo::shared_path(path_index);
 392 
 393   if (SystemDictionary::is_platform_class_loader(class_loader())) {
 394     assert(ent != NULL, "shared class for PlatformClassLoader should have valid SharedClassPathEntry");
 395     // The PlatformClassLoader can only load archived class originated from the
 396     // run-time image. The class' PackageEntry/ModuleEntry must be
 397     // defined by the PlatformClassLoader.
 398     if (mod_entry != NULL) {
 399       // PackageEntry/ModuleEntry is found in the classloader. Check if the
 400       // ModuleEntry's location agrees with the archived class' origination.
 401       if (ent->is_modules_image() && mod_entry->location()->starts_with("jrt:")) {
 402         return true; // Module class from the runtime image
 403       }
 404     }
 405   } else if (SystemDictionary::is_system_class_loader(class_loader())) {
 406     assert(ent != NULL, "shared class for system loader should have valid SharedClassPathEntry");
 407     if (pkg_string == NULL) {
 408       // The archived class is in the unnamed package. Currently, the boot image
 409       // does not contain any class in the unnamed package.
 410       assert(!ent->is_modules_image(), "Class in the unnamed package must be from the classpath");
 411       if (path_index >= ClassLoaderExt::app_class_paths_start_index()) {
 412         assert(path_index < ClassLoaderExt::app_module_paths_start_index(), "invalid path_index");
 413         return true;
 414       }
 415     } else {
 416       // Check if this is from a PackageEntry/ModuleEntry defined in the AppClassloader.
 417       if (pkg_entry == NULL) {
 418         // It's not guaranteed that the class is from the classpath if the
 419         // PackageEntry cannot be found from the AppClassloader. Need to check
 420         // the boot and platform classloader as well.
 421         if (get_package_entry(pkg_name, ClassLoaderData::class_loader_data_or_null(SystemDictionary::java_platform_loader())) == NULL &&
 422             get_package_entry(pkg_name, ClassLoaderData::the_null_class_loader_data()) == NULL) {
 423           // The PackageEntry is not defined in any of the boot/platform/app classloaders.
 424           // The archived class must from -cp path and not from the runtime image.
 425           if (!ent->is_modules_image() && path_index >= ClassLoaderExt::app_class_paths_start_index() &&
 426                                           path_index < ClassLoaderExt::app_module_paths_start_index()) {
 427             return true;
 428           }
 429         }
 430       } else if (mod_entry != NULL) {
 431         // The package/module is defined in the AppClassLoader. We support
 432         // archiving application module class from the runtime image or from
 433         // a named module from a module path.
 434         // Packages from the -cp path are in the unnamed_module.
 435         if (ent->is_modules_image() && mod_entry->location()->starts_with("jrt:")) {
 436           // shared module class from runtime image
 437           return true;
 438         } else if (pkg_entry->in_unnamed_module() && path_index >= ClassLoaderExt::app_class_paths_start_index() &&
 439             path_index < ClassLoaderExt::app_module_paths_start_index()) {
 440           // shared class from -cp
 441           DEBUG_ONLY( \
 442             ClassLoaderData* loader_data = class_loader_data(class_loader); \

 443             assert(mod_entry == loader_data->unnamed_module(), "the unnamed module is not defined in the classloader");)

 444           return true;
 445         } else {
 446           if(!pkg_entry->in_unnamed_module() &&
 447               (path_index >= ClassLoaderExt::app_module_paths_start_index())&&
 448               (path_index < FileMapInfo::get_number_of_shared_paths()) &&
 449               (strcmp(ent->name(), ClassLoader::skip_uri_protocol(mod_entry->location()->as_C_string())) == 0)) {
 450             // shared module class from module path
 451             return true;
 452           } else {
 453             assert(path_index < FileMapInfo::get_number_of_shared_paths(), "invalid path_index");
 454           }
 455         }
 456       }
 457     }
 458   } else {
 459     // TEMP: if a shared class can be found by a custom loader, consider it visible now.
 460     // FIXME: is this actually correct?
 461     return true;
 462   }
 463   return false;
 464 }
 465 
 466 // The following stack shows how this code is reached:
 467 //
 468 //   [0] SystemDictionaryShared::find_or_load_shared_class()
 469 //   [1] JVM_FindLoadedClass
 470 //   [2] java.lang.ClassLoader.findLoadedClass0()
 471 //   [3] java.lang.ClassLoader.findLoadedClass()
 472 //   [4] java.lang.ClassLoader.loadClass()
 473 //   [5] jdk.internal.loader.ClassLoaders$AppClassLoader_klass.loadClass()
 474 //


src/hotspot/share/classfile/systemDictionaryShared.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File