< 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.
 93   static Klass* resolve_or_fail(Symbol* class_name, bool throw_error, TRAPS) {
 94     return resolve_or_fail(class_name, Handle(), Handle(), throw_error, THREAD);
 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   // Resolve a superclass or superinterface. Called from ClassFileParser,
106   // parse_interfaces, resolve_instance_class_or_null, load_shared_class
107   // "class_name" is the class whose super class or interface is being resolved.
108   static InstanceKlass* resolve_super_or_fail(Symbol* class_name,
109                                               Symbol* super_name,
110                                               Handle class_loader,
111                                               Handle protection_domain,
112                                               bool is_superclass,
113                                               TRAPS);
114  private:
115   // Parse the stream to create a hidden class.
116   // Used by jvm_lookup_define_class.
117   static InstanceKlass* resolve_hidden_class_from_stream(ClassFileStream* st,
118                                                          Symbol* class_name,
119                                                          Handle class_loader,
120                                                          const ClassLoadInfo& cl_info,
121                                                          TRAPS);
122 
123   // Resolve a class from stream (called by jni_DefineClass and JVM_DefineClass)
124   // This class is added to the SystemDictionary.
125   static InstanceKlass* resolve_class_from_stream(ClassFileStream* st,
126                                                   Symbol* class_name,
127                                                   Handle class_loader,
128                                                   const ClassLoadInfo& cl_info,
129                                                   TRAPS);
130 
131   static oop get_system_class_loader_impl(TRAPS);
132   static oop get_platform_class_loader_impl(TRAPS);
133 
134  public:

135   // Resolve either a hidden or normal class from a stream of bytes, based on ClassLoadInfo
136   static InstanceKlass* resolve_from_stream(ClassFileStream* st,
137                                             Symbol* class_name,
138                                             Handle class_loader,
139                                             const ClassLoadInfo& cl_info,
140                                             TRAPS);
141 
142   // Lookup an already loaded class. If not found null is returned.
143   static InstanceKlass* find_instance_klass(Thread* current, Symbol* class_name,
144                                             Handle class_loader, Handle protection_domain);
145 
146   // Lookup an already loaded instance or array class.
147   // Do not make any queries to class loaders; consult only the cache.
148   // If not found null is returned.
149   static Klass* find_instance_or_array_klass(Thread* current, Symbol* class_name,
150                                              Handle class_loader,
151                                              Handle protection_domain);
152 
153   // Lookup an instance or array class that has already been loaded
154   // 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.
 94   static Klass* resolve_or_fail(Symbol* class_name, bool throw_error, TRAPS) {
 95     return resolve_or_fail(class_name, Handle(), Handle(), throw_error, THREAD);
 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   // Resolve a superclass or superinterface. Called from ClassFileParser,
107   // parse_interfaces, resolve_instance_class_or_null, load_shared_class
108   // "class_name" is the class whose super class or interface is being resolved.
109   static InstanceKlass* resolve_with_circularity_detection_or_fail(Symbol* class_name,
110                                               Symbol* super_name,
111                                               Handle class_loader,
112                                               Handle protection_domain,
113                                               bool is_superclass,
114                                               TRAPS);
115  private:
116   // Parse the stream to create a hidden class.
117   // Used by jvm_lookup_define_class.
118   static InstanceKlass* resolve_hidden_class_from_stream(ClassFileStream* st,
119                                                          Symbol* class_name,
120                                                          Handle class_loader,
121                                                          const ClassLoadInfo& cl_info,
122                                                          TRAPS);
123 
124   // Resolve a class from stream (called by jni_DefineClass and JVM_DefineClass)
125   // This class is added to the SystemDictionary.
126   static InstanceKlass* resolve_class_from_stream(ClassFileStream* st,
127                                                   Symbol* class_name,
128                                                   Handle class_loader,
129                                                   const ClassLoadInfo& cl_info,
130                                                   TRAPS);
131 
132   static oop get_system_class_loader_impl(TRAPS);
133   static oop get_platform_class_loader_impl(TRAPS);
134 
135  public:
136 
137   // Resolve either a hidden or normal class from a stream of bytes, based on ClassLoadInfo
138   static InstanceKlass* resolve_from_stream(ClassFileStream* st,
139                                             Symbol* class_name,
140                                             Handle class_loader,
141                                             const ClassLoadInfo& cl_info,
142                                             TRAPS);
143 
144   // Lookup an already loaded class. If not found null is returned.
145   static InstanceKlass* find_instance_klass(Thread* current, Symbol* class_name,
146                                             Handle class_loader, Handle protection_domain);
147 
148   // Lookup an already loaded instance or array class.
149   // Do not make any queries to class loaders; consult only the cache.
150   // If not found null is returned.
151   static Klass* find_instance_or_array_klass(Thread* current, Symbol* class_name,
152                                              Handle class_loader,
153                                              Handle protection_domain);
154 
155   // Lookup an instance or array class that has already been loaded
156   // either into the given class loader, or else into another class
< prev index next >