src/hotspot/share/memory/filemap.cpp
changeset 47991 a474466c4fdb
parent 47765 b7c7428eaab9
child 48794 ea0d0781c63c
equal deleted inserted replaced
47915:d4af6b80aec3 47991:a474466c4fdb
   264   it->push(&_name);
   264   it->push(&_name);
   265   it->push(&_manifest);
   265   it->push(&_manifest);
   266 }
   266 }
   267 
   267 
   268 void FileMapInfo::allocate_classpath_entry_table() {
   268 void FileMapInfo::allocate_classpath_entry_table() {
       
   269   assert(DumpSharedSpaces, "Sanity");
       
   270 
   269   Thread* THREAD = Thread::current();
   271   Thread* THREAD = Thread::current();
   270   ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data();
   272   ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data();
       
   273   ClassPathEntry* jrt = ClassLoader::get_jrt_entry();
       
   274 
       
   275   assert(jrt != NULL,
       
   276          "No modular java runtime image present when allocating the CDS classpath entry table");
       
   277 
   271   size_t entry_size = SharedClassUtil::shared_class_path_entry_size(); // assert ( should be 8 byte aligned??)
   278   size_t entry_size = SharedClassUtil::shared_class_path_entry_size(); // assert ( should be 8 byte aligned??)
   272   int num_entries = ClassLoader::number_of_classpath_entries();
   279   int num_boot_classpath_entries = ClassLoader::num_boot_classpath_entries();
       
   280   int num_app_classpath_entries = ClassLoader::num_app_classpath_entries();
       
   281   int num_entries = num_boot_classpath_entries + num_app_classpath_entries;
   273   size_t bytes = entry_size * num_entries;
   282   size_t bytes = entry_size * num_entries;
   274 
   283 
   275   _classpath_entry_table = MetadataFactory::new_array<u8>(loader_data, (int)(bytes + 7 / 8), THREAD);
   284   _classpath_entry_table = MetadataFactory::new_array<u8>(loader_data, (int)(bytes + 7 / 8), THREAD);
   276   _classpath_entry_table_size = num_entries;
   285   _classpath_entry_table_size = num_entries;
   277   _classpath_entry_size = entry_size;
   286   _classpath_entry_size = entry_size;
   278 
   287 
   279   assert(ClassLoader::get_jrt_entry() != NULL,
   288   // 1. boot class path
   280          "No modular java runtime image present when allocating the CDS classpath entry table");
   289   int i = 0;
   281 
   290   ClassPathEntry* cpe = jrt;
   282   for (int i=0; i<num_entries; i++) {
   291   while (cpe != NULL) {
   283     ClassPathEntry *cpe = ClassLoader::classpath_entry(i);
   292     const char* type = ((cpe == jrt) ? "jrt" : (cpe->is_jar_file() ? "jar" : "dir"));
   284     const char* type = ((i == 0) ? "jrt" : (cpe->is_jar_file() ? "jar" : "dir"));
       
   285 
       
   286     log_info(class, path)("add main shared path (%s) %s", type, cpe->name());
   293     log_info(class, path)("add main shared path (%s) %s", type, cpe->name());
   287     SharedClassPathEntry* ent = shared_classpath(i);
   294     SharedClassPathEntry* ent = shared_classpath(i);
   288     ent->init(cpe->name(), THREAD);
   295     ent->init(cpe->name(), THREAD);
   289 
   296     if (cpe != jrt) { // No need to do jimage.
   290     if (i > 0) { // No need to do jimage.
       
   291       EXCEPTION_MARK; // The following call should never throw, but would exit VM on error.
   297       EXCEPTION_MARK; // The following call should never throw, but would exit VM on error.
   292       SharedClassUtil::update_shared_classpath(cpe, ent, THREAD);
   298       SharedClassUtil::update_shared_classpath(cpe, ent, THREAD);
   293     }
   299     }
   294   }
   300     cpe = ClassLoader::get_next_boot_classpath_entry(cpe);
       
   301     i++;
       
   302   }
       
   303   assert(i == num_boot_classpath_entries,
       
   304          "number of boot class path entry mismatch");
       
   305 
       
   306   // 2. app class path
       
   307   ClassPathEntry *acpe = ClassLoader::app_classpath_entries();
       
   308   while (acpe != NULL) {
       
   309     log_info(class, path)("add app shared path %s", acpe->name());
       
   310     SharedClassPathEntry* ent = shared_classpath(i);
       
   311     ent->init(acpe->name(), THREAD);
       
   312     EXCEPTION_MARK;
       
   313     SharedClassUtil::update_shared_classpath(acpe, ent, THREAD);
       
   314     acpe = acpe->next();
       
   315     i ++;
       
   316   }
       
   317   assert(i == num_entries, "number of app class path entry mismatch");
   295 }
   318 }
   296 
   319 
   297 bool FileMapInfo::validate_classpath_entry_table() {
   320 bool FileMapInfo::validate_classpath_entry_table() {
   298   _validating_classpath_entry_table = true;
   321   _validating_classpath_entry_table = true;
   299 
   322