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