Mercurial > hg > graal-compiler
annotate src/share/vm/classfile/classLoader.cpp @ 1980:828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
Summary: move functions from hpi library to hotspot, communicate with licensees and open source community, check jdk for dependency, file CCC request
Reviewed-by: coleenp, acorn, dsamersoff
author | ikrylov |
---|---|
date | Wed, 01 Dec 2010 18:26:32 -0500 |
parents | f95d63e2154a |
children | 06f017f7daa7 75efcee5ac47 |
rev | line source |
---|---|
0 | 1 /* |
1644
2a47bd84841f
6965184: possible races in make_not_entrant_or_zombie
never
parents:
1552
diff
changeset
|
2 * Copyright (c) 1997, 2010, 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:
1188
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1188
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:
1188
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "classfile/classFileParser.hpp" | |
27 #include "classfile/classFileStream.hpp" | |
28 #include "classfile/classLoader.hpp" | |
29 #include "classfile/javaClasses.hpp" | |
30 #include "classfile/systemDictionary.hpp" | |
31 #include "classfile/vmSymbols.hpp" | |
32 #include "compiler/compileBroker.hpp" | |
33 #include "gc_interface/collectedHeap.inline.hpp" | |
34 #include "interpreter/bytecodeStream.hpp" | |
35 #include "interpreter/oopMapCache.hpp" | |
36 #include "memory/allocation.inline.hpp" | |
37 #include "memory/generation.hpp" | |
38 #include "memory/oopFactory.hpp" | |
39 #include "memory/universe.inline.hpp" | |
40 #include "oops/constantPoolKlass.hpp" | |
41 #include "oops/instanceKlass.hpp" | |
42 #include "oops/instanceRefKlass.hpp" | |
43 #include "oops/oop.inline.hpp" | |
44 #include "oops/symbolOop.hpp" | |
45 #include "prims/jvm_misc.hpp" | |
46 #include "runtime/arguments.hpp" | |
47 #include "runtime/compilationPolicy.hpp" | |
48 #include "runtime/fprofiler.hpp" | |
49 #include "runtime/handles.hpp" | |
50 #include "runtime/handles.inline.hpp" | |
51 #include "runtime/init.hpp" | |
52 #include "runtime/interfaceSupport.hpp" | |
53 #include "runtime/java.hpp" | |
54 #include "runtime/javaCalls.hpp" | |
55 #include "runtime/threadCritical.hpp" | |
56 #include "runtime/timer.hpp" | |
57 #include "services/management.hpp" | |
58 #include "services/threadService.hpp" | |
59 #include "utilities/events.hpp" | |
60 #include "utilities/hashtable.hpp" | |
61 #include "utilities/hashtable.inline.hpp" | |
62 #ifdef TARGET_OS_FAMILY_linux | |
63 # include "os_linux.inline.hpp" | |
64 #endif | |
65 #ifdef TARGET_OS_FAMILY_solaris | |
66 # include "os_solaris.inline.hpp" | |
67 #endif | |
68 #ifdef TARGET_OS_FAMILY_windows | |
69 # include "os_windows.inline.hpp" | |
70 #endif | |
0 | 71 |
72 | |
73 // Entry points in zip.dll for loading zip/jar file entries | |
74 | |
75 typedef void * * (JNICALL *ZipOpen_t)(const char *name, char **pmsg); | |
76 typedef void (JNICALL *ZipClose_t)(jzfile *zip); | |
77 typedef jzentry* (JNICALL *FindEntry_t)(jzfile *zip, const char *name, jint *sizeP, jint *nameLen); | |
78 typedef jboolean (JNICALL *ReadEntry_t)(jzfile *zip, jzentry *entry, unsigned char *buf, char *namebuf); | |
79 typedef jboolean (JNICALL *ReadMappedEntry_t)(jzfile *zip, jzentry *entry, unsigned char **buf, char *namebuf); | |
80 typedef jzentry* (JNICALL *GetNextEntry_t)(jzfile *zip, jint n); | |
81 | |
82 static ZipOpen_t ZipOpen = NULL; | |
83 static ZipClose_t ZipClose = NULL; | |
84 static FindEntry_t FindEntry = NULL; | |
85 static ReadEntry_t ReadEntry = NULL; | |
86 static ReadMappedEntry_t ReadMappedEntry = NULL; | |
87 static GetNextEntry_t GetNextEntry = NULL; | |
88 static canonicalize_fn_t CanonicalizeEntry = NULL; | |
89 | |
90 // Globals | |
91 | |
92 PerfCounter* ClassLoader::_perf_accumulated_time = NULL; | |
93 PerfCounter* ClassLoader::_perf_classes_inited = NULL; | |
94 PerfCounter* ClassLoader::_perf_class_init_time = NULL; | |
875
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
95 PerfCounter* ClassLoader::_perf_class_init_selftime = NULL; |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
96 PerfCounter* ClassLoader::_perf_classes_verified = NULL; |
0 | 97 PerfCounter* ClassLoader::_perf_class_verify_time = NULL; |
875
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
98 PerfCounter* ClassLoader::_perf_class_verify_selftime = NULL; |
0 | 99 PerfCounter* ClassLoader::_perf_classes_linked = NULL; |
100 PerfCounter* ClassLoader::_perf_class_link_time = NULL; | |
875
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
101 PerfCounter* ClassLoader::_perf_class_link_selftime = NULL; |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
102 PerfCounter* ClassLoader::_perf_class_parse_time = NULL; |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
103 PerfCounter* ClassLoader::_perf_class_parse_selftime = NULL; |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
104 PerfCounter* ClassLoader::_perf_sys_class_lookup_time = NULL; |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
105 PerfCounter* ClassLoader::_perf_shared_classload_time = NULL; |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
106 PerfCounter* ClassLoader::_perf_sys_classload_time = NULL; |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
107 PerfCounter* ClassLoader::_perf_app_classload_time = NULL; |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
108 PerfCounter* ClassLoader::_perf_app_classload_selftime = NULL; |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
109 PerfCounter* ClassLoader::_perf_app_classload_count = NULL; |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
110 PerfCounter* ClassLoader::_perf_define_appclasses = NULL; |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
111 PerfCounter* ClassLoader::_perf_define_appclass_time = NULL; |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
112 PerfCounter* ClassLoader::_perf_define_appclass_selftime = NULL; |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
113 PerfCounter* ClassLoader::_perf_app_classfile_bytes_read = NULL; |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
114 PerfCounter* ClassLoader::_perf_sys_classfile_bytes_read = NULL; |
0 | 115 PerfCounter* ClassLoader::_sync_systemLoaderLockContentionRate = NULL; |
116 PerfCounter* ClassLoader::_sync_nonSystemLoaderLockContentionRate = NULL; | |
117 PerfCounter* ClassLoader::_sync_JVMFindLoadedClassLockFreeCounter = NULL; | |
118 PerfCounter* ClassLoader::_sync_JVMDefineClassLockFreeCounter = NULL; | |
119 PerfCounter* ClassLoader::_sync_JNIDefineClassLockFreeCounter = NULL; | |
120 PerfCounter* ClassLoader::_unsafe_defineClassCallCounter = NULL; | |
121 PerfCounter* ClassLoader::_isUnsyncloadClass = NULL; | |
122 PerfCounter* ClassLoader::_load_instance_class_failCounter = NULL; | |
123 | |
124 ClassPathEntry* ClassLoader::_first_entry = NULL; | |
125 ClassPathEntry* ClassLoader::_last_entry = NULL; | |
126 PackageHashtable* ClassLoader::_package_hash_table = NULL; | |
127 | |
128 // helper routines | |
129 bool string_starts_with(const char* str, const char* str_to_find) { | |
130 size_t str_len = strlen(str); | |
131 size_t str_to_find_len = strlen(str_to_find); | |
132 if (str_to_find_len > str_len) { | |
133 return false; | |
134 } | |
135 return (strncmp(str, str_to_find, str_to_find_len) == 0); | |
136 } | |
137 | |
138 bool string_ends_with(const char* str, const char* str_to_find) { | |
139 size_t str_len = strlen(str); | |
140 size_t str_to_find_len = strlen(str_to_find); | |
141 if (str_to_find_len > str_len) { | |
142 return false; | |
143 } | |
144 return (strncmp(str + (str_len - str_to_find_len), str_to_find, str_to_find_len) == 0); | |
145 } | |
146 | |
147 | |
148 MetaIndex::MetaIndex(char** meta_package_names, int num_meta_package_names) { | |
149 if (num_meta_package_names == 0) { | |
150 _meta_package_names = NULL; | |
151 _num_meta_package_names = 0; | |
152 } else { | |
153 _meta_package_names = NEW_C_HEAP_ARRAY(char*, num_meta_package_names); | |
154 _num_meta_package_names = num_meta_package_names; | |
155 memcpy(_meta_package_names, meta_package_names, num_meta_package_names * sizeof(char*)); | |
156 } | |
157 } | |
158 | |
159 | |
160 MetaIndex::~MetaIndex() { | |
161 FREE_C_HEAP_ARRAY(char*, _meta_package_names); | |
162 } | |
163 | |
164 | |
165 bool MetaIndex::may_contain(const char* class_name) { | |
166 if ( _num_meta_package_names == 0) { | |
167 return false; | |
168 } | |
169 size_t class_name_len = strlen(class_name); | |
170 for (int i = 0; i < _num_meta_package_names; i++) { | |
171 char* pkg = _meta_package_names[i]; | |
172 size_t pkg_len = strlen(pkg); | |
173 size_t min_len = MIN2(class_name_len, pkg_len); | |
174 if (!strncmp(class_name, pkg, min_len)) { | |
175 return true; | |
176 } | |
177 } | |
178 return false; | |
179 } | |
180 | |
181 | |
182 ClassPathEntry::ClassPathEntry() { | |
183 set_next(NULL); | |
184 } | |
185 | |
186 | |
187 bool ClassPathEntry::is_lazy() { | |
188 return false; | |
189 } | |
190 | |
191 ClassPathDirEntry::ClassPathDirEntry(char* dir) : ClassPathEntry() { | |
192 _dir = NEW_C_HEAP_ARRAY(char, strlen(dir)+1); | |
193 strcpy(_dir, dir); | |
194 } | |
195 | |
196 | |
197 ClassFileStream* ClassPathDirEntry::open_stream(const char* name) { | |
198 // construct full path name | |
199 char path[JVM_MAXPATHLEN]; | |
200 if (jio_snprintf(path, sizeof(path), "%s%s%s", _dir, os::file_separator(), name) == -1) { | |
201 return NULL; | |
202 } | |
203 // check if file exists | |
204 struct stat st; | |
205 if (os::stat(path, &st) == 0) { | |
206 // found file, open it | |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
207 int file_handle = os::open(path, 0, 0); |
0 | 208 if (file_handle != -1) { |
209 // read contents into resource array | |
210 u1* buffer = NEW_RESOURCE_ARRAY(u1, st.st_size); | |
211 size_t num_read = os::read(file_handle, (char*) buffer, st.st_size); | |
212 // close file | |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
213 os::close(file_handle); |
0 | 214 // construct ClassFileStream |
215 if (num_read == (size_t)st.st_size) { | |
875
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
216 if (UsePerfData) { |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
217 ClassLoader::perf_sys_classfile_bytes_read()->inc(num_read); |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
218 } |
0 | 219 return new ClassFileStream(buffer, st.st_size, _dir); // Resource allocated |
220 } | |
221 } | |
222 } | |
223 return NULL; | |
224 } | |
225 | |
226 | |
227 ClassPathZipEntry::ClassPathZipEntry(jzfile* zip, const char* zip_name) : ClassPathEntry() { | |
228 _zip = zip; | |
229 _zip_name = NEW_C_HEAP_ARRAY(char, strlen(zip_name)+1); | |
230 strcpy(_zip_name, zip_name); | |
231 } | |
232 | |
233 ClassPathZipEntry::~ClassPathZipEntry() { | |
234 if (ZipClose != NULL) { | |
235 (*ZipClose)(_zip); | |
236 } | |
237 FREE_C_HEAP_ARRAY(char, _zip_name); | |
238 } | |
239 | |
240 ClassFileStream* ClassPathZipEntry::open_stream(const char* name) { | |
241 // enable call to C land | |
242 JavaThread* thread = JavaThread::current(); | |
243 ThreadToNativeFromVM ttn(thread); | |
244 // check whether zip archive contains name | |
245 jint filesize, name_len; | |
246 jzentry* entry = (*FindEntry)(_zip, name, &filesize, &name_len); | |
247 if (entry == NULL) return NULL; | |
248 u1* buffer; | |
249 char name_buf[128]; | |
250 char* filename; | |
251 if (name_len < 128) { | |
252 filename = name_buf; | |
253 } else { | |
254 filename = NEW_RESOURCE_ARRAY(char, name_len + 1); | |
255 } | |
256 | |
257 // file found, get pointer to class in mmaped jar file. | |
258 if (ReadMappedEntry == NULL || | |
259 !(*ReadMappedEntry)(_zip, entry, &buffer, filename)) { | |
260 // mmaped access not available, perhaps due to compression, | |
261 // read contents into resource array | |
262 buffer = NEW_RESOURCE_ARRAY(u1, filesize); | |
263 if (!(*ReadEntry)(_zip, entry, buffer, filename)) return NULL; | |
264 } | |
875
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
265 if (UsePerfData) { |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
266 ClassLoader::perf_sys_classfile_bytes_read()->inc(filesize); |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
267 } |
0 | 268 // return result |
269 return new ClassFileStream(buffer, filesize, _zip_name); // Resource allocated | |
270 } | |
271 | |
272 // invoke function for each entry in the zip file | |
273 void ClassPathZipEntry::contents_do(void f(const char* name, void* context), void* context) { | |
274 JavaThread* thread = JavaThread::current(); | |
275 HandleMark handle_mark(thread); | |
276 ThreadToNativeFromVM ttn(thread); | |
277 for (int n = 0; ; n++) { | |
278 jzentry * ze = ((*GetNextEntry)(_zip, n)); | |
279 if (ze == NULL) break; | |
280 (*f)(ze->name, context); | |
281 } | |
282 } | |
283 | |
284 LazyClassPathEntry::LazyClassPathEntry(char* path, struct stat st) : ClassPathEntry() { | |
285 _path = strdup(path); | |
286 _st = st; | |
287 _meta_index = NULL; | |
288 _resolved_entry = NULL; | |
289 } | |
290 | |
291 bool LazyClassPathEntry::is_jar_file() { | |
292 return ((_st.st_mode & S_IFREG) == S_IFREG); | |
293 } | |
294 | |
295 ClassPathEntry* LazyClassPathEntry::resolve_entry() { | |
296 if (_resolved_entry != NULL) { | |
297 return (ClassPathEntry*) _resolved_entry; | |
298 } | |
299 ClassPathEntry* new_entry = NULL; | |
300 ClassLoader::create_class_path_entry(_path, _st, &new_entry, false); | |
301 assert(new_entry != NULL, "earlier code should have caught this"); | |
302 { | |
303 ThreadCritical tc; | |
304 if (_resolved_entry == NULL) { | |
305 _resolved_entry = new_entry; | |
306 return new_entry; | |
307 } | |
308 } | |
309 assert(_resolved_entry != NULL, "bug in MT-safe resolution logic"); | |
310 delete new_entry; | |
311 return (ClassPathEntry*) _resolved_entry; | |
312 } | |
313 | |
314 ClassFileStream* LazyClassPathEntry::open_stream(const char* name) { | |
315 if (_meta_index != NULL && | |
316 !_meta_index->may_contain(name)) { | |
317 return NULL; | |
318 } | |
319 return resolve_entry()->open_stream(name); | |
320 } | |
321 | |
322 bool LazyClassPathEntry::is_lazy() { | |
323 return true; | |
324 } | |
325 | |
326 static void print_meta_index(LazyClassPathEntry* entry, | |
327 GrowableArray<char*>& meta_packages) { | |
328 tty->print("[Meta index for %s=", entry->name()); | |
329 for (int i = 0; i < meta_packages.length(); i++) { | |
330 if (i > 0) tty->print(" "); | |
331 tty->print(meta_packages.at(i)); | |
332 } | |
333 tty->print_cr("]"); | |
334 } | |
335 | |
336 | |
337 void ClassLoader::setup_meta_index() { | |
338 // Set up meta index which allows us to open boot jars lazily if | |
339 // class data sharing is enabled | |
340 const char* known_version = "% VERSION 2"; | |
341 char* meta_index_path = Arguments::get_meta_index_path(); | |
342 char* meta_index_dir = Arguments::get_meta_index_dir(); | |
343 FILE* file = fopen(meta_index_path, "r"); | |
344 int line_no = 0; | |
345 if (file != NULL) { | |
346 ResourceMark rm; | |
347 LazyClassPathEntry* cur_entry = NULL; | |
348 GrowableArray<char*> boot_class_path_packages(10); | |
349 char package_name[256]; | |
350 bool skipCurrentJar = false; | |
351 while (fgets(package_name, sizeof(package_name), file) != NULL) { | |
352 ++line_no; | |
353 // Remove trailing newline | |
354 package_name[strlen(package_name) - 1] = '\0'; | |
355 switch(package_name[0]) { | |
356 case '%': | |
357 { | |
358 if ((line_no == 1) && (strcmp(package_name, known_version) != 0)) { | |
359 if (TraceClassLoading && Verbose) { | |
360 tty->print("[Unsupported meta index version]"); | |
361 } | |
362 fclose(file); | |
363 return; | |
364 } | |
365 } | |
366 | |
367 // These directives indicate jar files which contain only | |
368 // classes, only non-classfile resources, or a combination of | |
369 // the two. See src/share/classes/sun/misc/MetaIndex.java and | |
370 // make/tools/MetaIndex/BuildMetaIndex.java in the J2SE | |
371 // workspace. | |
372 case '#': | |
373 case '!': | |
374 case '@': | |
375 { | |
376 // Hand off current packages to current lazy entry (if any) | |
377 if ((cur_entry != NULL) && | |
378 (boot_class_path_packages.length() > 0)) { | |
379 if (TraceClassLoading && Verbose) { | |
380 print_meta_index(cur_entry, boot_class_path_packages); | |
381 } | |
382 MetaIndex* index = new MetaIndex(boot_class_path_packages.adr_at(0), | |
383 boot_class_path_packages.length()); | |
384 cur_entry->set_meta_index(index); | |
385 } | |
386 cur_entry = NULL; | |
387 boot_class_path_packages.clear(); | |
388 | |
389 // Find lazy entry corresponding to this jar file | |
390 for (ClassPathEntry* entry = _first_entry; entry != NULL; entry = entry->next()) { | |
391 if (entry->is_lazy() && | |
392 string_starts_with(entry->name(), meta_index_dir) && | |
393 string_ends_with(entry->name(), &package_name[2])) { | |
394 cur_entry = (LazyClassPathEntry*) entry; | |
395 break; | |
396 } | |
397 } | |
398 | |
399 // If the first character is '@', it indicates the following jar | |
400 // file is a resource only jar file in which case, we should skip | |
401 // reading the subsequent entries since the resource loading is | |
402 // totally handled by J2SE side. | |
403 if (package_name[0] == '@') { | |
404 if (cur_entry != NULL) { | |
405 cur_entry->set_meta_index(new MetaIndex(NULL, 0)); | |
406 } | |
407 cur_entry = NULL; | |
408 skipCurrentJar = true; | |
409 } else { | |
410 skipCurrentJar = false; | |
411 } | |
412 | |
413 break; | |
414 } | |
415 | |
416 default: | |
417 { | |
418 if (!skipCurrentJar && cur_entry != NULL) { | |
419 char* new_name = strdup(package_name); | |
420 boot_class_path_packages.append(new_name); | |
421 } | |
422 } | |
423 } | |
424 } | |
425 // Hand off current packages to current lazy entry (if any) | |
426 if ((cur_entry != NULL) && | |
427 (boot_class_path_packages.length() > 0)) { | |
428 if (TraceClassLoading && Verbose) { | |
429 print_meta_index(cur_entry, boot_class_path_packages); | |
430 } | |
431 MetaIndex* index = new MetaIndex(boot_class_path_packages.adr_at(0), | |
432 boot_class_path_packages.length()); | |
433 cur_entry->set_meta_index(index); | |
434 } | |
435 fclose(file); | |
436 } | |
437 } | |
438 | |
439 void ClassLoader::setup_bootstrap_search_path() { | |
440 assert(_first_entry == NULL, "should not setup bootstrap class search path twice"); | |
441 char* sys_class_path = os::strdup(Arguments::get_sysclasspath()); | |
442 if (TraceClassLoading && Verbose) { | |
443 tty->print_cr("[Bootstrap loader class path=%s]", sys_class_path); | |
444 } | |
445 | |
446 int len = (int)strlen(sys_class_path); | |
447 int end = 0; | |
448 | |
449 // Iterate over class path entries | |
450 for (int start = 0; start < len; start = end) { | |
451 while (sys_class_path[end] && sys_class_path[end] != os::path_separator()[0]) { | |
452 end++; | |
453 } | |
454 char* path = NEW_C_HEAP_ARRAY(char, end-start+1); | |
455 strncpy(path, &sys_class_path[start], end-start); | |
456 path[end-start] = '\0'; | |
457 update_class_path_entry_list(path, false); | |
458 FREE_C_HEAP_ARRAY(char, path); | |
459 while (sys_class_path[end] == os::path_separator()[0]) { | |
460 end++; | |
461 } | |
462 } | |
463 } | |
464 | |
465 void ClassLoader::create_class_path_entry(char *path, struct stat st, ClassPathEntry **new_entry, bool lazy) { | |
466 JavaThread* thread = JavaThread::current(); | |
467 if (lazy) { | |
468 *new_entry = new LazyClassPathEntry(path, st); | |
469 return; | |
470 } | |
471 if ((st.st_mode & S_IFREG) == S_IFREG) { | |
472 // Regular file, should be a zip file | |
473 // Canonicalized filename | |
474 char canonical_path[JVM_MAXPATHLEN]; | |
475 if (!get_canonical_path(path, canonical_path, JVM_MAXPATHLEN)) { | |
476 // This matches the classic VM | |
477 EXCEPTION_MARK; | |
478 THROW_MSG(vmSymbols::java_io_IOException(), "Bad pathname"); | |
479 } | |
480 char* error_msg = NULL; | |
481 jzfile* zip; | |
482 { | |
483 // enable call to C land | |
484 ThreadToNativeFromVM ttn(thread); | |
485 HandleMark hm(thread); | |
486 zip = (*ZipOpen)(canonical_path, &error_msg); | |
487 } | |
488 if (zip != NULL && error_msg == NULL) { | |
489 *new_entry = new ClassPathZipEntry(zip, path); | |
490 if (TraceClassLoading) { | |
491 tty->print_cr("[Opened %s]", path); | |
492 } | |
493 } else { | |
494 ResourceMark rm(thread); | |
495 char *msg; | |
496 if (error_msg == NULL) { | |
497 msg = NEW_RESOURCE_ARRAY(char, strlen(path) + 128); ; | |
498 jio_snprintf(msg, strlen(path) + 127, "error in opening JAR file %s", path); | |
499 } else { | |
500 int len = (int)(strlen(path) + strlen(error_msg) + 128); | |
501 msg = NEW_RESOURCE_ARRAY(char, len); ; | |
502 jio_snprintf(msg, len - 1, "error in opening JAR file <%s> %s", error_msg, path); | |
503 } | |
504 EXCEPTION_MARK; | |
505 THROW_MSG(vmSymbols::java_lang_ClassNotFoundException(), msg); | |
506 } | |
507 } else { | |
508 // Directory | |
509 *new_entry = new ClassPathDirEntry(path); | |
510 if (TraceClassLoading) { | |
511 tty->print_cr("[Path %s]", path); | |
512 } | |
513 } | |
514 } | |
515 | |
516 | |
517 // Create a class path zip entry for a given path (return NULL if not found | |
518 // or zip/JAR file cannot be opened) | |
519 ClassPathZipEntry* ClassLoader::create_class_path_zip_entry(const char *path) { | |
520 // check for a regular file | |
521 struct stat st; | |
522 if (os::stat(path, &st) == 0) { | |
523 if ((st.st_mode & S_IFREG) == S_IFREG) { | |
524 char orig_path[JVM_MAXPATHLEN]; | |
525 char canonical_path[JVM_MAXPATHLEN]; | |
526 | |
527 strcpy(orig_path, path); | |
528 if (get_canonical_path(orig_path, canonical_path, JVM_MAXPATHLEN)) { | |
529 char* error_msg = NULL; | |
530 jzfile* zip; | |
531 { | |
532 // enable call to C land | |
533 JavaThread* thread = JavaThread::current(); | |
534 ThreadToNativeFromVM ttn(thread); | |
535 HandleMark hm(thread); | |
536 zip = (*ZipOpen)(canonical_path, &error_msg); | |
537 } | |
538 if (zip != NULL && error_msg == NULL) { | |
539 // create using canonical path | |
540 return new ClassPathZipEntry(zip, canonical_path); | |
541 } | |
542 } | |
543 } | |
544 } | |
545 return NULL; | |
546 } | |
547 | |
548 // returns true if entry already on class path | |
549 bool ClassLoader::contains_entry(ClassPathEntry *entry) { | |
550 ClassPathEntry* e = _first_entry; | |
551 while (e != NULL) { | |
552 // assume zip entries have been canonicalized | |
553 if (strcmp(entry->name(), e->name()) == 0) { | |
554 return true; | |
555 } | |
556 e = e->next(); | |
557 } | |
558 return false; | |
559 } | |
560 | |
561 void ClassLoader::add_to_list(ClassPathEntry *new_entry) { | |
562 if (new_entry != NULL) { | |
563 if (_last_entry == NULL) { | |
564 _first_entry = _last_entry = new_entry; | |
565 } else { | |
566 _last_entry->set_next(new_entry); | |
567 _last_entry = new_entry; | |
568 } | |
569 } | |
570 } | |
571 | |
572 void ClassLoader::update_class_path_entry_list(const char *path, | |
573 bool check_for_duplicates) { | |
574 struct stat st; | |
575 if (os::stat((char *)path, &st) == 0) { | |
576 // File or directory found | |
577 ClassPathEntry* new_entry = NULL; | |
578 create_class_path_entry((char *)path, st, &new_entry, LazyBootClassLoader); | |
579 // The kernel VM adds dynamically to the end of the classloader path and | |
580 // doesn't reorder the bootclasspath which would break java.lang.Package | |
581 // (see PackageInfo). | |
582 // Add new entry to linked list | |
583 if (!check_for_duplicates || !contains_entry(new_entry)) { | |
584 add_to_list(new_entry); | |
585 } | |
586 } | |
587 } | |
588 | |
589 void ClassLoader::print_bootclasspath() { | |
590 ClassPathEntry* e = _first_entry; | |
591 tty->print("[bootclasspath= "); | |
592 while (e != NULL) { | |
593 tty->print("%s ;", e->name()); | |
594 e = e->next(); | |
595 } | |
596 tty->print_cr("]"); | |
597 } | |
598 | |
599 void ClassLoader::load_zip_library() { | |
600 assert(ZipOpen == NULL, "should not load zip library twice"); | |
601 // First make sure native library is loaded | |
602 os::native_java_library(); | |
603 // Load zip library | |
604 char path[JVM_MAXPATHLEN]; | |
605 char ebuf[1024]; | |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
606 os::dll_build_name(path, sizeof(path), Arguments::get_dll_dir(), "zip"); |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
607 void* handle = os::dll_load(path, ebuf, sizeof ebuf); |
0 | 608 if (handle == NULL) { |
609 vm_exit_during_initialization("Unable to load ZIP library", path); | |
610 } | |
611 // Lookup zip entry points | |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
612 ZipOpen = CAST_TO_FN_PTR(ZipOpen_t, os::dll_lookup(handle, "ZIP_Open")); |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
613 ZipClose = CAST_TO_FN_PTR(ZipClose_t, os::dll_lookup(handle, "ZIP_Close")); |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
614 FindEntry = CAST_TO_FN_PTR(FindEntry_t, os::dll_lookup(handle, "ZIP_FindEntry")); |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
615 ReadEntry = CAST_TO_FN_PTR(ReadEntry_t, os::dll_lookup(handle, "ZIP_ReadEntry")); |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
616 ReadMappedEntry = CAST_TO_FN_PTR(ReadMappedEntry_t, os::dll_lookup(handle, "ZIP_ReadMappedEntry")); |
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
617 GetNextEntry = CAST_TO_FN_PTR(GetNextEntry_t, os::dll_lookup(handle, "ZIP_GetNextEntry")); |
0 | 618 |
619 // ZIP_Close is not exported on Windows in JDK5.0 so don't abort if ZIP_Close is NULL | |
620 if (ZipOpen == NULL || FindEntry == NULL || ReadEntry == NULL || GetNextEntry == NULL) { | |
621 vm_exit_during_initialization("Corrupted ZIP library", path); | |
622 } | |
623 | |
624 // Lookup canonicalize entry in libjava.dll | |
625 void *javalib_handle = os::native_java_library(); | |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
626 CanonicalizeEntry = CAST_TO_FN_PTR(canonicalize_fn_t, os::dll_lookup(javalib_handle, "Canonicalize")); |
0 | 627 // This lookup only works on 1.3. Do not check for non-null here |
628 } | |
629 | |
630 // PackageInfo data exists in order to support the java.lang.Package | |
631 // class. A Package object provides information about a java package | |
632 // (version, vendor, etc.) which originates in the manifest of the jar | |
633 // file supplying the package. For application classes, the ClassLoader | |
634 // object takes care of this. | |
635 | |
636 // For system (boot) classes, the Java code in the Package class needs | |
637 // to be able to identify which source jar file contained the boot | |
638 // class, so that it can extract the manifest from it. This table | |
639 // identifies java packages with jar files in the boot classpath. | |
640 | |
641 // Because the boot classpath cannot change, the classpath index is | |
642 // sufficient to identify the source jar file or directory. (Since | |
643 // directories have no manifests, the directory name is not required, | |
644 // but is available.) | |
645 | |
646 // When using sharing -- the pathnames of entries in the boot classpath | |
647 // may not be the same at runtime as they were when the archive was | |
648 // created (NFS, Samba, etc.). The actual files and directories named | |
649 // in the classpath must be the same files, in the same order, even | |
650 // though the exact name is not the same. | |
651 | |
652 class PackageInfo: public BasicHashtableEntry { | |
653 public: | |
654 const char* _pkgname; // Package name | |
655 int _classpath_index; // Index of directory or JAR file loaded from | |
656 | |
657 PackageInfo* next() { | |
658 return (PackageInfo*)BasicHashtableEntry::next(); | |
659 } | |
660 | |
661 const char* pkgname() { return _pkgname; } | |
662 void set_pkgname(char* pkgname) { _pkgname = pkgname; } | |
663 | |
664 const char* filename() { | |
665 return ClassLoader::classpath_entry(_classpath_index)->name(); | |
666 } | |
667 | |
668 void set_index(int index) { | |
669 _classpath_index = index; | |
670 } | |
671 }; | |
672 | |
673 | |
674 class PackageHashtable : public BasicHashtable { | |
675 private: | |
676 inline unsigned int compute_hash(const char *s, int n) { | |
677 unsigned int val = 0; | |
678 while (--n >= 0) { | |
679 val = *s++ + 31 * val; | |
680 } | |
681 return val; | |
682 } | |
683 | |
684 PackageInfo* bucket(int index) { | |
685 return (PackageInfo*)BasicHashtable::bucket(index); | |
686 } | |
687 | |
688 PackageInfo* get_entry(int index, unsigned int hash, | |
689 const char* pkgname, size_t n) { | |
690 for (PackageInfo* pp = bucket(index); pp != NULL; pp = pp->next()) { | |
691 if (pp->hash() == hash && | |
692 strncmp(pkgname, pp->pkgname(), n) == 0 && | |
693 pp->pkgname()[n] == '\0') { | |
694 return pp; | |
695 } | |
696 } | |
697 return NULL; | |
698 } | |
699 | |
700 public: | |
701 PackageHashtable(int table_size) | |
702 : BasicHashtable(table_size, sizeof(PackageInfo)) {} | |
703 | |
704 PackageHashtable(int table_size, HashtableBucket* t, int number_of_entries) | |
705 : BasicHashtable(table_size, sizeof(PackageInfo), t, number_of_entries) {} | |
706 | |
707 PackageInfo* get_entry(const char* pkgname, int n) { | |
708 unsigned int hash = compute_hash(pkgname, n); | |
709 return get_entry(hash_to_index(hash), hash, pkgname, n); | |
710 } | |
711 | |
712 PackageInfo* new_entry(char* pkgname, int n) { | |
713 unsigned int hash = compute_hash(pkgname, n); | |
714 PackageInfo* pp; | |
715 pp = (PackageInfo*)BasicHashtable::new_entry(hash); | |
716 pp->set_pkgname(pkgname); | |
717 return pp; | |
718 } | |
719 | |
720 void add_entry(PackageInfo* pp) { | |
721 int index = hash_to_index(pp->hash()); | |
722 BasicHashtable::add_entry(index, pp); | |
723 } | |
724 | |
725 void copy_pkgnames(const char** packages) { | |
726 int n = 0; | |
727 for (int i = 0; i < table_size(); ++i) { | |
728 for (PackageInfo* pp = bucket(i); pp != NULL; pp = pp->next()) { | |
729 packages[n++] = pp->pkgname(); | |
730 } | |
731 } | |
732 assert(n == number_of_entries(), "just checking"); | |
733 } | |
734 | |
735 void copy_table(char** top, char* end, PackageHashtable* table); | |
736 }; | |
737 | |
738 | |
739 void PackageHashtable::copy_table(char** top, char* end, | |
740 PackageHashtable* table) { | |
741 // Copy (relocate) the table to the shared space. | |
742 BasicHashtable::copy_table(top, end); | |
743 | |
744 // Calculate the space needed for the package name strings. | |
745 int i; | |
746 int n = 0; | |
747 for (i = 0; i < table_size(); ++i) { | |
748 for (PackageInfo* pp = table->bucket(i); | |
749 pp != NULL; | |
750 pp = pp->next()) { | |
751 n += (int)(strlen(pp->pkgname()) + 1); | |
752 } | |
753 } | |
754 if (*top + n + sizeof(intptr_t) >= end) { | |
755 warning("\nThe shared miscellaneous data space is not large " | |
756 "enough to \npreload requested classes. Use " | |
757 "-XX:SharedMiscDataSize= to increase \nthe initial " | |
758 "size of the miscellaneous data space.\n"); | |
759 exit(2); | |
760 } | |
761 | |
762 // Copy the table data (the strings) to the shared space. | |
763 n = align_size_up(n, sizeof(HeapWord)); | |
764 *(intptr_t*)(*top) = n; | |
765 *top += sizeof(intptr_t); | |
766 | |
767 for (i = 0; i < table_size(); ++i) { | |
768 for (PackageInfo* pp = table->bucket(i); | |
769 pp != NULL; | |
770 pp = pp->next()) { | |
771 int n1 = (int)(strlen(pp->pkgname()) + 1); | |
772 pp->set_pkgname((char*)memcpy(*top, pp->pkgname(), n1)); | |
773 *top += n1; | |
774 } | |
775 } | |
776 *top = (char*)align_size_up((intptr_t)*top, sizeof(HeapWord)); | |
777 } | |
778 | |
779 | |
780 void ClassLoader::copy_package_info_buckets(char** top, char* end) { | |
781 _package_hash_table->copy_buckets(top, end); | |
782 } | |
783 | |
784 void ClassLoader::copy_package_info_table(char** top, char* end) { | |
785 _package_hash_table->copy_table(top, end, _package_hash_table); | |
786 } | |
787 | |
788 | |
789 PackageInfo* ClassLoader::lookup_package(const char *pkgname) { | |
790 const char *cp = strrchr(pkgname, '/'); | |
791 if (cp != NULL) { | |
792 // Package prefix found | |
793 int n = cp - pkgname + 1; | |
794 return _package_hash_table->get_entry(pkgname, n); | |
795 } | |
796 return NULL; | |
797 } | |
798 | |
799 | |
800 bool ClassLoader::add_package(const char *pkgname, int classpath_index, TRAPS) { | |
801 assert(pkgname != NULL, "just checking"); | |
802 // Bootstrap loader no longer holds system loader lock obj serializing | |
803 // load_instance_class and thereby add_package | |
804 { | |
805 MutexLocker ml(PackageTable_lock, THREAD); | |
806 // First check for previously loaded entry | |
807 PackageInfo* pp = lookup_package(pkgname); | |
808 if (pp != NULL) { | |
809 // Existing entry found, check source of package | |
810 pp->set_index(classpath_index); | |
811 return true; | |
812 } | |
813 | |
814 const char *cp = strrchr(pkgname, '/'); | |
815 if (cp != NULL) { | |
816 // Package prefix found | |
817 int n = cp - pkgname + 1; | |
818 | |
819 char* new_pkgname = NEW_C_HEAP_ARRAY(char, n + 1); | |
820 if (new_pkgname == NULL) { | |
821 return false; | |
822 } | |
823 | |
824 memcpy(new_pkgname, pkgname, n); | |
825 new_pkgname[n] = '\0'; | |
826 pp = _package_hash_table->new_entry(new_pkgname, n); | |
827 pp->set_index(classpath_index); | |
828 | |
829 // Insert into hash table | |
830 _package_hash_table->add_entry(pp); | |
831 } | |
832 return true; | |
833 } | |
834 } | |
835 | |
836 | |
837 oop ClassLoader::get_system_package(const char* name, TRAPS) { | |
838 PackageInfo* pp; | |
839 { | |
840 MutexLocker ml(PackageTable_lock, THREAD); | |
841 pp = lookup_package(name); | |
842 } | |
843 if (pp == NULL) { | |
844 return NULL; | |
845 } else { | |
846 Handle p = java_lang_String::create_from_str(pp->filename(), THREAD); | |
847 return p(); | |
848 } | |
849 } | |
850 | |
851 | |
852 objArrayOop ClassLoader::get_system_packages(TRAPS) { | |
853 ResourceMark rm(THREAD); | |
854 int nof_entries; | |
855 const char** packages; | |
856 { | |
857 MutexLocker ml(PackageTable_lock, THREAD); | |
858 // Allocate resource char* array containing package names | |
859 nof_entries = _package_hash_table->number_of_entries(); | |
860 if ((packages = NEW_RESOURCE_ARRAY(const char*, nof_entries)) == NULL) { | |
861 return NULL; | |
862 } | |
863 _package_hash_table->copy_pkgnames(packages); | |
864 } | |
865 // Allocate objArray and fill with java.lang.String | |
1142 | 866 objArrayOop r = oopFactory::new_objArray(SystemDictionary::String_klass(), |
0 | 867 nof_entries, CHECK_0); |
868 objArrayHandle result(THREAD, r); | |
869 for (int i = 0; i < nof_entries; i++) { | |
870 Handle str = java_lang_String::create_from_str(packages[i], CHECK_0); | |
871 result->obj_at_put(i, str()); | |
872 } | |
873 | |
874 return result(); | |
875 } | |
876 | |
877 | |
878 instanceKlassHandle ClassLoader::load_classfile(symbolHandle h_name, TRAPS) { | |
879 ResourceMark rm(THREAD); | |
880 EventMark m("loading class " INTPTR_FORMAT, (address)h_name()); | |
881 ThreadProfilerMark tpm(ThreadProfilerMark::classLoaderRegion); | |
882 | |
883 stringStream st; | |
884 // st.print() uses too much stack space while handling a StackOverflowError | |
885 // st.print("%s.class", h_name->as_utf8()); | |
886 st.print_raw(h_name->as_utf8()); | |
887 st.print_raw(".class"); | |
888 char* name = st.as_string(); | |
889 | |
890 // Lookup stream for parsing .class file | |
891 ClassFileStream* stream = NULL; | |
892 int classpath_index = 0; | |
893 { | |
875
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
894 PerfClassTraceTime vmtimer(perf_sys_class_lookup_time(), |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
895 ((JavaThread*) THREAD)->get_thread_stat()->perf_timers_addr(), |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
896 PerfClassTraceTime::CLASS_LOAD); |
0 | 897 ClassPathEntry* e = _first_entry; |
898 while (e != NULL) { | |
899 stream = e->open_stream(name); | |
900 if (stream != NULL) { | |
901 break; | |
902 } | |
903 e = e->next(); | |
904 ++classpath_index; | |
905 } | |
906 } | |
907 | |
908 instanceKlassHandle h(THREAD, klassOop(NULL)); | |
909 if (stream != NULL) { | |
910 | |
911 // class file found, parse it | |
912 ClassFileParser parser(stream); | |
913 Handle class_loader; | |
914 Handle protection_domain; | |
915 symbolHandle parsed_name; | |
916 instanceKlassHandle result = parser.parseClassFile(h_name, | |
917 class_loader, | |
918 protection_domain, | |
919 parsed_name, | |
973
ad6585fd4087
6830542: Performance: JVM_DefineClass already verified.
acorn
parents:
882
diff
changeset
|
920 false, |
0 | 921 CHECK_(h)); |
922 | |
923 // add to package table | |
924 if (add_package(name, classpath_index, THREAD)) { | |
925 h = result; | |
926 } | |
927 } | |
928 | |
929 return h; | |
930 } | |
931 | |
932 | |
933 void ClassLoader::create_package_info_table(HashtableBucket *t, int length, | |
934 int number_of_entries) { | |
935 assert(_package_hash_table == NULL, "One package info table allowed."); | |
936 assert(length == package_hash_table_size * sizeof(HashtableBucket), | |
937 "bad shared package info size."); | |
938 _package_hash_table = new PackageHashtable(package_hash_table_size, t, | |
939 number_of_entries); | |
940 } | |
941 | |
942 | |
943 void ClassLoader::create_package_info_table() { | |
944 assert(_package_hash_table == NULL, "shouldn't have one yet"); | |
945 _package_hash_table = new PackageHashtable(package_hash_table_size); | |
946 } | |
947 | |
948 | |
949 // Initialize the class loader's access to methods in libzip. Parse and | |
950 // process the boot classpath into a list ClassPathEntry objects. Once | |
951 // this list has been created, it must not change order (see class PackageInfo) | |
952 // it can be appended to and is by jvmti and the kernel vm. | |
953 | |
954 void ClassLoader::initialize() { | |
955 assert(_package_hash_table == NULL, "should have been initialized by now."); | |
956 EXCEPTION_MARK; | |
957 | |
958 if (UsePerfData) { | |
959 // jvmstat performance counters | |
960 NEWPERFTICKCOUNTER(_perf_accumulated_time, SUN_CLS, "time"); | |
961 NEWPERFTICKCOUNTER(_perf_class_init_time, SUN_CLS, "classInitTime"); | |
875
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
962 NEWPERFTICKCOUNTER(_perf_class_init_selftime, SUN_CLS, "classInitTime.self"); |
0 | 963 NEWPERFTICKCOUNTER(_perf_class_verify_time, SUN_CLS, "classVerifyTime"); |
875
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
964 NEWPERFTICKCOUNTER(_perf_class_verify_selftime, SUN_CLS, "classVerifyTime.self"); |
0 | 965 NEWPERFTICKCOUNTER(_perf_class_link_time, SUN_CLS, "classLinkedTime"); |
875
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
966 NEWPERFTICKCOUNTER(_perf_class_link_selftime, SUN_CLS, "classLinkedTime.self"); |
0 | 967 NEWPERFEVENTCOUNTER(_perf_classes_inited, SUN_CLS, "initializedClasses"); |
968 NEWPERFEVENTCOUNTER(_perf_classes_linked, SUN_CLS, "linkedClasses"); | |
875
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
969 NEWPERFEVENTCOUNTER(_perf_classes_verified, SUN_CLS, "verifiedClasses"); |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
970 |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
971 NEWPERFTICKCOUNTER(_perf_class_parse_time, SUN_CLS, "parseClassTime"); |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
972 NEWPERFTICKCOUNTER(_perf_class_parse_selftime, SUN_CLS, "parseClassTime.self"); |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
973 NEWPERFTICKCOUNTER(_perf_sys_class_lookup_time, SUN_CLS, "lookupSysClassTime"); |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
974 NEWPERFTICKCOUNTER(_perf_shared_classload_time, SUN_CLS, "sharedClassLoadTime"); |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
975 NEWPERFTICKCOUNTER(_perf_sys_classload_time, SUN_CLS, "sysClassLoadTime"); |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
976 NEWPERFTICKCOUNTER(_perf_app_classload_time, SUN_CLS, "appClassLoadTime"); |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
977 NEWPERFTICKCOUNTER(_perf_app_classload_selftime, SUN_CLS, "appClassLoadTime.self"); |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
978 NEWPERFEVENTCOUNTER(_perf_app_classload_count, SUN_CLS, "appClassLoadCount"); |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
979 NEWPERFTICKCOUNTER(_perf_define_appclasses, SUN_CLS, "defineAppClasses"); |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
980 NEWPERFTICKCOUNTER(_perf_define_appclass_time, SUN_CLS, "defineAppClassTime"); |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
981 NEWPERFTICKCOUNTER(_perf_define_appclass_selftime, SUN_CLS, "defineAppClassTime.self"); |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
982 NEWPERFBYTECOUNTER(_perf_app_classfile_bytes_read, SUN_CLS, "appClassBytes"); |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
983 NEWPERFBYTECOUNTER(_perf_sys_classfile_bytes_read, SUN_CLS, "sysClassBytes"); |
6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
mchung
parents:
723
diff
changeset
|
984 |
0 | 985 |
986 // The following performance counters are added for measuring the impact | |
987 // of the bug fix of 6365597. They are mainly focused on finding out | |
988 // the behavior of system & user-defined classloader lock, whether | |
989 // ClassLoader.loadClass/findClass is being called synchronized or not. | |
990 // Also two additional counters are created to see whether 'UnsyncloadClass' | |
991 // flag is being set or not and how many times load_instance_class call | |
992 // fails with linkageError etc. | |
993 NEWPERFEVENTCOUNTER(_sync_systemLoaderLockContentionRate, SUN_CLS, | |
994 "systemLoaderLockContentionRate"); | |
995 NEWPERFEVENTCOUNTER(_sync_nonSystemLoaderLockContentionRate, SUN_CLS, | |
996 "nonSystemLoaderLockContentionRate"); | |
997 NEWPERFEVENTCOUNTER(_sync_JVMFindLoadedClassLockFreeCounter, SUN_CLS, | |
998 "jvmFindLoadedClassNoLockCalls"); | |
999 NEWPERFEVENTCOUNTER(_sync_JVMDefineClassLockFreeCounter, SUN_CLS, | |
1000 "jvmDefineClassNoLockCalls"); | |
1001 | |
1002 NEWPERFEVENTCOUNTER(_sync_JNIDefineClassLockFreeCounter, SUN_CLS, | |
1003 "jniDefineClassNoLockCalls"); | |
1004 | |
1005 NEWPERFEVENTCOUNTER(_unsafe_defineClassCallCounter, SUN_CLS, | |
1006 "unsafeDefineClassCalls"); | |
1007 | |
1008 NEWPERFEVENTCOUNTER(_isUnsyncloadClass, SUN_CLS, "isUnsyncloadClassSet"); | |
1009 NEWPERFEVENTCOUNTER(_load_instance_class_failCounter, SUN_CLS, | |
1010 "loadInstanceClassFailRate"); | |
1011 | |
1012 // increment the isUnsyncloadClass counter if UnsyncloadClass is set. | |
1013 if (UnsyncloadClass) { | |
1014 _isUnsyncloadClass->inc(); | |
1015 } | |
1016 } | |
1017 | |
1018 // lookup zip library entry points | |
1019 load_zip_library(); | |
1020 // initialize search path | |
1021 setup_bootstrap_search_path(); | |
1022 if (LazyBootClassLoader) { | |
1023 // set up meta index which makes boot classpath initialization lazier | |
1024 setup_meta_index(); | |
1025 } | |
1026 } | |
1027 | |
1028 | |
1029 jlong ClassLoader::classloader_time_ms() { | |
1030 return UsePerfData ? | |
1031 Management::ticks_to_ms(_perf_accumulated_time->get_value()) : -1; | |
1032 } | |
1033 | |
1034 jlong ClassLoader::class_init_count() { | |
1035 return UsePerfData ? _perf_classes_inited->get_value() : -1; | |
1036 } | |
1037 | |
1038 jlong ClassLoader::class_init_time_ms() { | |
1039 return UsePerfData ? | |
1040 Management::ticks_to_ms(_perf_class_init_time->get_value()) : -1; | |
1041 } | |
1042 | |
1043 jlong ClassLoader::class_verify_time_ms() { | |
1044 return UsePerfData ? | |
1045 Management::ticks_to_ms(_perf_class_verify_time->get_value()) : -1; | |
1046 } | |
1047 | |
1048 jlong ClassLoader::class_link_count() { | |
1049 return UsePerfData ? _perf_classes_linked->get_value() : -1; | |
1050 } | |
1051 | |
1052 jlong ClassLoader::class_link_time_ms() { | |
1053 return UsePerfData ? | |
1054 Management::ticks_to_ms(_perf_class_link_time->get_value()) : -1; | |
1055 } | |
1056 | |
1057 int ClassLoader::compute_Object_vtable() { | |
1058 // hardwired for JDK1.2 -- would need to duplicate class file parsing | |
1059 // code to determine actual value from file | |
1060 // Would be value '11' if finals were in vtable | |
1061 int JDK_1_2_Object_vtable_size = 5; | |
1062 return JDK_1_2_Object_vtable_size * vtableEntry::size(); | |
1063 } | |
1064 | |
1065 | |
1066 void classLoader_init() { | |
1067 ClassLoader::initialize(); | |
1068 } | |
1069 | |
1070 | |
1071 bool ClassLoader::get_canonical_path(char* orig, char* out, int len) { | |
1072 assert(orig != NULL && out != NULL && len > 0, "bad arguments"); | |
1073 if (CanonicalizeEntry != NULL) { | |
1074 JNIEnv* env = JavaThread::current()->jni_environment(); | |
1980
828eafbd85cc
6348631: remove the use of the HPI library from Hotspot
ikrylov
parents:
1972
diff
changeset
|
1075 if ((CanonicalizeEntry)(env, os::native_path(orig), out, len) < 0) { |
0 | 1076 return false; |
1077 } | |
1078 } else { | |
1079 // On JDK 1.2.2 the Canonicalize does not exist, so just do nothing | |
1080 strncpy(out, orig, len); | |
1081 out[len - 1] = '\0'; | |
1082 } | |
1083 return true; | |
1084 } | |
1085 | |
1086 #ifndef PRODUCT | |
1087 | |
1088 void ClassLoader::verify() { | |
1089 _package_hash_table->verify(); | |
1090 } | |
1091 | |
1092 | |
1093 // CompileTheWorld | |
1094 // | |
1095 // Iterates over all class path entries and forces compilation of all methods | |
1096 // in all classes found. Currently, only zip/jar archives are searched. | |
1097 // | |
1098 // The classes are loaded by the Java level bootstrap class loader, and the | |
1099 // initializer is called. If DelayCompilationDuringStartup is true (default), | |
1100 // the interpreter will run the initialization code. Note that forcing | |
1101 // initialization in this way could potentially lead to initialization order | |
1102 // problems, in which case we could just force the initialization bit to be set. | |
1103 | |
1104 | |
1105 // We need to iterate over the contents of a zip/jar file, so we replicate the | |
1106 // jzcell and jzfile definitions from zip_util.h but rename jzfile to real_jzfile, | |
1107 // since jzfile already has a void* definition. | |
1108 // | |
1109 // Note that this is only used in debug mode. | |
1110 // | |
1111 // HotSpot integration note: | |
1112 // Matches zip_util.h 1.14 99/06/01 from jdk1.3 beta H build | |
1113 | |
1114 | |
1115 // JDK 1.3 version | |
1116 typedef struct real_jzentry13 { /* Zip file entry */ | |
1117 char *name; /* entry name */ | |
1118 jint time; /* modification time */ | |
1119 jint size; /* size of uncompressed data */ | |
1120 jint csize; /* size of compressed data (zero if uncompressed) */ | |
1121 jint crc; /* crc of uncompressed data */ | |
1122 char *comment; /* optional zip file comment */ | |
1123 jbyte *extra; /* optional extra data */ | |
1124 jint pos; /* position of LOC header (if negative) or data */ | |
1125 } real_jzentry13; | |
1126 | |
1127 typedef struct real_jzfile13 { /* Zip file */ | |
1128 char *name; /* zip file name */ | |
1129 jint refs; /* number of active references */ | |
1130 jint fd; /* open file descriptor */ | |
1131 void *lock; /* read lock */ | |
1132 char *comment; /* zip file comment */ | |
1133 char *msg; /* zip error message */ | |
1134 void *entries; /* array of hash cells */ | |
1135 jint total; /* total number of entries */ | |
1136 unsigned short *table; /* Hash chain heads: indexes into entries */ | |
1137 jint tablelen; /* number of hash eads */ | |
1138 real_jzfile13 *next; /* next zip file in search list */ | |
1139 jzentry *cache; /* we cache the most recently freed jzentry */ | |
1140 /* Information on metadata names in META-INF directory */ | |
1141 char **metanames; /* array of meta names (may have null names) */ | |
1142 jint metacount; /* number of slots in metanames array */ | |
1143 /* If there are any per-entry comments, they are in the comments array */ | |
1144 char **comments; | |
1145 } real_jzfile13; | |
1146 | |
1147 // JDK 1.2 version | |
1148 typedef struct real_jzentry12 { /* Zip file entry */ | |
1149 char *name; /* entry name */ | |
1150 jint time; /* modification time */ | |
1151 jint size; /* size of uncompressed data */ | |
1152 jint csize; /* size of compressed data (zero if uncompressed) */ | |
1153 jint crc; /* crc of uncompressed data */ | |
1154 char *comment; /* optional zip file comment */ | |
1155 jbyte *extra; /* optional extra data */ | |
1156 jint pos; /* position of LOC header (if negative) or data */ | |
1157 struct real_jzentry12 *next; /* next entry in hash table */ | |
1158 } real_jzentry12; | |
1159 | |
1160 typedef struct real_jzfile12 { /* Zip file */ | |
1161 char *name; /* zip file name */ | |
1162 jint refs; /* number of active references */ | |
1163 jint fd; /* open file descriptor */ | |
1164 void *lock; /* read lock */ | |
1165 char *comment; /* zip file comment */ | |
1166 char *msg; /* zip error message */ | |
1167 real_jzentry12 *entries; /* array of zip entries */ | |
1168 jint total; /* total number of entries */ | |
1169 real_jzentry12 **table; /* hash table of entries */ | |
1170 jint tablelen; /* number of buckets */ | |
1171 jzfile *next; /* next zip file in search list */ | |
1172 } real_jzfile12; | |
1173 | |
1174 | |
1175 void ClassPathDirEntry::compile_the_world(Handle loader, TRAPS) { | |
1176 // For now we only compile all methods in all classes in zip/jar files | |
1177 tty->print_cr("CompileTheWorld : Skipped classes in %s", _dir); | |
1178 tty->cr(); | |
1179 } | |
1180 | |
1181 | |
1182 bool ClassPathDirEntry::is_rt_jar() { | |
1183 return false; | |
1184 } | |
1185 | |
1186 void ClassPathZipEntry::compile_the_world(Handle loader, TRAPS) { | |
1187 if (JDK_Version::is_jdk12x_version()) { | |
1188 compile_the_world12(loader, THREAD); | |
1189 } else { | |
1190 compile_the_world13(loader, THREAD); | |
1191 } | |
1192 if (HAS_PENDING_EXCEPTION) { | |
1193 if (PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())) { | |
1194 CLEAR_PENDING_EXCEPTION; | |
1195 tty->print_cr("\nCompileTheWorld : Ran out of memory\n"); | |
1196 size_t used = Universe::heap()->permanent_used(); | |
1197 size_t capacity = Universe::heap()->permanent_capacity(); | |
1198 tty->print_cr("Permanent generation used %dK of %dK", used/K, capacity/K); | |
1199 tty->print_cr("Increase size by setting e.g. -XX:MaxPermSize=%dK\n", capacity*2/K); | |
1200 } else { | |
1201 tty->print_cr("\nCompileTheWorld : Unexpected exception occurred\n"); | |
1202 } | |
1203 } | |
1204 } | |
1205 | |
1206 // Version that works for JDK 1.3.x | |
1207 void ClassPathZipEntry::compile_the_world13(Handle loader, TRAPS) { | |
1208 real_jzfile13* zip = (real_jzfile13*) _zip; | |
1209 tty->print_cr("CompileTheWorld : Compiling all classes in %s", zip->name); | |
1210 tty->cr(); | |
1211 // Iterate over all entries in zip file | |
1212 for (int n = 0; ; n++) { | |
1213 real_jzentry13 * ze = (real_jzentry13 *)((*GetNextEntry)(_zip, n)); | |
1214 if (ze == NULL) break; | |
1215 ClassLoader::compile_the_world_in(ze->name, loader, CHECK); | |
1216 } | |
1217 } | |
1218 | |
1219 | |
1220 // Version that works for JDK 1.2.x | |
1221 void ClassPathZipEntry::compile_the_world12(Handle loader, TRAPS) { | |
1222 real_jzfile12* zip = (real_jzfile12*) _zip; | |
1223 tty->print_cr("CompileTheWorld : Compiling all classes in %s", zip->name); | |
1224 tty->cr(); | |
1225 // Iterate over all entries in zip file | |
1226 for (int n = 0; ; n++) { | |
1227 real_jzentry12 * ze = (real_jzentry12 *)((*GetNextEntry)(_zip, n)); | |
1228 if (ze == NULL) break; | |
1229 ClassLoader::compile_the_world_in(ze->name, loader, CHECK); | |
1230 } | |
1231 } | |
1232 | |
1233 bool ClassPathZipEntry::is_rt_jar() { | |
1234 if (JDK_Version::is_jdk12x_version()) { | |
1235 return is_rt_jar12(); | |
1236 } else { | |
1237 return is_rt_jar13(); | |
1238 } | |
1239 } | |
1240 | |
1241 // JDK 1.3 version | |
1242 bool ClassPathZipEntry::is_rt_jar13() { | |
1243 real_jzfile13* zip = (real_jzfile13*) _zip; | |
1244 int len = (int)strlen(zip->name); | |
1245 // Check whether zip name ends in "rt.jar" | |
1246 // This will match other archives named rt.jar as well, but this is | |
1247 // only used for debugging. | |
1248 return (len >= 6) && (strcasecmp(zip->name + len - 6, "rt.jar") == 0); | |
1249 } | |
1250 | |
1251 // JDK 1.2 version | |
1252 bool ClassPathZipEntry::is_rt_jar12() { | |
1253 real_jzfile12* zip = (real_jzfile12*) _zip; | |
1254 int len = (int)strlen(zip->name); | |
1255 // Check whether zip name ends in "rt.jar" | |
1256 // This will match other archives named rt.jar as well, but this is | |
1257 // only used for debugging. | |
1258 return (len >= 6) && (strcasecmp(zip->name + len - 6, "rt.jar") == 0); | |
1259 } | |
1260 | |
1261 void LazyClassPathEntry::compile_the_world(Handle loader, TRAPS) { | |
1262 resolve_entry()->compile_the_world(loader, CHECK); | |
1263 } | |
1264 | |
1265 bool LazyClassPathEntry::is_rt_jar() { | |
1266 return resolve_entry()->is_rt_jar(); | |
1267 } | |
1268 | |
1269 void ClassLoader::compile_the_world() { | |
1270 EXCEPTION_MARK; | |
1271 HandleMark hm(THREAD); | |
1272 ResourceMark rm(THREAD); | |
1273 // Make sure we don't run with background compilation | |
1274 BackgroundCompilation = false; | |
1275 // Find bootstrap loader | |
1276 Handle system_class_loader (THREAD, SystemDictionary::java_system_loader()); | |
1277 // Iterate over all bootstrap class path entries | |
1278 ClassPathEntry* e = _first_entry; | |
1279 while (e != NULL) { | |
1280 // We stop at rt.jar, unless it is the first bootstrap path entry | |
1281 if (e->is_rt_jar() && e != _first_entry) break; | |
1282 e->compile_the_world(system_class_loader, CATCH); | |
1283 e = e->next(); | |
1284 } | |
1285 tty->print_cr("CompileTheWorld : Done"); | |
1286 { | |
1287 // Print statistics as if before normal exit: | |
1288 extern void print_statistics(); | |
1289 print_statistics(); | |
1290 } | |
1291 vm_exit(0); | |
1292 } | |
1293 | |
1294 int ClassLoader::_compile_the_world_counter = 0; | |
1188
99af867dfa05
6919886: Sweep CodeCache more aggressively to reduce its usage for CompileTheWorld
kvn
parents:
1142
diff
changeset
|
1295 static int _codecache_sweep_counter = 0; |
0 | 1296 |
1297 void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) { | |
1298 int len = (int)strlen(name); | |
1299 if (len > 6 && strcmp(".class", name + len - 6) == 0) { | |
1300 // We have a .class file | |
1301 char buffer[2048]; | |
1302 strncpy(buffer, name, len - 6); | |
1303 buffer[len-6] = 0; | |
1304 // If the file has a period after removing .class, it's not really a | |
1305 // valid class file. The class loader will check everything else. | |
1306 if (strchr(buffer, '.') == NULL) { | |
1307 _compile_the_world_counter++; | |
723 | 1308 if (_compile_the_world_counter > CompileTheWorldStopAt) return; |
1309 | |
1310 // Construct name without extension | |
1311 symbolHandle sym = oopFactory::new_symbol_handle(buffer, CHECK); | |
1312 // Use loader to load and initialize class | |
1313 klassOop ik = SystemDictionary::resolve_or_null(sym, loader, Handle(), THREAD); | |
1314 instanceKlassHandle k (THREAD, ik); | |
1315 if (k.not_null() && !HAS_PENDING_EXCEPTION) { | |
1316 k->initialize(THREAD); | |
1317 } | |
1318 bool exception_occurred = HAS_PENDING_EXCEPTION; | |
1319 CLEAR_PENDING_EXCEPTION; | |
1320 if (CompileTheWorldPreloadClasses && k.not_null()) { | |
1321 constantPoolKlass::preload_and_initialize_all_classes(k->constants(), THREAD); | |
1322 if (HAS_PENDING_EXCEPTION) { | |
1323 // If something went wrong in preloading we just ignore it | |
1324 CLEAR_PENDING_EXCEPTION; | |
1325 tty->print_cr("Preloading failed for (%d) %s", _compile_the_world_counter, buffer); | |
0 | 1326 } |
723 | 1327 } |
1328 | |
1329 if (_compile_the_world_counter >= CompileTheWorldStartAt) { | |
0 | 1330 if (k.is_null() || (exception_occurred && !CompileTheWorldIgnoreInitErrors)) { |
1331 // If something went wrong (e.g. ExceptionInInitializerError) we skip this class | |
1332 tty->print_cr("CompileTheWorld (%d) : Skipping %s", _compile_the_world_counter, buffer); | |
1333 } else { | |
1334 tty->print_cr("CompileTheWorld (%d) : %s", _compile_the_world_counter, buffer); | |
1335 // Preload all classes to get around uncommon traps | |
1336 // Iterate over all methods in class | |
1337 for (int n = 0; n < k->methods()->length(); n++) { | |
1338 methodHandle m (THREAD, methodOop(k->methods()->obj_at(n))); | |
1783 | 1339 if (CompilationPolicy::can_be_compiled(m)) { |
1188
99af867dfa05
6919886: Sweep CodeCache more aggressively to reduce its usage for CompileTheWorld
kvn
parents:
1142
diff
changeset
|
1340 |
99af867dfa05
6919886: Sweep CodeCache more aggressively to reduce its usage for CompileTheWorld
kvn
parents:
1142
diff
changeset
|
1341 if (++_codecache_sweep_counter == CompileTheWorldSafepointInterval) { |
99af867dfa05
6919886: Sweep CodeCache more aggressively to reduce its usage for CompileTheWorld
kvn
parents:
1142
diff
changeset
|
1342 // Give sweeper a chance to keep up with CTW |
99af867dfa05
6919886: Sweep CodeCache more aggressively to reduce its usage for CompileTheWorld
kvn
parents:
1142
diff
changeset
|
1343 VM_ForceSafepoint op; |
99af867dfa05
6919886: Sweep CodeCache more aggressively to reduce its usage for CompileTheWorld
kvn
parents:
1142
diff
changeset
|
1344 VMThread::execute(&op); |
99af867dfa05
6919886: Sweep CodeCache more aggressively to reduce its usage for CompileTheWorld
kvn
parents:
1142
diff
changeset
|
1345 _codecache_sweep_counter = 0; |
99af867dfa05
6919886: Sweep CodeCache more aggressively to reduce its usage for CompileTheWorld
kvn
parents:
1142
diff
changeset
|
1346 } |
0 | 1347 // Force compilation |
1783 | 1348 CompileBroker::compile_method(m, InvocationEntryBci, CompLevel_initial_compile, |
0 | 1349 methodHandle(), 0, "CTW", THREAD); |
1350 if (HAS_PENDING_EXCEPTION) { | |
1351 CLEAR_PENDING_EXCEPTION; | |
1352 tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_counter, m->name()->as_C_string()); | |
1353 } | |
723 | 1354 if (TieredCompilation) { |
1355 // Clobber the first compile and force second tier compilation | |
1356 nmethod* nm = m->code(); | |
1357 if (nm != NULL) { | |
1358 // Throw out the code so that the code cache doesn't fill up | |
1359 nm->make_not_entrant(); | |
1360 m->clear_code(); | |
1361 } | |
1783 | 1362 CompileBroker::compile_method(m, InvocationEntryBci, CompLevel_full_optimization, |
723 | 1363 methodHandle(), 0, "CTW", THREAD); |
1364 if (HAS_PENDING_EXCEPTION) { | |
1365 CLEAR_PENDING_EXCEPTION; | |
1366 tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_counter, m->name()->as_C_string()); | |
1367 } | |
0 | 1368 } |
1369 } | |
723 | 1370 |
1371 nmethod* nm = m->code(); | |
1372 if (nm != NULL) { | |
1373 // Throw out the code so that the code cache doesn't fill up | |
1374 nm->make_not_entrant(); | |
1375 m->clear_code(); | |
0 | 1376 } |
1377 } | |
1378 } | |
1379 } | |
1380 } | |
1381 } | |
1382 } | |
1383 | |
1384 #endif //PRODUCT |