< prev index next >

src/share/vm/classfile/protectionDomainCache.hpp

Print this page




  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_CLASSFILE_PROTECTIONDOMAINCACHE_HPP
  26 #define SHARE_VM_CLASSFILE_PROTECTIONDOMAINCACHE_HPP
  27 
  28 #include "oops/oop.hpp"
  29 #include "memory/iterator.hpp"
  30 #include "utilities/hashtable.hpp"
  31 
  32 // This class caches the approved protection domains that can access loaded classes.
  33 // Dictionary entry pd_set point to entries in this hashtable.   Please refer
  34 // to dictionary.hpp pd_set for more information about how protection domain entries
  35 // are used.
  36 // This table is walked during GC, rather than the entire system dictionary
  37 class ProtectionDomainCacheEntry : public HashtableEntry<oop, mtClass> {
  38   friend class VMStructs;
  39  public:
  40   oop protection_domain() { return literal(); }
  41 
  42   ProtectionDomainCacheEntry* next() {
  43     return (ProtectionDomainCacheEntry*)HashtableEntry<oop, mtClass>::next();
  44   }
  45 
  46   ProtectionDomainCacheEntry** next_addr() {
  47     return (ProtectionDomainCacheEntry**)HashtableEntry<oop, mtClass>::next_addr();
  48   }
  49 
  50   void oops_do(OopClosure* f) {
  51     f->do_oop(literal_addr());
  52   }
  53 
  54   void print() PRODUCT_RETURN;
  55   void verify();
  56 };
  57 
  58 // The ProtectionDomainCacheTable contains all protection domain oops. The system
  59 // dictionary entries reference its entries instead of having references to oops
  60 // directly.
  61 // This is used to speed up system dictionary iteration: the oops in the
  62 // protection domain are the only ones referring the Java heap. So when there is
  63 // need to update these, instead of going over every entry of the system dictionary,
  64 // we only need to iterate over this set.
  65 // The amount of different protection domains used is typically magnitudes smaller
  66 // than the number of system dictionary entries (loaded classes).
  67 class ProtectionDomainCacheTable : public Hashtable<oop, mtClass> {
  68   friend class VMStructs;
  69 private:
  70   ProtectionDomainCacheEntry* bucket(int i) {
  71     return (ProtectionDomainCacheEntry*) Hashtable<oop, mtClass>::bucket(i);
  72   }
  73 
  74   // The following method is not MT-safe and must be done under lock.
  75   ProtectionDomainCacheEntry** bucket_addr(int i) {
  76     return (ProtectionDomainCacheEntry**) Hashtable<oop, mtClass>::bucket_addr(i);
  77   }
  78 




  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_CLASSFILE_PROTECTIONDOMAINCACHE_HPP
  26 #define SHARE_VM_CLASSFILE_PROTECTIONDOMAINCACHE_HPP
  27 
  28 #include "oops/oop.hpp"
  29 #include "memory/iterator.hpp"
  30 #include "utilities/hashtable.hpp"
  31 
  32 // This class caches the approved protection domains that can access loaded classes.
  33 // Dictionary entry pd_set point to entries in this hashtable.   Please refer
  34 // to dictionary.hpp pd_set for more information about how protection domain entries
  35 // are used.
  36 // This table is walked during GC, rather than the class loader data graph dictionaries.
  37 class ProtectionDomainCacheEntry : public HashtableEntry<oop, mtClass> {
  38   friend class VMStructs;
  39  public:
  40   oop protection_domain() { return literal(); }
  41 
  42   ProtectionDomainCacheEntry* next() {
  43     return (ProtectionDomainCacheEntry*)HashtableEntry<oop, mtClass>::next();
  44   }
  45 
  46   ProtectionDomainCacheEntry** next_addr() {
  47     return (ProtectionDomainCacheEntry**)HashtableEntry<oop, mtClass>::next_addr();
  48   }
  49 
  50   void oops_do(OopClosure* f) {
  51     f->do_oop(literal_addr());
  52   }
  53 
  54   void print() PRODUCT_RETURN;
  55   void verify();
  56 };
  57 
  58 // The ProtectionDomainCacheTable contains all protection domain oops. The
  59 // dictionary entries reference its entries instead of having references to oops
  60 // directly.
  61 // This is used to speed up system dictionary iteration: the oops in the
  62 // protection domain are the only ones referring the Java heap. So when there is
  63 // need to update these, instead of going over every entry of the system dictionary,
  64 // we only need to iterate over this set.
  65 // The amount of different protection domains used is typically magnitudes smaller
  66 // than the number of system dictionary entries (loaded classes).
  67 class ProtectionDomainCacheTable : public Hashtable<oop, mtClass> {
  68   friend class VMStructs;
  69 private:
  70   ProtectionDomainCacheEntry* bucket(int i) {
  71     return (ProtectionDomainCacheEntry*) Hashtable<oop, mtClass>::bucket(i);
  72   }
  73 
  74   // The following method is not MT-safe and must be done under lock.
  75   ProtectionDomainCacheEntry** bucket_addr(int i) {
  76     return (ProtectionDomainCacheEntry**) Hashtable<oop, mtClass>::bucket_addr(i);
  77   }
  78 


< prev index next >