< prev index next >

src/hotspot/share/classfile/classLoaderData.hpp

Print this page




  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  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_CLASSFILE_CLASSLOADERDATA_HPP
  26 #define SHARE_CLASSFILE_CLASSLOADERDATA_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "memory/memRegion.hpp"
  30 #include "memory/metaspace.hpp"
  31 #include "oops/oopHandle.hpp"
  32 #include "oops/weakHandle.hpp"
  33 #include "runtime/atomic.hpp"
  34 #include "runtime/mutex.hpp"
  35 #include "utilities/growableArray.hpp"
  36 #include "utilities/macros.hpp"
  37 #if INCLUDE_JFR
  38 #include "jfr/support/jfrTraceIdExtension.hpp"
  39 #endif
  40 
  41 // external name (synthetic) for the primordial "bootstrap" class loader instance
  42 #define BOOTSTRAP_LOADER_NAME "bootstrap"
  43 #define BOOTSTRAP_LOADER_NAME_LEN 9
  44 
  45 //
  46 // A class loader represents a linkset. Conceptually, a linkset identifies
  47 // the complete transitive closure of resolved links that a dynamic linker can
  48 // produce.
  49 //
  50 // A ClassLoaderData also encapsulates the allocation space, called a metaspace,
  51 // used by the dynamic linker to allocate the runtime representation of all
  52 // the types it defines.
  53 //


 143   Dictionary*  _dictionary;              // The loaded InstanceKlasses, including initiated by this class loader
 144 
 145   // These method IDs are created for the class loader and set to NULL when the
 146   // class loader is unloaded.  They are rarely freed, only for redefine classes
 147   // and if they lose a data race in InstanceKlass.
 148   JNIMethodBlock*                  _jmethod_ids;
 149 
 150   // Metadata to be deallocated when it's safe at class unloading, when
 151   // this class loader isn't unloaded itself.
 152   GrowableArray<Metadata*>*      _deallocate_list;
 153 
 154   // Support for walking class loader data objects
 155   ClassLoaderData* _next; /// Next loader_datas created
 156 
 157   Klass*  _class_loader_klass;
 158   Symbol* _name;
 159   Symbol* _name_and_id;
 160   JFR_ONLY(DEFINE_TRACE_ID_FIELD;)
 161 
 162   void set_next(ClassLoaderData* next) { _next = next; }
 163   ClassLoaderData* next() const        { return Atomic::load(&_next); }
 164 
 165   ClassLoaderData(Handle h_class_loader, bool is_unsafe_anonymous);
 166   ~ClassLoaderData();
 167 
 168   // The CLD are not placed in the Heap, so the Card Table or
 169   // the Mod Union Table can't be used to mark when CLD have modified oops.
 170   // The CT and MUT bits saves this information for the whole class loader data.
 171   void clear_modified_oops()             { _modified_oops = false; }
 172  public:
 173   void record_modified_oops()            { _modified_oops = true; }
 174   bool has_modified_oops()               { return _modified_oops; }
 175 
 176   void accumulate_modified_oops()        { if (has_modified_oops()) _accumulated_modified_oops = true; }
 177   void clear_accumulated_modified_oops() { _accumulated_modified_oops = false; }
 178   bool has_accumulated_modified_oops()   { return _accumulated_modified_oops; }
 179   oop holder_no_keepalive() const;
 180   oop holder_phantom() const;
 181 
 182  private:
 183   void unload();




  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  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_CLASSFILE_CLASSLOADERDATA_HPP
  26 #define SHARE_CLASSFILE_CLASSLOADERDATA_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "memory/memRegion.hpp"
  30 #include "memory/metaspace.hpp"
  31 #include "oops/oopHandle.hpp"
  32 #include "oops/weakHandle.hpp"

  33 #include "runtime/mutex.hpp"
  34 #include "utilities/growableArray.hpp"
  35 #include "utilities/macros.hpp"
  36 #if INCLUDE_JFR
  37 #include "jfr/support/jfrTraceIdExtension.hpp"
  38 #endif
  39 
  40 // external name (synthetic) for the primordial "bootstrap" class loader instance
  41 #define BOOTSTRAP_LOADER_NAME "bootstrap"
  42 #define BOOTSTRAP_LOADER_NAME_LEN 9
  43 
  44 //
  45 // A class loader represents a linkset. Conceptually, a linkset identifies
  46 // the complete transitive closure of resolved links that a dynamic linker can
  47 // produce.
  48 //
  49 // A ClassLoaderData also encapsulates the allocation space, called a metaspace,
  50 // used by the dynamic linker to allocate the runtime representation of all
  51 // the types it defines.
  52 //


 142   Dictionary*  _dictionary;              // The loaded InstanceKlasses, including initiated by this class loader
 143 
 144   // These method IDs are created for the class loader and set to NULL when the
 145   // class loader is unloaded.  They are rarely freed, only for redefine classes
 146   // and if they lose a data race in InstanceKlass.
 147   JNIMethodBlock*                  _jmethod_ids;
 148 
 149   // Metadata to be deallocated when it's safe at class unloading, when
 150   // this class loader isn't unloaded itself.
 151   GrowableArray<Metadata*>*      _deallocate_list;
 152 
 153   // Support for walking class loader data objects
 154   ClassLoaderData* _next; /// Next loader_datas created
 155 
 156   Klass*  _class_loader_klass;
 157   Symbol* _name;
 158   Symbol* _name_and_id;
 159   JFR_ONLY(DEFINE_TRACE_ID_FIELD;)
 160 
 161   void set_next(ClassLoaderData* next) { _next = next; }
 162   ClassLoaderData* next() const        { return _next; }
 163 
 164   ClassLoaderData(Handle h_class_loader, bool is_unsafe_anonymous);
 165   ~ClassLoaderData();
 166 
 167   // The CLD are not placed in the Heap, so the Card Table or
 168   // the Mod Union Table can't be used to mark when CLD have modified oops.
 169   // The CT and MUT bits saves this information for the whole class loader data.
 170   void clear_modified_oops()             { _modified_oops = false; }
 171  public:
 172   void record_modified_oops()            { _modified_oops = true; }
 173   bool has_modified_oops()               { return _modified_oops; }
 174 
 175   void accumulate_modified_oops()        { if (has_modified_oops()) _accumulated_modified_oops = true; }
 176   void clear_accumulated_modified_oops() { _accumulated_modified_oops = false; }
 177   bool has_accumulated_modified_oops()   { return _accumulated_modified_oops; }
 178   oop holder_no_keepalive() const;
 179   oop holder_phantom() const;
 180 
 181  private:
 182   void unload();


< prev index next >