< prev index next >

src/share/vm/classfile/classLoaderData.cpp

Print this page




 125 // Due to the uniqueness that no other class shares the anonymous class' name or
 126 // ClassLoaderData, no other non-GC thread has knowledge of the anonymous class while
 127 // it is being defined, therefore _keep_alive is not volatile or atomic.
 128 void ClassLoaderData::inc_keep_alive() {
 129   assert(_keep_alive >= 0, "Invalid keep alive count");
 130   _keep_alive++;
 131 }
 132 
 133 void ClassLoaderData::dec_keep_alive() {
 134   assert(_keep_alive > 0, "Invalid keep alive count");
 135   _keep_alive--;
 136 }
 137 
 138 void ClassLoaderData::oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim) {
 139   if (must_claim && !claim()) {
 140     return;
 141   }
 142 
 143   f->do_oop(&_class_loader);
 144   _dependencies.oops_do(f);

 145   _handles->oops_do(f);

 146   if (klass_closure != NULL) {
 147     classes_do(klass_closure);
 148   }
 149 }
 150 
 151 void ClassLoaderData::Dependencies::oops_do(OopClosure* f) {
 152   f->do_oop((oop*)&_list_head);
 153 }
 154 
 155 void ClassLoaderData::classes_do(KlassClosure* klass_closure) {
 156   // Lock-free access requires load_ptr_acquire
 157   for (Klass* k = load_ptr_acquire(&_klasses); k != NULL; k = k->next_link()) {
 158     klass_closure->do_klass(k);
 159     assert(k != k->next_link(), "no loops!");
 160   }
 161 }
 162 
 163 void ClassLoaderData::classes_do(void f(Klass * const)) {
 164   assert_locked_or_safepoint(_metaspace_lock);
 165   for (Klass* k = _klasses; k != NULL; k = k->next_link()) {




 125 // Due to the uniqueness that no other class shares the anonymous class' name or
 126 // ClassLoaderData, no other non-GC thread has knowledge of the anonymous class while
 127 // it is being defined, therefore _keep_alive is not volatile or atomic.
 128 void ClassLoaderData::inc_keep_alive() {
 129   assert(_keep_alive >= 0, "Invalid keep alive count");
 130   _keep_alive++;
 131 }
 132 
 133 void ClassLoaderData::dec_keep_alive() {
 134   assert(_keep_alive > 0, "Invalid keep alive count");
 135   _keep_alive--;
 136 }
 137 
 138 void ClassLoaderData::oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim) {
 139   if (must_claim && !claim()) {
 140     return;
 141   }
 142 
 143   f->do_oop(&_class_loader);
 144   _dependencies.oops_do(f);
 145   if (_handles != NULL) {
 146     _handles->oops_do(f);
 147   }
 148   if (klass_closure != NULL) {
 149     classes_do(klass_closure);
 150   }
 151 }
 152 
 153 void ClassLoaderData::Dependencies::oops_do(OopClosure* f) {
 154   f->do_oop((oop*)&_list_head);
 155 }
 156 
 157 void ClassLoaderData::classes_do(KlassClosure* klass_closure) {
 158   // Lock-free access requires load_ptr_acquire
 159   for (Klass* k = load_ptr_acquire(&_klasses); k != NULL; k = k->next_link()) {
 160     klass_closure->do_klass(k);
 161     assert(k != k->next_link(), "no loops!");
 162   }
 163 }
 164 
 165 void ClassLoaderData::classes_do(void f(Klass * const)) {
 166   assert_locked_or_safepoint(_metaspace_lock);
 167   for (Klass* k = _klasses; k != NULL; k = k->next_link()) {


< prev index next >