author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 47103 | hotspot/src/share/vm/classfile/classLoader.hpp@a993ec29ec75 |
child 47534 | a9b5df78f0f2 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
42876
diff
changeset
|
2 |
* Copyright (c) 1997, 2017, 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 |
||
47103
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
46746
diff
changeset
|
28 |
#include "classfile/jimage.hpp" |
34666 | 29 |
#include "runtime/orderAccess.hpp" |
7397 | 30 |
#include "runtime/perfData.hpp" |
34666 | 31 |
#include "utilities/exceptions.hpp" |
27683
1d5707553fff
8064580: Move INCLUDE_CDS include section to the end of the include list
stefank
parents:
27025
diff
changeset
|
32 |
#include "utilities/macros.hpp" |
7397 | 33 |
|
1 | 34 |
// The VM class loader. |
35 |
#include <sys/stat.h> |
|
36 |
||
36508 | 37 |
// Name of boot "modules" image |
38 |
#define MODULES_IMAGE_NAME "modules" |
|
39 |
||
40 |
// Name of the resource containing mapping from module names to defining class loader type |
|
41 |
#define MODULE_LOADER_MAP "jdk/internal/vm/cds/resources/ModuleLoaderMap.dat" |
|
42 |
||
43 |
// Initial sizes of the following arrays are based on the generated ModuleLoaderMap.dat |
|
44 |
#define INITIAL_BOOT_MODULES_ARRAY_SIZE 30 |
|
45 |
#define INITIAL_PLATFORM_MODULES_ARRAY_SIZE 15 |
|
46 |
||
47 |
// Class path entry (directory or zip file) |
|
1 | 48 |
|
32619
47acec81dcca
8087181: Move native jimage code to its own library (maybe libjimage)
jlaskey
parents:
31612
diff
changeset
|
49 |
class JImageFile; |
34666 | 50 |
class ClassFileStream; |
47103
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
46746
diff
changeset
|
51 |
class PackageEntry; |
31608 | 52 |
|
34666 | 53 |
class ClassPathEntry : public CHeapObj<mtClass> { |
54 |
private: |
|
40887
8d35e19f5548
8158854: Ensure release_store is paired with load_acquire in lock-free code
dholmes
parents:
40244
diff
changeset
|
55 |
ClassPathEntry* volatile _next; |
34666 | 56 |
public: |
1 | 57 |
// Next entry in class path |
40887
8d35e19f5548
8158854: Ensure release_store is paired with load_acquire in lock-free code
dholmes
parents:
40244
diff
changeset
|
58 |
ClassPathEntry* next() const { |
8d35e19f5548
8158854: Ensure release_store is paired with load_acquire in lock-free code
dholmes
parents:
40244
diff
changeset
|
59 |
return (ClassPathEntry*) OrderAccess::load_ptr_acquire(&_next); |
8d35e19f5548
8158854: Ensure release_store is paired with load_acquire in lock-free code
dholmes
parents:
40244
diff
changeset
|
60 |
} |
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46329
diff
changeset
|
61 |
virtual ~ClassPathEntry() {} |
1 | 62 |
void set_next(ClassPathEntry* next) { |
40887
8d35e19f5548
8158854: Ensure release_store is paired with load_acquire in lock-free code
dholmes
parents:
40244
diff
changeset
|
63 |
// may have unlocked readers, so ensure visibility. |
1 | 64 |
OrderAccess::release_store_ptr(&_next, next); |
65 |
} |
|
36508 | 66 |
virtual bool is_jrt() = 0; |
34666 | 67 |
virtual bool is_jar_file() const = 0; |
68 |
virtual const char* name() const = 0; |
|
69 |
virtual JImageFile* jimage() const = 0; |
|
1 | 70 |
// Constructor |
34666 | 71 |
ClassPathEntry() : _next(NULL) {} |
1 | 72 |
// Attempt to locate file_name through this class path entry. |
73 |
// 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
|
74 |
virtual ClassFileStream* open_stream(const char* name, TRAPS) = 0; |
1 | 75 |
// Debugging |
76 |
NOT_PRODUCT(virtual void compile_the_world(Handle loader, TRAPS) = 0;) |
|
77 |
}; |
|
78 |
||
79 |
class ClassPathDirEntry: public ClassPathEntry { |
|
80 |
private: |
|
26419 | 81 |
const char* _dir; // Name of directory |
1 | 82 |
public: |
36508 | 83 |
bool is_jrt() { return false; } |
34666 | 84 |
bool is_jar_file() const { return false; } |
85 |
const char* name() const { return _dir; } |
|
86 |
JImageFile* jimage() const { return NULL; } |
|
26419 | 87 |
ClassPathDirEntry(const char* dir); |
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46329
diff
changeset
|
88 |
virtual ~ClassPathDirEntry() {} |
19685
3df9b00b5d5f
8020675: invalid jar file in the bootclasspath could lead to jvm fatal error
ccheung
parents:
17004
diff
changeset
|
89 |
ClassFileStream* open_stream(const char* name, TRAPS); |
1 | 90 |
// Debugging |
91 |
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);) |
|
92 |
}; |
|
93 |
||
94 |
||
95 |
// Type definitions for zip file and zip file entry |
|
96 |
typedef void* jzfile; |
|
97 |
typedef struct { |
|
98 |
char *name; /* entry name */ |
|
99 |
jlong time; /* modification time */ |
|
100 |
jlong size; /* size of uncompressed data */ |
|
101 |
jlong csize; /* size of compressed data (zero if uncompressed) */ |
|
102 |
jint crc; /* crc of uncompressed data */ |
|
103 |
char *comment; /* optional zip file comment */ |
|
104 |
jbyte *extra; /* optional extra data */ |
|
105 |
jlong pos; /* position of LOC header (if negative) or data */ |
|
106 |
} jzentry; |
|
107 |
||
108 |
class ClassPathZipEntry: public ClassPathEntry { |
|
37418
ebb041956080
8152329: jvm should treat the "Multi-Release" jar manifest attribute name as case insensitive
ccheung
parents:
37220
diff
changeset
|
109 |
enum { |
ebb041956080
8152329: jvm should treat the "Multi-Release" jar manifest attribute name as case insensitive
ccheung
parents:
37220
diff
changeset
|
110 |
_unknown = 0, |
ebb041956080
8152329: jvm should treat the "Multi-Release" jar manifest attribute name as case insensitive
ccheung
parents:
37220
diff
changeset
|
111 |
_yes = 1, |
ebb041956080
8152329: jvm should treat the "Multi-Release" jar manifest attribute name as case insensitive
ccheung
parents:
37220
diff
changeset
|
112 |
_no = 2 |
ebb041956080
8152329: jvm should treat the "Multi-Release" jar manifest attribute name as case insensitive
ccheung
parents:
37220
diff
changeset
|
113 |
}; |
1 | 114 |
private: |
26419 | 115 |
jzfile* _zip; // The zip archive |
116 |
const char* _zip_name; // Name of zip archive |
|
37220
ec74292c0c9c
8075253: Multiversion JAR feature: CDS does not support MV-JARs
ccheung
parents:
36508
diff
changeset
|
117 |
bool _is_boot_append; // entry coming from -Xbootclasspath/a |
37418
ebb041956080
8152329: jvm should treat the "Multi-Release" jar manifest attribute name as case insensitive
ccheung
parents:
37220
diff
changeset
|
118 |
u1 _multi_versioned; // indicates if the jar file has multi-versioned entries. |
ebb041956080
8152329: jvm should treat the "Multi-Release" jar manifest attribute name as case insensitive
ccheung
parents:
37220
diff
changeset
|
119 |
// It can have value of "_unknown", "_yes", or "_no" |
1 | 120 |
public: |
36508 | 121 |
bool is_jrt() { return false; } |
34666 | 122 |
bool is_jar_file() const { return true; } |
123 |
const char* name() const { return _zip_name; } |
|
124 |
JImageFile* jimage() const { return NULL; } |
|
37220
ec74292c0c9c
8075253: Multiversion JAR feature: CDS does not support MV-JARs
ccheung
parents:
36508
diff
changeset
|
125 |
ClassPathZipEntry(jzfile* zip, const char* zip_name, bool is_boot_append); |
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46329
diff
changeset
|
126 |
virtual ~ClassPathZipEntry(); |
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
127 |
u1* open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS); |
37220
ec74292c0c9c
8075253: Multiversion JAR feature: CDS does not support MV-JARs
ccheung
parents:
36508
diff
changeset
|
128 |
u1* open_versioned_entry(const char* name, jint* filesize, TRAPS) NOT_CDS_RETURN_(NULL); |
19685
3df9b00b5d5f
8020675: invalid jar file in the bootclasspath could lead to jvm fatal error
ccheung
parents:
17004
diff
changeset
|
129 |
ClassFileStream* open_stream(const char* name, TRAPS); |
1 | 130 |
void contents_do(void f(const char* name, void* context), void* context); |
37220
ec74292c0c9c
8075253: Multiversion JAR feature: CDS does not support MV-JARs
ccheung
parents:
36508
diff
changeset
|
131 |
bool is_multiple_versioned(TRAPS) NOT_CDS_RETURN_(false); |
1 | 132 |
// Debugging |
133 |
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);) |
|
134 |
}; |
|
135 |
||
136 |
||
27562 | 137 |
// For java image files |
138 |
class ClassPathImageEntry: public ClassPathEntry { |
|
139 |
private: |
|
32619
47acec81dcca
8087181: Move native jimage code to its own library (maybe libjimage)
jlaskey
parents:
31612
diff
changeset
|
140 |
JImageFile* _jimage; |
47acec81dcca
8087181: Move native jimage code to its own library (maybe libjimage)
jlaskey
parents:
31612
diff
changeset
|
141 |
const char* _name; |
27562 | 142 |
public: |
36508 | 143 |
bool is_jrt(); |
34666 | 144 |
bool is_jar_file() const { return false; } |
145 |
bool is_open() const { return _jimage != NULL; } |
|
146 |
const char* name() const { return _name == NULL ? "" : _name; } |
|
147 |
JImageFile* jimage() const { return _jimage; } |
|
32619
47acec81dcca
8087181: Move native jimage code to its own library (maybe libjimage)
jlaskey
parents:
31612
diff
changeset
|
148 |
ClassPathImageEntry(JImageFile* jimage, const char* name); |
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46329
diff
changeset
|
149 |
virtual ~ClassPathImageEntry(); |
27562 | 150 |
ClassFileStream* open_stream(const char* name, TRAPS); |
151 |
||
152 |
// Debugging |
|
153 |
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);) |
|
1 | 154 |
}; |
155 |
||
37773
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
156 |
// ModuleClassPathList contains a linked list of ClassPathEntry's |
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
157 |
// that have been specified for a specific module. Currently, |
40244
b3055c216762
8136930: Simplify use of module-system options by custom launchers
hseigel
parents:
40013
diff
changeset
|
158 |
// the only way to specify a module/path pair is via the --patch-module |
37773
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
159 |
// command line option. |
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
160 |
class ModuleClassPathList : public CHeapObj<mtClass> { |
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
161 |
private: |
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
162 |
Symbol* _module_name; |
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
163 |
// First and last entries of class path entries for a specific module |
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
164 |
ClassPathEntry* _module_first_entry; |
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
165 |
ClassPathEntry* _module_last_entry; |
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
166 |
public: |
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
167 |
Symbol* module_name() const { return _module_name; } |
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
168 |
ClassPathEntry* module_first_entry() const { return _module_first_entry; } |
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
169 |
ModuleClassPathList(Symbol* module_name); |
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
170 |
~ModuleClassPathList(); |
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
171 |
void add_to_list(ClassPathEntry* new_entry); |
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
172 |
}; |
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
173 |
|
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
174 |
class SharedPathsMiscInfo; |
1 | 175 |
|
176 |
class ClassLoader: AllStatic { |
|
177 |
public: |
|
36508 | 178 |
enum ClassLoaderType { |
179 |
BOOT_LOADER = 1, /* boot loader */ |
|
180 |
PLATFORM_LOADER = 2, /* PlatformClassLoader */ |
|
181 |
APP_LOADER = 3 /* AppClassLoader */ |
|
1 | 182 |
}; |
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
183 |
protected: |
1 | 184 |
|
185 |
// Performance counters |
|
186 |
static PerfCounter* _perf_accumulated_time; |
|
187 |
static PerfCounter* _perf_classes_inited; |
|
188 |
static PerfCounter* _perf_class_init_time; |
|
3575
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
189 |
static PerfCounter* _perf_class_init_selftime; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
190 |
static PerfCounter* _perf_classes_verified; |
1 | 191 |
static PerfCounter* _perf_class_verify_time; |
3575
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
192 |
static PerfCounter* _perf_class_verify_selftime; |
1 | 193 |
static PerfCounter* _perf_classes_linked; |
194 |
static PerfCounter* _perf_class_link_time; |
|
3575
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
195 |
static PerfCounter* _perf_class_link_selftime; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
196 |
static PerfCounter* _perf_class_parse_time; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
197 |
static PerfCounter* _perf_class_parse_selftime; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
198 |
static PerfCounter* _perf_sys_class_lookup_time; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
199 |
static PerfCounter* _perf_shared_classload_time; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
200 |
static PerfCounter* _perf_sys_classload_time; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
201 |
static PerfCounter* _perf_app_classload_time; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
202 |
static PerfCounter* _perf_app_classload_selftime; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
203 |
static PerfCounter* _perf_app_classload_count; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
204 |
static PerfCounter* _perf_define_appclasses; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
205 |
static PerfCounter* _perf_define_appclass_time; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
206 |
static PerfCounter* _perf_define_appclass_selftime; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
207 |
static PerfCounter* _perf_app_classfile_bytes_read; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
208 |
static PerfCounter* _perf_sys_classfile_bytes_read; |
1 | 209 |
|
210 |
static PerfCounter* _sync_systemLoaderLockContentionRate; |
|
211 |
static PerfCounter* _sync_nonSystemLoaderLockContentionRate; |
|
212 |
static PerfCounter* _sync_JVMFindLoadedClassLockFreeCounter; |
|
213 |
static PerfCounter* _sync_JVMDefineClassLockFreeCounter; |
|
214 |
static PerfCounter* _sync_JNIDefineClassLockFreeCounter; |
|
215 |
||
216 |
static PerfCounter* _unsafe_defineClassCallCounter; |
|
217 |
static PerfCounter* _isUnsyncloadClass; |
|
218 |
static PerfCounter* _load_instance_class_failCounter; |
|
219 |
||
37773
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
220 |
// The boot class path consists of 3 ordered pieces: |
40244
b3055c216762
8136930: Simplify use of module-system options by custom launchers
hseigel
parents:
40013
diff
changeset
|
221 |
// 1. the module/path pairs specified to --patch-module |
b3055c216762
8136930: Simplify use of module-system options by custom launchers
hseigel
parents:
40013
diff
changeset
|
222 |
// --patch-module=<module>=<file>(<pathsep><file>)* |
37773
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
223 |
// 2. the base piece |
40013 | 224 |
// [jimage | build with exploded modules] |
37773
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
225 |
// 3. boot loader append path |
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
226 |
// [-Xbootclasspath/a]; [jvmti appended entries] |
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
227 |
// |
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
228 |
// The boot loader must obey this order when attempting |
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
229 |
// to load a class. |
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
230 |
|
40244
b3055c216762
8136930: Simplify use of module-system options by custom launchers
hseigel
parents:
40013
diff
changeset
|
231 |
// 1. Contains the module/path pairs specified to --patch-module |
b3055c216762
8136930: Simplify use of module-system options by custom launchers
hseigel
parents:
40013
diff
changeset
|
232 |
static GrowableArray<ModuleClassPathList*>* _patch_mod_entries; |
37773
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
233 |
|
40013 | 234 |
// 2. the base piece |
235 |
// Contains the ClassPathEntry of the modular java runtime image. |
|
236 |
// If no java runtime image is present, this indicates a |
|
237 |
// build with exploded modules is being used instead. |
|
238 |
static ClassPathEntry* _jrt_entry; |
|
239 |
static GrowableArray<ModuleClassPathList*>* _exploded_entries; |
|
240 |
enum { EXPLODED_ENTRY_SIZE = 80 }; // Initial number of exploded modules |
|
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
241 |
|
40013 | 242 |
// 3. the boot loader's append path |
243 |
// [-Xbootclasspath/a]; [jvmti appended entries] |
|
244 |
// Note: boot loader append path does not support named modules. |
|
36508 | 245 |
static ClassPathEntry* _first_append_entry; |
40013 | 246 |
// Last entry in linked list of appended ClassPathEntry instances |
247 |
static ClassPathEntry* _last_append_entry; |
|
1 | 248 |
|
40013 | 249 |
// Note: _num_entries includes the java runtime image and all |
250 |
// the entries on the _first_append_entry linked list. |
|
251 |
static int _num_entries; |
|
36508 | 252 |
|
47103
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
46746
diff
changeset
|
253 |
// number of entries in the boot class path including the |
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
46746
diff
changeset
|
254 |
// java runtime image |
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
46746
diff
changeset
|
255 |
static int _num_boot_entries; |
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
46746
diff
changeset
|
256 |
|
36508 | 257 |
// Array of module names associated with the boot class loader |
258 |
CDS_ONLY(static GrowableArray<char*>* _boot_modules_array;) |
|
259 |
||
260 |
// Array of module names associated with the platform class loader |
|
261 |
CDS_ONLY(static GrowableArray<char*>* _platform_modules_array;) |
|
262 |
||
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
263 |
// Info used by CDS |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
264 |
CDS_ONLY(static SharedPathsMiscInfo * _shared_paths_misc_info;) |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
265 |
|
40013 | 266 |
// Initialization: |
267 |
// - setup the boot loader's system class path |
|
40244
b3055c216762
8136930: Simplify use of module-system options by custom launchers
hseigel
parents:
40013
diff
changeset
|
268 |
// - setup the boot loader's patch mod entries, if present |
40013 | 269 |
// - create the ModuleEntry for java.base |
1 | 270 |
static void setup_bootstrap_search_path(); |
36508 | 271 |
static void setup_search_path(const char *class_path, bool setting_bootstrap); |
40244
b3055c216762
8136930: Simplify use of module-system options by custom launchers
hseigel
parents:
40013
diff
changeset
|
272 |
static void setup_patch_mod_entries(); |
40013 | 273 |
static void create_javabase(); |
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
274 |
|
1 | 275 |
static void load_zip_library(); |
32619
47acec81dcca
8087181: Move native jimage code to its own library (maybe libjimage)
jlaskey
parents:
31612
diff
changeset
|
276 |
static void load_jimage_library(); |
26419 | 277 |
static ClassPathEntry* create_class_path_entry(const char *path, const struct stat* st, |
37220
ec74292c0c9c
8075253: Multiversion JAR feature: CDS does not support MV-JARs
ccheung
parents:
36508
diff
changeset
|
278 |
bool throw_exception, |
ec74292c0c9c
8075253: Multiversion JAR feature: CDS does not support MV-JARs
ccheung
parents:
36508
diff
changeset
|
279 |
bool is_boot_append, TRAPS); |
1 | 280 |
|
36508 | 281 |
public: |
282 |
||
283 |
// If the package for the fully qualified class name is in the boot |
|
284 |
// loader's package entry table then add_package() sets the classpath_index |
|
285 |
// field so that get_system_package() will know to return a non-null value |
|
286 |
// for the package's location. And, so that the package will be added to |
|
287 |
// the list of packages returned by get_system_packages(). |
|
288 |
// For packages whose classes are loaded from the boot loader class path, the |
|
289 |
// classpath_index indicates which entry on the boot loader class path. |
|
290 |
static bool add_package(const char *fullq_class_name, s2 classpath_index, TRAPS); |
|
291 |
||
1 | 292 |
// Canonicalizes path names, so strcmp will work properly. This is mainly |
293 |
// to avoid confusing the zip library |
|
26419 | 294 |
static bool get_canonical_path(const char* orig, char* out, int len); |
34666 | 295 |
static const char* file_name_for_class_name(const char* class_name, |
296 |
int class_name_len); |
|
47103
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
46746
diff
changeset
|
297 |
static PackageEntry* get_package_entry(const char* class_name, ClassLoaderData* loader_data, TRAPS); |
34666 | 298 |
|
1 | 299 |
public: |
27562 | 300 |
static jboolean decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg); |
27025 | 301 |
static int crc32(int crc, const char* buf, int len); |
26419 | 302 |
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
|
303 |
bool check_for_duplicates, |
37220
ec74292c0c9c
8075253: Multiversion JAR feature: CDS does not support MV-JARs
ccheung
parents:
36508
diff
changeset
|
304 |
bool is_boot_append, |
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
305 |
bool throw_exception=true); |
1 | 306 |
static void print_bootclasspath(); |
307 |
||
308 |
// Timing |
|
3575
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
309 |
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
|
310 |
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
|
311 |
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
|
312 |
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
|
313 |
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
|
314 |
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
|
315 |
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
|
316 |
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
|
317 |
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
|
318 |
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
|
319 |
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
|
320 |
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
|
321 |
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
|
322 |
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
|
323 |
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
|
324 |
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
|
325 |
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
|
326 |
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
|
327 |
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
|
328 |
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
|
329 |
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
|
330 |
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
|
331 |
static PerfCounter* perf_sys_classfile_bytes_read() { return _perf_sys_classfile_bytes_read; } |
1 | 332 |
|
333 |
// Record how often system loader lock object is contended |
|
334 |
static PerfCounter* sync_systemLoaderLockContentionRate() { |
|
335 |
return _sync_systemLoaderLockContentionRate; |
|
336 |
} |
|
337 |
||
338 |
// Record how often non system loader lock object is contended |
|
339 |
static PerfCounter* sync_nonSystemLoaderLockContentionRate() { |
|
340 |
return _sync_nonSystemLoaderLockContentionRate; |
|
341 |
} |
|
342 |
||
343 |
// Record how many calls to JVM_FindLoadedClass w/o holding a lock |
|
344 |
static PerfCounter* sync_JVMFindLoadedClassLockFreeCounter() { |
|
345 |
return _sync_JVMFindLoadedClassLockFreeCounter; |
|
346 |
} |
|
347 |
||
348 |
// Record how many calls to JVM_DefineClass w/o holding a lock |
|
349 |
static PerfCounter* sync_JVMDefineClassLockFreeCounter() { |
|
350 |
return _sync_JVMDefineClassLockFreeCounter; |
|
351 |
} |
|
352 |
||
353 |
// Record how many calls to jni_DefineClass w/o holding a lock |
|
354 |
static PerfCounter* sync_JNIDefineClassLockFreeCounter() { |
|
355 |
return _sync_JNIDefineClassLockFreeCounter; |
|
356 |
} |
|
357 |
||
358 |
// Record how many calls to Unsafe_DefineClass |
|
359 |
static PerfCounter* unsafe_defineClassCallCounter() { |
|
360 |
return _unsafe_defineClassCallCounter; |
|
361 |
} |
|
362 |
||
363 |
// Record how many times SystemDictionary::load_instance_class call |
|
364 |
// fails with linkageError when Unsyncloadclass flag is set. |
|
365 |
static PerfCounter* load_instance_class_failCounter() { |
|
366 |
return _load_instance_class_failCounter; |
|
367 |
} |
|
368 |
||
40013 | 369 |
// Modular java runtime image is present vs. a build with exploded modules |
370 |
static bool has_jrt_entry() { return (_jrt_entry != NULL); } |
|
371 |
static ClassPathEntry* get_jrt_entry() { return _jrt_entry; } |
|
37773
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
372 |
|
40013 | 373 |
// Add a module's exploded directory to the boot loader's exploded module build list |
374 |
static void add_to_exploded_build_list(Symbol* module_name, TRAPS); |
|
36508 | 375 |
|
40244
b3055c216762
8136930: Simplify use of module-system options by custom launchers
hseigel
parents:
40013
diff
changeset
|
376 |
// Attempt load of individual class from either the patched or exploded modules build lists |
40013 | 377 |
static ClassFileStream* search_module_entries(const GrowableArray<ModuleClassPathList*>* const module_list, |
378 |
const char* const class_name, |
|
379 |
const char* const file_name, TRAPS); |
|
36508 | 380 |
|
1 | 381 |
// Load individual .class file |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
42876
diff
changeset
|
382 |
static InstanceKlass* load_class(Symbol* class_name, bool search_append_only, TRAPS); |
1 | 383 |
|
384 |
// If the specified package has been loaded by the system, then returns |
|
385 |
// the name of the directory or ZIP file that the package was loaded from. |
|
386 |
// Returns null if the package was not loaded. |
|
387 |
// Note: The specified name can either be the name of a class or package. |
|
388 |
// If a package name is specified, then it must be "/"-separator and also |
|
389 |
// end with a trailing "/". |
|
390 |
static oop get_system_package(const char* name, TRAPS); |
|
391 |
||
392 |
// Returns an array of Java strings representing all of the currently |
|
393 |
// loaded system packages. |
|
394 |
// Note: The package names returned are "/"-separated and end with a |
|
395 |
// trailing "/". |
|
396 |
static objArrayOop get_system_packages(TRAPS); |
|
397 |
||
398 |
// Initialization |
|
399 |
static void initialize(); |
|
40013 | 400 |
static void classLoader_init2(TRAPS); |
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
401 |
CDS_ONLY(static void initialize_shared_path();) |
36508 | 402 |
|
1 | 403 |
static int compute_Object_vtable(); |
404 |
||
405 |
static ClassPathEntry* classpath_entry(int n) { |
|
46746
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46630
diff
changeset
|
406 |
assert(n >= 0 && n < _num_entries, "sanity"); |
40013 | 407 |
if (n == 0) { |
408 |
assert(has_jrt_entry(), "No class path entry at 0 for exploded module builds"); |
|
409 |
return ClassLoader::_jrt_entry; |
|
410 |
} else { |
|
411 |
// The java runtime image is always the first entry |
|
412 |
// in the FileMapInfo::_classpath_entry_table. Even though |
|
413 |
// the _jrt_entry is not included in the _first_append_entry |
|
414 |
// linked list, it must be accounted for when comparing the |
|
415 |
// class path vs. the shared archive class path. |
|
416 |
ClassPathEntry* e = ClassLoader::_first_append_entry; |
|
417 |
while (--n >= 1) { |
|
418 |
assert(e != NULL, "Not that many classpath entries."); |
|
419 |
e = e->next(); |
|
420 |
} |
|
421 |
return e; |
|
1 | 422 |
} |
423 |
} |
|
424 |
||
46746
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46630
diff
changeset
|
425 |
static int number_of_classpath_entries() { |
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46630
diff
changeset
|
426 |
return _num_entries; |
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46630
diff
changeset
|
427 |
} |
ea379ebb9447
8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents:
46630
diff
changeset
|
428 |
|
42634
7459867ebf98
8168850: Mark module entries that have been specified by --patch-module
rprotacio
parents:
41741
diff
changeset
|
429 |
static bool is_in_patch_mod_entries(Symbol* module_name); |
7459867ebf98
8168850: Mark module entries that have been specified by --patch-module
rprotacio
parents:
41741
diff
changeset
|
430 |
|
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
431 |
#if INCLUDE_CDS |
1 | 432 |
// Sharing dump and restore |
433 |
||
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
434 |
static void check_shared_classpath(const char *path); |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
435 |
static void finalize_shared_paths_misc_info(); |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
436 |
static int get_shared_paths_misc_info_size(); |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
437 |
static void* get_shared_paths_misc_info(); |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
438 |
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
|
439 |
static void exit_with_path_failure(const char* error, const char* message); |
36508 | 440 |
|
441 |
static s2 module_to_classloader(const char* module_name); |
|
442 |
static void initialize_module_loader_map(JImageFile* jimage); |
|
38192
05ab1ee04bf2
8155678: ClassLoader::initialize_module_loader_map should only be called when dumping CDS archive.
jiangli
parents:
37418
diff
changeset
|
443 |
static s2 classloader_type(Symbol* class_name, ClassPathEntry* e, |
05ab1ee04bf2
8155678: ClassLoader::initialize_module_loader_map should only be called when dumping CDS archive.
jiangli
parents:
37418
diff
changeset
|
444 |
int classpath_index, TRAPS); |
47103
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
46746
diff
changeset
|
445 |
static void record_shared_class_loader_type(InstanceKlass* ik, const ClassFileStream* stream); |
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
446 |
#endif |
47103
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
46746
diff
changeset
|
447 |
static JImageLocationRef jimage_find_resource(JImageFile* jf, const char* module_name, |
a993ec29ec75
8186842: Use Java class loaders for creating the CDS archive
ccheung
parents:
46746
diff
changeset
|
448 |
const char* file_name, jlong &size); |
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
449 |
|
36364
5971776598e5
8150103: Convert TraceClassPaths to Unified Logging
mockner
parents:
34666
diff
changeset
|
450 |
static void trace_class_path(const char* msg, const char* name = NULL); |
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
451 |
|
1 | 452 |
// VM monitoring and management support |
453 |
static jlong classloader_time_ms(); |
|
454 |
static jlong class_method_total_size(); |
|
455 |
static jlong class_init_count(); |
|
456 |
static jlong class_init_time_ms(); |
|
457 |
static jlong class_verify_time_ms(); |
|
458 |
static jlong class_link_count(); |
|
459 |
static jlong class_link_time_ms(); |
|
460 |
||
36508 | 461 |
static void set_first_append_entry(ClassPathEntry* entry); |
462 |
||
1 | 463 |
// indicates if class path already contains a entry (exact match by name) |
41741
2f5b8bbcb18c
8166931: Do not include classes which are unusable during run time in the classlist file
ccheung
parents:
41281
diff
changeset
|
464 |
static bool contains_append_entry(const char* name); |
1 | 465 |
|
466 |
// adds a class path list |
|
467 |
static void add_to_list(ClassPathEntry* new_entry); |
|
468 |
||
469 |
// creates a class path zip entry (returns NULL if JAR file cannot be opened) |
|
37220
ec74292c0c9c
8075253: Multiversion JAR feature: CDS does not support MV-JARs
ccheung
parents:
36508
diff
changeset
|
470 |
static ClassPathZipEntry* create_class_path_zip_entry(const char *apath, bool is_boot_append); |
1 | 471 |
|
36508 | 472 |
// add a path to class path list |
473 |
static void add_to_list(const char* apath); |
|
474 |
||
475 |
static bool string_ends_with(const char* str, const char* str_to_find); |
|
476 |
||
37773
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
477 |
// obtain package name from a fully qualified class name |
39216
40c3d66352ae
8153858: Clean up needed when obtaining the package name from a fully qualified class name
rprotacio
parents:
38207
diff
changeset
|
478 |
// *bad_class_name is set to true if there's a problem with parsing class_name, to |
40c3d66352ae
8153858: Clean up needed when obtaining the package name from a fully qualified class name
rprotacio
parents:
38207
diff
changeset
|
479 |
// distinguish from a class_name with no package name, as both cases have a NULL return value |
40c3d66352ae
8153858: Clean up needed when obtaining the package name from a fully qualified class name
rprotacio
parents:
38207
diff
changeset
|
480 |
static const char* package_from_name(const char* const class_name, bool* bad_class_name = NULL); |
37773
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37418
diff
changeset
|
481 |
|
36508 | 482 |
static bool is_jrt(const char* name) { return string_ends_with(name, MODULES_IMAGE_NAME); } |
483 |
||
1 | 484 |
// Debugging |
485 |
static void verify() PRODUCT_RETURN; |
|
486 |
||
487 |
// Force compilation of all methods in all classes in bootstrap class path (stress test) |
|
488 |
#ifndef PRODUCT |
|
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25949
diff
changeset
|
489 |
protected: |
17004
4d2371d76a19
8011933: add number of classes, methods and time spent to CompileTheWorld
twisti
parents:
13963
diff
changeset
|
490 |
static int _compile_the_world_class_counter; |
4d2371d76a19
8011933: add number of classes, methods and time spent to CompileTheWorld
twisti
parents:
13963
diff
changeset
|
491 |
static int _compile_the_world_method_counter; |
1 | 492 |
public: |
493 |
static void compile_the_world(); |
|
494 |
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
|
495 |
static int compile_the_world_counter() { return _compile_the_world_class_counter; } |
1 | 496 |
#endif //PRODUCT |
497 |
}; |
|
3575
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
498 |
|
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
499 |
// 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
|
500 |
// 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
|
501 |
// 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
|
502 |
// 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
|
503 |
// 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
|
504 |
// (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
|
505 |
// 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
|
506 |
class PerfClassTraceTime { |
7910
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
507 |
public: |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
508 |
enum { |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
509 |
CLASS_LOAD = 0, |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
510 |
PARSE_CLASS = 1, |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
511 |
CLASS_LINK = 2, |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
512 |
CLASS_VERIFY = 3, |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
513 |
CLASS_CLINIT = 4, |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
514 |
DEFINE_CLASS = 5, |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
515 |
EVENT_TYPE_COUNT = 6 |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
516 |
}; |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
517 |
protected: |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
518 |
// _t tracks time from initialization to destruction of this timer instance |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
519 |
// 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
|
520 |
// 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
|
521 |
elapsedTimer _t; |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
522 |
PerfLongCounter* _timep; |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
523 |
PerfLongCounter* _selftimep; |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
524 |
PerfLongCounter* _eventp; |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
525 |
// pointer to thread-local recursion counter and timer array |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
526 |
// The thread_local timers track cumulative time for specific event types |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
527 |
// exclusive of time for other event types, but including recursive calls |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
528 |
// of the same type. |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
529 |
int* _recursion_counters; |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
530 |
elapsedTimer* _timers; |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
531 |
int _event_type; |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
532 |
int _prev_active_event; |
3575
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
533 |
|
7910
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
534 |
public: |
3575
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
535 |
|
7910
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
536 |
inline PerfClassTraceTime(PerfLongCounter* timep, /* counter incremented with inclusive time */ |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
537 |
PerfLongCounter* selftimep, /* counter incremented with exclusive time */ |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
538 |
PerfLongCounter* eventp, /* event counter */ |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
539 |
int* recursion_counters, /* thread-local recursion counter array */ |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
540 |
elapsedTimer* timers, /* thread-local timer array */ |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
541 |
int type /* event type */ ) : |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
542 |
_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
|
543 |
initialize(); |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
544 |
} |
3575
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
545 |
|
7910
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
546 |
inline PerfClassTraceTime(PerfLongCounter* timep, /* counter incremented with inclusive time */ |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
547 |
elapsedTimer* timers, /* thread-local timer array */ |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
548 |
int type /* event type */ ) : |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
549 |
_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
|
550 |
initialize(); |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
551 |
} |
3575
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
552 |
|
7910
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
553 |
inline void suspend() { _t.stop(); _timers[_event_type].stop(); } |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
554 |
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
|
555 |
|
7910
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
556 |
~PerfClassTraceTime(); |
135031ddb2bb
6966589: hs16-b08 causes java.lang.StackOverflowError
minqi
parents:
7397
diff
changeset
|
557 |
void initialize(); |
3575
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
558 |
}; |
224791e7ecab
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
1
diff
changeset
|
559 |
|
7397 | 560 |
#endif // SHARE_VM_CLASSFILE_CLASSLOADER_HPP |