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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/classFileParser.hpp"
27 #include "classfile/classFileStream.hpp"
28 #include "classfile/classLoader.hpp"
29 #include "classfile/classLoaderData.inline.hpp"
30 #include "classfile/classLoaderExt.hpp"
31 #include "classfile/dictionary.hpp"
32 #include "classfile/javaClasses.inline.hpp"
33 #include "classfile/klassFactory.hpp"
34 #include "classfile/loaderConstraints.hpp"
35 #include "classfile/packageEntry.hpp"
36 #include "classfile/placeholders.hpp"
37 #include "classfile/resolutionErrors.hpp"
38 #include "classfile/stringTable.hpp"
39 #include "classfile/systemDictionary.hpp"
40 #include "classfile/vmSymbols.hpp"
41 #include "code/codeCache.hpp"
42 #include "compiler/compileBroker.hpp"
43 #include "gc/shared/gcLocker.hpp"
44 #include "interpreter/bytecodeStream.hpp"
45 #include "interpreter/interpreter.hpp"
64 #include "runtime/java.hpp"
65 #include "runtime/javaCalls.hpp"
66 #include "runtime/mutexLocker.hpp"
67 #include "runtime/orderAccess.inline.hpp"
68 #include "runtime/signature.hpp"
69 #include "services/classLoadingService.hpp"
70 #include "services/threadService.hpp"
71 #include "trace/traceMacros.hpp"
72 #include "utilities/macros.hpp"
73 #include "utilities/ticks.hpp"
74 #if INCLUDE_CDS
75 #include "classfile/sharedClassUtil.hpp"
76 #include "classfile/systemDictionaryShared.hpp"
77 #endif
78 #if INCLUDE_JVMCI
79 #include "jvmci/jvmciRuntime.hpp"
80 #endif
81 #if INCLUDE_TRACE
82 #include "trace/tracing.hpp"
83 #endif
84 #include "aot/aotLoader.hpp"
85
86 Dictionary* SystemDictionary::_dictionary = NULL;
87 PlaceholderTable* SystemDictionary::_placeholders = NULL;
88 Dictionary* SystemDictionary::_shared_dictionary = NULL;
89 LoaderConstraintTable* SystemDictionary::_loader_constraints = NULL;
90 ResolutionErrorTable* SystemDictionary::_resolution_errors = NULL;
91 SymbolPropertyTable* SystemDictionary::_invoke_method_table = NULL;
92
93
94 int SystemDictionary::_number_of_modifications = 0;
95 int SystemDictionary::_sdgeneration = 0;
96 const int SystemDictionary::_primelist[_prime_array_size] = {1009,2017,4049,5051,10103,
97 20201,40423,99991};
98
99 oop SystemDictionary::_system_loader_lock_obj = NULL;
100
101 InstanceKlass* SystemDictionary::_well_known_klasses[SystemDictionary::WKID_LIMIT]
102 = { NULL /*, NULL...*/ };
103
104 InstanceKlass* SystemDictionary::_box_klasses[T_VOID+1] = { NULL /*, NULL...*/ };
1410 if (SystemDictionaryShared::is_sharing_possible(loader_data)) {
1411 ResourceMark rm(THREAD);
1412 classlist_file->print_cr("%s", ik->name()->as_C_string());
1413 classlist_file->flush();
1414 }
1415 }
1416
1417 // notify a class loaded from shared object
1418 ClassLoadingService::notify_class_loaded(ik(), true /* shared class */);
1419 }
1420
1421 ik->set_has_passed_fingerprint_check(false);
1422 if (UseAOT && ik->supers_have_passed_fingerprint_checks()) {
1423 uint64_t aot_fp = AOTLoader::get_saved_fingerprint(ik());
1424 uint64_t cds_fp = ik->get_stored_fingerprint();
1425 if (aot_fp != 0 && aot_fp == cds_fp) {
1426 // This class matches with a class saved in an AOT library
1427 ik->set_has_passed_fingerprint_check(true);
1428 } else {
1429 ResourceMark rm;
1430 log_info(classfingerprint)("%s : expected = " PTR64_FORMAT " actual = " PTR64_FORMAT, ik->external_name(), aot_fp, cds_fp);
1431 }
1432 }
1433 return ik;
1434 }
1435 #endif // INCLUDE_CDS
1436
1437 instanceKlassHandle SystemDictionary::load_instance_class(Symbol* class_name, Handle class_loader, TRAPS) {
1438 instanceKlassHandle nh = instanceKlassHandle(); // null Handle
1439
1440 if (class_loader.is_null()) {
1441 ResourceMark rm;
1442 PackageEntry* pkg_entry = NULL;
1443 bool search_only_bootloader_append = false;
1444 ClassLoaderData *loader_data = class_loader_data(class_loader);
1445
1446 // Find the package in the boot loader's package entry table.
1447 TempNewSymbol pkg_name = InstanceKlass::package_from_name(class_name, CHECK_NULL);
1448 if (pkg_name != NULL) {
1449 pkg_entry = loader_data->packages()->lookup_only(pkg_name);
1450 }
|
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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "aot/aotLoader.hpp"
27 #include "classfile/classFileParser.hpp"
28 #include "classfile/classFileStream.hpp"
29 #include "classfile/classLoader.hpp"
30 #include "classfile/classLoaderData.inline.hpp"
31 #include "classfile/classLoaderExt.hpp"
32 #include "classfile/dictionary.hpp"
33 #include "classfile/javaClasses.inline.hpp"
34 #include "classfile/klassFactory.hpp"
35 #include "classfile/loaderConstraints.hpp"
36 #include "classfile/packageEntry.hpp"
37 #include "classfile/placeholders.hpp"
38 #include "classfile/resolutionErrors.hpp"
39 #include "classfile/stringTable.hpp"
40 #include "classfile/systemDictionary.hpp"
41 #include "classfile/vmSymbols.hpp"
42 #include "code/codeCache.hpp"
43 #include "compiler/compileBroker.hpp"
44 #include "gc/shared/gcLocker.hpp"
45 #include "interpreter/bytecodeStream.hpp"
46 #include "interpreter/interpreter.hpp"
65 #include "runtime/java.hpp"
66 #include "runtime/javaCalls.hpp"
67 #include "runtime/mutexLocker.hpp"
68 #include "runtime/orderAccess.inline.hpp"
69 #include "runtime/signature.hpp"
70 #include "services/classLoadingService.hpp"
71 #include "services/threadService.hpp"
72 #include "trace/traceMacros.hpp"
73 #include "utilities/macros.hpp"
74 #include "utilities/ticks.hpp"
75 #if INCLUDE_CDS
76 #include "classfile/sharedClassUtil.hpp"
77 #include "classfile/systemDictionaryShared.hpp"
78 #endif
79 #if INCLUDE_JVMCI
80 #include "jvmci/jvmciRuntime.hpp"
81 #endif
82 #if INCLUDE_TRACE
83 #include "trace/tracing.hpp"
84 #endif
85
86 Dictionary* SystemDictionary::_dictionary = NULL;
87 PlaceholderTable* SystemDictionary::_placeholders = NULL;
88 Dictionary* SystemDictionary::_shared_dictionary = NULL;
89 LoaderConstraintTable* SystemDictionary::_loader_constraints = NULL;
90 ResolutionErrorTable* SystemDictionary::_resolution_errors = NULL;
91 SymbolPropertyTable* SystemDictionary::_invoke_method_table = NULL;
92
93
94 int SystemDictionary::_number_of_modifications = 0;
95 int SystemDictionary::_sdgeneration = 0;
96 const int SystemDictionary::_primelist[_prime_array_size] = {1009,2017,4049,5051,10103,
97 20201,40423,99991};
98
99 oop SystemDictionary::_system_loader_lock_obj = NULL;
100
101 InstanceKlass* SystemDictionary::_well_known_klasses[SystemDictionary::WKID_LIMIT]
102 = { NULL /*, NULL...*/ };
103
104 InstanceKlass* SystemDictionary::_box_klasses[T_VOID+1] = { NULL /*, NULL...*/ };
1410 if (SystemDictionaryShared::is_sharing_possible(loader_data)) {
1411 ResourceMark rm(THREAD);
1412 classlist_file->print_cr("%s", ik->name()->as_C_string());
1413 classlist_file->flush();
1414 }
1415 }
1416
1417 // notify a class loaded from shared object
1418 ClassLoadingService::notify_class_loaded(ik(), true /* shared class */);
1419 }
1420
1421 ik->set_has_passed_fingerprint_check(false);
1422 if (UseAOT && ik->supers_have_passed_fingerprint_checks()) {
1423 uint64_t aot_fp = AOTLoader::get_saved_fingerprint(ik());
1424 uint64_t cds_fp = ik->get_stored_fingerprint();
1425 if (aot_fp != 0 && aot_fp == cds_fp) {
1426 // This class matches with a class saved in an AOT library
1427 ik->set_has_passed_fingerprint_check(true);
1428 } else {
1429 ResourceMark rm;
1430 log_info(class, fingerprint)("%s : expected = " PTR64_FORMAT " actual = " PTR64_FORMAT, ik->external_name(), aot_fp, cds_fp);
1431 }
1432 }
1433 return ik;
1434 }
1435 #endif // INCLUDE_CDS
1436
1437 instanceKlassHandle SystemDictionary::load_instance_class(Symbol* class_name, Handle class_loader, TRAPS) {
1438 instanceKlassHandle nh = instanceKlassHandle(); // null Handle
1439
1440 if (class_loader.is_null()) {
1441 ResourceMark rm;
1442 PackageEntry* pkg_entry = NULL;
1443 bool search_only_bootloader_append = false;
1444 ClassLoaderData *loader_data = class_loader_data(class_loader);
1445
1446 // Find the package in the boot loader's package entry table.
1447 TempNewSymbol pkg_name = InstanceKlass::package_from_name(class_name, CHECK_NULL);
1448 if (pkg_name != NULL) {
1449 pkg_entry = loader_data->packages()->lookup_only(pkg_name);
1450 }
|