systemDictionary.hpp revision 2204
2014N/A * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A// The system dictionary stores all loaded classes and maps: 2062N/A// [class name,class loader] -> class i.e. [Symbol*,oop] -> klassOop 0N/A// Classes are loaded lazily. The default VM class loader is 0N/A// represented as NULL. 0N/A// The underlying data structure is an open hash table with a fixed number 0N/A// of buckets. During loading the loader object is locked, (for the VM loader 0N/A// a private lock object is used). Class loading can thus be done concurrently, 0N/A// but only by different loaders. 0N/A// During loading a placeholder (name, loader) is temporarily placed in 0N/A// a side data structure, and is used to detect ClassCircularityErrors 0N/A// and to perform verification during GC. A GC can occur in the midst 0N/A// of class loading, as we call out to Java, have to take locks, etc. 0N/A// When class loading is finished, a new entry is added to the system 0N/A// dictionary and the place holder is removed. Note that the protection 0N/A// domain field of the system dictionary has not yet been filled in when 0N/A// the "real" system dictionary entry is created. 0N/A// Clients of this class who are interested in finding if a class has 0N/A// been completely loaded -- not classes in the process of being loaded -- 0N/A// can read the SystemDictionary unlocked. This is safe because 0N/A// - entries are only deleted at safepoints 0N/A// - readers cannot come to a safepoint while actively examining 0N/A// an entry (an entry cannot be deleted from under a reader) 0N/A// - entries must be fully formed before they are available to concurrent 0N/A// readers (we must ensure write ordering) 0N/A// Note that placeholders are deleted at any time, as they are removed 0N/A// when a class is completely loaded. Therefore, readers as well as writers 0N/A// of placeholders must hold the SystemDictionary_lock. 132N/A// Certain classes are preloaded, such as java.lang.Object and java.lang.String. 132N/A// They are all "well-known", in the sense that no class loader is allowed 132N/A// to provide a different definition. 132N/A// These klasses must all have names defined in vmSymbols. 132N/A// Each well-known class has a short klass name (like object_klass), 132N/A// a vmSymbol name (like java_lang_Object), and a flag word 132N/A// that makes some minor distinctions, like whether the klass 132N/A// is preloaded, optional, release-specific, etc. 132N/A// The order of these definitions is significant; it is the order in which 132N/A// preloading is actually performed by initialize_preloaded_classes. 132N/A /* well-known classes */ \
132N/A /* Preload ref klasses and set reference types */ \
132N/A /* NOTE: needed too early in bootstrapping process to have checks based on JDK version */ \
132N/A /* Universe::is_gte_jdk14x_version() is not set up by this point. */ \
132N/A /* It's okay if this turns out to be NULL in non-1.4 JDKs. */ \
710N/A /* support for dynamic typing; it's OK if these are NULL in earlier JDKs */ \
1908N/A /* Note: MethodHandle must be first, and CallSite last in group */ \
132N/A /* It's NULL in non-1.4 JDKs. */ \
132N/A /* Universe::is_gte_jdk14x_version() is not set up by this point. */ \
132N/A /* It's okay if this turns out to be NULL in non-1.4 JDKs. */ \
132N/A /* If this class isn't present, it won't be referenced. */ \
132N/A /* Preload boxing klasses */ \
132N/A Pre,
// preloaded; error if not present 132N/A // Order is significant. Options before this point require resolve_or_fail. 132N/A // Options after this point will use resolve_or_null instead. 132N/A Opt,
// preload tried; NULL if not present 0N/A // Returns a class with a given class name and class loader. Loads the 0N/A // class if needed. If not found a NoClassDefFoundError or a 0N/A // ClassNotFoundException is thrown, depending on the value on the 0N/A // throw_error flag. For most uses the throw_error argument should be set 0N/A // Convenient call for null loader and protection domain. 0N/A // handle error translation for resolve_or_null results 0N/A // Returns a class with a given class name and class loader. 0N/A // Loads the class if needed. If not found NULL is returned. 0N/A // Version with null loader and protection domain 0N/A // Resolve a superclass or superinterface. Called from ClassFileParser, 0N/A // parse_interfaces, resolve_instance_class_or_null, load_shared_class 0N/A // "child_name" is the class whose super class or interface is being resolved. 0N/A // Parse new stream. This won't update the system dictionary or 0N/A // class hierarchy, simply parse the stream. Used by JVMTI RedefineClasses. 0N/A // Resolve from stream (called by jni_DefineClass and JVM_DefineClass) 0N/A // Lookup an already loaded class. If not found NULL is returned. 0N/A // Lookup an already loaded instance or array class. 0N/A // Do not make any queries to class loaders; consult only the cache. 0N/A // If not found NULL is returned. 132N/A // If the given name is known to vmSymbols, return the well-know klass: 0N/A // Lookup an instance or array class that has already been loaded 0N/A // either into the given class loader, or else into another class 0N/A // loader that is constrained (via loader constraints) to produce 0N/A // a consistent class. Do not take protection domains into account. 0N/A // Do not make any queries to class loaders; consult only the cache. 0N/A // Return NULL if the class is not found. 0N/A // This function is a strict superset of find_instance_or_array_klass. 0N/A // This function (the unchecked version) makes a conservative prediction 0N/A // of the result of the checked version, assuming successful lookup. 0N/A // If both functions return non-null, they must return the same value. 0N/A // Also, the unchecked version may sometimes be non-null where the 0N/A // checked version is null. This can occur in several ways: 0N/A // 1. No query has yet been made to the class loader. 0N/A // 2. The class loader was queried, but chose not to delegate. 0N/A // 4. Loading was attempted, but there was a linkage error of some sort. 0N/A // In all of these cases, the loader constraints on this type are 0N/A // satisfied, and it is safe for classes in the given class loader 0N/A // to manipulate strongly-typed values of the found class, subject 0N/A // to local linkage and access checks. 0N/A // Iterate over all klasses in dictionary 0N/A // Just the classes from defining class loaders 0N/A // Added for initialize_itable_for_klass to handle exceptions 0N/A // All classes, and their class loaders 0N/A // All classes, and their class loaders 0N/A // (added for helpers that use HandleMarks and ResourceMarks) 0N/A // All entries in the placeholder table and their class loaders 0N/A // Iterate over all methods in all klasses in dictionary 0N/A // Garbage collection support 0N/A // This method applies "blk->do_oop" to all the pointers to "system" 0N/A // classes and loaders. 0N/A // This method applies "blk->do_oop" to all the placeholders. 0N/A // Unload (that is, break root links to) all unmarked classes and 0N/A // loaders. Returns "true" iff something was unloaded. 0N/A // Applies "f->do_oop" to all root oops in the system dictionary. 0N/A // System loader lock 0N/A // Traverses preloaded oops: various system classes. These are 0N/A // guaranteed to be in the perm gen. 0N/A // Number of contained klasses 0N/A // This is both fully loaded classes and classes in the process 0N/A // Monotonically increasing counter which grows as classes are 0N/A // of breakpoints are performed 0N/A // Needed by evolution and breakpoint code 0N/A // Verify class is in dictionary 0N/A // Fast access to commonly used classes (preloaded) 132N/A // despite the optional loading, if you use this it must be present: 132N/A // Local definition for direct access to the private array: 0N/A // methods returning lazily loaded klasses 0N/A // The corresponding method to load the class must be called before calling them. 0N/A // Tells whether ClassLoader.loadClassInternal is present 0N/A // Returns default system loader 0N/A // Compute the default system loader 0N/A // Mirrors for primitive classes (created eagerly) 0N/A // Note: java_lang_Class::primitive_type is the inverse of java_mirror 0N/A // Check class loader constraints 2204N/A // find the java.lang.invoke.MethodHandles::invoke method for a given signature 2204N/A // ask Java to compute a java.lang.invoke.MethodType object for a given signature 2204N/A // ask Java to compute a java.lang.invoke.MethodHandle object for a given CP entry 726N/A // ask Java to create a dynamic call site, while linking an invokedynamic op 726N/A // coordinate with Java about bootstrap methods 0N/A // Utility for printing loader "name" as part of tracing constraints 0N/A // Record the error when the first attempt to resolve a reference from a constant 0N/A // pool entry to a class fails. 0N/A // Hashtable holding loaded classes. 0N/A // Hashtable holding placeholders for classes being loaded. 0N/A // Hashtable holding classes from the shared archive. 0N/A // Monotonically increasing counter which grows with 0N/A // _number_of_classes as well as hot-swapping and breakpoint setting 0N/A // Lock object for system class loader 0N/A // Constraints on class loaders 0N/A // Resolution errors 710N/A // Invoke methods (JSR 292) 0N/A // for VM_CounterDecay iteration support 0N/A // Basic loading operations 0N/A // Wait on SystemDictionary_lock; unlocks lockObject before 0N/A // waiting; relocks lockObject with correct recursion count 0N/A // after waiting, but before reentering SystemDictionary_lock 0N/A // to preserve lock order semantics. 0N/A // Setup link to hierarchy 0N/A // We pass in the hashtable index so we can calculate it outside of 0N/A // the SystemDictionary_lock. 0N/A // Basic find on loaded classes 0N/A // Basic find on classes in the midst of being loaded 0N/A // Updating entry in dictionary 0N/A // Add a completely loaded class 0N/A // Add a placeholder for a class being loaded 0N/A // Performs cleanups after resolve_super_or_fail. This typically needs 0N/A // to be called on failure. 0N/A // Won't throw, but can block. 0N/A // Class loader constraints 0N/A // Variables holding commonly used klasses (preloaded) 0N/A // Lazily loaded klasses 132N/A // table of box klasses (int_klass, etc.) 1879N/A#
endif // SHARE_VM_CLASSFILE_SYSTEMDICTIONARY_HPP