RFR (S) 8228485: JVM crashes when bootstrap method for condy triggers loading of class whose static initializer throws exception

coleen.phillimore at oracle.com coleen.phillimore at oracle.com
Tue Jul 23 15:14:40 UTC 2019



On 7/23/19 9:15 AM, David Holmes wrote:
> Hi Coleen,
>
> On 23/07/2019 9:59 pm, coleen.phillimore at oracle.com wrote:
>> Summary: Add case for JVM_CONSTANT_Dynamic in error_message function.
>
> Fix seems reasonable. Begs the question as to whether there are other 
> missing cases for this code?

No, there are not currently.  Only these constant pool tags use 
save_and_throw_exception, in order to throw the same exception for each 
time the cp entry is resolved with an error:

jbyte constantTag::error_value() const {
   switch (_tag) {
   case JVM_CONSTANT_UnresolvedClass:
     return JVM_CONSTANT_UnresolvedClassInError;
   case JVM_CONSTANT_MethodHandle:
     return JVM_CONSTANT_MethodHandleInError;
   case JVM_CONSTANT_MethodType:
     return JVM_CONSTANT_MethodTypeInError;
   case JVM_CONSTANT_Dynamic:
     return JVM_CONSTANT_DynamicInError;
   default:
     ShouldNotReachHere();
     return JVM_CONSTANT_Invalid;
   }
}


>
> Can this manifest with regular Java sources? I'm unclear exactly how 
> this is being manifested in the jasm file.

The jasm file is to force initialization of the static class inside the 
Condy expression.  Otherwise it may be initialized outside and not hit 
the error.

thanks,
Coleen
>
> Thanks,
> David
>
>> Tested locally with hotspot and java/lang/invoke condy tests and new 
>> test which exercises the code.  This might be needed for jdk 13.
>>
>> open webrev at 
>> http://cr.openjdk.java.net/~coleenp/2019/8228485.01/webrev
>> bug link https://bugs.openjdk.java.net/browse/JDK-8228485
>>
>> Thanks,
>> Coleen



More information about the hotspot-runtime-dev mailing list