791 constantTag tag, TRAPS) { 792 Symbol* error = PENDING_EXCEPTION->klass()->name(); 793 794 int error_tag = tag.error_value(); 795 796 if (!PENDING_EXCEPTION-> 797 is_a(SystemDictionary::LinkageError_klass())) { 798 // Just throw the exception and don't prevent these classes from 799 // being loaded due to virtual machine errors like StackOverflow 800 // and OutOfMemoryError, etc, or if the thread was hit by stop() 801 // Needs clarification to section 5.4.3 of the VM spec (see 6308271) 802 } else if (this_cp->tag_at(which).value() != error_tag) { 803 Symbol* message = exception_message(this_cp, which, tag, PENDING_EXCEPTION); 804 SystemDictionary::add_resolution_error(this_cp, which, error, message); 805 // CAS in the tag. If a thread beat us to registering this error that's fine. 806 // If another thread resolved the reference, this is a race condition. This 807 // thread may have had a security manager or something temporary. 808 // This doesn't deterministically get an error. So why do we save this? 809 // We save this because jvmti can add classes to the bootclass path after 810 // this error, so it needs to get the same error if the error is first. 811 jbyte old_tag = Atomic::cmpxchg((jbyte)error_tag, 812 (jbyte*)this_cp->tag_addr_at(which), (jbyte)tag.value()); 813 if (old_tag != error_tag && old_tag != tag.value()) { 814 // MethodHandles and MethodType doesn't change to resolved version. 815 assert(this_cp->tag_at(which).is_klass(), "Wrong tag value"); 816 // Forget the exception and use the resolved class. 817 CLEAR_PENDING_EXCEPTION; 818 } 819 } else { 820 // some other thread put this in error state 821 throw_resolution_error(this_cp, which, CHECK); 822 } 823 } 824 825 constantTag ConstantPool::constant_tag_at(int which) { 826 constantTag tag = tag_at(which); 827 if (tag.is_dynamic_constant() || 828 tag.is_dynamic_constant_in_error()) { 829 BasicType bt = basic_type_for_constant_at(which); 830 // dynamic constant could return an array, treat as object 831 return constantTag::ofBasicType(is_reference_type(bt) ? T_OBJECT : bt); 832 } | 791 constantTag tag, TRAPS) { 792 Symbol* error = PENDING_EXCEPTION->klass()->name(); 793 794 int error_tag = tag.error_value(); 795 796 if (!PENDING_EXCEPTION-> 797 is_a(SystemDictionary::LinkageError_klass())) { 798 // Just throw the exception and don't prevent these classes from 799 // being loaded due to virtual machine errors like StackOverflow 800 // and OutOfMemoryError, etc, or if the thread was hit by stop() 801 // Needs clarification to section 5.4.3 of the VM spec (see 6308271) 802 } else if (this_cp->tag_at(which).value() != error_tag) { 803 Symbol* message = exception_message(this_cp, which, tag, PENDING_EXCEPTION); 804 SystemDictionary::add_resolution_error(this_cp, which, error, message); 805 // CAS in the tag. If a thread beat us to registering this error that's fine. 806 // If another thread resolved the reference, this is a race condition. This 807 // thread may have had a security manager or something temporary. 808 // This doesn't deterministically get an error. So why do we save this? 809 // We save this because jvmti can add classes to the bootclass path after 810 // this error, so it needs to get the same error if the error is first. 811 jbyte old_tag = Atomic::cmpxchg((jbyte*)this_cp->tag_addr_at(which), 812 (jbyte)tag.value(), 813 (jbyte)error_tag); 814 if (old_tag != error_tag && old_tag != tag.value()) { 815 // MethodHandles and MethodType doesn't change to resolved version. 816 assert(this_cp->tag_at(which).is_klass(), "Wrong tag value"); 817 // Forget the exception and use the resolved class. 818 CLEAR_PENDING_EXCEPTION; 819 } 820 } else { 821 // some other thread put this in error state 822 throw_resolution_error(this_cp, which, CHECK); 823 } 824 } 825 826 constantTag ConstantPool::constant_tag_at(int which) { 827 constantTag tag = tag_at(which); 828 if (tag.is_dynamic_constant() || 829 tag.is_dynamic_constant_in_error()) { 830 BasicType bt = basic_type_for_constant_at(which); 831 // dynamic constant could return an array, treat as object 832 return constantTag::ofBasicType(is_reference_type(bt) ? T_OBJECT : bt); 833 } |