< prev index next >

src/hotspot/share/oops/klass.cpp

Print this page




 393     } else if (log) {
 394       if (log_is_enabled(Trace, class, unload)) {
 395         ResourceMark rm;
 396         log_trace(class, unload)("unlinking class (sibling): %s", chain->external_name());
 397       }
 398     }
 399   }
 400   return NULL;
 401 }
 402 
 403 void Klass::set_subklass(Klass* s) {
 404   assert(s != this, "sanity check");
 405   Atomic::release_store(&_subklass, s);
 406 }
 407 
 408 void Klass::set_next_sibling(Klass* s) {
 409   assert(s != this, "sanity check");
 410   // Does not need release semantics. If used by cleanup, it will link to
 411   // already safely published data, and if used by inserts, will be published
 412   // safely using cmpxchg.
 413   Atomic::store(s, &_next_sibling);
 414 }
 415 
 416 void Klass::append_to_sibling_list() {
 417   assert_locked_or_safepoint(Compile_lock);
 418   debug_only(verify();)
 419   // add ourselves to superklass' subklass list
 420   InstanceKlass* super = superklass();
 421   if (super == NULL) return;        // special case: class Object
 422   assert((!super->is_interface()    // interfaces cannot be supers
 423           && (super->superklass() == NULL || !is_interface())),
 424          "an interface can only be a subklass of Object");
 425 
 426   // Make sure there is no stale subklass head
 427   super->clean_subklass();
 428 
 429   for (;;) {
 430     Klass* prev_first_subklass = Atomic::load_acquire(&_super->_subklass);
 431     if (prev_first_subklass != NULL) {
 432       // set our sibling to be the superklass' previous first subklass
 433       assert(prev_first_subklass->is_loader_alive(), "May not attach not alive klasses");




 393     } else if (log) {
 394       if (log_is_enabled(Trace, class, unload)) {
 395         ResourceMark rm;
 396         log_trace(class, unload)("unlinking class (sibling): %s", chain->external_name());
 397       }
 398     }
 399   }
 400   return NULL;
 401 }
 402 
 403 void Klass::set_subklass(Klass* s) {
 404   assert(s != this, "sanity check");
 405   Atomic::release_store(&_subklass, s);
 406 }
 407 
 408 void Klass::set_next_sibling(Klass* s) {
 409   assert(s != this, "sanity check");
 410   // Does not need release semantics. If used by cleanup, it will link to
 411   // already safely published data, and if used by inserts, will be published
 412   // safely using cmpxchg.
 413   Atomic::store(&_next_sibling, s);
 414 }
 415 
 416 void Klass::append_to_sibling_list() {
 417   assert_locked_or_safepoint(Compile_lock);
 418   debug_only(verify();)
 419   // add ourselves to superklass' subklass list
 420   InstanceKlass* super = superklass();
 421   if (super == NULL) return;        // special case: class Object
 422   assert((!super->is_interface()    // interfaces cannot be supers
 423           && (super->superklass() == NULL || !is_interface())),
 424          "an interface can only be a subklass of Object");
 425 
 426   // Make sure there is no stale subklass head
 427   super->clean_subklass();
 428 
 429   for (;;) {
 430     Klass* prev_first_subklass = Atomic::load_acquire(&_super->_subklass);
 431     if (prev_first_subklass != NULL) {
 432       // set our sibling to be the superklass' previous first subklass
 433       assert(prev_first_subklass->is_loader_alive(), "May not attach not alive klasses");


< prev index next >