267 if (e == NULL) {
268 return NULL;
269 }
270 {
271 PerfClassTraceTime vmtimer(perf_sys_class_lookup_time(),
272 ((JavaThread*) THREAD)->get_thread_stat()->perf_timers_addr(),
273 PerfClassTraceTime::CLASS_LOAD);
274 stream = e->open_stream(file_name, CHECK_NULL);
275 }
276
277 if (NULL == stream) {
278 log_warning(cds)("Preload Warning: Cannot find %s", class_name);
279 return NULL;
280 }
281
282 assert(stream != NULL, "invariant");
283 stream->set_verify(true);
284
285 ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data();
286 Handle protection_domain;
287
288 InstanceKlass* result = KlassFactory::create_from_stream(stream,
289 name,
290 loader_data,
291 protection_domain,
292 NULL, // unsafe_anonymous_host
293 NULL, // cp_patches
294 THREAD);
295
296 if (HAS_PENDING_EXCEPTION) {
297 log_error(cds)("Preload Error: Failed to load %s", class_name);
298 return NULL;
299 }
300 return result;
301 }
302
303 struct CachedClassPathEntry {
304 const char* _path;
305 ClassPathEntry* _entry;
306 };
307
308 static GrowableArray<CachedClassPathEntry>* cached_path_entries = NULL;
309
310 ClassPathEntry* ClassLoaderExt::find_classpath_entry_from_cache(const char* path, TRAPS) {
311 // This is called from dump time so it's single threaded and there's no need for a lock.
312 assert(DumpSharedSpaces, "this function is only used with -Xshare:dump");
313 if (cached_path_entries == NULL) {
|
267 if (e == NULL) {
268 return NULL;
269 }
270 {
271 PerfClassTraceTime vmtimer(perf_sys_class_lookup_time(),
272 ((JavaThread*) THREAD)->get_thread_stat()->perf_timers_addr(),
273 PerfClassTraceTime::CLASS_LOAD);
274 stream = e->open_stream(file_name, CHECK_NULL);
275 }
276
277 if (NULL == stream) {
278 log_warning(cds)("Preload Warning: Cannot find %s", class_name);
279 return NULL;
280 }
281
282 assert(stream != NULL, "invariant");
283 stream->set_verify(true);
284
285 ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data();
286 Handle protection_domain;
287 ClassLoadInfo cl_info(protection_domain);
288
289 InstanceKlass* result = KlassFactory::create_from_stream(stream,
290 name,
291 loader_data,
292 cl_info,
293 THREAD);
294
295 if (HAS_PENDING_EXCEPTION) {
296 log_error(cds)("Preload Error: Failed to load %s", class_name);
297 return NULL;
298 }
299 return result;
300 }
301
302 struct CachedClassPathEntry {
303 const char* _path;
304 ClassPathEntry* _entry;
305 };
306
307 static GrowableArray<CachedClassPathEntry>* cached_path_entries = NULL;
308
309 ClassPathEntry* ClassLoaderExt::find_classpath_entry_from_cache(const char* path, TRAPS) {
310 // This is called from dump time so it's single threaded and there's no need for a lock.
311 assert(DumpSharedSpaces, "this function is only used with -Xshare:dump");
312 if (cached_path_entries == NULL) {
|