annotate src/share/vm/classfile/systemDictionary.hpp @ 0:a61af66fc99e

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