< prev index next >

src/hotspot/share/classfile/classLoader.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2017, 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  *


 120 PerfCounter*    ClassLoader::_perf_class_link_selftime = NULL;
 121 PerfCounter*    ClassLoader::_perf_class_parse_time = NULL;
 122 PerfCounter*    ClassLoader::_perf_class_parse_selftime = NULL;
 123 PerfCounter*    ClassLoader::_perf_sys_class_lookup_time = NULL;
 124 PerfCounter*    ClassLoader::_perf_shared_classload_time = NULL;
 125 PerfCounter*    ClassLoader::_perf_sys_classload_time = NULL;
 126 PerfCounter*    ClassLoader::_perf_app_classload_time = NULL;
 127 PerfCounter*    ClassLoader::_perf_app_classload_selftime = NULL;
 128 PerfCounter*    ClassLoader::_perf_app_classload_count = NULL;
 129 PerfCounter*    ClassLoader::_perf_define_appclasses = NULL;
 130 PerfCounter*    ClassLoader::_perf_define_appclass_time = NULL;
 131 PerfCounter*    ClassLoader::_perf_define_appclass_selftime = NULL;
 132 PerfCounter*    ClassLoader::_perf_app_classfile_bytes_read = NULL;
 133 PerfCounter*    ClassLoader::_perf_sys_classfile_bytes_read = NULL;
 134 PerfCounter*    ClassLoader::_sync_systemLoaderLockContentionRate = NULL;
 135 PerfCounter*    ClassLoader::_sync_nonSystemLoaderLockContentionRate = NULL;
 136 PerfCounter*    ClassLoader::_sync_JVMFindLoadedClassLockFreeCounter = NULL;
 137 PerfCounter*    ClassLoader::_sync_JVMDefineClassLockFreeCounter = NULL;
 138 PerfCounter*    ClassLoader::_sync_JNIDefineClassLockFreeCounter = NULL;
 139 PerfCounter*    ClassLoader::_unsafe_defineClassCallCounter = NULL;
 140 PerfCounter*    ClassLoader::_isUnsyncloadClass = NULL;
 141 PerfCounter*    ClassLoader::_load_instance_class_failCounter = NULL;
 142 
 143 GrowableArray<ModuleClassPathList*>* ClassLoader::_patch_mod_entries = NULL;
 144 GrowableArray<ModuleClassPathList*>* ClassLoader::_exploded_entries = NULL;
 145 ClassPathEntry* ClassLoader::_jrt_entry = NULL;
 146 ClassPathEntry* ClassLoader::_first_append_entry = NULL;
 147 ClassPathEntry* ClassLoader::_last_append_entry  = NULL;
 148 #if INCLUDE_CDS
 149 ClassPathEntry* ClassLoader::_app_classpath_entries = NULL;
 150 ClassPathEntry* ClassLoader::_last_app_classpath_entry = NULL;
 151 GrowableArray<char*>* ClassLoader::_boot_modules_array = NULL;
 152 GrowableArray<char*>* ClassLoader::_platform_modules_array = NULL;
 153 SharedPathsMiscInfo* ClassLoader::_shared_paths_misc_info = NULL;
 154 #endif
 155 
 156 // helper routines
 157 bool string_starts_with(const char* str, const char* str_to_find) {
 158   size_t str_len = strlen(str);
 159   size_t str_to_find_len = strlen(str_to_find);
 160   if (str_to_find_len > str_len) {


1625 
1626     NEWPERFTICKCOUNTER(_perf_class_parse_time, SUN_CLS, "parseClassTime");
1627     NEWPERFTICKCOUNTER(_perf_class_parse_selftime, SUN_CLS, "parseClassTime.self");
1628     NEWPERFTICKCOUNTER(_perf_sys_class_lookup_time, SUN_CLS, "lookupSysClassTime");
1629     NEWPERFTICKCOUNTER(_perf_shared_classload_time, SUN_CLS, "sharedClassLoadTime");
1630     NEWPERFTICKCOUNTER(_perf_sys_classload_time, SUN_CLS, "sysClassLoadTime");
1631     NEWPERFTICKCOUNTER(_perf_app_classload_time, SUN_CLS, "appClassLoadTime");
1632     NEWPERFTICKCOUNTER(_perf_app_classload_selftime, SUN_CLS, "appClassLoadTime.self");
1633     NEWPERFEVENTCOUNTER(_perf_app_classload_count, SUN_CLS, "appClassLoadCount");
1634     NEWPERFTICKCOUNTER(_perf_define_appclasses, SUN_CLS, "defineAppClasses");
1635     NEWPERFTICKCOUNTER(_perf_define_appclass_time, SUN_CLS, "defineAppClassTime");
1636     NEWPERFTICKCOUNTER(_perf_define_appclass_selftime, SUN_CLS, "defineAppClassTime.self");
1637     NEWPERFBYTECOUNTER(_perf_app_classfile_bytes_read, SUN_CLS, "appClassBytes");
1638     NEWPERFBYTECOUNTER(_perf_sys_classfile_bytes_read, SUN_CLS, "sysClassBytes");
1639 
1640 
1641     // The following performance counters are added for measuring the impact
1642     // of the bug fix of 6365597. They are mainly focused on finding out
1643     // the behavior of system & user-defined classloader lock, whether
1644     // ClassLoader.loadClass/findClass is being called synchronized or not.
1645     // Also two additional counters are created to see whether 'UnsyncloadClass'
1646     // flag is being set or not and how many times load_instance_class call
1647     // fails with linkageError etc.
1648     NEWPERFEVENTCOUNTER(_sync_systemLoaderLockContentionRate, SUN_CLS,
1649                         "systemLoaderLockContentionRate");
1650     NEWPERFEVENTCOUNTER(_sync_nonSystemLoaderLockContentionRate, SUN_CLS,
1651                         "nonSystemLoaderLockContentionRate");
1652     NEWPERFEVENTCOUNTER(_sync_JVMFindLoadedClassLockFreeCounter, SUN_CLS,
1653                         "jvmFindLoadedClassNoLockCalls");
1654     NEWPERFEVENTCOUNTER(_sync_JVMDefineClassLockFreeCounter, SUN_CLS,
1655                         "jvmDefineClassNoLockCalls");
1656 
1657     NEWPERFEVENTCOUNTER(_sync_JNIDefineClassLockFreeCounter, SUN_CLS,
1658                         "jniDefineClassNoLockCalls");
1659 
1660     NEWPERFEVENTCOUNTER(_unsafe_defineClassCallCounter, SUN_CLS,
1661                         "unsafeDefineClassCalls");
1662 
1663     NEWPERFEVENTCOUNTER(_isUnsyncloadClass, SUN_CLS, "isUnsyncloadClassSet");
1664     NEWPERFEVENTCOUNTER(_load_instance_class_failCounter, SUN_CLS,
1665                         "loadInstanceClassFailRate");
1666 
1667     // increment the isUnsyncloadClass counter if UnsyncloadClass is set.
1668     if (UnsyncloadClass) {
1669       _isUnsyncloadClass->inc();
1670     }
1671   }
1672 
1673   // lookup zip library entry points
1674   load_zip_library();
1675   // lookup jimage library entry points
1676   load_jimage_library();
1677 #if INCLUDE_CDS
1678   // initialize search path
1679   if (DumpSharedSpaces) {
1680     _shared_paths_misc_info = SharedClassUtil::allocate_shared_paths_misc_info();
1681   }
1682 #endif
1683   setup_bootstrap_search_path();
1684 }
1685 
1686 #if INCLUDE_CDS
1687 void ClassLoader::initialize_shared_path() {
1688   if (DumpSharedSpaces) {
1689     ClassLoaderExt::setup_search_paths();
1690     _shared_paths_misc_info->write_jint(0); // see comments in SharedPathsMiscInfo::check()


   1 /*
   2  * Copyright (c) 1997, 2018, 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  *


 120 PerfCounter*    ClassLoader::_perf_class_link_selftime = NULL;
 121 PerfCounter*    ClassLoader::_perf_class_parse_time = NULL;
 122 PerfCounter*    ClassLoader::_perf_class_parse_selftime = NULL;
 123 PerfCounter*    ClassLoader::_perf_sys_class_lookup_time = NULL;
 124 PerfCounter*    ClassLoader::_perf_shared_classload_time = NULL;
 125 PerfCounter*    ClassLoader::_perf_sys_classload_time = NULL;
 126 PerfCounter*    ClassLoader::_perf_app_classload_time = NULL;
 127 PerfCounter*    ClassLoader::_perf_app_classload_selftime = NULL;
 128 PerfCounter*    ClassLoader::_perf_app_classload_count = NULL;
 129 PerfCounter*    ClassLoader::_perf_define_appclasses = NULL;
 130 PerfCounter*    ClassLoader::_perf_define_appclass_time = NULL;
 131 PerfCounter*    ClassLoader::_perf_define_appclass_selftime = NULL;
 132 PerfCounter*    ClassLoader::_perf_app_classfile_bytes_read = NULL;
 133 PerfCounter*    ClassLoader::_perf_sys_classfile_bytes_read = NULL;
 134 PerfCounter*    ClassLoader::_sync_systemLoaderLockContentionRate = NULL;
 135 PerfCounter*    ClassLoader::_sync_nonSystemLoaderLockContentionRate = NULL;
 136 PerfCounter*    ClassLoader::_sync_JVMFindLoadedClassLockFreeCounter = NULL;
 137 PerfCounter*    ClassLoader::_sync_JVMDefineClassLockFreeCounter = NULL;
 138 PerfCounter*    ClassLoader::_sync_JNIDefineClassLockFreeCounter = NULL;
 139 PerfCounter*    ClassLoader::_unsafe_defineClassCallCounter = NULL;

 140 PerfCounter*    ClassLoader::_load_instance_class_failCounter = NULL;
 141 
 142 GrowableArray<ModuleClassPathList*>* ClassLoader::_patch_mod_entries = NULL;
 143 GrowableArray<ModuleClassPathList*>* ClassLoader::_exploded_entries = NULL;
 144 ClassPathEntry* ClassLoader::_jrt_entry = NULL;
 145 ClassPathEntry* ClassLoader::_first_append_entry = NULL;
 146 ClassPathEntry* ClassLoader::_last_append_entry  = NULL;
 147 #if INCLUDE_CDS
 148 ClassPathEntry* ClassLoader::_app_classpath_entries = NULL;
 149 ClassPathEntry* ClassLoader::_last_app_classpath_entry = NULL;
 150 GrowableArray<char*>* ClassLoader::_boot_modules_array = NULL;
 151 GrowableArray<char*>* ClassLoader::_platform_modules_array = NULL;
 152 SharedPathsMiscInfo* ClassLoader::_shared_paths_misc_info = NULL;
 153 #endif
 154 
 155 // helper routines
 156 bool string_starts_with(const char* str, const char* str_to_find) {
 157   size_t str_len = strlen(str);
 158   size_t str_to_find_len = strlen(str_to_find);
 159   if (str_to_find_len > str_len) {


1624 
1625     NEWPERFTICKCOUNTER(_perf_class_parse_time, SUN_CLS, "parseClassTime");
1626     NEWPERFTICKCOUNTER(_perf_class_parse_selftime, SUN_CLS, "parseClassTime.self");
1627     NEWPERFTICKCOUNTER(_perf_sys_class_lookup_time, SUN_CLS, "lookupSysClassTime");
1628     NEWPERFTICKCOUNTER(_perf_shared_classload_time, SUN_CLS, "sharedClassLoadTime");
1629     NEWPERFTICKCOUNTER(_perf_sys_classload_time, SUN_CLS, "sysClassLoadTime");
1630     NEWPERFTICKCOUNTER(_perf_app_classload_time, SUN_CLS, "appClassLoadTime");
1631     NEWPERFTICKCOUNTER(_perf_app_classload_selftime, SUN_CLS, "appClassLoadTime.self");
1632     NEWPERFEVENTCOUNTER(_perf_app_classload_count, SUN_CLS, "appClassLoadCount");
1633     NEWPERFTICKCOUNTER(_perf_define_appclasses, SUN_CLS, "defineAppClasses");
1634     NEWPERFTICKCOUNTER(_perf_define_appclass_time, SUN_CLS, "defineAppClassTime");
1635     NEWPERFTICKCOUNTER(_perf_define_appclass_selftime, SUN_CLS, "defineAppClassTime.self");
1636     NEWPERFBYTECOUNTER(_perf_app_classfile_bytes_read, SUN_CLS, "appClassBytes");
1637     NEWPERFBYTECOUNTER(_perf_sys_classfile_bytes_read, SUN_CLS, "sysClassBytes");
1638 
1639 
1640     // The following performance counters are added for measuring the impact
1641     // of the bug fix of 6365597. They are mainly focused on finding out
1642     // the behavior of system & user-defined classloader lock, whether
1643     // ClassLoader.loadClass/findClass is being called synchronized or not.



1644     NEWPERFEVENTCOUNTER(_sync_systemLoaderLockContentionRate, SUN_CLS,
1645                         "systemLoaderLockContentionRate");
1646     NEWPERFEVENTCOUNTER(_sync_nonSystemLoaderLockContentionRate, SUN_CLS,
1647                         "nonSystemLoaderLockContentionRate");
1648     NEWPERFEVENTCOUNTER(_sync_JVMFindLoadedClassLockFreeCounter, SUN_CLS,
1649                         "jvmFindLoadedClassNoLockCalls");
1650     NEWPERFEVENTCOUNTER(_sync_JVMDefineClassLockFreeCounter, SUN_CLS,
1651                         "jvmDefineClassNoLockCalls");
1652 
1653     NEWPERFEVENTCOUNTER(_sync_JNIDefineClassLockFreeCounter, SUN_CLS,
1654                         "jniDefineClassNoLockCalls");
1655 
1656     NEWPERFEVENTCOUNTER(_unsafe_defineClassCallCounter, SUN_CLS,
1657                         "unsafeDefineClassCalls");
1658 

1659     NEWPERFEVENTCOUNTER(_load_instance_class_failCounter, SUN_CLS,
1660                         "loadInstanceClassFailRate");





1661   }
1662 
1663   // lookup zip library entry points
1664   load_zip_library();
1665   // lookup jimage library entry points
1666   load_jimage_library();
1667 #if INCLUDE_CDS
1668   // initialize search path
1669   if (DumpSharedSpaces) {
1670     _shared_paths_misc_info = SharedClassUtil::allocate_shared_paths_misc_info();
1671   }
1672 #endif
1673   setup_bootstrap_search_path();
1674 }
1675 
1676 #if INCLUDE_CDS
1677 void ClassLoader::initialize_shared_path() {
1678   if (DumpSharedSpaces) {
1679     ClassLoaderExt::setup_search_paths();
1680     _shared_paths_misc_info->write_jint(0); // see comments in SharedPathsMiscInfo::check()


< prev index next >