RFR: 8255493: Support for pre-generated java.lang.invoke classes in CDS dynamic archive [v11]

Ioi Lam iklam at openjdk.java.net
Fri Apr 30 03:46:58 UTC 2021


On Fri, 30 Apr 2021 02:57:02 GMT, Yumin Qi <minqi at openjdk.org> wrote:

>> src/hotspot/share/cds/lambdaFormInvokers.cpp line 84:
>> 
>>> 82: #define HANDLE_IF_HAS_EXCEPTION                                                                         \
>>> 83:   if (HAS_PENDING_EXCEPTION) {                                                                          \
>>> 84:     if (!PENDING_EXCEPTION->is_a(vmClasses::OutOfMemoryError_klass())) {                                \
>> 
>> I would suggest adding a comment and error message to explain why we ignore the error:
>> 
>> 
>> // We may get an exception if the classlist contains an error (or an outdated entry generated by
>> // an older JDK).
>> if (DumpSharedArchive) {
>>   log_error(cds)("Failed to generate LambdaForm holder classes. Is your classlist out of date?");
>> } else {
>>   log_error(cds)("Failed to generate LambdaForm holder classes. Was the base archive generated with an outdated classlist?");
>> }
>
> Do you mean DumpSharedSpaces? So the message will be different between static (DumpSharedSpaces) and dynamic, right?

Yes, because the errors can only be caused by bad input from the classlist, which is only used during static archive dump. The information collected during dynamic dump are correct, and cannot cause `CDS.generateLambdaFormHolderClasses()` to fail.

>> src/hotspot/share/cds/lambdaFormInvokers.cpp line 141:
>> 
>>> 139:     ClassFileStream st((u1*)buf, len, NULL, ClassFileStream::verify);
>>> 140:     reload_class(class_name, st, THREAD);
>>> 141:     HANDLE_IF_HAS_EXCEPTION;
>> 
>> Is this necessary? I think bad classlists will cause errors in the JavaCalls::call_static call above, but not here.
>
> Here is the original code, and it is necessary, KlassFactory::create_from_stream could throw exception.

What kid of exceptions will be thrown (other than OOM?) Do you mean `CDS.generateLambdaFormHolderClasses()` can generate bad class files?

-------------

PR: https://git.openjdk.java.net/jdk/pull/3611


More information about the hotspot-dev mailing list