RFR: 8255493: Support for pre-generated java.lang.invoke classes in CDS dynamic archive [v2]
Ioi Lam
iklam at openjdk.java.net
Mon Apr 26 23:32:37 UTC 2021
On Mon, 26 Apr 2021 20:50:04 GMT, Yumin Qi <minqi at openjdk.org> wrote:
>> Hi, Please review
>>
>> When do dynamic dump, the pre-generated lambda form classes from java.lang.invoke are not stored in dynamic archive. The patch will regenerate the four holder classes,
>> "java.lang.invoke.Invokers$Holder",
>> "java.lang.invoke.DirectMethodHandle$Holder",
>> "java.lang.invoke.DelegatingMethodHandle$Holder",
>> "java.lang.invoke.LambdaForm$Holder"
>> which will include the versions in static archive and new loaded functions all together and stored in dynamic archive. New test case added.
>> (Minor change to PrintSharedArchiveAtExit, which the index is not consecutive)
>>
>> Tests: tier1,tier2,tier3,tier4
>>
>> Thanks
>> Yumin
>
> Yumin Qi has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
>
> - Serialize lambdafor invokers in readonly talbe, merged with master
> - Merge branch 'master' into jdk-8255493
> - Merge branch 'master' of ssh://github.com/yminqi/jdk into jdk-8255493
> - 8255493: Support for pre-generated java.lang.invoke classes in CDS dynamic archive
Changes requested by iklam (Reviewer).
src/hotspot/share/cds/lambdaFormInvokers.cpp line 90:
> 88: int len = _lambdaform_lines->length();
> 89: objArrayHandle list_lines = oopFactory::new_objArray_handle(vmClasses::String_klass(), len, CHECK);
> 90: if (list_lines == nullptr) {
There's no need to check for null. If allocation fails, the CHECK in the previous line will force this function to return.
(same for the check on line 96).
src/hotspot/share/cds/lambdaFormInvokers.cpp line 137:
> 135: // make a copy of class bytes so GC will not affect us.
> 136: char *buf = resource_allocate_bytes(THREAD, len);
> 137: if (buf == nullptr) {
`resource_allocate_bytes(THREAD, len)` by default uses `AllocFailStrategy::EXIT_OOM`. We should explicitly pass `RETURN_NULL` instead.
Also, the `resource_free_bytes` call below doesn't seem necessary. The buffer will be freed when the ResourceMark is popped.
src/hotspot/share/cds/metaspaceShared.cpp line 1466:
> 1464: LambdaFormInvokers::append_filtered(str);
> 1465: }
> 1466: }
I think the above block should be moved into lambdaFormInvokers.cpp
-------------
PR: https://git.openjdk.java.net/jdk/pull/3611
More information about the hotspot-dev
mailing list