src/hotspot/share/classfile/classLoaderData.hpp
branchstuefe-new-metaspace-branch
changeset 58063 bdf136b8ae0e
parent 58005 9ee010450e84
child 59272 54750b448264
equal deleted inserted replaced
58062:65cad575ace3 58063:bdf136b8ae0e
    25 #ifndef SHARE_CLASSFILE_CLASSLOADERDATA_HPP
    25 #ifndef SHARE_CLASSFILE_CLASSLOADERDATA_HPP
    26 #define SHARE_CLASSFILE_CLASSLOADERDATA_HPP
    26 #define SHARE_CLASSFILE_CLASSLOADERDATA_HPP
    27 
    27 
    28 #include "memory/allocation.hpp"
    28 #include "memory/allocation.hpp"
    29 #include "memory/memRegion.hpp"
    29 #include "memory/memRegion.hpp"
    30 #include "memory/metaspace.hpp"
       
    31 #include "oops/oopHandle.hpp"
    30 #include "oops/oopHandle.hpp"
    32 #include "oops/weakHandle.hpp"
    31 #include "oops/weakHandle.hpp"
    33 #include "runtime/atomic.hpp"
    32 #include "runtime/atomic.hpp"
    34 #include "runtime/mutex.hpp"
    33 #include "runtime/mutex.hpp"
    35 #include "utilities/growableArray.hpp"
    34 #include "utilities/growableArray.hpp"
    61 class ModuleEntryTable;
    60 class ModuleEntryTable;
    62 class PackageEntryTable;
    61 class PackageEntryTable;
    63 class DictionaryEntry;
    62 class DictionaryEntry;
    64 class Dictionary;
    63 class Dictionary;
    65 
    64 
       
    65 namespace metaspace {
       
    66   class ClassLoaderMetaspace;
       
    67 }
       
    68 
    66 // ClassLoaderData class
    69 // ClassLoaderData class
    67 
    70 
    68 class ClassLoaderData : public CHeapObj<mtClass> {
    71 class ClassLoaderData : public CHeapObj<mtClass> {
    69   friend class VMStructs;
    72   friend class VMStructs;
    70 
    73 
   111 
   114 
   112   WeakHandle<vm_class_loader_data> _holder; // The oop that determines lifetime of this class loader
   115   WeakHandle<vm_class_loader_data> _holder; // The oop that determines lifetime of this class loader
   113   OopHandle _class_loader;    // The instance of java/lang/ClassLoader associated with
   116   OopHandle _class_loader;    // The instance of java/lang/ClassLoader associated with
   114                               // this ClassLoaderData
   117                               // this ClassLoaderData
   115 
   118 
   116   ClassLoaderMetaspace * volatile _metaspace;  // Meta-space where meta-data defined by the
   119   metaspace::ClassLoaderMetaspace* volatile _metaspace;  // Meta-space where meta-data defined by the
   117                                     // classes in the class loader are allocated.
   120                                     // classes in the class loader are allocated.
   118   Mutex* _metaspace_lock;  // Locks the metaspace for allocations and setup.
   121   Mutex* _metaspace_lock;  // Locks the metaspace for allocations and setup.
   119   bool _unloading;         // true if this class loader goes away
   122   bool _unloading;         // true if this class loader goes away
   120   bool _is_unsafe_anonymous; // CLD is dedicated to one class and that class determines the CLDs lifecycle.
   123   bool _is_unsafe_anonymous; // CLD is dedicated to one class and that class determines the CLDs lifecycle.
   121                              // For example, an unsafe anonymous class.
   124                              // For example, an unsafe anonymous class.
   221   // Computes if the CLD is alive or not. This is safe to call in concurrent
   224   // Computes if the CLD is alive or not. This is safe to call in concurrent
   222   // contexts.
   225   // contexts.
   223   bool is_alive() const;
   226   bool is_alive() const;
   224 
   227 
   225   // Accessors
   228   // Accessors
   226   ClassLoaderMetaspace* metaspace_or_null() const { return _metaspace; }
   229   metaspace::ClassLoaderMetaspace* metaspace_or_null() const { return _metaspace; }
   227 
   230 
   228   static ClassLoaderData* the_null_class_loader_data() {
   231   static ClassLoaderData* the_null_class_loader_data() {
   229     return _the_null_class_loader_data;
   232     return _the_null_class_loader_data;
   230   }
   233   }
   231 
   234 
   254   bool is_builtin_class_loader_data() const;
   257   bool is_builtin_class_loader_data() const;
   255   bool is_permanent_class_loader_data() const;
   258   bool is_permanent_class_loader_data() const;
   256 
   259 
   257   // The Metaspace is created lazily so may be NULL.  This
   260   // The Metaspace is created lazily so may be NULL.  This
   258   // method will allocate a Metaspace if needed.
   261   // method will allocate a Metaspace if needed.
   259   ClassLoaderMetaspace* metaspace_non_null();
   262   metaspace::ClassLoaderMetaspace* metaspace_non_null();
   260 
   263 
   261   inline oop class_loader() const;
   264   inline oop class_loader() const;
   262 
   265 
   263   // Returns true if this class loader data is for a loader going away.
   266   // Returns true if this class loader data is for a loader going away.
   264   // Note that this is only safe after the GC has computed if the CLD is
   267   // Note that this is only safe after the GC has computed if the CLD is