hotspot/src/share/vm/classfile/classLoaderData.hpp
changeset 31046 d01ad7a0ecb0
parent 31038 2fd2fdc6a70a
child 34257 4be3504cc03b
equal deleted inserted replaced
31045:31769e6e8293 31046:d01ad7a0ecb0
    49 // system dictionary, are roots of garbage collection, and provides iterators
    49 // system dictionary, are roots of garbage collection, and provides iterators
    50 // for root tracing and other GC operations.
    50 // for root tracing and other GC operations.
    51 
    51 
    52 class ClassLoaderData;
    52 class ClassLoaderData;
    53 class JNIMethodBlock;
    53 class JNIMethodBlock;
       
    54 class JNIHandleBlock;
    54 class Metadebug;
    55 class Metadebug;
    55 
    56 
    56 // GC root for walking class loader data created
    57 // GC root for walking class loader data created
    57 
    58 
    58 class ClassLoaderDataGraph : public AllStatic {
    59 class ClassLoaderDataGraph : public AllStatic {
   170   volatile int _claimed;   // true if claimed, for example during GC traces.
   171   volatile int _claimed;   // true if claimed, for example during GC traces.
   171                            // To avoid applying oop closure more than once.
   172                            // To avoid applying oop closure more than once.
   172                            // Has to be an int because we cas it.
   173                            // Has to be an int because we cas it.
   173   Klass* _klasses;         // The classes defined by the class loader.
   174   Klass* _klasses;         // The classes defined by the class loader.
   174 
   175 
       
   176   JNIHandleBlock* _handles; // Handles to constant pool arrays
       
   177 
   175   // These method IDs are created for the class loader and set to NULL when the
   178   // These method IDs are created for the class loader and set to NULL when the
   176   // class loader is unloaded.  They are rarely freed, only for redefine classes
   179   // class loader is unloaded.  They are rarely freed, only for redefine classes
   177   // and if they lose a data race in InstanceKlass.
   180   // and if they lose a data race in InstanceKlass.
   178   JNIMethodBlock*                  _jmethod_ids;
   181   JNIMethodBlock*                  _jmethod_ids;
   179 
   182 
   194 
   197 
   195   ClassLoaderData(Handle h_class_loader, bool is_anonymous, Dependencies dependencies);
   198   ClassLoaderData(Handle h_class_loader, bool is_anonymous, Dependencies dependencies);
   196   ~ClassLoaderData();
   199   ~ClassLoaderData();
   197 
   200 
   198   void set_metaspace(Metaspace* m) { _metaspace = m; }
   201   void set_metaspace(Metaspace* m) { _metaspace = m; }
       
   202 
       
   203   JNIHandleBlock* handles() const;
       
   204   void set_handles(JNIHandleBlock* handles);
   199 
   205 
   200   // GC interface.
   206   // GC interface.
   201   void clear_claimed()          { _claimed = 0; }
   207   void clear_claimed()          { _claimed = 0; }
   202   bool claimed() const          { return _claimed == 1; }
   208   bool claimed() const          { return _claimed == 1; }
   203   bool claim();
   209   bool claim();
   282   void print_value_on(outputStream* out) const;
   288   void print_value_on(outputStream* out) const;
   283   void dump(outputStream * const out) PRODUCT_RETURN;
   289   void dump(outputStream * const out) PRODUCT_RETURN;
   284   void verify();
   290   void verify();
   285   const char* loader_name();
   291   const char* loader_name();
   286 
   292 
       
   293   jobject add_handle(Handle h);
   287   void add_class(Klass* k);
   294   void add_class(Klass* k);
   288   void remove_class(Klass* k);
   295   void remove_class(Klass* k);
   289   bool contains_klass(Klass* k);
   296   bool contains_klass(Klass* k);
   290   void record_dependency(Klass* to, TRAPS);
   297   void record_dependency(Klass* to, TRAPS);
   291   void init_dependencies(TRAPS);
   298   void init_dependencies(TRAPS);