< prev index next >

src/share/vm/classfile/dictionary.hpp

Print this page


  75 
  76   void free_entry(DictionaryEntry* entry);
  77 
  78   void add_klass(Symbol* class_name, ClassLoaderData* loader_data, InstanceKlass* obj);
  79 
  80   InstanceKlass* find_class(int index, unsigned int hash,
  81                             Symbol* name, ClassLoaderData* loader_data);
  82 
  83   InstanceKlass* find_shared_class(int index, unsigned int hash, Symbol* name);
  84 
  85   // Compiler support
  86   InstanceKlass* try_get_next_class();
  87 
  88   // GC support
  89   void oops_do(OopClosure* f);
  90   void roots_oops_do(OopClosure* strong, OopClosure* weak);
  91 
  92   void classes_do(void f(Klass*));
  93   void classes_do(void f(Klass*, TRAPS), TRAPS);
  94   void classes_do(void f(Klass*, ClassLoaderData*));

  95 
  96   void unlink(BoolObjectClosure* is_alive);
  97   void remove_classes_in_error_state();
  98 
  99   // Classes loaded by the bootstrap loader are always strongly reachable.
 100   // If we're not doing class unloading, all classes are strongly reachable.
 101   static bool is_strongly_reachable(ClassLoaderData* loader_data, Klass* klass) {
 102     assert (klass != NULL, "should have non-null klass");
 103     return (loader_data->is_the_null_class_loader_data() || !ClassUnloading);
 104   }
 105 
 106   // Unload (that is, break root links to) all unmarked classes and loaders.
 107   void do_unloading();
 108 
 109   // Protection domains
 110   InstanceKlass* find(int index, unsigned int hash, Symbol* name,
 111                       ClassLoaderData* loader_data, Handle protection_domain, TRAPS);
 112   bool is_valid_protection_domain(int index, unsigned int hash,
 113                                   Symbol* name, ClassLoaderData* loader_data,
 114                                   Handle protection_domain);
 115   void add_protection_domain(int index, unsigned int hash,
 116                              InstanceKlass* klass, ClassLoaderData* loader_data,
 117                              Handle protection_domain, TRAPS);
 118 
 119   // Sharing support
 120   void reorder_dictionary();
 121 
 122   ProtectionDomainCacheEntry* cache_get(Handle protection_domain);
 123 
 124   void print(bool details = true);
 125 #ifdef ASSERT
 126   void printPerformanceInfoDetails();
 127 #endif // ASSERT
 128   void verify();
 129 };
 130 
 131 // An entry in the system dictionary, this describes a class as
 132 // { InstanceKlass*, loader, protection_domain }.
 133 
 134 class DictionaryEntry : public HashtableEntry<InstanceKlass*, mtClass> {
 135   friend class VMStructs;
 136  private:
 137   // Contains the set of approved protection domains that can access
 138   // this system dictionary entry.
 139   //
 140   // This protection domain set is a set of tuples:


 147   // If such an entry (C, ICL, PD) exists in the table, it means that
 148   // it is okay for a class Foo to reference C, where
 149   //
 150   //    Foo.protection_domain() == PD, and
 151   //    Foo's defining class loader == ICL
 152   //
 153   // The usage of the PD set can be seen in SystemDictionary::validate_protection_domain()
 154   // It is essentially a cache to avoid repeated Java up-calls to
 155   // ClassLoader.checkPackageAccess().
 156   //
 157   ProtectionDomainEntry* _pd_set;
 158   ClassLoaderData*       _loader_data;
 159 
 160  public:
 161   // Tells whether a protection is in the approved set.
 162   bool contains_protection_domain(oop protection_domain) const;
 163   // Adds a protection domain to the approved set.
 164   void add_protection_domain(Dictionary* dict, Handle protection_domain);
 165 
 166   InstanceKlass* klass() const { return (InstanceKlass*)literal(); }

 167 
 168   DictionaryEntry* next() const {
 169     return (DictionaryEntry*)HashtableEntry<InstanceKlass*, mtClass>::next();
 170   }
 171 
 172   DictionaryEntry** next_addr() {
 173     return (DictionaryEntry**)HashtableEntry<InstanceKlass*, mtClass>::next_addr();
 174   }
 175 
 176   ClassLoaderData* loader_data() const { return _loader_data; }
 177   void set_loader_data(ClassLoaderData* loader_data) { _loader_data = loader_data; }
 178 
 179   ProtectionDomainEntry* pd_set() const { return _pd_set; }
 180   void set_pd_set(ProtectionDomainEntry* pd_set) { _pd_set = pd_set; }
 181 
 182   // Tells whether the initiating class' protection can access the this _klass
 183   bool is_valid_protection_domain(Handle protection_domain) {
 184     if (!ProtectionDomainVerification) return true;
 185     if (!SystemDictionary::has_checkPackageAccess()) return true;
 186 




  75 
  76   void free_entry(DictionaryEntry* entry);
  77 
  78   void add_klass(Symbol* class_name, ClassLoaderData* loader_data, InstanceKlass* obj);
  79 
  80   InstanceKlass* find_class(int index, unsigned int hash,
  81                             Symbol* name, ClassLoaderData* loader_data);
  82 
  83   InstanceKlass* find_shared_class(int index, unsigned int hash, Symbol* name);
  84 
  85   // Compiler support
  86   InstanceKlass* try_get_next_class();
  87 
  88   // GC support
  89   void oops_do(OopClosure* f);
  90   void roots_oops_do(OopClosure* strong, OopClosure* weak);
  91 
  92   void classes_do(void f(Klass*));
  93   void classes_do(void f(Klass*, TRAPS), TRAPS);
  94   void classes_do(void f(Klass*, ClassLoaderData*));
  95   void classes_do(MetaspaceClosure* it);
  96 
  97   void unlink(BoolObjectClosure* is_alive);
  98   void remove_classes_in_error_state();
  99 
 100   // Classes loaded by the bootstrap loader are always strongly reachable.
 101   // If we're not doing class unloading, all classes are strongly reachable.
 102   static bool is_strongly_reachable(ClassLoaderData* loader_data, Klass* klass) {
 103     assert (klass != NULL, "should have non-null klass");
 104     return (loader_data->is_the_null_class_loader_data() || !ClassUnloading);
 105   }
 106 
 107   // Unload (that is, break root links to) all unmarked classes and loaders.
 108   void do_unloading();
 109 
 110   // Protection domains
 111   InstanceKlass* find(int index, unsigned int hash, Symbol* name,
 112                       ClassLoaderData* loader_data, Handle protection_domain, TRAPS);
 113   bool is_valid_protection_domain(int index, unsigned int hash,
 114                                   Symbol* name, ClassLoaderData* loader_data,
 115                                   Handle protection_domain);
 116   void add_protection_domain(int index, unsigned int hash,
 117                              InstanceKlass* klass, ClassLoaderData* loader_data,
 118                              Handle protection_domain, TRAPS);
 119 
 120   // Sharing support
 121   void reorder_dictionary_for_sharing();
 122 
 123   ProtectionDomainCacheEntry* cache_get(Handle protection_domain);
 124 
 125   void print(bool details = true);
 126 #ifdef ASSERT
 127   void printPerformanceInfoDetails();
 128 #endif // ASSERT
 129   void verify();
 130 };
 131 
 132 // An entry in the system dictionary, this describes a class as
 133 // { InstanceKlass*, loader, protection_domain }.
 134 
 135 class DictionaryEntry : public HashtableEntry<InstanceKlass*, mtClass> {
 136   friend class VMStructs;
 137  private:
 138   // Contains the set of approved protection domains that can access
 139   // this system dictionary entry.
 140   //
 141   // This protection domain set is a set of tuples:


 148   // If such an entry (C, ICL, PD) exists in the table, it means that
 149   // it is okay for a class Foo to reference C, where
 150   //
 151   //    Foo.protection_domain() == PD, and
 152   //    Foo's defining class loader == ICL
 153   //
 154   // The usage of the PD set can be seen in SystemDictionary::validate_protection_domain()
 155   // It is essentially a cache to avoid repeated Java up-calls to
 156   // ClassLoader.checkPackageAccess().
 157   //
 158   ProtectionDomainEntry* _pd_set;
 159   ClassLoaderData*       _loader_data;
 160 
 161  public:
 162   // Tells whether a protection is in the approved set.
 163   bool contains_protection_domain(oop protection_domain) const;
 164   // Adds a protection domain to the approved set.
 165   void add_protection_domain(Dictionary* dict, Handle protection_domain);
 166 
 167   InstanceKlass* klass() const { return (InstanceKlass*)literal(); }
 168   InstanceKlass** klass_addr() { return (InstanceKlass**)literal_addr(); }
 169 
 170   DictionaryEntry* next() const {
 171     return (DictionaryEntry*)HashtableEntry<InstanceKlass*, mtClass>::next();
 172   }
 173 
 174   DictionaryEntry** next_addr() {
 175     return (DictionaryEntry**)HashtableEntry<InstanceKlass*, mtClass>::next_addr();
 176   }
 177 
 178   ClassLoaderData* loader_data() const { return _loader_data; }
 179   void set_loader_data(ClassLoaderData* loader_data) { _loader_data = loader_data; }
 180 
 181   ProtectionDomainEntry* pd_set() const { return _pd_set; }
 182   void set_pd_set(ProtectionDomainEntry* pd_set) { _pd_set = pd_set; }
 183 
 184   // Tells whether the initiating class' protection can access the this _klass
 185   bool is_valid_protection_domain(Handle protection_domain) {
 186     if (!ProtectionDomainVerification) return true;
 187     if (!SystemDictionary::has_checkPackageAccess()) return true;
 188 


< prev index next >