RFR: 8247536: Support for pre-generated java.lang.invoke classes in CDS static archive
mandy.chung at oracle.com
Wed Aug 19 20:30:57 UTC 2020
On 8/17/20 12:37 PM, Yumin Qi wrote:
> Hi, Ioi
> Thanks for review/suggestion. I have updated the webrev at the
> following link:
This patch leverages the TRACE_RESOLVE output and passes the trace
output to VM. VM then calls
GenerateJLIClassesHelper::generateMHHolderClasses to do the parsing and
generate Holder class per the resolved LFs. I think there are other
cleaner alternatives implementing this. jlink --generate-jli-classes
plugin depends the trace output whereas -Xshare:dump does not. It's
cleaner to skip generating the trace output and parsing for dumping
shared archive purpose. In addition, the implementation needs some
cleanup (I can send you feedback on the next revision)
Instead of relying on a system property
"java.lang.invoke.MethodHandle.CDS_TRACE_RESOLVE", it's better to use
jdk.internal.vm.isCDSDumpingEnabled() to detect if this is CDS dump time.
One possible approach:
- Add the trace methods in GenerateJLIClassesHelper class to trace these
tracePregeneratedLambdaForm(String name, MethodType type, Class<?>
* I'm not sure if these method should also accept the case when an
exception is thrown but it's okay we add it as well to match existing
- these trace methods will either (1) send the trace output to
System.out or (2) collect speciesTypes, invokerTypes, callSiteTypes, and
dmhMethods in the runtime if -Xshare:dump is specified.
- ClassSpecializer and InvokerBytecodeGenerator will call these trace
- TRACE_RESOLVE is set when the system property is set to true. If
-Xshare:dump is enabled, the trace methods will not write to
System.out. Does CDS want a log of these entry? I assume not?
- jlink plugin will continue to do the parsing. It can construct a new
class that takes the
speciesTypes, invokerTypes, callSiteTypes, and dmhMethods parameters
parsed from the trace output. jlink plugin can invoke an instance method
to return Map<String, byte>. I suggest the key for this return map is
the class name rather than a jimage entry name and the caller can map it
to an jimage entry name if needed.
- CDS will invoke a different entry to return Object as you currently
What do you think?
More information about the core-libs-dev