< prev index next >

src/hotspot/share/oops/constantPool.cpp

Print this page




 454   CPKlassSlot kslot = this_cp->klass_slot_at(which);
 455   int resolved_klass_index = kslot.resolved_klass_index();
 456   int name_index = kslot.name_index();
 457   assert(this_cp->tag_at(name_index).is_symbol(), "sanity");
 458 
 459   Klass* klass = this_cp->resolved_klasses()->at(resolved_klass_index);
 460   if (klass != NULL) {
 461     return klass;
 462   }
 463 
 464   // This tag doesn't change back to unresolved class unless at a safepoint.
 465   if (this_cp->tag_at(which).is_unresolved_klass_in_error()) {
 466     // The original attempt to resolve this constant pool entry failed so find the
 467     // class of the original error and throw another error of the same class
 468     // (JVMS 5.4.3).
 469     // If there is a detail message, pass that detail message to the error.
 470     // The JVMS does not strictly require us to duplicate the same detail message,
 471     // or any internal exception fields such as cause or stacktrace.  But since the
 472     // detail message is often a class name or other literal string, we will repeat it
 473     // if we can find it in the symbol table.
 474     throw_resolution_error(this_cp, which, CHECK_0);
 475     ShouldNotReachHere();
 476   }
 477 
 478   Handle mirror_handle;
 479   Symbol* name = this_cp->symbol_at(name_index);
 480   Handle loader (THREAD, this_cp->pool_holder()->class_loader());
 481   Handle protection_domain (THREAD, this_cp->pool_holder()->protection_domain());
 482   Klass* k = SystemDictionary::resolve_or_fail(name, loader, protection_domain, true, THREAD);
 483   if (!HAS_PENDING_EXCEPTION) {
 484     // preserve the resolved klass from unloading
 485     mirror_handle = Handle(THREAD, k->java_mirror());
 486     // Do access check for klasses
 487     verify_constant_pool_resolve(this_cp, k, THREAD);
 488   }
 489 
 490   // Failed to resolve class. We must record the errors so that subsequent attempts
 491   // to resolve this constant pool entry fail with the same error (JVMS 5.4.3).
 492   if (HAS_PENDING_EXCEPTION) {
 493     if (save_resolution_error) {
 494       save_and_throw_exception(this_cp, which, constantTag(JVM_CONSTANT_UnresolvedClass), CHECK_NULL);




 454   CPKlassSlot kslot = this_cp->klass_slot_at(which);
 455   int resolved_klass_index = kslot.resolved_klass_index();
 456   int name_index = kslot.name_index();
 457   assert(this_cp->tag_at(name_index).is_symbol(), "sanity");
 458 
 459   Klass* klass = this_cp->resolved_klasses()->at(resolved_klass_index);
 460   if (klass != NULL) {
 461     return klass;
 462   }
 463 
 464   // This tag doesn't change back to unresolved class unless at a safepoint.
 465   if (this_cp->tag_at(which).is_unresolved_klass_in_error()) {
 466     // The original attempt to resolve this constant pool entry failed so find the
 467     // class of the original error and throw another error of the same class
 468     // (JVMS 5.4.3).
 469     // If there is a detail message, pass that detail message to the error.
 470     // The JVMS does not strictly require us to duplicate the same detail message,
 471     // or any internal exception fields such as cause or stacktrace.  But since the
 472     // detail message is often a class name or other literal string, we will repeat it
 473     // if we can find it in the symbol table.
 474     throw_resolution_error(this_cp, which, CHECK_NULL);
 475     ShouldNotReachHere();
 476   }
 477 
 478   Handle mirror_handle;
 479   Symbol* name = this_cp->symbol_at(name_index);
 480   Handle loader (THREAD, this_cp->pool_holder()->class_loader());
 481   Handle protection_domain (THREAD, this_cp->pool_holder()->protection_domain());
 482   Klass* k = SystemDictionary::resolve_or_fail(name, loader, protection_domain, true, THREAD);
 483   if (!HAS_PENDING_EXCEPTION) {
 484     // preserve the resolved klass from unloading
 485     mirror_handle = Handle(THREAD, k->java_mirror());
 486     // Do access check for klasses
 487     verify_constant_pool_resolve(this_cp, k, THREAD);
 488   }
 489 
 490   // Failed to resolve class. We must record the errors so that subsequent attempts
 491   // to resolve this constant pool entry fail with the same error (JVMS 5.4.3).
 492   if (HAS_PENDING_EXCEPTION) {
 493     if (save_resolution_error) {
 494       save_and_throw_exception(this_cp, which, constantTag(JVM_CONSTANT_UnresolvedClass), CHECK_NULL);


< prev index next >