1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/classfile/systemDictionary.hpp Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,581 @@ 1.4 +/* 1.5 + * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.24 + * have any questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +// The system dictionary stores all loaded classes and maps: 1.29 +// 1.30 +// [class name,class loader] -> class i.e. [symbolOop,oop] -> klassOop 1.31 +// 1.32 +// Classes are loaded lazily. The default VM class loader is 1.33 +// represented as NULL. 1.34 + 1.35 +// The underlying data structure is an open hash table with a fixed number 1.36 +// of buckets. During loading the loader object is locked, (for the VM loader 1.37 +// a private lock object is used). Class loading can thus be done concurrently, 1.38 +// but only by different loaders. 1.39 +// 1.40 +// During loading a placeholder (name, loader) is temporarily placed in 1.41 +// a side data structure, and is used to detect ClassCircularityErrors 1.42 +// and to perform verification during GC. A GC can occur in the midst 1.43 +// of class loading, as we call out to Java, have to take locks, etc. 1.44 +// 1.45 +// When class loading is finished, a new entry is added to the system 1.46 +// dictionary and the place holder is removed. Note that the protection 1.47 +// domain field of the system dictionary has not yet been filled in when 1.48 +// the "real" system dictionary entry is created. 1.49 +// 1.50 +// Clients of this class who are interested in finding if a class has 1.51 +// been completely loaded -- not classes in the process of being loaded -- 1.52 +// can read the SystemDictionary unlocked. This is safe because 1.53 +// - entries are only deleted at safepoints 1.54 +// - readers cannot come to a safepoint while actively examining 1.55 +// an entry (an entry cannot be deleted from under a reader) 1.56 +// - entries must be fully formed before they are available to concurrent 1.57 +// readers (we must ensure write ordering) 1.58 +// 1.59 +// Note that placeholders are deleted at any time, as they are removed 1.60 +// when a class is completely loaded. Therefore, readers as well as writers 1.61 +// of placeholders must hold the SystemDictionary_lock. 1.62 +// 1.63 + 1.64 +class Dictionary; 1.65 +class PlaceholderTable; 1.66 +class LoaderConstraintTable; 1.67 +class HashtableBucket; 1.68 +class ResolutionErrorTable; 1.69 + 1.70 +class SystemDictionary : AllStatic { 1.71 + friend class VMStructs; 1.72 + friend class CompactingPermGenGen; 1.73 + NOT_PRODUCT(friend class instanceKlassKlass;) 1.74 + 1.75 + public: 1.76 + // Returns a class with a given class name and class loader. Loads the 1.77 + // class if needed. If not found a NoClassDefFoundError or a 1.78 + // ClassNotFoundException is thrown, depending on the value on the 1.79 + // throw_error flag. For most uses the throw_error argument should be set 1.80 + // to true. 1.81 + 1.82 + static klassOop resolve_or_fail(symbolHandle class_name, Handle class_loader, Handle protection_domain, bool throw_error, TRAPS); 1.83 + // Convenient call for null loader and protection domain. 1.84 + static klassOop resolve_or_fail(symbolHandle class_name, bool throw_error, TRAPS); 1.85 +private: 1.86 + // handle error translation for resolve_or_null results 1.87 + static klassOop handle_resolution_exception(symbolHandle class_name, Handle class_loader, Handle protection_domain, bool throw_error, KlassHandle klass_h, TRAPS); 1.88 + 1.89 +public: 1.90 + 1.91 + // Returns a class with a given class name and class loader. 1.92 + // Loads the class if needed. If not found NULL is returned. 1.93 + static klassOop resolve_or_null(symbolHandle class_name, Handle class_loader, Handle protection_domain, TRAPS); 1.94 + // Version with null loader and protection domain 1.95 + static klassOop resolve_or_null(symbolHandle class_name, TRAPS); 1.96 + 1.97 + // Resolve a superclass or superinterface. Called from ClassFileParser, 1.98 + // parse_interfaces, resolve_instance_class_or_null, load_shared_class 1.99 + // "child_name" is the class whose super class or interface is being resolved. 1.100 + static klassOop resolve_super_or_fail(symbolHandle child_name, 1.101 + symbolHandle class_name, 1.102 + Handle class_loader, 1.103 + Handle protection_domain, 1.104 + bool is_superclass, 1.105 + TRAPS); 1.106 + 1.107 + // Parse new stream. This won't update the system dictionary or 1.108 + // class hierarchy, simply parse the stream. Used by JVMTI RedefineClasses. 1.109 + static klassOop parse_stream(symbolHandle class_name, 1.110 + Handle class_loader, 1.111 + Handle protection_domain, 1.112 + ClassFileStream* st, 1.113 + TRAPS); 1.114 + 1.115 + // Resolve from stream (called by jni_DefineClass and JVM_DefineClass) 1.116 + static klassOop resolve_from_stream(symbolHandle class_name, Handle class_loader, Handle protection_domain, ClassFileStream* st, TRAPS); 1.117 + 1.118 + // Lookup an already loaded class. If not found NULL is returned. 1.119 + static klassOop find(symbolHandle class_name, Handle class_loader, Handle protection_domain, TRAPS); 1.120 + 1.121 + // Lookup an already loaded instance or array class. 1.122 + // Do not make any queries to class loaders; consult only the cache. 1.123 + // If not found NULL is returned. 1.124 + static klassOop find_instance_or_array_klass(symbolHandle class_name, 1.125 + Handle class_loader, 1.126 + Handle protection_domain, 1.127 + TRAPS); 1.128 + 1.129 + // Lookup an instance or array class that has already been loaded 1.130 + // either into the given class loader, or else into another class 1.131 + // loader that is constrained (via loader constraints) to produce 1.132 + // a consistent class. Do not take protection domains into account. 1.133 + // Do not make any queries to class loaders; consult only the cache. 1.134 + // Return NULL if the class is not found. 1.135 + // 1.136 + // This function is a strict superset of find_instance_or_array_klass. 1.137 + // This function (the unchecked version) makes a conservative prediction 1.138 + // of the result of the checked version, assuming successful lookup. 1.139 + // If both functions return non-null, they must return the same value. 1.140 + // Also, the unchecked version may sometimes be non-null where the 1.141 + // checked version is null. This can occur in several ways: 1.142 + // 1. No query has yet been made to the class loader. 1.143 + // 2. The class loader was queried, but chose not to delegate. 1.144 + // 3. ClassLoader.checkPackageAccess rejected a proposed protection domain. 1.145 + // 4. Loading was attempted, but there was a linkage error of some sort. 1.146 + // In all of these cases, the loader constraints on this type are 1.147 + // satisfied, and it is safe for classes in the given class loader 1.148 + // to manipulate strongly-typed values of the found class, subject 1.149 + // to local linkage and access checks. 1.150 + static klassOop find_constrained_instance_or_array_klass(symbolHandle class_name, 1.151 + Handle class_loader, 1.152 + TRAPS); 1.153 + 1.154 + // Iterate over all klasses in dictionary 1.155 + // Just the classes from defining class loaders 1.156 + static void classes_do(void f(klassOop)); 1.157 + // Added for initialize_itable_for_klass to handle exceptions 1.158 + static void classes_do(void f(klassOop, TRAPS), TRAPS); 1.159 + // All classes, and their class loaders 1.160 + static void classes_do(void f(klassOop, oop)); 1.161 + // All classes, and their class loaders 1.162 + // (added for helpers that use HandleMarks and ResourceMarks) 1.163 + static void classes_do(void f(klassOop, oop, TRAPS), TRAPS); 1.164 + // All entries in the placeholder table and their class loaders 1.165 + static void placeholders_do(void f(symbolOop, oop)); 1.166 + 1.167 + // Iterate over all methods in all klasses in dictionary 1.168 + static void methods_do(void f(methodOop)); 1.169 + 1.170 + // Garbage collection support 1.171 + 1.172 + // This method applies "blk->do_oop" to all the pointers to "system" 1.173 + // classes and loaders. 1.174 + static void always_strong_oops_do(OopClosure* blk); 1.175 + static void always_strong_classes_do(OopClosure* blk); 1.176 + // This method applies "blk->do_oop" to all the placeholders. 1.177 + static void placeholders_do(OopClosure* blk); 1.178 + 1.179 + // Unload (that is, break root links to) all unmarked classes and 1.180 + // loaders. Returns "true" iff something was unloaded. 1.181 + static bool do_unloading(BoolObjectClosure* is_alive); 1.182 + 1.183 + // Applies "f->do_oop" to all root oops in the system dictionary. 1.184 + static void oops_do(OopClosure* f); 1.185 + 1.186 + // System loader lock 1.187 + static oop system_loader_lock() { return _system_loader_lock_obj; } 1.188 + 1.189 +private: 1.190 + // Traverses preloaded oops: various system classes. These are 1.191 + // guaranteed to be in the perm gen. 1.192 + static void preloaded_oops_do(OopClosure* f); 1.193 + static void lazily_loaded_oops_do(OopClosure* f); 1.194 + 1.195 +public: 1.196 + // Sharing support. 1.197 + static void reorder_dictionary(); 1.198 + static void copy_buckets(char** top, char* end); 1.199 + static void copy_table(char** top, char* end); 1.200 + static void reverse(); 1.201 + static void set_shared_dictionary(HashtableBucket* t, int length, 1.202 + int number_of_entries); 1.203 + // Printing 1.204 + static void print() PRODUCT_RETURN; 1.205 + static void print_class_statistics() PRODUCT_RETURN; 1.206 + static void print_method_statistics() PRODUCT_RETURN; 1.207 + 1.208 + // Number of contained klasses 1.209 + // This is both fully loaded classes and classes in the process 1.210 + // of being loaded 1.211 + static int number_of_classes(); 1.212 + 1.213 + // Monotonically increasing counter which grows as classes are 1.214 + // loaded or modifications such as hot-swapping or setting/removing 1.215 + // of breakpoints are performed 1.216 + static inline int number_of_modifications() { assert_locked_or_safepoint(Compile_lock); return _number_of_modifications; } 1.217 + // Needed by evolution and breakpoint code 1.218 + static inline void notice_modification() { assert_locked_or_safepoint(Compile_lock); ++_number_of_modifications; } 1.219 + 1.220 + // Verification 1.221 + static void verify(); 1.222 + 1.223 +#ifdef ASSERT 1.224 + static bool is_internal_format(symbolHandle class_name); 1.225 +#endif 1.226 + 1.227 + // Verify class is in dictionary 1.228 + static void verify_obj_klass_present(Handle obj, 1.229 + symbolHandle class_name, 1.230 + Handle class_loader); 1.231 + 1.232 + // Initialization 1.233 + static void initialize(TRAPS); 1.234 + 1.235 + // Fast access to commonly used classes (preloaded) 1.236 + static klassOop check_klass(klassOop k) { 1.237 + assert(k != NULL, "preloaded klass not initialized"); 1.238 + return k; 1.239 + } 1.240 + 1.241 +public: 1.242 + static klassOop object_klass() { return check_klass(_object_klass); } 1.243 + static klassOop string_klass() { return check_klass(_string_klass); } 1.244 + static klassOop class_klass() { return check_klass(_class_klass); } 1.245 + static klassOop cloneable_klass() { return check_klass(_cloneable_klass); } 1.246 + static klassOop classloader_klass() { return check_klass(_classloader_klass); } 1.247 + static klassOop serializable_klass() { return check_klass(_serializable_klass); } 1.248 + static klassOop system_klass() { return check_klass(_system_klass); } 1.249 + 1.250 + static klassOop throwable_klass() { return check_klass(_throwable_klass); } 1.251 + static klassOop error_klass() { return check_klass(_error_klass); } 1.252 + static klassOop threaddeath_klass() { return check_klass(_threaddeath_klass); } 1.253 + static klassOop exception_klass() { return check_klass(_exception_klass); } 1.254 + static klassOop runtime_exception_klass() { return check_klass(_runtime_exception_klass); } 1.255 + static klassOop classNotFoundException_klass() { return check_klass(_classNotFoundException_klass); } 1.256 + static klassOop noClassDefFoundError_klass() { return check_klass(_noClassDefFoundError_klass); } 1.257 + static klassOop linkageError_klass() { return check_klass(_linkageError_klass); } 1.258 + static klassOop ClassCastException_klass() { return check_klass(_classCastException_klass); } 1.259 + static klassOop ArrayStoreException_klass() { return check_klass(_arrayStoreException_klass); } 1.260 + static klassOop virtualMachineError_klass() { return check_klass(_virtualMachineError_klass); } 1.261 + static klassOop OutOfMemoryError_klass() { return check_klass(_outOfMemoryError_klass); } 1.262 + static klassOop StackOverflowError_klass() { return check_klass(_StackOverflowError_klass); } 1.263 + static klassOop IllegalMonitorStateException_klass() { return check_klass(_illegalMonitorStateException_klass); } 1.264 + static klassOop protectionDomain_klass() { return check_klass(_protectionDomain_klass); } 1.265 + static klassOop AccessControlContext_klass() { return check_klass(_AccessControlContext_klass); } 1.266 + static klassOop reference_klass() { return check_klass(_reference_klass); } 1.267 + static klassOop soft_reference_klass() { return check_klass(_soft_reference_klass); } 1.268 + static klassOop weak_reference_klass() { return check_klass(_weak_reference_klass); } 1.269 + static klassOop final_reference_klass() { return check_klass(_final_reference_klass); } 1.270 + static klassOop phantom_reference_klass() { return check_klass(_phantom_reference_klass); } 1.271 + static klassOop finalizer_klass() { return check_klass(_finalizer_klass); } 1.272 + 1.273 + static klassOop thread_klass() { return check_klass(_thread_klass); } 1.274 + static klassOop threadGroup_klass() { return check_klass(_threadGroup_klass); } 1.275 + static klassOop properties_klass() { return check_klass(_properties_klass); } 1.276 + static klassOop reflect_accessible_object_klass() { return check_klass(_reflect_accessible_object_klass); } 1.277 + static klassOop reflect_field_klass() { return check_klass(_reflect_field_klass); } 1.278 + static klassOop reflect_method_klass() { return check_klass(_reflect_method_klass); } 1.279 + static klassOop reflect_constructor_klass() { return check_klass(_reflect_constructor_klass); } 1.280 + static klassOop reflect_method_accessor_klass() { 1.281 + assert(JDK_Version::is_gte_jdk14x_version() && UseNewReflection, "JDK 1.4 only"); 1.282 + return check_klass(_reflect_method_accessor_klass); 1.283 + } 1.284 + static klassOop reflect_constructor_accessor_klass() { 1.285 + assert(JDK_Version::is_gte_jdk14x_version() && UseNewReflection, "JDK 1.4 only"); 1.286 + return check_klass(_reflect_constructor_accessor_klass); 1.287 + } 1.288 + // NOTE: needed too early in bootstrapping process to have checks based on JDK version 1.289 + static klassOop reflect_magic_klass() { return _reflect_magic_klass; } 1.290 + static klassOop reflect_delegating_classloader_klass() { return _reflect_delegating_classloader_klass; } 1.291 + static klassOop reflect_constant_pool_klass() { 1.292 + assert(JDK_Version::is_gte_jdk15x_version(), "JDK 1.5 only"); 1.293 + return _reflect_constant_pool_klass; 1.294 + } 1.295 + static klassOop reflect_unsafe_static_field_accessor_impl_klass() { 1.296 + assert(JDK_Version::is_gte_jdk15x_version(), "JDK 1.5 only"); 1.297 + return _reflect_unsafe_static_field_accessor_impl_klass; 1.298 + } 1.299 + 1.300 + static klassOop vector_klass() { return check_klass(_vector_klass); } 1.301 + static klassOop hashtable_klass() { return check_klass(_hashtable_klass); } 1.302 + static klassOop stringBuffer_klass() { return check_klass(_stringBuffer_klass); } 1.303 + static klassOop stackTraceElement_klass() { return check_klass(_stackTraceElement_klass); } 1.304 + 1.305 + static klassOop java_nio_Buffer_klass() { return check_klass(_java_nio_Buffer_klass); } 1.306 + 1.307 + static klassOop sun_misc_AtomicLongCSImpl_klass() { return _sun_misc_AtomicLongCSImpl_klass; } 1.308 + 1.309 + // To support incremental JRE downloads (KERNEL JRE). Null if not present. 1.310 + static klassOop sun_jkernel_DownloadManager_klass() { return _sun_jkernel_DownloadManager_klass; } 1.311 + 1.312 + static klassOop boolean_klass() { return check_klass(_boolean_klass); } 1.313 + static klassOop char_klass() { return check_klass(_char_klass); } 1.314 + static klassOop float_klass() { return check_klass(_float_klass); } 1.315 + static klassOop double_klass() { return check_klass(_double_klass); } 1.316 + static klassOop byte_klass() { return check_klass(_byte_klass); } 1.317 + static klassOop short_klass() { return check_klass(_short_klass); } 1.318 + static klassOop int_klass() { return check_klass(_int_klass); } 1.319 + static klassOop long_klass() { return check_klass(_long_klass); } 1.320 + 1.321 + static klassOop box_klass(BasicType t) { 1.322 + assert((uint)t < T_VOID+1, "range check"); 1.323 + return check_klass(_box_klasses[t]); 1.324 + } 1.325 + static BasicType box_klass_type(klassOop k); // inverse of box_klass 1.326 + 1.327 + // methods returning lazily loaded klasses 1.328 + // The corresponding method to load the class must be called before calling them. 1.329 + static klassOop abstract_ownable_synchronizer_klass() { return check_klass(_abstract_ownable_synchronizer_klass); } 1.330 + 1.331 + static void load_abstract_ownable_synchronizer_klass(TRAPS); 1.332 + 1.333 +private: 1.334 + // Tells whether ClassLoader.loadClassInternal is present 1.335 + static bool has_loadClassInternal() { return _has_loadClassInternal; } 1.336 + 1.337 +public: 1.338 + // Tells whether ClassLoader.checkPackageAccess is present 1.339 + static bool has_checkPackageAccess() { return _has_checkPackageAccess; } 1.340 + 1.341 + static bool class_klass_loaded() { return _class_klass != NULL; } 1.342 + static bool cloneable_klass_loaded() { return _cloneable_klass != NULL; } 1.343 + 1.344 + // Returns default system loader 1.345 + static oop java_system_loader(); 1.346 + 1.347 + // Compute the default system loader 1.348 + static void compute_java_system_loader(TRAPS); 1.349 + 1.350 +private: 1.351 + // Mirrors for primitive classes (created eagerly) 1.352 + static oop check_mirror(oop m) { 1.353 + assert(m != NULL, "mirror not initialized"); 1.354 + return m; 1.355 + } 1.356 + 1.357 +public: 1.358 + // Note: java_lang_Class::primitive_type is the inverse of java_mirror 1.359 + 1.360 + // Check class loader constraints 1.361 + static bool add_loader_constraint(symbolHandle name, Handle loader1, 1.362 + Handle loader2, TRAPS); 1.363 + static char* check_signature_loaders(symbolHandle signature, Handle loader1, 1.364 + Handle loader2, bool is_method, TRAPS); 1.365 + 1.366 + // Utility for printing loader "name" as part of tracing constraints 1.367 + static const char* loader_name(oop loader) { 1.368 + return ((loader) == NULL ? "<bootloader>" : 1.369 + instanceKlass::cast((loader)->klass())->name()->as_C_string() ); 1.370 + } 1.371 + 1.372 + // Record the error when the first attempt to resolve a reference from a constant 1.373 + // pool entry to a class fails. 1.374 + static void add_resolution_error(constantPoolHandle pool, int which, symbolHandle error); 1.375 + static symbolOop find_resolution_error(constantPoolHandle pool, int which); 1.376 + 1.377 + private: 1.378 + 1.379 + enum Constants { 1.380 + _loader_constraint_size = 107, // number of entries in constraint table 1.381 + _resolution_error_size = 107, // number of entries in resolution error table 1.382 + _nof_buckets = 1009 // number of buckets in hash table 1.383 + }; 1.384 + 1.385 + 1.386 + // Static variables 1.387 + 1.388 + // Hashtable holding loaded classes. 1.389 + static Dictionary* _dictionary; 1.390 + 1.391 + // Hashtable holding placeholders for classes being loaded. 1.392 + static PlaceholderTable* _placeholders; 1.393 + 1.394 + // Hashtable holding classes from the shared archive. 1.395 + static Dictionary* _shared_dictionary; 1.396 + 1.397 + // Monotonically increasing counter which grows with 1.398 + // _number_of_classes as well as hot-swapping and breakpoint setting 1.399 + // and removal. 1.400 + static int _number_of_modifications; 1.401 + 1.402 + // Lock object for system class loader 1.403 + static oop _system_loader_lock_obj; 1.404 + 1.405 + // Constraints on class loaders 1.406 + static LoaderConstraintTable* _loader_constraints; 1.407 + 1.408 + // Resolution errors 1.409 + static ResolutionErrorTable* _resolution_errors; 1.410 + 1.411 +public: 1.412 + // for VM_CounterDecay iteration support 1.413 + friend class CounterDecay; 1.414 + static klassOop try_get_next_class(); 1.415 + 1.416 +private: 1.417 + static void validate_protection_domain(instanceKlassHandle klass, 1.418 + Handle class_loader, 1.419 + Handle protection_domain, TRAPS); 1.420 + 1.421 + friend class VM_PopulateDumpSharedSpace; 1.422 + friend class TraversePlaceholdersClosure; 1.423 + static Dictionary* dictionary() { return _dictionary; } 1.424 + static Dictionary* shared_dictionary() { return _shared_dictionary; } 1.425 + static PlaceholderTable* placeholders() { return _placeholders; } 1.426 + static LoaderConstraintTable* constraints() { return _loader_constraints; } 1.427 + static ResolutionErrorTable* resolution_errors() { return _resolution_errors; } 1.428 + 1.429 + // Basic loading operations 1.430 + static klassOop resolve_instance_class_or_null(symbolHandle class_name, Handle class_loader, Handle protection_domain, TRAPS); 1.431 + static klassOop resolve_array_class_or_null(symbolHandle class_name, Handle class_loader, Handle protection_domain, TRAPS); 1.432 + static instanceKlassHandle handle_parallel_super_load(symbolHandle class_name, symbolHandle supername, Handle class_loader, Handle protection_domain, Handle lockObject, TRAPS); 1.433 + // Wait on SystemDictionary_lock; unlocks lockObject before 1.434 + // waiting; relocks lockObject with correct recursion count 1.435 + // after waiting, but before reentering SystemDictionary_lock 1.436 + // to preserve lock order semantics. 1.437 + static void double_lock_wait(Handle lockObject, TRAPS); 1.438 + static void define_instance_class(instanceKlassHandle k, TRAPS); 1.439 + static instanceKlassHandle find_or_define_instance_class(symbolHandle class_name, 1.440 + Handle class_loader, 1.441 + instanceKlassHandle k, TRAPS); 1.442 + static instanceKlassHandle load_shared_class(symbolHandle class_name, 1.443 + Handle class_loader, TRAPS); 1.444 + static instanceKlassHandle load_shared_class(instanceKlassHandle ik, 1.445 + Handle class_loader, TRAPS); 1.446 + static instanceKlassHandle load_instance_class(symbolHandle class_name, Handle class_loader, TRAPS); 1.447 + static Handle compute_loader_lock_object(Handle class_loader, TRAPS); 1.448 + static void check_loader_lock_contention(Handle loader_lock, TRAPS); 1.449 + 1.450 + static klassOop find_shared_class(symbolHandle class_name); 1.451 + 1.452 + // Setup link to hierarchy 1.453 + static void add_to_hierarchy(instanceKlassHandle k, TRAPS); 1.454 + 1.455 +private: 1.456 + // We pass in the hashtable index so we can calculate it outside of 1.457 + // the SystemDictionary_lock. 1.458 + 1.459 + // Basic find on loaded classes 1.460 + static klassOop find_class(int index, unsigned int hash, 1.461 + symbolHandle name, Handle loader); 1.462 + 1.463 + // Basic find on classes in the midst of being loaded 1.464 + static symbolOop find_placeholder(int index, unsigned int hash, 1.465 + symbolHandle name, Handle loader); 1.466 + 1.467 + // Basic find operation of loaded classes and classes in the midst 1.468 + // of loading; used for assertions and verification only. 1.469 + static oop find_class_or_placeholder(symbolHandle class_name, 1.470 + Handle class_loader); 1.471 + 1.472 + // Updating entry in dictionary 1.473 + // Add a completely loaded class 1.474 + static void add_klass(int index, symbolHandle class_name, 1.475 + Handle class_loader, KlassHandle obj); 1.476 + 1.477 + // Add a placeholder for a class being loaded 1.478 + static void add_placeholder(int index, 1.479 + symbolHandle class_name, 1.480 + Handle class_loader); 1.481 + static void remove_placeholder(int index, 1.482 + symbolHandle class_name, 1.483 + Handle class_loader); 1.484 + 1.485 + // Performs cleanups after resolve_super_or_fail. This typically needs 1.486 + // to be called on failure. 1.487 + // Won't throw, but can block. 1.488 + static void resolution_cleanups(symbolHandle class_name, 1.489 + Handle class_loader, 1.490 + TRAPS); 1.491 + 1.492 + // Initialization 1.493 + static void initialize_preloaded_classes(TRAPS); 1.494 + 1.495 + // Class loader constraints 1.496 + static void check_constraints(int index, unsigned int hash, 1.497 + instanceKlassHandle k, Handle loader, 1.498 + bool defining, TRAPS); 1.499 + static void update_dictionary(int d_index, unsigned int d_hash, 1.500 + int p_index, unsigned int p_hash, 1.501 + instanceKlassHandle k, Handle loader, TRAPS); 1.502 + 1.503 + // Variables holding commonly used klasses (preloaded) 1.504 + static klassOop _object_klass; 1.505 + static klassOop _string_klass; 1.506 + static klassOop _class_klass; 1.507 + static klassOop _cloneable_klass; 1.508 + static klassOop _classloader_klass; 1.509 + static klassOop _serializable_klass; 1.510 + static klassOop _system_klass; 1.511 + 1.512 + static klassOop _throwable_klass; 1.513 + static klassOop _error_klass; 1.514 + static klassOop _threaddeath_klass; 1.515 + static klassOop _exception_klass; 1.516 + static klassOop _runtime_exception_klass; 1.517 + static klassOop _classNotFoundException_klass; 1.518 + static klassOop _noClassDefFoundError_klass; 1.519 + static klassOop _linkageError_klass; 1.520 + static klassOop _classCastException_klass; 1.521 + static klassOop _arrayStoreException_klass; 1.522 + static klassOop _virtualMachineError_klass; 1.523 + static klassOop _outOfMemoryError_klass; 1.524 + static klassOop _StackOverflowError_klass; 1.525 + static klassOop _illegalMonitorStateException_klass; 1.526 + static klassOop _protectionDomain_klass; 1.527 + static klassOop _AccessControlContext_klass; 1.528 + static klassOop _reference_klass; 1.529 + static klassOop _soft_reference_klass; 1.530 + static klassOop _weak_reference_klass; 1.531 + static klassOop _final_reference_klass; 1.532 + static klassOop _phantom_reference_klass; 1.533 + static klassOop _finalizer_klass; 1.534 + 1.535 + static klassOop _thread_klass; 1.536 + static klassOop _threadGroup_klass; 1.537 + static klassOop _properties_klass; 1.538 + static klassOop _reflect_accessible_object_klass; 1.539 + static klassOop _reflect_field_klass; 1.540 + static klassOop _reflect_method_klass; 1.541 + static klassOop _reflect_constructor_klass; 1.542 + // 1.4 reflection implementation 1.543 + static klassOop _reflect_magic_klass; 1.544 + static klassOop _reflect_method_accessor_klass; 1.545 + static klassOop _reflect_constructor_accessor_klass; 1.546 + static klassOop _reflect_delegating_classloader_klass; 1.547 + // 1.5 annotations implementation 1.548 + static klassOop _reflect_constant_pool_klass; 1.549 + static klassOop _reflect_unsafe_static_field_accessor_impl_klass; 1.550 + 1.551 + static klassOop _stringBuffer_klass; 1.552 + static klassOop _vector_klass; 1.553 + static klassOop _hashtable_klass; 1.554 + 1.555 + static klassOop _stackTraceElement_klass; 1.556 + 1.557 + static klassOop _java_nio_Buffer_klass; 1.558 + 1.559 + static klassOop _sun_misc_AtomicLongCSImpl_klass; 1.560 + 1.561 + // KERNEL JRE support. 1.562 + static klassOop _sun_jkernel_DownloadManager_klass; 1.563 + 1.564 + // Lazily loaded klasses 1.565 + static volatile klassOop _abstract_ownable_synchronizer_klass; 1.566 + 1.567 + // Box klasses 1.568 + static klassOop _boolean_klass; 1.569 + static klassOop _char_klass; 1.570 + static klassOop _float_klass; 1.571 + static klassOop _double_klass; 1.572 + static klassOop _byte_klass; 1.573 + static klassOop _short_klass; 1.574 + static klassOop _int_klass; 1.575 + static klassOop _long_klass; 1.576 + 1.577 + // table of same 1.578 + static klassOop _box_klasses[T_VOID+1]; 1.579 + 1.580 + static oop _java_system_loader; 1.581 + 1.582 + static bool _has_loadClassInternal; 1.583 + static bool _has_checkPackageAccess; 1.584 +};