1 /*
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
1285
1286 // Adjust methods to recover missing data. They need addresses for
1287 // interpreter entry points and their default native method address
1288 // must be reset.
1289
1290 // Updating methods must be done under a lock so multiple
1291 // threads don't update these in parallel
1292 //
1293 // Shared classes are all currently loaded by either the bootstrap or
1294 // internal parallel class loaders, so this will never cause a deadlock
1295 // on a custom class loader lock.
1296
1297 ClassLoaderData* loader_data = ClassLoaderData::class_loader_data(class_loader());
1298 {
1299 Handle lockObject = compute_loader_lock_object(class_loader, THREAD);
1300 check_loader_lock_contention(lockObject, THREAD);
1301 ObjectLocker ol(lockObject, THREAD, true);
1302 ik->restore_unshareable_info(loader_data, protection_domain, CHECK_(nh));
1303 }
1304
1305 if (TraceClassLoading) {
1306 ResourceMark rm;
1307 tty->print("[Loaded %s", ik->external_name());
1308 tty->print(" from shared objects file");
1309 if (class_loader.not_null()) {
1310 tty->print(" by %s", loader_data->loader_name());
1311 }
1312 tty->print_cr("]");
1313 }
1314
1315 if (DumpLoadedClassList != NULL && classlist_file->is_open()) {
1316 // Only dump the classes that can be stored into CDS archive
1317 if (SystemDictionaryShared::is_sharing_possible(loader_data)) {
1318 ResourceMark rm(THREAD);
1319 classlist_file->print_cr("%s", ik->name()->as_C_string());
1320 classlist_file->flush();
1321 }
1322 }
1323
1324 // notify a class loaded from shared object
1325 ClassLoadingService::notify_class_loaded(ik(), true /* shared class */);
1326 }
1327 return ik;
1328 }
1329 #endif // INCLUDE_CDS
1330
1331 instanceKlassHandle SystemDictionary::load_instance_class(Symbol* class_name, Handle class_loader, TRAPS) {
1332 instanceKlassHandle nh = instanceKlassHandle(); // null Handle
|
1 /*
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
1285
1286 // Adjust methods to recover missing data. They need addresses for
1287 // interpreter entry points and their default native method address
1288 // must be reset.
1289
1290 // Updating methods must be done under a lock so multiple
1291 // threads don't update these in parallel
1292 //
1293 // Shared classes are all currently loaded by either the bootstrap or
1294 // internal parallel class loaders, so this will never cause a deadlock
1295 // on a custom class loader lock.
1296
1297 ClassLoaderData* loader_data = ClassLoaderData::class_loader_data(class_loader());
1298 {
1299 Handle lockObject = compute_loader_lock_object(class_loader, THREAD);
1300 check_loader_lock_contention(lockObject, THREAD);
1301 ObjectLocker ol(lockObject, THREAD, true);
1302 ik->restore_unshareable_info(loader_data, protection_domain, CHECK_(nh));
1303 }
1304
1305 if (log_is_enabled(Info, classload)) {
1306 ik()->print_loading_log(LogLevel::Info, loader_data, NULL);
1307 }
1308 else if (log_is_enabled(Debug, classload)) {
1309 ik()->print_loading_log(LogLevel::Debug, loader_data, NULL);
1310 }
1311
1312 if (DumpLoadedClassList != NULL && classlist_file->is_open()) {
1313 // Only dump the classes that can be stored into CDS archive
1314 if (SystemDictionaryShared::is_sharing_possible(loader_data)) {
1315 ResourceMark rm(THREAD);
1316 classlist_file->print_cr("%s", ik->name()->as_C_string());
1317 classlist_file->flush();
1318 }
1319 }
1320
1321 // notify a class loaded from shared object
1322 ClassLoadingService::notify_class_loaded(ik(), true /* shared class */);
1323 }
1324 return ik;
1325 }
1326 #endif // INCLUDE_CDS
1327
1328 instanceKlassHandle SystemDictionary::load_instance_class(Symbol* class_name, Handle class_loader, TRAPS) {
1329 instanceKlassHandle nh = instanceKlassHandle(); // null Handle
|