< prev index next >

src/hotspot/share/classfile/systemDictionary.hpp

Print this page

 53 // domain field of the dictionary entry has not yet been filled in when
 54 // the "real" dictionary entry is created.
 55 //
 56 // Clients of this class who are interested in finding if a class has
 57 // been completely loaded -- not classes in the process of being loaded --
 58 // can read the dictionary unlocked. This is safe because
 59 //    - entries are only deleted when the class loader is not alive, when the
 60 //      entire dictionary is deleted.
 61 //    - entries must be fully formed before they are available to concurrent
 62 //         readers (we must ensure write ordering)
 63 //
 64 // Note that placeholders are deleted at any time, as they are removed
 65 // when a class is completely loaded. Therefore, readers as well as writers
 66 // of placeholders must hold the SystemDictionary_lock.
 67 //
 68 
 69 class BootstrapInfo;
 70 class ClassFileStream;
 71 class ClassLoadInfo;
 72 class Dictionary;

 73 class PackageEntry;
 74 class GCTimer;
 75 class EventClassLoad;
 76 class Symbol;
 77 
 78 class SystemDictionary : AllStatic {
 79   friend class BootstrapInfo;
 80   friend class vmClasses;
 81   friend class VMStructs;
 82 
 83  public:
 84 
 85   // Returns a class with a given class name and class loader.  Loads the
 86   // class if needed. If not found a NoClassDefFoundError or a
 87   // ClassNotFoundException is thrown, depending on the value on the
 88   // throw_error flag.  For most uses the throw_error argument should be set
 89   // to true.
 90 
 91   static Klass* resolve_or_fail(Symbol* class_name, Handle class_loader, Handle protection_domain, bool throw_error, TRAPS);
 92   // Convenient call for null loader and protection domain.

 95   }
 96 
 97   // Returns a class with a given class name and class loader.
 98   // Loads the class if needed. If not found null is returned.
 99   static Klass* resolve_or_null(Symbol* class_name, Handle class_loader, Handle protection_domain, TRAPS);
100   // Version with null loader and protection domain
101   static Klass* resolve_or_null(Symbol* class_name, TRAPS) {
102     return resolve_or_null(class_name, Handle(), Handle(), THREAD);
103   }
104 
105   static InstanceKlass* resolve_with_circularity_detection(Symbol* class_name,
106                                                            Symbol* next_name,
107                                                            Handle class_loader,
108                                                            Handle protection_domain,
109                                                            bool is_superclass,
110                                                            TRAPS);
111 
112   // Resolve a superclass or superinterface. Called from ClassFileParser,
113   // parse_interfaces, resolve_instance_class_or_null, load_shared_class
114   // "class_name" is the class whose super class or interface is being resolved.
115   static InstanceKlass* resolve_super_or_fail(Symbol* class_name, Symbol* super_name,

116                                               Handle class_loader,
117                                               Handle protection_domain, bool is_superclass, TRAPS) {
118     return resolve_with_circularity_detection(class_name, super_name, class_loader, protection_domain,
119                                               is_superclass, THREAD);
120   }
121 
122  private:
123   // Parse the stream to create a hidden class.
124   // Used by jvm_lookup_define_class.
125   static InstanceKlass* resolve_hidden_class_from_stream(ClassFileStream* st,
126                                                          Symbol* class_name,
127                                                          Handle class_loader,
128                                                          const ClassLoadInfo& cl_info,
129                                                          TRAPS);
130 
131   // Resolve a class from stream (called by jni_DefineClass and JVM_DefineClass)
132   // This class is added to the SystemDictionary.
133   static InstanceKlass* resolve_class_from_stream(ClassFileStream* st,
134                                                   Symbol* class_name,
135                                                   Handle class_loader,
136                                                   const ClassLoadInfo& cl_info,
137                                                   TRAPS);
138 
139   static oop get_system_class_loader_impl(TRAPS);
140   static oop get_platform_class_loader_impl(TRAPS);
141 
142  public:

143   // Resolve either a hidden or normal class from a stream of bytes, based on ClassLoadInfo
144   static InstanceKlass* resolve_from_stream(ClassFileStream* st,
145                                             Symbol* class_name,
146                                             Handle class_loader,
147                                             const ClassLoadInfo& cl_info,
148                                             TRAPS);
149 
150   // Lookup an already loaded class. If not found null is returned.
151   static InstanceKlass* find_instance_klass(Thread* current, Symbol* class_name,
152                                             Handle class_loader, Handle protection_domain);
153 
154   // Lookup an already loaded instance or array class.
155   // Do not make any queries to class loaders; consult only the cache.
156   // If not found null is returned.
157   static Klass* find_instance_or_array_klass(Thread* current, Symbol* class_name,
158                                              Handle class_loader,
159                                              Handle protection_domain);
160 
161   // Lookup an instance or array class that has already been loaded
162   // either into the given class loader, or else into another class

 53 // domain field of the dictionary entry has not yet been filled in when
 54 // the "real" dictionary entry is created.
 55 //
 56 // Clients of this class who are interested in finding if a class has
 57 // been completely loaded -- not classes in the process of being loaded --
 58 // can read the dictionary unlocked. This is safe because
 59 //    - entries are only deleted when the class loader is not alive, when the
 60 //      entire dictionary is deleted.
 61 //    - entries must be fully formed before they are available to concurrent
 62 //         readers (we must ensure write ordering)
 63 //
 64 // Note that placeholders are deleted at any time, as they are removed
 65 // when a class is completely loaded. Therefore, readers as well as writers
 66 // of placeholders must hold the SystemDictionary_lock.
 67 //
 68 
 69 class BootstrapInfo;
 70 class ClassFileStream;
 71 class ClassLoadInfo;
 72 class Dictionary;
 73 class AllFieldStream;
 74 class PackageEntry;
 75 class GCTimer;
 76 class EventClassLoad;
 77 class Symbol;
 78 
 79 class SystemDictionary : AllStatic {
 80   friend class BootstrapInfo;
 81   friend class vmClasses;
 82   friend class VMStructs;
 83 
 84  public:
 85 
 86   // Returns a class with a given class name and class loader.  Loads the
 87   // class if needed. If not found a NoClassDefFoundError or a
 88   // ClassNotFoundException is thrown, depending on the value on the
 89   // throw_error flag.  For most uses the throw_error argument should be set
 90   // to true.
 91 
 92   static Klass* resolve_or_fail(Symbol* class_name, Handle class_loader, Handle protection_domain, bool throw_error, TRAPS);
 93   // Convenient call for null loader and protection domain.

 96   }
 97 
 98   // Returns a class with a given class name and class loader.
 99   // Loads the class if needed. If not found null is returned.
100   static Klass* resolve_or_null(Symbol* class_name, Handle class_loader, Handle protection_domain, TRAPS);
101   // Version with null loader and protection domain
102   static Klass* resolve_or_null(Symbol* class_name, TRAPS) {
103     return resolve_or_null(class_name, Handle(), Handle(), THREAD);
104   }
105 
106   static InstanceKlass* resolve_with_circularity_detection(Symbol* class_name,
107                                                            Symbol* next_name,
108                                                            Handle class_loader,
109                                                            Handle protection_domain,
110                                                            bool is_superclass,
111                                                            TRAPS);
112 
113   // Resolve a superclass or superinterface. Called from ClassFileParser,
114   // parse_interfaces, resolve_instance_class_or_null, load_shared_class
115   // "class_name" is the class whose super class or interface is being resolved.
116   static InstanceKlass* resolve_with_circularity_detection_or_fail(Symbol* class_name,
117                                               Symbol* super_name,
118                                               Handle class_loader,
119                                               Handle protection_domain, bool is_superclass, TRAPS) {
120     return resolve_with_circularity_detection(class_name, super_name, class_loader, protection_domain,
121                                               is_superclass, THREAD);
122   }
123 
124  private:
125   // Parse the stream to create a hidden class.
126   // Used by jvm_lookup_define_class.
127   static InstanceKlass* resolve_hidden_class_from_stream(ClassFileStream* st,
128                                                          Symbol* class_name,
129                                                          Handle class_loader,
130                                                          const ClassLoadInfo& cl_info,
131                                                          TRAPS);
132 
133   // Resolve a class from stream (called by jni_DefineClass and JVM_DefineClass)
134   // This class is added to the SystemDictionary.
135   static InstanceKlass* resolve_class_from_stream(ClassFileStream* st,
136                                                   Symbol* class_name,
137                                                   Handle class_loader,
138                                                   const ClassLoadInfo& cl_info,
139                                                   TRAPS);
140 
141   static oop get_system_class_loader_impl(TRAPS);
142   static oop get_platform_class_loader_impl(TRAPS);
143 
144  public:
145 
146   // Resolve either a hidden or normal class from a stream of bytes, based on ClassLoadInfo
147   static InstanceKlass* resolve_from_stream(ClassFileStream* st,
148                                             Symbol* class_name,
149                                             Handle class_loader,
150                                             const ClassLoadInfo& cl_info,
151                                             TRAPS);
152 
153   // Lookup an already loaded class. If not found null is returned.
154   static InstanceKlass* find_instance_klass(Thread* current, Symbol* class_name,
155                                             Handle class_loader, Handle protection_domain);
156 
157   // Lookup an already loaded instance or array class.
158   // Do not make any queries to class loaders; consult only the cache.
159   // If not found null is returned.
160   static Klass* find_instance_or_array_klass(Thread* current, Symbol* class_name,
161                                              Handle class_loader,
162                                              Handle protection_domain);
163 
164   // Lookup an instance or array class that has already been loaded
165   // either into the given class loader, or else into another class
< prev index next >