< prev index next >

src/hotspot/share/classfile/sharedClassUtil.cpp

Print this page


 124         return fail("[APP classpath mismatch, actual: -Djava.class.path=", appcp);
 125       }
 126       if (appcp[len] != '\0' && appcp[len] != os::path_separator()[0]) {
 127         return fail("Dump time APP classpath is not a proper prefix of run time APP classpath: ", appcp);
 128       }
 129     }
 130     break;
 131   default:
 132     return SharedPathsMiscInfo::check(type, path);
 133   }
 134 
 135   return true;
 136 }
 137 
 138 void SharedClassUtil::update_shared_classpath(ClassPathEntry *cpe, SharedClassPathEntry* e, TRAPS) {
 139   ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data();
 140   SharedClassPathEntryExt* ent = (SharedClassPathEntryExt*)e;
 141   ResourceMark rm(THREAD);
 142   jint manifest_size;
 143   bool isSigned;


 144   char* manifest = ClassLoaderExt::read_manifest(cpe, &manifest_size, CHECK);
 145   if (manifest != NULL) {
 146     ManifestStream* stream = new ManifestStream((u1*)manifest,
 147                                                 manifest_size);
 148     isSigned = stream->check_is_signed();
 149     if (isSigned) {
 150       ent->_is_signed = true;
 151     } else {
 152       // Copy the manifest into the shared archive
 153       manifest = ClassLoaderExt::read_raw_manifest(cpe, &manifest_size, CHECK);
 154       Array<u1>* buf = MetadataFactory::new_array<u1>(loader_data,
 155                                                       manifest_size,
 156                                                       THREAD);
 157       char* p = (char*)(buf->data());
 158       memcpy(p, manifest, manifest_size);
 159       ent->set_manifest(buf);
 160       ent->_is_signed = false;

 161     }
 162   }
 163 }
 164 
 165 void SharedClassUtil::initialize(TRAPS) {
 166   if (UseSharedSpaces) {
 167     int size = FileMapInfo::get_number_of_share_classpaths();
 168     if (size > 0) {
 169       SystemDictionaryShared::allocate_shared_data_arrays(size, THREAD);
 170       if (!DumpSharedSpaces) {
 171         FileMapHeaderExt* header = (FileMapHeaderExt*)FileMapInfo::current_info()->header();
 172         ClassLoaderExt::init_paths_start_index(header->_app_paths_start_index);
 173       }
 174     }
 175   }
 176 
 177   if (DumpSharedSpaces) {
 178     if (SharedArchiveConfigFile) {
 179       read_extra_data(SharedArchiveConfigFile, THREAD);
 180     }




 124         return fail("[APP classpath mismatch, actual: -Djava.class.path=", appcp);
 125       }
 126       if (appcp[len] != '\0' && appcp[len] != os::path_separator()[0]) {
 127         return fail("Dump time APP classpath is not a proper prefix of run time APP classpath: ", appcp);
 128       }
 129     }
 130     break;
 131   default:
 132     return SharedPathsMiscInfo::check(type, path);
 133   }
 134 
 135   return true;
 136 }
 137 
 138 void SharedClassUtil::update_shared_classpath(ClassPathEntry *cpe, SharedClassPathEntry* e, TRAPS) {
 139   ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data();
 140   SharedClassPathEntryExt* ent = (SharedClassPathEntryExt*)e;
 141   ResourceMark rm(THREAD);
 142   jint manifest_size;
 143   bool isSigned;
 144 
 145   if (cpe->is_jar_file()) {
 146     char* manifest = ClassLoaderExt::read_manifest(cpe, &manifest_size, CHECK);
 147     if (manifest != NULL) {
 148       ManifestStream* stream = new ManifestStream((u1*)manifest,
 149                                                   manifest_size);
 150       isSigned = stream->check_is_signed();
 151       if (isSigned) {
 152         ent->_is_signed = true;
 153       } else {
 154         // Copy the manifest into the shared archive
 155         manifest = ClassLoaderExt::read_raw_manifest(cpe, &manifest_size, CHECK);
 156         Array<u1>* buf = MetadataFactory::new_array<u1>(loader_data,
 157                                                         manifest_size,
 158                                                         THREAD);
 159         char* p = (char*)(buf->data());
 160         memcpy(p, manifest, manifest_size);
 161         ent->set_manifest(buf);
 162         ent->_is_signed = false;
 163       }
 164     }
 165   }
 166 }
 167 
 168 void SharedClassUtil::initialize(TRAPS) {
 169   if (UseSharedSpaces) {
 170     int size = FileMapInfo::get_number_of_share_classpaths();
 171     if (size > 0) {
 172       SystemDictionaryShared::allocate_shared_data_arrays(size, THREAD);
 173       if (!DumpSharedSpaces) {
 174         FileMapHeaderExt* header = (FileMapHeaderExt*)FileMapInfo::current_info()->header();
 175         ClassLoaderExt::init_paths_start_index(header->_app_paths_start_index);
 176       }
 177     }
 178   }
 179 
 180   if (DumpSharedSpaces) {
 181     if (SharedArchiveConfigFile) {
 182       read_extra_data(SharedArchiveConfigFile, THREAD);
 183     }


< prev index next >