< prev index next >

src/share/vm/classfile/classLoader.cpp

Print this page




1341   return file_name;
1342 }
1343 
1344 // Search either the patch-module or exploded build entries for class
1345 ClassFileStream* ClassLoader::search_module_entries(const GrowableArray<ModuleClassPathList*>* const module_list,
1346                                                     const char* const class_name, const char* const file_name, TRAPS) {
1347   ClassFileStream* stream = NULL;
1348 
1349   // Find the class' defining module in the boot loader's module entry table
1350   PackageEntry* pkg_entry = get_package_entry(class_name, ClassLoaderData::the_null_class_loader_data(), CHECK_NULL);
1351   ModuleEntry* mod_entry = (pkg_entry != NULL) ? pkg_entry->module() : NULL;
1352 
1353   // If the module system has not defined java.base yet, then
1354   // classes loaded are assumed to be defined to java.base.
1355   // When java.base is eventually defined by the module system,
1356   // all packages of classes that have been previously loaded
1357   // are verified in ModuleEntryTable::verify_javabase_packages().
1358   if (!Universe::is_module_initialized() &&
1359       !ModuleEntryTable::javabase_defined() &&
1360       mod_entry == NULL) {
1361     mod_entry = ModuleEntryTable::javabase_module();
1362   }
1363 
1364   // The module must be a named module
1365   if (mod_entry != NULL && mod_entry->is_named()) {
1366     int num_of_entries = module_list->length();
1367     const Symbol* class_module_name = mod_entry->name();
1368 
1369     // Loop through all the modules in either the patch-module or exploded entries looking for module
1370     for (int i = 0; i < num_of_entries; i++) {
1371       ModuleClassPathList* module_cpl = module_list->at(i);
1372       Symbol* module_cpl_name = module_cpl->module_name();
1373 
1374       if (module_cpl_name->fast_compare(class_module_name) == 0) {
1375         // Class' module has been located, attempt to load
1376         // the class from the module's ClassPathEntry list.
1377         ClassPathEntry* e = module_cpl->module_first_entry();
1378         while (e != NULL) {
1379           stream = e->open_stream(file_name, CHECK_NULL);
1380           // No context.check is required since CDS is not supported
1381           // for an exploded modules build or if --patch-module is specified.


1691 
1692 void ClassLoader::create_javabase() {
1693   Thread* THREAD = Thread::current();
1694 
1695   // Create java.base's module entry for the boot
1696   // class loader prior to loading j.l.Ojbect.
1697   ClassLoaderData* null_cld = ClassLoaderData::the_null_class_loader_data();
1698 
1699   // Get module entry table
1700   ModuleEntryTable* null_cld_modules = null_cld->modules();
1701   if (null_cld_modules == NULL) {
1702     vm_exit_during_initialization("No ModuleEntryTable for the boot class loader");
1703   }
1704 
1705   {
1706     MutexLocker ml(Module_lock, THREAD);
1707     ModuleEntry* jb_module = null_cld_modules->locked_create_entry_or_null(Handle(NULL), vmSymbols::java_base(), NULL, NULL, null_cld);
1708     if (jb_module == NULL) {
1709       vm_exit_during_initialization("Unable to create ModuleEntry for java.base");
1710     }
1711     ModuleEntryTable::set_javabase_module(jb_module);
1712   }
1713 }
1714 
1715 #ifndef PRODUCT
1716 
1717 // CompileTheWorld
1718 //
1719 // Iterates over all class path entries and forces compilation of all methods
1720 // in all classes found. Currently, only zip/jar archives are searched.
1721 //
1722 // The classes are loaded by the Java level bootstrap class loader, and the
1723 // initializer is called. If DelayCompilationDuringStartup is true (default),
1724 // the interpreter will run the initialization code. Note that forcing
1725 // initialization in this way could potentially lead to initialization order
1726 // problems, in which case we could just force the initialization bit to be set.
1727 
1728 
1729 // We need to iterate over the contents of a zip/jar file, so we replicate the
1730 // jzcell and jzfile definitions from zip_util.h but rename jzfile to real_jzfile,
1731 // since jzfile already has a void* definition.




1341   return file_name;
1342 }
1343 
1344 // Search either the patch-module or exploded build entries for class
1345 ClassFileStream* ClassLoader::search_module_entries(const GrowableArray<ModuleClassPathList*>* const module_list,
1346                                                     const char* const class_name, const char* const file_name, TRAPS) {
1347   ClassFileStream* stream = NULL;
1348 
1349   // Find the class' defining module in the boot loader's module entry table
1350   PackageEntry* pkg_entry = get_package_entry(class_name, ClassLoaderData::the_null_class_loader_data(), CHECK_NULL);
1351   ModuleEntry* mod_entry = (pkg_entry != NULL) ? pkg_entry->module() : NULL;
1352 
1353   // If the module system has not defined java.base yet, then
1354   // classes loaded are assumed to be defined to java.base.
1355   // When java.base is eventually defined by the module system,
1356   // all packages of classes that have been previously loaded
1357   // are verified in ModuleEntryTable::verify_javabase_packages().
1358   if (!Universe::is_module_initialized() &&
1359       !ModuleEntryTable::javabase_defined() &&
1360       mod_entry == NULL) {
1361     mod_entry = ModuleEntryTable::javabase_moduleEntry();
1362   }
1363 
1364   // The module must be a named module
1365   if (mod_entry != NULL && mod_entry->is_named()) {
1366     int num_of_entries = module_list->length();
1367     const Symbol* class_module_name = mod_entry->name();
1368 
1369     // Loop through all the modules in either the patch-module or exploded entries looking for module
1370     for (int i = 0; i < num_of_entries; i++) {
1371       ModuleClassPathList* module_cpl = module_list->at(i);
1372       Symbol* module_cpl_name = module_cpl->module_name();
1373 
1374       if (module_cpl_name->fast_compare(class_module_name) == 0) {
1375         // Class' module has been located, attempt to load
1376         // the class from the module's ClassPathEntry list.
1377         ClassPathEntry* e = module_cpl->module_first_entry();
1378         while (e != NULL) {
1379           stream = e->open_stream(file_name, CHECK_NULL);
1380           // No context.check is required since CDS is not supported
1381           // for an exploded modules build or if --patch-module is specified.


1691 
1692 void ClassLoader::create_javabase() {
1693   Thread* THREAD = Thread::current();
1694 
1695   // Create java.base's module entry for the boot
1696   // class loader prior to loading j.l.Ojbect.
1697   ClassLoaderData* null_cld = ClassLoaderData::the_null_class_loader_data();
1698 
1699   // Get module entry table
1700   ModuleEntryTable* null_cld_modules = null_cld->modules();
1701   if (null_cld_modules == NULL) {
1702     vm_exit_during_initialization("No ModuleEntryTable for the boot class loader");
1703   }
1704 
1705   {
1706     MutexLocker ml(Module_lock, THREAD);
1707     ModuleEntry* jb_module = null_cld_modules->locked_create_entry_or_null(Handle(NULL), vmSymbols::java_base(), NULL, NULL, null_cld);
1708     if (jb_module == NULL) {
1709       vm_exit_during_initialization("Unable to create ModuleEntry for java.base");
1710     }
1711     ModuleEntryTable::set_javabase_moduleEntry(jb_module);
1712   }
1713 }
1714 
1715 #ifndef PRODUCT
1716 
1717 // CompileTheWorld
1718 //
1719 // Iterates over all class path entries and forces compilation of all methods
1720 // in all classes found. Currently, only zip/jar archives are searched.
1721 //
1722 // The classes are loaded by the Java level bootstrap class loader, and the
1723 // initializer is called. If DelayCompilationDuringStartup is true (default),
1724 // the interpreter will run the initialization code. Note that forcing
1725 // initialization in this way could potentially lead to initialization order
1726 // problems, in which case we could just force the initialization bit to be set.
1727 
1728 
1729 // We need to iterate over the contents of a zip/jar file, so we replicate the
1730 // jzcell and jzfile definitions from zip_util.h but rename jzfile to real_jzfile,
1731 // since jzfile already has a void* definition.


< prev index next >