0
|
1 /*
|
|
2 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
|
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 *
|
|
5 * This code is free software; you can redistribute it and/or modify it
|
|
6 * under the terms of the GNU General Public License version 2 only, as
|
|
7 * published by the Free Software Foundation.
|
|
8 *
|
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 * version 2 for more details (a copy is included in the LICENSE file that
|
|
13 * accompanied this code).
|
|
14 *
|
|
15 * You should have received a copy of the GNU General Public License version
|
|
16 * 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 *
|
|
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
20 * CA 95054 USA or visit www.sun.com if you need additional information or
|
|
21 * have any questions.
|
|
22 *
|
|
23 */
|
|
24
|
|
25 // The system dictionary stores all loaded classes and maps:
|
|
26 //
|
|
27 // [class name,class loader] -> class i.e. [symbolOop,oop] -> klassOop
|
|
28 //
|
|
29 // Classes are loaded lazily. The default VM class loader is
|
|
30 // represented as NULL.
|
|
31
|
|
32 // The underlying data structure is an open hash table with a fixed number
|
|
33 // of buckets. During loading the loader object is locked, (for the VM loader
|
|
34 // a private lock object is used). Class loading can thus be done concurrently,
|
|
35 // but only by different loaders.
|
|
36 //
|
|
37 // During loading a placeholder (name, loader) is temporarily placed in
|
|
38 // a side data structure, and is used to detect ClassCircularityErrors
|
|
39 // and to perform verification during GC. A GC can occur in the midst
|
|
40 // of class loading, as we call out to Java, have to take locks, etc.
|
|
41 //
|
|
42 // When class loading is finished, a new entry is added to the system
|
|
43 // dictionary and the place holder is removed. Note that the protection
|
|
44 // domain field of the system dictionary has not yet been filled in when
|
|
45 // the "real" system dictionary entry is created.
|
|
46 //
|
|
47 // Clients of this class who are interested in finding if a class has
|
|
48 // been completely loaded -- not classes in the process of being loaded --
|
|
49 // can read the SystemDictionary unlocked. This is safe because
|
|
50 // - entries are only deleted at safepoints
|
|
51 // - readers cannot come to a safepoint while actively examining
|
|
52 // an entry (an entry cannot be deleted from under a reader)
|
|
53 // - entries must be fully formed before they are available to concurrent
|
|
54 // readers (we must ensure write ordering)
|
|
55 //
|
|
56 // Note that placeholders are deleted at any time, as they are removed
|
|
57 // when a class is completely loaded. Therefore, readers as well as writers
|
|
58 // of placeholders must hold the SystemDictionary_lock.
|
|
59 //
|
|
60
|
|
61 class Dictionary;
|
|
62 class PlaceholderTable;
|
|
63 class LoaderConstraintTable;
|
|
64 class HashtableBucket;
|
|
65 class ResolutionErrorTable;
|
|
66
|
|
67 class SystemDictionary : AllStatic {
|
|
68 friend class VMStructs;
|
|
69 friend class CompactingPermGenGen;
|
|
70 NOT_PRODUCT(friend class instanceKlassKlass;)
|
|
71
|
|
72 public:
|
|
73 // Returns a class with a given class name and class loader. Loads the
|
|
74 // class if needed. If not found a NoClassDefFoundError or a
|
|
75 // ClassNotFoundException is thrown, depending on the value on the
|
|
76 // throw_error flag. For most uses the throw_error argument should be set
|
|
77 // to true.
|
|
78
|
|
79 static klassOop resolve_or_fail(symbolHandle class_name, Handle class_loader, Handle protection_domain, bool throw_error, TRAPS);
|
|
80 // Convenient call for null loader and protection domain.
|
|
81 static klassOop resolve_or_fail(symbolHandle class_name, bool throw_error, TRAPS);
|
|
82 private:
|
|
83 // handle error translation for resolve_or_null results
|
|
84 static klassOop handle_resolution_exception(symbolHandle class_name, Handle class_loader, Handle protection_domain, bool throw_error, KlassHandle klass_h, TRAPS);
|
|
85
|
|
86 public:
|
|
87
|
|
88 // Returns a class with a given class name and class loader.
|
|
89 // Loads the class if needed. If not found NULL is returned.
|
|
90 static klassOop resolve_or_null(symbolHandle class_name, Handle class_loader, Handle protection_domain, TRAPS);
|
|
91 // Version with null loader and protection domain
|
|
92 static klassOop resolve_or_null(symbolHandle class_name, TRAPS);
|
|
93
|
|
94 // Resolve a superclass or superinterface. Called from ClassFileParser,
|
|
95 // parse_interfaces, resolve_instance_class_or_null, load_shared_class
|
|
96 // "child_name" is the class whose super class or interface is being resolved.
|
|
97 static klassOop resolve_super_or_fail(symbolHandle child_name,
|
|
98 symbolHandle class_name,
|
|
99 Handle class_loader,
|
|
100 Handle protection_domain,
|
|
101 bool is_superclass,
|
|
102 TRAPS);
|
|
103
|
|
104 // Parse new stream. This won't update the system dictionary or
|
|
105 // class hierarchy, simply parse the stream. Used by JVMTI RedefineClasses.
|
|
106 static klassOop parse_stream(symbolHandle class_name,
|
|
107 Handle class_loader,
|
|
108 Handle protection_domain,
|
|
109 ClassFileStream* st,
|
|
110 TRAPS);
|
|
111
|
|
112 // Resolve from stream (called by jni_DefineClass and JVM_DefineClass)
|
|
113 static klassOop resolve_from_stream(symbolHandle class_name, Handle class_loader, Handle protection_domain, ClassFileStream* st, TRAPS);
|
|
114
|
|
115 // Lookup an already loaded class. If not found NULL is returned.
|
|
116 static klassOop find(symbolHandle class_name, Handle class_loader, Handle protection_domain, TRAPS);
|
|
117
|
|
118 // Lookup an already loaded instance or array class.
|
|
119 // Do not make any queries to class loaders; consult only the cache.
|
|
120 // If not found NULL is returned.
|
|
121 static klassOop find_instance_or_array_klass(symbolHandle class_name,
|
|
122 Handle class_loader,
|
|
123 Handle protection_domain,
|
|
124 TRAPS);
|
|
125
|
|
126 // Lookup an instance or array class that has already been loaded
|
|
127 // either into the given class loader, or else into another class
|
|
128 // loader that is constrained (via loader constraints) to produce
|
|
129 // a consistent class. Do not take protection domains into account.
|
|
130 // Do not make any queries to class loaders; consult only the cache.
|
|
131 // Return NULL if the class is not found.
|
|
132 //
|
|
133 // This function is a strict superset of find_instance_or_array_klass.
|
|
134 // This function (the unchecked version) makes a conservative prediction
|
|
135 // of the result of the checked version, assuming successful lookup.
|
|
136 // If both functions return non-null, they must return the same value.
|
|
137 // Also, the unchecked version may sometimes be non-null where the
|
|
138 // checked version is null. This can occur in several ways:
|
|
139 // 1. No query has yet been made to the class loader.
|
|
140 // 2. The class loader was queried, but chose not to delegate.
|
|
141 // 3. ClassLoader.checkPackageAccess rejected a proposed protection domain.
|
|
142 // 4. Loading was attempted, but there was a linkage error of some sort.
|
|
143 // In all of these cases, the loader constraints on this type are
|
|
144 // satisfied, and it is safe for classes in the given class loader
|
|
145 // to manipulate strongly-typed values of the found class, subject
|
|
146 // to local linkage and access checks.
|
|
147 static klassOop find_constrained_instance_or_array_klass(symbolHandle class_name,
|
|
148 Handle class_loader,
|
|
149 TRAPS);
|
|
150
|
|
151 // Iterate over all klasses in dictionary
|
|
152 // Just the classes from defining class loaders
|
|
153 static void classes_do(void f(klassOop));
|
|
154 // Added for initialize_itable_for_klass to handle exceptions
|
|
155 static void classes_do(void f(klassOop, TRAPS), TRAPS);
|
|
156 // All classes, and their class loaders
|
|
157 static void classes_do(void f(klassOop, oop));
|
|
158 // All classes, and their class loaders
|
|
159 // (added for helpers that use HandleMarks and ResourceMarks)
|
|
160 static void classes_do(void f(klassOop, oop, TRAPS), TRAPS);
|
|
161 // All entries in the placeholder table and their class loaders
|
|
162 static void placeholders_do(void f(symbolOop, oop));
|
|
163
|
|
164 // Iterate over all methods in all klasses in dictionary
|
|
165 static void methods_do(void f(methodOop));
|
|
166
|
|
167 // Garbage collection support
|
|
168
|
|
169 // This method applies "blk->do_oop" to all the pointers to "system"
|
|
170 // classes and loaders.
|
|
171 static void always_strong_oops_do(OopClosure* blk);
|
|
172 static void always_strong_classes_do(OopClosure* blk);
|
|
173 // This method applies "blk->do_oop" to all the placeholders.
|
|
174 static void placeholders_do(OopClosure* blk);
|
|
175
|
|
176 // Unload (that is, break root links to) all unmarked classes and
|
|
177 // loaders. Returns "true" iff something was unloaded.
|
|
178 static bool do_unloading(BoolObjectClosure* is_alive);
|
|
179
|
|
180 // Applies "f->do_oop" to all root oops in the system dictionary.
|
|
181 static void oops_do(OopClosure* f);
|
|
182
|
|
183 // System loader lock
|
|
184 static oop system_loader_lock() { return _system_loader_lock_obj; }
|
|
185
|
|
186 private:
|
|
187 // Traverses preloaded oops: various system classes. These are
|
|
188 // guaranteed to be in the perm gen.
|
|
189 static void preloaded_oops_do(OopClosure* f);
|
|
190 static void lazily_loaded_oops_do(OopClosure* f);
|
|
191
|
|
192 public:
|
|
193 // Sharing support.
|
|
194 static void reorder_dictionary();
|
|
195 static void copy_buckets(char** top, char* end);
|
|
196 static void copy_table(char** top, char* end);
|
|
197 static void reverse();
|
|
198 static void set_shared_dictionary(HashtableBucket* t, int length,
|
|
199 int number_of_entries);
|
|
200 // Printing
|
|
201 static void print() PRODUCT_RETURN;
|
|
202 static void print_class_statistics() PRODUCT_RETURN;
|
|
203 static void print_method_statistics() PRODUCT_RETURN;
|
|
204
|
|
205 // Number of contained klasses
|
|
206 // This is both fully loaded classes and classes in the process
|
|
207 // of being loaded
|
|
208 static int number_of_classes();
|
|
209
|
|
210 // Monotonically increasing counter which grows as classes are
|
|
211 // loaded or modifications such as hot-swapping or setting/removing
|
|
212 // of breakpoints are performed
|
|
213 static inline int number_of_modifications() { assert_locked_or_safepoint(Compile_lock); return _number_of_modifications; }
|
|
214 // Needed by evolution and breakpoint code
|
|
215 static inline void notice_modification() { assert_locked_or_safepoint(Compile_lock); ++_number_of_modifications; }
|
|
216
|
|
217 // Verification
|
|
218 static void verify();
|
|
219
|
|
220 #ifdef ASSERT
|
|
221 static bool is_internal_format(symbolHandle class_name);
|
|
222 #endif
|
|
223
|
|
224 // Verify class is in dictionary
|
|
225 static void verify_obj_klass_present(Handle obj,
|
|
226 symbolHandle class_name,
|
|
227 Handle class_loader);
|
|
228
|
|
229 // Initialization
|
|
230 static void initialize(TRAPS);
|
|
231
|
|
232 // Fast access to commonly used classes (preloaded)
|
|
233 static klassOop check_klass(klassOop k) {
|
|
234 assert(k != NULL, "preloaded klass not initialized");
|
|
235 return k;
|
|
236 }
|
|
237
|
|
238 public:
|
|
239 static klassOop object_klass() { return check_klass(_object_klass); }
|
|
240 static klassOop string_klass() { return check_klass(_string_klass); }
|
|
241 static klassOop class_klass() { return check_klass(_class_klass); }
|
|
242 static klassOop cloneable_klass() { return check_klass(_cloneable_klass); }
|
|
243 static klassOop classloader_klass() { return check_klass(_classloader_klass); }
|
|
244 static klassOop serializable_klass() { return check_klass(_serializable_klass); }
|
|
245 static klassOop system_klass() { return check_klass(_system_klass); }
|
|
246
|
|
247 static klassOop throwable_klass() { return check_klass(_throwable_klass); }
|
|
248 static klassOop error_klass() { return check_klass(_error_klass); }
|
|
249 static klassOop threaddeath_klass() { return check_klass(_threaddeath_klass); }
|
|
250 static klassOop exception_klass() { return check_klass(_exception_klass); }
|
|
251 static klassOop runtime_exception_klass() { return check_klass(_runtime_exception_klass); }
|
|
252 static klassOop classNotFoundException_klass() { return check_klass(_classNotFoundException_klass); }
|
|
253 static klassOop noClassDefFoundError_klass() { return check_klass(_noClassDefFoundError_klass); }
|
|
254 static klassOop linkageError_klass() { return check_klass(_linkageError_klass); }
|
|
255 static klassOop ClassCastException_klass() { return check_klass(_classCastException_klass); }
|
|
256 static klassOop ArrayStoreException_klass() { return check_klass(_arrayStoreException_klass); }
|
|
257 static klassOop virtualMachineError_klass() { return check_klass(_virtualMachineError_klass); }
|
|
258 static klassOop OutOfMemoryError_klass() { return check_klass(_outOfMemoryError_klass); }
|
|
259 static klassOop StackOverflowError_klass() { return check_klass(_StackOverflowError_klass); }
|
|
260 static klassOop IllegalMonitorStateException_klass() { return check_klass(_illegalMonitorStateException_klass); }
|
|
261 static klassOop protectionDomain_klass() { return check_klass(_protectionDomain_klass); }
|
|
262 static klassOop AccessControlContext_klass() { return check_klass(_AccessControlContext_klass); }
|
|
263 static klassOop reference_klass() { return check_klass(_reference_klass); }
|
|
264 static klassOop soft_reference_klass() { return check_klass(_soft_reference_klass); }
|
|
265 static klassOop weak_reference_klass() { return check_klass(_weak_reference_klass); }
|
|
266 static klassOop final_reference_klass() { return check_klass(_final_reference_klass); }
|
|
267 static klassOop phantom_reference_klass() { return check_klass(_phantom_reference_klass); }
|
|
268 static klassOop finalizer_klass() { return check_klass(_finalizer_klass); }
|
|
269
|
|
270 static klassOop thread_klass() { return check_klass(_thread_klass); }
|
|
271 static klassOop threadGroup_klass() { return check_klass(_threadGroup_klass); }
|
|
272 static klassOop properties_klass() { return check_klass(_properties_klass); }
|
|
273 static klassOop reflect_accessible_object_klass() { return check_klass(_reflect_accessible_object_klass); }
|
|
274 static klassOop reflect_field_klass() { return check_klass(_reflect_field_klass); }
|
|
275 static klassOop reflect_method_klass() { return check_klass(_reflect_method_klass); }
|
|
276 static klassOop reflect_constructor_klass() { return check_klass(_reflect_constructor_klass); }
|
|
277 static klassOop reflect_method_accessor_klass() {
|
|
278 assert(JDK_Version::is_gte_jdk14x_version() && UseNewReflection, "JDK 1.4 only");
|
|
279 return check_klass(_reflect_method_accessor_klass);
|
|
280 }
|
|
281 static klassOop reflect_constructor_accessor_klass() {
|
|
282 assert(JDK_Version::is_gte_jdk14x_version() && UseNewReflection, "JDK 1.4 only");
|
|
283 return check_klass(_reflect_constructor_accessor_klass);
|
|
284 }
|
|
285 // NOTE: needed too early in bootstrapping process to have checks based on JDK version
|
|
286 static klassOop reflect_magic_klass() { return _reflect_magic_klass; }
|
|
287 static klassOop reflect_delegating_classloader_klass() { return _reflect_delegating_classloader_klass; }
|
|
288 static klassOop reflect_constant_pool_klass() {
|
|
289 assert(JDK_Version::is_gte_jdk15x_version(), "JDK 1.5 only");
|
|
290 return _reflect_constant_pool_klass;
|
|
291 }
|
|
292 static klassOop reflect_unsafe_static_field_accessor_impl_klass() {
|
|
293 assert(JDK_Version::is_gte_jdk15x_version(), "JDK 1.5 only");
|
|
294 return _reflect_unsafe_static_field_accessor_impl_klass;
|
|
295 }
|
|
296
|
|
297 static klassOop vector_klass() { return check_klass(_vector_klass); }
|
|
298 static klassOop hashtable_klass() { return check_klass(_hashtable_klass); }
|
|
299 static klassOop stringBuffer_klass() { return check_klass(_stringBuffer_klass); }
|
|
300 static klassOop stackTraceElement_klass() { return check_klass(_stackTraceElement_klass); }
|
|
301
|
|
302 static klassOop java_nio_Buffer_klass() { return check_klass(_java_nio_Buffer_klass); }
|
|
303
|
|
304 static klassOop sun_misc_AtomicLongCSImpl_klass() { return _sun_misc_AtomicLongCSImpl_klass; }
|
|
305
|
|
306 // To support incremental JRE downloads (KERNEL JRE). Null if not present.
|
|
307 static klassOop sun_jkernel_DownloadManager_klass() { return _sun_jkernel_DownloadManager_klass; }
|
|
308
|
|
309 static klassOop boolean_klass() { return check_klass(_boolean_klass); }
|
|
310 static klassOop char_klass() { return check_klass(_char_klass); }
|
|
311 static klassOop float_klass() { return check_klass(_float_klass); }
|
|
312 static klassOop double_klass() { return check_klass(_double_klass); }
|
|
313 static klassOop byte_klass() { return check_klass(_byte_klass); }
|
|
314 static klassOop short_klass() { return check_klass(_short_klass); }
|
|
315 static klassOop int_klass() { return check_klass(_int_klass); }
|
|
316 static klassOop long_klass() { return check_klass(_long_klass); }
|
|
317
|
|
318 static klassOop box_klass(BasicType t) {
|
|
319 assert((uint)t < T_VOID+1, "range check");
|
|
320 return check_klass(_box_klasses[t]);
|
|
321 }
|
|
322 static BasicType box_klass_type(klassOop k); // inverse of box_klass
|
|
323
|
|
324 // methods returning lazily loaded klasses
|
|
325 // The corresponding method to load the class must be called before calling them.
|
|
326 static klassOop abstract_ownable_synchronizer_klass() { return check_klass(_abstract_ownable_synchronizer_klass); }
|
|
327
|
|
328 static void load_abstract_ownable_synchronizer_klass(TRAPS);
|
|
329
|
|
330 private:
|
|
331 // Tells whether ClassLoader.loadClassInternal is present
|
|
332 static bool has_loadClassInternal() { return _has_loadClassInternal; }
|
|
333
|
|
334 public:
|
|
335 // Tells whether ClassLoader.checkPackageAccess is present
|
|
336 static bool has_checkPackageAccess() { return _has_checkPackageAccess; }
|
|
337
|
|
338 static bool class_klass_loaded() { return _class_klass != NULL; }
|
|
339 static bool cloneable_klass_loaded() { return _cloneable_klass != NULL; }
|
|
340
|
|
341 // Returns default system loader
|
|
342 static oop java_system_loader();
|
|
343
|
|
344 // Compute the default system loader
|
|
345 static void compute_java_system_loader(TRAPS);
|
|
346
|
|
347 private:
|
|
348 // Mirrors for primitive classes (created eagerly)
|
|
349 static oop check_mirror(oop m) {
|
|
350 assert(m != NULL, "mirror not initialized");
|
|
351 return m;
|
|
352 }
|
|
353
|
|
354 public:
|
|
355 // Note: java_lang_Class::primitive_type is the inverse of java_mirror
|
|
356
|
|
357 // Check class loader constraints
|
|
358 static bool add_loader_constraint(symbolHandle name, Handle loader1,
|
|
359 Handle loader2, TRAPS);
|
|
360 static char* check_signature_loaders(symbolHandle signature, Handle loader1,
|
|
361 Handle loader2, bool is_method, TRAPS);
|
|
362
|
|
363 // Utility for printing loader "name" as part of tracing constraints
|
|
364 static const char* loader_name(oop loader) {
|
|
365 return ((loader) == NULL ? "<bootloader>" :
|
|
366 instanceKlass::cast((loader)->klass())->name()->as_C_string() );
|
|
367 }
|
|
368
|
|
369 // Record the error when the first attempt to resolve a reference from a constant
|
|
370 // pool entry to a class fails.
|
|
371 static void add_resolution_error(constantPoolHandle pool, int which, symbolHandle error);
|
|
372 static symbolOop find_resolution_error(constantPoolHandle pool, int which);
|
|
373
|
|
374 private:
|
|
375
|
|
376 enum Constants {
|
|
377 _loader_constraint_size = 107, // number of entries in constraint table
|
|
378 _resolution_error_size = 107, // number of entries in resolution error table
|
|
379 _nof_buckets = 1009 // number of buckets in hash table
|
|
380 };
|
|
381
|
|
382
|
|
383 // Static variables
|
|
384
|
|
385 // Hashtable holding loaded classes.
|
|
386 static Dictionary* _dictionary;
|
|
387
|
|
388 // Hashtable holding placeholders for classes being loaded.
|
|
389 static PlaceholderTable* _placeholders;
|
|
390
|
|
391 // Hashtable holding classes from the shared archive.
|
|
392 static Dictionary* _shared_dictionary;
|
|
393
|
|
394 // Monotonically increasing counter which grows with
|
|
395 // _number_of_classes as well as hot-swapping and breakpoint setting
|
|
396 // and removal.
|
|
397 static int _number_of_modifications;
|
|
398
|
|
399 // Lock object for system class loader
|
|
400 static oop _system_loader_lock_obj;
|
|
401
|
|
402 // Constraints on class loaders
|
|
403 static LoaderConstraintTable* _loader_constraints;
|
|
404
|
|
405 // Resolution errors
|
|
406 static ResolutionErrorTable* _resolution_errors;
|
|
407
|
|
408 public:
|
|
409 // for VM_CounterDecay iteration support
|
|
410 friend class CounterDecay;
|
|
411 static klassOop try_get_next_class();
|
|
412
|
|
413 private:
|
|
414 static void validate_protection_domain(instanceKlassHandle klass,
|
|
415 Handle class_loader,
|
|
416 Handle protection_domain, TRAPS);
|
|
417
|
|
418 friend class VM_PopulateDumpSharedSpace;
|
|
419 friend class TraversePlaceholdersClosure;
|
|
420 static Dictionary* dictionary() { return _dictionary; }
|
|
421 static Dictionary* shared_dictionary() { return _shared_dictionary; }
|
|
422 static PlaceholderTable* placeholders() { return _placeholders; }
|
|
423 static LoaderConstraintTable* constraints() { return _loader_constraints; }
|
|
424 static ResolutionErrorTable* resolution_errors() { return _resolution_errors; }
|
|
425
|
|
426 // Basic loading operations
|
|
427 static klassOop resolve_instance_class_or_null(symbolHandle class_name, Handle class_loader, Handle protection_domain, TRAPS);
|
|
428 static klassOop resolve_array_class_or_null(symbolHandle class_name, Handle class_loader, Handle protection_domain, TRAPS);
|
|
429 static instanceKlassHandle handle_parallel_super_load(symbolHandle class_name, symbolHandle supername, Handle class_loader, Handle protection_domain, Handle lockObject, TRAPS);
|
|
430 // Wait on SystemDictionary_lock; unlocks lockObject before
|
|
431 // waiting; relocks lockObject with correct recursion count
|
|
432 // after waiting, but before reentering SystemDictionary_lock
|
|
433 // to preserve lock order semantics.
|
|
434 static void double_lock_wait(Handle lockObject, TRAPS);
|
|
435 static void define_instance_class(instanceKlassHandle k, TRAPS);
|
|
436 static instanceKlassHandle find_or_define_instance_class(symbolHandle class_name,
|
|
437 Handle class_loader,
|
|
438 instanceKlassHandle k, TRAPS);
|
|
439 static instanceKlassHandle load_shared_class(symbolHandle class_name,
|
|
440 Handle class_loader, TRAPS);
|
|
441 static instanceKlassHandle load_shared_class(instanceKlassHandle ik,
|
|
442 Handle class_loader, TRAPS);
|
|
443 static instanceKlassHandle load_instance_class(symbolHandle class_name, Handle class_loader, TRAPS);
|
|
444 static Handle compute_loader_lock_object(Handle class_loader, TRAPS);
|
|
445 static void check_loader_lock_contention(Handle loader_lock, TRAPS);
|
|
446
|
|
447 static klassOop find_shared_class(symbolHandle class_name);
|
|
448
|
|
449 // Setup link to hierarchy
|
|
450 static void add_to_hierarchy(instanceKlassHandle k, TRAPS);
|
|
451
|
|
452 private:
|
|
453 // We pass in the hashtable index so we can calculate it outside of
|
|
454 // the SystemDictionary_lock.
|
|
455
|
|
456 // Basic find on loaded classes
|
|
457 static klassOop find_class(int index, unsigned int hash,
|
|
458 symbolHandle name, Handle loader);
|
|
459
|
|
460 // Basic find on classes in the midst of being loaded
|
|
461 static symbolOop find_placeholder(int index, unsigned int hash,
|
|
462 symbolHandle name, Handle loader);
|
|
463
|
|
464 // Basic find operation of loaded classes and classes in the midst
|
|
465 // of loading; used for assertions and verification only.
|
|
466 static oop find_class_or_placeholder(symbolHandle class_name,
|
|
467 Handle class_loader);
|
|
468
|
|
469 // Updating entry in dictionary
|
|
470 // Add a completely loaded class
|
|
471 static void add_klass(int index, symbolHandle class_name,
|
|
472 Handle class_loader, KlassHandle obj);
|
|
473
|
|
474 // Add a placeholder for a class being loaded
|
|
475 static void add_placeholder(int index,
|
|
476 symbolHandle class_name,
|
|
477 Handle class_loader);
|
|
478 static void remove_placeholder(int index,
|
|
479 symbolHandle class_name,
|
|
480 Handle class_loader);
|
|
481
|
|
482 // Performs cleanups after resolve_super_or_fail. This typically needs
|
|
483 // to be called on failure.
|
|
484 // Won't throw, but can block.
|
|
485 static void resolution_cleanups(symbolHandle class_name,
|
|
486 Handle class_loader,
|
|
487 TRAPS);
|
|
488
|
|
489 // Initialization
|
|
490 static void initialize_preloaded_classes(TRAPS);
|
|
491
|
|
492 // Class loader constraints
|
|
493 static void check_constraints(int index, unsigned int hash,
|
|
494 instanceKlassHandle k, Handle loader,
|
|
495 bool defining, TRAPS);
|
|
496 static void update_dictionary(int d_index, unsigned int d_hash,
|
|
497 int p_index, unsigned int p_hash,
|
|
498 instanceKlassHandle k, Handle loader, TRAPS);
|
|
499
|
|
500 // Variables holding commonly used klasses (preloaded)
|
|
501 static klassOop _object_klass;
|
|
502 static klassOop _string_klass;
|
|
503 static klassOop _class_klass;
|
|
504 static klassOop _cloneable_klass;
|
|
505 static klassOop _classloader_klass;
|
|
506 static klassOop _serializable_klass;
|
|
507 static klassOop _system_klass;
|
|
508
|
|
509 static klassOop _throwable_klass;
|
|
510 static klassOop _error_klass;
|
|
511 static klassOop _threaddeath_klass;
|
|
512 static klassOop _exception_klass;
|
|
513 static klassOop _runtime_exception_klass;
|
|
514 static klassOop _classNotFoundException_klass;
|
|
515 static klassOop _noClassDefFoundError_klass;
|
|
516 static klassOop _linkageError_klass;
|
|
517 static klassOop _classCastException_klass;
|
|
518 static klassOop _arrayStoreException_klass;
|
|
519 static klassOop _virtualMachineError_klass;
|
|
520 static klassOop _outOfMemoryError_klass;
|
|
521 static klassOop _StackOverflowError_klass;
|
|
522 static klassOop _illegalMonitorStateException_klass;
|
|
523 static klassOop _protectionDomain_klass;
|
|
524 static klassOop _AccessControlContext_klass;
|
|
525 static klassOop _reference_klass;
|
|
526 static klassOop _soft_reference_klass;
|
|
527 static klassOop _weak_reference_klass;
|
|
528 static klassOop _final_reference_klass;
|
|
529 static klassOop _phantom_reference_klass;
|
|
530 static klassOop _finalizer_klass;
|
|
531
|
|
532 static klassOop _thread_klass;
|
|
533 static klassOop _threadGroup_klass;
|
|
534 static klassOop _properties_klass;
|
|
535 static klassOop _reflect_accessible_object_klass;
|
|
536 static klassOop _reflect_field_klass;
|
|
537 static klassOop _reflect_method_klass;
|
|
538 static klassOop _reflect_constructor_klass;
|
|
539 // 1.4 reflection implementation
|
|
540 static klassOop _reflect_magic_klass;
|
|
541 static klassOop _reflect_method_accessor_klass;
|
|
542 static klassOop _reflect_constructor_accessor_klass;
|
|
543 static klassOop _reflect_delegating_classloader_klass;
|
|
544 // 1.5 annotations implementation
|
|
545 static klassOop _reflect_constant_pool_klass;
|
|
546 static klassOop _reflect_unsafe_static_field_accessor_impl_klass;
|
|
547
|
|
548 static klassOop _stringBuffer_klass;
|
|
549 static klassOop _vector_klass;
|
|
550 static klassOop _hashtable_klass;
|
|
551
|
|
552 static klassOop _stackTraceElement_klass;
|
|
553
|
|
554 static klassOop _java_nio_Buffer_klass;
|
|
555
|
|
556 static klassOop _sun_misc_AtomicLongCSImpl_klass;
|
|
557
|
|
558 // KERNEL JRE support.
|
|
559 static klassOop _sun_jkernel_DownloadManager_klass;
|
|
560
|
|
561 // Lazily loaded klasses
|
|
562 static volatile klassOop _abstract_ownable_synchronizer_klass;
|
|
563
|
|
564 // Box klasses
|
|
565 static klassOop _boolean_klass;
|
|
566 static klassOop _char_klass;
|
|
567 static klassOop _float_klass;
|
|
568 static klassOop _double_klass;
|
|
569 static klassOop _byte_klass;
|
|
570 static klassOop _short_klass;
|
|
571 static klassOop _int_klass;
|
|
572 static klassOop _long_klass;
|
|
573
|
|
574 // table of same
|
|
575 static klassOop _box_klasses[T_VOID+1];
|
|
576
|
|
577 static oop _java_system_loader;
|
|
578
|
|
579 static bool _has_loadClassInternal;
|
|
580 static bool _has_checkPackageAccess;
|
|
581 };
|