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

David Holmes dholmes at openjdk.java.net
Wed Apr 28 08:01:56 UTC 2021


On Wed, 28 Apr 2021 02:58:05 GMT, Yumin Qi <minqi at openjdk.org> wrote:

>> src/hotspot/share/cds/dynamicArchive.cpp line 374:
>> 
>>> 372:   JavaThread* THREAD = JavaThread::current();
>>> 373:   log_info(cds, dynamic)("Regenerate lambdaform holder classes ...");
>>> 374:   LambdaFormInvokers::regenerate_holder_classes(THREAD);
>> 
>> You still have not addressed the exception problem here. This call can return early with an exception pending due to line 89 in the called method, which uses CHECK. That exception will escape up to the Java code after the VM operation completes.
>> 
>> Note: If `regenerate_holder_classes` is changed to suppress all exceptions then it should not be declared TRAPS and there is no need to pass THREAD (manifest [Java]Thread::current() internally as needed).
>
> Thanks for pointing this out, I checked the function LambdaFormInvokers::regenerate_holder_classes again.  Looks the TRAPS can be removed. There are two cases: 
>   1) If any allocation failed due to OOM, vm will exit except for the line 124:
>            char *buf = resource_allocate_bytes(THREAD, len, AllocFailStrategy::RETURN_NULL);
>            if (buf == nullptr) {
>              log_info(cds)("Out of memory when reloading class %s, quit", class_name);
>              return;
>            }
> 2) CDS.generateLambdaFormHolderClasses may throw exception, the exception is supressed inside the function.
> So I will remove the TRAPS.

Are you saying that this:

objArrayHandle list_lines = oopFactory::new_objArray_handle(vmClasses::String_klass(), len, CHECK);

won't throw an exception but will abort the VM? I'm not seeing that.

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

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


More information about the hotspot-dev mailing list