author | mchung |
Tue, 24 Nov 2015 14:59:17 -0800 | |
changeset 34280 | 72bfaaffee36 |
parent 32619 | 47acec81dcca |
child 34287 | 06ababebbd58 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
29076
4a5f7c1e6ed7
8068687: Remove meta-index support and cleanup hotspot code for rt.jar etc in non-modular jdk image
hseigel
parents:
27711
diff
changeset
|
2 |
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3795
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3795
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3795
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#ifndef SHARE_VM_CLASSFILE_CLASSLOADER_HPP |
26 |
#define SHARE_VM_CLASSFILE_CLASSLOADER_HPP |
|
27 |
||
28 |
#include "classfile/classFileParser.hpp" |
|
29 |
#include "runtime/perfData.hpp" |
|
27683
1d5707553fff
8064580: Move INCLUDE_CDS include section to the end of the include list
stefank
parents:
27025
diff
changeset
|
30 |
#include "utilities/macros.hpp" |
7397 | 31 |
|
1 | 32 |
// The VM class loader. |
33 |
#include <sys/stat.h> |
|
34 |
||
31608 | 35 |
// Name of boot module image |
36 |
#define BOOT_IMAGE_NAME "bootmodules.jimage" |
|
1 | 37 |
|
38 |
// Class path entry (directory or zip file) |
|
39 |
||
32619
47acec81dcca
8087181: Move native jimage code to its own library (maybe libjimage)
jlaskey
parents:
31612
diff
changeset
|
40 |
class JImageFile; |
31608 | 41 |
|
13195 | 42 |
class ClassPathEntry: public CHeapObj<mtClass> { |
1 | 43 |
private: |
44 |
ClassPathEntry* _next; |
|
45 |
public: |
|
46 |
// Next entry in class path |
|
47 |
ClassPathEntry* next() { return _next; } |
|
48 |
void set_next(ClassPathEntry* next) { |
|
49 |
// may have unlocked readers, so write atomically. |
|
50 |
OrderAccess::release_store_ptr(&_next, next); |
|
51 |
} |
|
52 |
virtual bool is_jar_file() = 0; |
|
53 |
virtual const char* name() = 0; |
|
32619
47acec81dcca
8087181: Move native jimage code to its own library (maybe libjimage)
jlaskey
parents:
31612
diff
changeset
|
54 |
virtual JImageFile* jimage() = 0; |
1 | 55 |
// Constructor |
56 |
ClassPathEntry(); |
|
57 |
// Attempt to locate file_name through this class path entry. |
|
58 |
// Returns a class file parsing stream if successfull. |
|
19685
3df9b00b5d5f
8020675: invalid jar file in the bootclasspath could lead to jvm fatal error
ccheung
parents:
17004
diff
changeset
|
59 |
virtual ClassFileStream* open_stream(const char* name, TRAPS) = 0; |
1 | 60 |
// Debugging |
61 |
NOT_PRODUCT(virtual void compile_the_world(Handle loader, TRAPS) = 0;) |
|
27562 | 62 |
NOT_PRODUCT(virtual bool is_jrt() = 0;) |
1 | 63 |
}; |
64 |
||
65 |
||
66 |
class ClassPathDirEntry: public ClassPathEntry { |
|
67 |
private: |
|
26419 | 68 |
const char* _dir; // Name of directory |
1 | 69 |
public: |
31608 | 70 |
bool is_jar_file() { return false; } |
71 |
const char* name() { return _dir; } |
|
32619
47acec81dcca
8087181: Move native jimage code to its own library (maybe libjimage)
jlaskey
parents:
31612
diff
changeset
|
72 |
JImageFile* jimage() { return NULL; } |
26419 | 73 |
ClassPathDirEntry(const char* dir); |
19685
3df9b00b5d5f
8020675: invalid jar file in the bootclasspath could lead to jvm fatal error
ccheung
parents:
17004
diff
changeset
|
74 |
ClassFileStream* open_stream(const char* name, TRAPS); |
1 | 75 |
// Debugging |
76 |
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);) |
|
27562 | 77 |
NOT_PRODUCT(bool is_jrt();) |
1 | 78 |
}; |
79 |
||
80 |
||
81 |
// Type definitions for zip file and zip file entry |
|
82 |
typedef void* jzfile; |
|
83 |
typedef struct { |
|
84 |
char *name; /* entry name */ |
|
85 |
jlong time; /* modification time */ |
|
86 |
jlong size; /* size of uncompressed data */ |
|
87 |
jlong csize; /* size of compressed data (zero if uncompressed) */ |
|
88 |
jint crc; /* crc of uncompressed data */ |
|
89 |
char *comment; /* optional zip file comment */ |
|
90 |
jbyte *extra; /* optional extra data */ |
|
91 |
jlong pos; /* position of LOC header (if negative) or data */ |
|
92 |
} jzentry; |
|
93 |
||
94 |
||
95 |
class ClassPathZipEntry: public ClassPathEntry { |
|
96 |
private: |
|
26419 | 97 |
jzfile* _zip; // The zip archive |
98 |
const char* _zip_name; // Name of zip archive |
|
1 | 99 |
public: |
31608 | 100 |
bool is_jar_file() { return true; } |
101 |
const char* name() { return _zip_name; } |
|
32619
47acec81dcca
8087181: Move native jimage code to its own library (maybe libjimage)
jlaskey
parents:
31612
diff
changeset
|
102 |
JImageFile* jimage() { return NULL; } |
1 | 103 |
ClassPathZipEntry(jzfile* zip, const char* zip_name); |
104 |
~ClassPathZipEntry(); |
|
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
105 |
u1* open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS); |
19685
3df9b00b5d5f
8020675: invalid jar file in the bootclasspath could lead to jvm fatal error
ccheung
parents:
17004
diff
changeset
|
106 |
ClassFileStream* open_stream(const char* name, TRAPS); |
1 | 107 |
void contents_do(void f(const char* name, void* context), void* context); |
108 |
// Debugging |
|
109 |
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);) |
|
27562 | 110 |
NOT_PRODUCT(bool is_jrt();) |
1 | 111 |
}; |
112 |
||
113 |
||
27562 | 114 |
// For java image files |
115 |
class ClassPathImageEntry: public ClassPathEntry { |
|
116 |
private: |
|
32619
47acec81dcca
8087181: Move native jimage code to its own library (maybe libjimage)
jlaskey
parents:
31612
diff
changeset
|
117 |
JImageFile* _jimage; |
47acec81dcca
8087181: Move native jimage code to its own library (maybe libjimage)
jlaskey
parents:
31612
diff
changeset
|
118 |
const char* _name; |
27562 | 119 |
public: |
120 |
bool is_jar_file() { return false; } |
|
32619
47acec81dcca
8087181: Move native jimage code to its own library (maybe libjimage)
jlaskey
parents:
31612
diff
changeset
|
121 |
bool is_open() { return _jimage != NULL; } |
47acec81dcca
8087181: Move native jimage code to its own library (maybe libjimage)
jlaskey
parents:
31612
diff
changeset
|
122 |
const char* name() { return _name == NULL ? "" : _name; } |
47acec81dcca
8087181: Move native jimage code to its own library (maybe libjimage)
jlaskey
parents:
31612
diff
changeset
|
123 |
JImageFile* jimage() { return _jimage; } |
47acec81dcca
8087181: Move native jimage code to its own library (maybe libjimage)
jlaskey
parents:
31612
diff
changeset
|
124 |
ClassPathImageEntry(JImageFile* jimage, const char* name); |
27562 | 125 |
~ClassPathImageEntry(); |
32619
47acec81dcca
8087181: Move native jimage code to its own library (maybe libjimage)
jlaskey
parents:
31612
diff
changeset
|
126 |
static void name_to_package(const char* name, char* buffer, int length); |
27562 | 127 |
ClassFileStream* open_stream(const char* name, TRAPS); |
128 |
||
129 |
// Debugging |
|
130 |
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);) |
|
131 |
NOT_PRODUCT(bool is_jrt();) |
|
1 | 132 |
}; |
133 |
||
134 |
class PackageHashtable; |
|
135 |
class PackageInfo; |
|
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
136 |
class SharedPathsMiscInfo; |
13195 | 137 |
template <MEMFLAGS F> class HashtableBucket; |
1 | 138 |
|
139 |
class ClassLoader: AllStatic { |
|
140 |
public: |
|
141 |
enum SomeConstants { |
|
142 |
package_hash_table_size = 31 // Number of buckets |
|
143 |
}; |
|
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
144 |
protected: |
1 | 145 |
|
146 |
// Performance counters |
|
147 |
static PerfCounter* _perf_accumulated_time; |
|
148 |
static PerfCounter* _perf_classes_inited; |
|
149 |
static PerfCounter* _perf_class_init_time; |
|
3575
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
150 |
static PerfCounter* _perf_class_init_selftime; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
151 |
static PerfCounter* _perf_classes_verified; |
1 | 152 |
static PerfCounter* _perf_class_verify_time; |
3575
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
153 |
static PerfCounter* _perf_class_verify_selftime; |
1 | 154 |
static PerfCounter* _perf_classes_linked; |
155 |
static PerfCounter* _perf_class_link_time; |
|
3575
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
156 |
static PerfCounter* _perf_class_link_selftime; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
157 |
static PerfCounter* _perf_class_parse_time; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
158 |
static PerfCounter* _perf_class_parse_selftime; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
159 |
static PerfCounter* _perf_sys_class_lookup_time; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
160 |
static PerfCounter* _perf_shared_classload_time; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
161 |
static PerfCounter* _perf_sys_classload_time; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
162 |
static PerfCounter* _perf_app_classload_time; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
163 |
static PerfCounter* _perf_app_classload_selftime; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
164 |
static PerfCounter* _perf_app_classload_count; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
165 |
static PerfCounter* _perf_define_appclasses; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
166 |
static PerfCounter* _perf_define_appclass_time; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
167 |
static PerfCounter* _perf_define_appclass_selftime; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
168 |
static PerfCounter* _perf_app_classfile_bytes_read; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
169 |
static PerfCounter* _perf_sys_classfile_bytes_read; |
1 | 170 |
|
171 |
static PerfCounter* _sync_systemLoaderLockContentionRate; |
|
172 |
static PerfCounter* _sync_nonSystemLoaderLockContentionRate; |
|
173 |
static PerfCounter* _sync_JVMFindLoadedClassLockFreeCounter; |
|
174 |
static PerfCounter* _sync_JVMDefineClassLockFreeCounter; |
|
175 |
static PerfCounter* _sync_JNIDefineClassLockFreeCounter; |
|
176 |
||
177 |
static PerfCounter* _unsafe_defineClassCallCounter; |
|
178 |
static PerfCounter* _isUnsyncloadClass; |
|
179 |
static PerfCounter* _load_instance_class_failCounter; |
|
180 |
||
181 |
// First entry in linked list of ClassPathEntry instances |
|
182 |
static ClassPathEntry* _first_entry; |
|
183 |
// Last entry in linked list of ClassPathEntry instances |
|
184 |
static ClassPathEntry* _last_entry; |
|
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
185 |
static int _num_entries; |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
186 |
|
1 | 187 |
// Hash table used to keep track of loaded packages |
188 |
static PackageHashtable* _package_hash_table; |
|
189 |
static const char* _shared_archive; |
|
190 |
||
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
191 |
// Info used by CDS |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
192 |
CDS_ONLY(static SharedPathsMiscInfo * _shared_paths_misc_info;) |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
193 |
|
1 | 194 |
// Hash function |
195 |
static unsigned int hash(const char *s, int n); |
|
196 |
// Returns the package file name corresponding to the specified package |
|
197 |
// or class name, or null if not found. |
|
198 |
static PackageInfo* lookup_package(const char *pkgname); |
|
199 |
// Adds a new package entry for the specified class or package name and |
|
200 |
// corresponding directory or jar file name. |
|
201 |
static bool add_package(const char *pkgname, int classpath_index, TRAPS); |
|
202 |
||
203 |
// Initialization |
|
204 |
static void setup_bootstrap_search_path(); |
|
26419 | 205 |
static void setup_search_path(const char *class_path); |
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
206 |
|
1 | 207 |
static void load_zip_library(); |
32619
47acec81dcca
8087181: Move native jimage code to its own library (maybe libjimage)
jlaskey
parents:
31612
diff
changeset
|
208 |
static void load_jimage_library(); |
26419 | 209 |
static ClassPathEntry* create_class_path_entry(const char *path, const struct stat* st, |
31612
930eee00deb0
8073423: Remove LazyClassPathEntry support if no longer needed
hseigel
parents:
31608
diff
changeset
|
210 |
bool throw_exception, TRAPS); |
1 | 211 |
|
212 |
// Canonicalizes path names, so strcmp will work properly. This is mainly |
|
213 |
// to avoid confusing the zip library |
|
26419 | 214 |
static bool get_canonical_path(const char* orig, char* out, int len); |
1 | 215 |
public: |
27562 | 216 |
static jboolean decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg); |
27025 | 217 |
static int crc32(int crc, const char* buf, int len); |
26419 | 218 |
static bool update_class_path_entry_list(const char *path, |
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
219 |
bool check_for_duplicates, |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
220 |
bool throw_exception=true); |
1 | 221 |
static void print_bootclasspath(); |
222 |
||
223 |
// Timing |
|
3575
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
224 |
static PerfCounter* perf_accumulated_time() { return _perf_accumulated_time; } |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
225 |
static PerfCounter* perf_classes_inited() { return _perf_classes_inited; } |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
226 |
static PerfCounter* perf_class_init_time() { return _perf_class_init_time; } |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
227 |
static PerfCounter* perf_class_init_selftime() { return _perf_class_init_selftime; } |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
228 |
static PerfCounter* perf_classes_verified() { return _perf_classes_verified; } |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
229 |
static PerfCounter* perf_class_verify_time() { return _perf_class_verify_time; } |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
230 |
static PerfCounter* perf_class_verify_selftime() { return _perf_class_verify_selftime; } |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
231 |
static PerfCounter* perf_classes_linked() { return _perf_classes_linked; } |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
232 |
static PerfCounter* perf_class_link_time() { return _perf_class_link_time; } |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
233 |
static PerfCounter* perf_class_link_selftime() { return _perf_class_link_selftime; } |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
234 |
static PerfCounter* perf_class_parse_time() { return _perf_class_parse_time; } |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
235 |
static PerfCounter* perf_class_parse_selftime() { return _perf_class_parse_selftime; } |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
236 |
static PerfCounter* perf_sys_class_lookup_time() { return _perf_sys_class_lookup_time; } |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
237 |
static PerfCounter* perf_shared_classload_time() { return _perf_shared_classload_time; } |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
238 |
static PerfCounter* perf_sys_classload_time() { return _perf_sys_classload_time; } |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
239 |
static PerfCounter* perf_app_classload_time() { return _perf_app_classload_time; } |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
240 |
static PerfCounter* perf_app_classload_selftime() { return _perf_app_classload_selftime; } |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
241 |
static PerfCounter* perf_app_classload_count() { return _perf_app_classload_count; } |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
242 |
static PerfCounter* perf_define_appclasses() { return _perf_define_appclasses; } |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
243 |
static PerfCounter* perf_define_appclass_time() { return _perf_define_appclass_time; } |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
244 |
static PerfCounter* perf_define_appclass_selftime() { return _perf_define_appclass_selftime; } |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
245 |
static PerfCounter* perf_app_classfile_bytes_read() { return _perf_app_classfile_bytes_read; } |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
246 |
static PerfCounter* perf_sys_classfile_bytes_read() { return _perf_sys_classfile_bytes_read; } |
1 | 247 |
|
248 |
// Record how often system loader lock object is contended |
|
249 |
static PerfCounter* sync_systemLoaderLockContentionRate() { |
|
250 |
return _sync_systemLoaderLockContentionRate; |
|
251 |
} |
|
252 |
||
253 |
// Record how often non system loader lock object is contended |
|
254 |
static PerfCounter* sync_nonSystemLoaderLockContentionRate() { |
|
255 |
return _sync_nonSystemLoaderLockContentionRate; |
|
256 |
} |
|
257 |
||
258 |
// Record how many calls to JVM_FindLoadedClass w/o holding a lock |
|
259 |
static PerfCounter* sync_JVMFindLoadedClassLockFreeCounter() { |
|
260 |
return _sync_JVMFindLoadedClassLockFreeCounter; |
|
261 |
} |
|
262 |
||
263 |
// Record how many calls to JVM_DefineClass w/o holding a lock |
|
264 |
static PerfCounter* sync_JVMDefineClassLockFreeCounter() { |
|
265 |
return _sync_JVMDefineClassLockFreeCounter; |
|
266 |
} |
|
267 |
||
268 |
// Record how many calls to jni_DefineClass w/o holding a lock |
|
269 |
static PerfCounter* sync_JNIDefineClassLockFreeCounter() { |
|
270 |
return _sync_JNIDefineClassLockFreeCounter; |
|
271 |
} |
|
272 |
||
273 |
// Record how many calls to Unsafe_DefineClass |
|
274 |
static PerfCounter* unsafe_defineClassCallCounter() { |
|
275 |
return _unsafe_defineClassCallCounter; |
|
276 |
} |
|
277 |
||
278 |
// Record how many times SystemDictionary::load_instance_class call |
|
279 |
// fails with linkageError when Unsyncloadclass flag is set. |
|
280 |
static PerfCounter* load_instance_class_failCounter() { |
|
281 |
return _load_instance_class_failCounter; |
|
282 |
} |
|
283 |
||
284 |
// Load individual .class file |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7910
diff
changeset
|
285 |
static instanceKlassHandle load_classfile(Symbol* h_name, TRAPS); |
1 | 286 |
|
287 |
// If the specified package has been loaded by the system, then returns |
|
288 |
// the name of the directory or ZIP file that the package was loaded from. |
|
289 |
// Returns null if the package was not loaded. |
|
290 |
// Note: The specified name can either be the name of a class or package. |
|
291 |
// If a package name is specified, then it must be "/"-separator and also |
|
292 |
// end with a trailing "/". |
|
293 |
static oop get_system_package(const char* name, TRAPS); |
|
294 |
||
295 |
// Returns an array of Java strings representing all of the currently |
|
296 |
// loaded system packages. |
|
297 |
// Note: The package names returned are "/"-separated and end with a |
|
298 |
// trailing "/". |
|
299 |
static objArrayOop get_system_packages(TRAPS); |
|
300 |
||
301 |
// Initialization |
|
302 |
static void initialize(); |
|
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
303 |
CDS_ONLY(static void initialize_shared_path();) |
1 | 304 |
static void create_package_info_table(); |
13195 | 305 |
static void create_package_info_table(HashtableBucket<mtClass> *t, int length, |
1 | 306 |
int number_of_entries); |
307 |
static int compute_Object_vtable(); |
|
308 |
||
309 |
static ClassPathEntry* classpath_entry(int n) { |
|
310 |
ClassPathEntry* e = ClassLoader::_first_entry; |
|
311 |
while (--n >= 0) { |
|
312 |
assert(e != NULL, "Not that many classpath entries."); |
|
313 |
e = e->next(); |
|
314 |
} |
|
315 |
return e; |
|
316 |
} |
|
317 |
||
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
318 |
#if INCLUDE_CDS |
1 | 319 |
// Sharing dump and restore |
320 |
static void copy_package_info_buckets(char** top, char* end); |
|
321 |
static void copy_package_info_table(char** top, char* end); |
|
322 |
||
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
323 |
static void check_shared_classpath(const char *path); |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
324 |
static void finalize_shared_paths_misc_info(); |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
325 |
static int get_shared_paths_misc_info_size(); |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
326 |
static void* get_shared_paths_misc_info(); |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
327 |
static bool check_shared_paths_misc_info(void* info, int size); |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
328 |
static void exit_with_path_failure(const char* error, const char* message); |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
329 |
#endif |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
330 |
|
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
331 |
static void trace_class_path(const char* msg, const char* name = NULL); |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
332 |
|
1 | 333 |
// VM monitoring and management support |
334 |
static jlong classloader_time_ms(); |
|
335 |
static jlong class_method_total_size(); |
|
336 |
static jlong class_init_count(); |
|
337 |
static jlong class_init_time_ms(); |
|
338 |
static jlong class_verify_time_ms(); |
|
339 |
static jlong class_link_count(); |
|
340 |
static jlong class_link_time_ms(); |
|
341 |
||
342 |
// indicates if class path already contains a entry (exact match by name) |
|
343 |
static bool contains_entry(ClassPathEntry* entry); |
|
344 |
||
345 |
// adds a class path list |
|
346 |
static void add_to_list(ClassPathEntry* new_entry); |
|
347 |
||
348 |
// creates a class path zip entry (returns NULL if JAR file cannot be opened) |
|
349 |
static ClassPathZipEntry* create_class_path_zip_entry(const char *apath); |
|
350 |
||
351 |
// Debugging |
|
352 |
static void verify() PRODUCT_RETURN; |
|
353 |
||
354 |
// Force compilation of all methods in all classes in bootstrap class path (stress test) |
|
355 |
#ifndef PRODUCT |
|
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
356 |
protected: |
17004
4d2371d76a19
8011933: add number of classes, methods and time spent to CompileTheWorld
twisti
parents:
13963
diff
changeset
|
357 |
static int _compile_the_world_class_counter; |
4d2371d76a19
8011933: add number of classes, methods and time spent to CompileTheWorld
twisti
parents:
13963
diff
changeset
|
358 |
static int _compile_the_world_method_counter; |
1 | 359 |
public: |
360 |
static void compile_the_world(); |
|
361 |
static void compile_the_world_in(char* name, Handle loader, TRAPS); |
|
17004
4d2371d76a19
8011933: add number of classes, methods and time spent to CompileTheWorld
twisti
parents:
13963
diff
changeset
|
362 |
static int compile_the_world_counter() { return _compile_the_world_class_counter; } |
1 | 363 |
#endif //PRODUCT |
364 |
}; |
|
3575
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
365 |
|
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
366 |
// PerfClassTraceTime is used to measure time for class loading related events. |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
367 |
// This class tracks cumulative time and exclusive time for specific event types. |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
368 |
// During the execution of one event, other event types (e.g. class loading and |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
369 |
// resolution) as well as recursive calls of the same event type could happen. |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
370 |
// Only one elapsed timer (cumulative) and one thread-local self timer (exclusive) |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
371 |
// (i.e. only one event type) are active at a time even multiple PerfClassTraceTime |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
372 |
// instances have been created as multiple events are happening. |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
373 |
class PerfClassTraceTime { |
7910
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
374 |
public: |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
375 |
enum { |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
376 |
CLASS_LOAD = 0, |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
377 |
PARSE_CLASS = 1, |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
378 |
CLASS_LINK = 2, |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
379 |
CLASS_VERIFY = 3, |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
380 |
CLASS_CLINIT = 4, |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
381 |
DEFINE_CLASS = 5, |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
382 |
EVENT_TYPE_COUNT = 6 |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
383 |
}; |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
384 |
protected: |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
385 |
// _t tracks time from initialization to destruction of this timer instance |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
386 |
// including time for all other event types, and recursive calls of this type. |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
387 |
// When a timer is called recursively, the elapsedTimer _t would not be used. |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
388 |
elapsedTimer _t; |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
389 |
PerfLongCounter* _timep; |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
390 |
PerfLongCounter* _selftimep; |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
391 |
PerfLongCounter* _eventp; |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
392 |
// pointer to thread-local recursion counter and timer array |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
393 |
// The thread_local timers track cumulative time for specific event types |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
394 |
// exclusive of time for other event types, but including recursive calls |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
395 |
// of the same type. |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
396 |
int* _recursion_counters; |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
397 |
elapsedTimer* _timers; |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
398 |
int _event_type; |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
399 |
int _prev_active_event; |
3575
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
400 |
|
7910
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
401 |
public: |
3575
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
402 |
|
7910
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
403 |
inline PerfClassTraceTime(PerfLongCounter* timep, /* counter incremented with inclusive time */ |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
404 |
PerfLongCounter* selftimep, /* counter incremented with exclusive time */ |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
405 |
PerfLongCounter* eventp, /* event counter */ |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
406 |
int* recursion_counters, /* thread-local recursion counter array */ |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
407 |
elapsedTimer* timers, /* thread-local timer array */ |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
408 |
int type /* event type */ ) : |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
409 |
_timep(timep), _selftimep(selftimep), _eventp(eventp), _recursion_counters(recursion_counters), _timers(timers), _event_type(type) { |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
410 |
initialize(); |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
411 |
} |
3575
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
412 |
|
7910
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
413 |
inline PerfClassTraceTime(PerfLongCounter* timep, /* counter incremented with inclusive time */ |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
414 |
elapsedTimer* timers, /* thread-local timer array */ |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
415 |
int type /* event type */ ) : |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
416 |
_timep(timep), _selftimep(NULL), _eventp(NULL), _recursion_counters(NULL), _timers(timers), _event_type(type) { |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
417 |
initialize(); |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
418 |
} |
3575
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
419 |
|
7910
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
420 |
inline void suspend() { _t.stop(); _timers[_event_type].stop(); } |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
421 |
inline void resume() { _t.start(); _timers[_event_type].start(); } |
3575
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
422 |
|
7910
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
423 |
~PerfClassTraceTime(); |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
424 |
void initialize(); |
3575
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
425 |
}; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
426 |
|
7397 | 427 |
#endif // SHARE_VM_CLASSFILE_CLASSLOADER_HPP |