< prev index next >

src/hotspot/share/oops/constantPool.cpp

Print this page




 476   }
 477 
 478   // Failed to resolve class. We must record the errors so that subsequent attempts
 479   // to resolve this constant pool entry fail with the same error (JVMS 5.4.3).
 480   if (HAS_PENDING_EXCEPTION) {
 481     if (save_resolution_error) {
 482       save_and_throw_exception(this_cp, which, constantTag(JVM_CONSTANT_UnresolvedClass), CHECK_NULL);
 483       // If CHECK_NULL above doesn't return the exception, that means that
 484       // some other thread has beaten us and has resolved the class.
 485       // To preserve old behavior, we return the resolved class.
 486       klass = this_cp->resolved_klasses()->at(resolved_klass_index);
 487       assert(klass != NULL, "must be resolved if exception was cleared");
 488       return klass;
 489     } else {
 490       return NULL;  // return the pending exception
 491     }
 492   }
 493 
 494   // Make this class loader depend upon the class loader owning the class reference
 495   ClassLoaderData* this_key = this_cp->pool_holder()->class_loader_data();
 496   this_key->record_dependency(k, CHECK_NULL); // Can throw OOM
 497 
 498   // logging for class+resolve.
 499   if (log_is_enabled(Debug, class, resolve)){
 500     trace_class_resolution(this_cp, k);
 501   }
 502   Klass** adr = this_cp->resolved_klasses()->adr_at(resolved_klass_index);
 503   OrderAccess::release_store(adr, k);
 504   // The interpreter assumes when the tag is stored, the klass is resolved
 505   // and the Klass* stored in _resolved_klasses is non-NULL, so we need
 506   // hardware store ordering here.
 507   this_cp->release_tag_at_put(which, JVM_CONSTANT_Class);
 508   return k;
 509 }
 510 
 511 
 512 // Does not update ConstantPool* - to avoid any exception throwing. Used
 513 // by compiler and exception handling.  Also used to avoid classloads for
 514 // instanceof operations. Returns NULL if the class has not been loaded or
 515 // if the verification of constant pool failed
 516 Klass* ConstantPool::klass_at_if_loaded(const constantPoolHandle& this_cp, int which) {




 476   }
 477 
 478   // Failed to resolve class. We must record the errors so that subsequent attempts
 479   // to resolve this constant pool entry fail with the same error (JVMS 5.4.3).
 480   if (HAS_PENDING_EXCEPTION) {
 481     if (save_resolution_error) {
 482       save_and_throw_exception(this_cp, which, constantTag(JVM_CONSTANT_UnresolvedClass), CHECK_NULL);
 483       // If CHECK_NULL above doesn't return the exception, that means that
 484       // some other thread has beaten us and has resolved the class.
 485       // To preserve old behavior, we return the resolved class.
 486       klass = this_cp->resolved_klasses()->at(resolved_klass_index);
 487       assert(klass != NULL, "must be resolved if exception was cleared");
 488       return klass;
 489     } else {
 490       return NULL;  // return the pending exception
 491     }
 492   }
 493 
 494   // Make this class loader depend upon the class loader owning the class reference
 495   ClassLoaderData* this_key = this_cp->pool_holder()->class_loader_data();
 496   this_key->record_dependency(k);
 497 
 498   // logging for class+resolve.
 499   if (log_is_enabled(Debug, class, resolve)){
 500     trace_class_resolution(this_cp, k);
 501   }
 502   Klass** adr = this_cp->resolved_klasses()->adr_at(resolved_klass_index);
 503   OrderAccess::release_store(adr, k);
 504   // The interpreter assumes when the tag is stored, the klass is resolved
 505   // and the Klass* stored in _resolved_klasses is non-NULL, so we need
 506   // hardware store ordering here.
 507   this_cp->release_tag_at_put(which, JVM_CONSTANT_Class);
 508   return k;
 509 }
 510 
 511 
 512 // Does not update ConstantPool* - to avoid any exception throwing. Used
 513 // by compiler and exception handling.  Also used to avoid classloads for
 514 // instanceof operations. Returns NULL if the class has not been loaded or
 515 // if the verification of constant pool failed
 516 Klass* ConstantPool::klass_at_if_loaded(const constantPoolHandle& this_cp, int which) {


< prev index next >