< prev index next >

src/share/vm/classfile/classLoaderData.hpp

Print this page




  70   friend class VMStructs;
  71  private:
  72   // All CLDs (except the null CLD) can be reached by walking _head->_next->...
  73   static ClassLoaderData* _head;
  74   static ClassLoaderData* _unloading;
  75   // CMS support.
  76   static ClassLoaderData* _saved_head;
  77   static ClassLoaderData* _saved_unloading;
  78   static bool _should_purge;
  79   // OOM has been seen in metaspace allocation. Used to prevent some
  80   // allocations until class unloading
  81   static bool _metaspace_oom;
  82 
  83   static ClassLoaderData* add(Handle class_loader, bool anonymous, TRAPS);
  84   static void post_class_unload_events();
  85  public:
  86   static ClassLoaderData* find_or_create(Handle class_loader, TRAPS);
  87   static void purge();
  88   static void clear_claimed_marks();
  89   // oops do
  90   static void oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim);
  91   static void keep_alive_oops_do(OopClosure* blk, KlassClosure* klass_closure, bool must_claim);
  92   static void always_strong_oops_do(OopClosure* blk, KlassClosure* klass_closure, bool must_claim);
  93   // cld do
  94   static void cld_do(CLDClosure* cl);
  95   static void cld_unloading_do(CLDClosure* cl);
  96   static void roots_cld_do(CLDClosure* strong, CLDClosure* weak);
  97   static void keep_alive_cld_do(CLDClosure* cl);
  98   static void always_strong_cld_do(CLDClosure* cl);
  99   // klass do
 100   // Walking classes through the ClassLoaderDataGraph include array classes.  It also includes
 101   // classes that are allocated but not loaded, classes that have errors, and scratch classes
 102   // for redefinition.  These classes are removed during the next class unloading.
 103   // Walking the ClassLoaderDataGraph also includes anonymous classes.
 104   static void classes_do(KlassClosure* klass_closure);
 105   static void classes_do(void f(Klass* const));
 106   static void methods_do(void f(Method*));
 107   static void modules_do(void f(ModuleEntry*));
 108   static void modules_unloading_do(void f(ModuleEntry*));
 109   static void packages_do(void f(PackageEntry*));
 110   static void packages_unloading_do(void f(PackageEntry*));
 111   static void loaded_classes_do(KlassClosure* klass_closure);
 112   static void classes_unloading_do(void f(Klass* const));


 330 
 331   oop class_loader() const      { return _class_loader; }
 332 
 333   // The object the GC is using to keep this ClassLoaderData alive.
 334   oop keep_alive_object() const;
 335 
 336   // Returns true if this class loader data is for a loader going away.
 337   bool is_unloading() const     {
 338     assert(!(is_the_null_class_loader_data() && _unloading), "The null class loader can never be unloaded");
 339     return _unloading;
 340   }
 341 
 342   // Used to refcount an anonymous class's CLD in order to
 343   // indicate their aliveness without a keep_alive_object().
 344   void inc_keep_alive();
 345   void dec_keep_alive();
 346 
 347   inline unsigned int identity_hash() const { return (unsigned int)(((intptr_t)this) >> 3); }
 348 
 349   // Used when tracing from klasses.
 350   void oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim);
 351 
 352   void classes_do(KlassClosure* klass_closure);
 353   Klass* klasses() { return _klasses; }
 354 
 355   JNIMethodBlock* jmethod_ids() const              { return _jmethod_ids; }
 356   void set_jmethod_ids(JNIMethodBlock* new_block)  { _jmethod_ids = new_block; }
 357 
 358   void print()                                     { print_on(tty); }
 359   void print_on(outputStream* out) const;
 360   void print_value()                               { print_value_on(tty); }
 361   void print_value_on(outputStream* out) const;
 362   void dump(outputStream * const out) PRODUCT_RETURN;
 363   void verify();
 364   const char* loader_name();
 365 
 366   OopHandle add_handle(Handle h);
 367   void remove_handle(OopHandle h);
 368   void init_handle_locked(OopHandle& pd, Handle h);  // used for concurrent access to ModuleEntry::_pd field
 369   void add_class(Klass* k, bool publicize = true);
 370   void remove_class(Klass* k);




  70   friend class VMStructs;
  71  private:
  72   // All CLDs (except the null CLD) can be reached by walking _head->_next->...
  73   static ClassLoaderData* _head;
  74   static ClassLoaderData* _unloading;
  75   // CMS support.
  76   static ClassLoaderData* _saved_head;
  77   static ClassLoaderData* _saved_unloading;
  78   static bool _should_purge;
  79   // OOM has been seen in metaspace allocation. Used to prevent some
  80   // allocations until class unloading
  81   static bool _metaspace_oom;
  82 
  83   static ClassLoaderData* add(Handle class_loader, bool anonymous, TRAPS);
  84   static void post_class_unload_events();
  85  public:
  86   static ClassLoaderData* find_or_create(Handle class_loader, TRAPS);
  87   static void purge();
  88   static void clear_claimed_marks();
  89   // oops do
  90   static void oops_do(OopClosure* f, bool must_claim);
  91   static void keep_alive_oops_do(OopClosure* blk, bool must_claim);
  92   static void always_strong_oops_do(OopClosure* blk, bool must_claim);
  93   // cld do
  94   static void cld_do(CLDClosure* cl);
  95   static void cld_unloading_do(CLDClosure* cl);
  96   static void roots_cld_do(CLDClosure* strong, CLDClosure* weak);
  97   static void keep_alive_cld_do(CLDClosure* cl);
  98   static void always_strong_cld_do(CLDClosure* cl);
  99   // klass do
 100   // Walking classes through the ClassLoaderDataGraph include array classes.  It also includes
 101   // classes that are allocated but not loaded, classes that have errors, and scratch classes
 102   // for redefinition.  These classes are removed during the next class unloading.
 103   // Walking the ClassLoaderDataGraph also includes anonymous classes.
 104   static void classes_do(KlassClosure* klass_closure);
 105   static void classes_do(void f(Klass* const));
 106   static void methods_do(void f(Method*));
 107   static void modules_do(void f(ModuleEntry*));
 108   static void modules_unloading_do(void f(ModuleEntry*));
 109   static void packages_do(void f(PackageEntry*));
 110   static void packages_unloading_do(void f(PackageEntry*));
 111   static void loaded_classes_do(KlassClosure* klass_closure);
 112   static void classes_unloading_do(void f(Klass* const));


 330 
 331   oop class_loader() const      { return _class_loader; }
 332 
 333   // The object the GC is using to keep this ClassLoaderData alive.
 334   oop keep_alive_object() const;
 335 
 336   // Returns true if this class loader data is for a loader going away.
 337   bool is_unloading() const     {
 338     assert(!(is_the_null_class_loader_data() && _unloading), "The null class loader can never be unloaded");
 339     return _unloading;
 340   }
 341 
 342   // Used to refcount an anonymous class's CLD in order to
 343   // indicate their aliveness without a keep_alive_object().
 344   void inc_keep_alive();
 345   void dec_keep_alive();
 346 
 347   inline unsigned int identity_hash() const { return (unsigned int)(((intptr_t)this) >> 3); }
 348 
 349   // Used when tracing from klasses.
 350   void oops_do(OopClosure* f, bool must_claim);
 351 
 352   void classes_do(KlassClosure* klass_closure);
 353   Klass* klasses() { return _klasses; }
 354 
 355   JNIMethodBlock* jmethod_ids() const              { return _jmethod_ids; }
 356   void set_jmethod_ids(JNIMethodBlock* new_block)  { _jmethod_ids = new_block; }
 357 
 358   void print()                                     { print_on(tty); }
 359   void print_on(outputStream* out) const;
 360   void print_value()                               { print_value_on(tty); }
 361   void print_value_on(outputStream* out) const;
 362   void dump(outputStream * const out) PRODUCT_RETURN;
 363   void verify();
 364   const char* loader_name();
 365 
 366   OopHandle add_handle(Handle h);
 367   void remove_handle(OopHandle h);
 368   void init_handle_locked(OopHandle& pd, Handle h);  // used for concurrent access to ModuleEntry::_pd field
 369   void add_class(Klass* k, bool publicize = true);
 370   void remove_class(Klass* k);


< prev index next >