InvokerBytecodeGenerator.
Since lambda forms and bound method handle species are closely tied to
method types, which have many varieties, this generator needs traces to
detect which method types are used, so generation matches the actual usage.
See the main entrypoint generateHolderClasses(Stream) for more details
about traces.
Note this pregeneration does not cover all lambda forms that can be created.
For example, forms created by LambdaFormEditor are not captured.
Pregenerated species classes are resolved in ClassSpecializer.
and behave identically to on-demand generated ones. Pregenerated lambda
forms are resolved in InvokerBytecodeGenerator#lookupPregenerated, which
looks up methods for code from the following 4 possibly-generated classes:
VarHandle linker forms, analogous to invoker forms in Invokers.,
have a similar pre-generation system except it is done at source generation;
they reside in VarHandleGuards.
Currently, GenerateJLIClassesHelper is invoked when creating a modular JDK
image or generating an AOT cache.
When creating a modular JDK image,
jdk.tools.jlink.internal.plugins.GenerateJLIClassesPlugin passes the
traces in the file jdk/tools/jlink/internal/plugins/default_jli_trace.txt
in $JAVA_HOME/lib/modules to this generator. The traces are generated
from the execution of build.tools.classlist.HelloClasslist in the build
process of the JDK.
To list all the Species classes in a JDK image:
jimage list $JAVA_HOME/lib/modules | grep BoundMethodHandle.Species_
All these pregenerated classes can be examined by javap in the same image: (Note to escape
$in bash)javap -c -p -v java.lang.invoke.LambdaForm\$Holder
When creating an AOT cache, traces generated from the training run are
captured and stored inside the AOT configuration file, and are accessed with
the C++ FinalImageRecipes class. Classes regenerated from these traces
are linked in assembly phase; see regeneratedClasses.hpp.
generateHolderClasses(Stream), BoundMethodHandle.Specializer , DelegatingMethodHandle.Holder , DirectMethodHandle.Holder , Invokers.Holder , LambdaForm.Holder , VarHandleGuards
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final Annotation | |
| pack-priv static final String | |
| pack-priv static final String | |
| pack-priv static final String | |
| pack-priv static final String | |
| pack-priv static final Map | |
| pack-priv static final String | |
| pack-priv static final String |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static byte[] | generateBasicFormsClassBytes(String className)
Returns a |
| private static byte[] | |
| pack-priv static Map. | generateConcreteBMHClassBytes(final String types)
Returns a |
| pack-priv static byte[] | generateDelegatingMethodHandleHolderClassBytes(String className, MethodType[] methodTypes)
Returns a |
| pack-priv static byte[] | generateDirectMethodHandleHolderClassBytes(String className, MethodType[] methodTypes, int[] types)
Returns a |
| pack-priv static Map | generateHolderClasses(Stream<String>
the traces to determine the lambda forms and species
to generate traces)Returns a map from class names in internal form to the corresponding class bytes. |
| pack-priv static byte[] | generateInvokersHolderClassBytes(String className, MethodType[] linkerMethodTypes, MethodType[] invokerMethodTypes, MethodType[] callSiteMethodTypes)
Returns a |
| private static LambdaForm | |
| private static LambdaForm |
| AOT_SAFE_ANNOTATION | back to summary |
|---|---|
| pack-priv static final Annotation AOT_SAFE_ANNOTATION | |
| BASIC_FORMS_HOLDER | back to summary |
|---|---|
| pack-priv static final String BASIC_FORMS_HOLDER | |
| BMH_SPECIES_PREFIX | back to summary |
|---|---|
| pack-priv static final String BMH_SPECIES_PREFIX | |
| DELEGATING_HOLDER | back to summary |
|---|---|
| pack-priv static final String DELEGATING_HOLDER | |
| DIRECT_HOLDER | back to summary |
|---|---|
| pack-priv static final String DIRECT_HOLDER | |
| DMH_METHOD_TYPE_MAP | back to summary |
|---|---|
| pack-priv static final Map<String, Integer> DMH_METHOD_TYPE_MAP | |
| INVOKERS_HOLDER | back to summary |
|---|---|
| pack-priv static final String INVOKERS_HOLDER | |
| INVOKERS_HOLDER_CLASS_NAME | back to summary |
|---|---|
| pack-priv static final String INVOKERS_HOLDER_CLASS_NAME | |
| GenerateJLIClassesHelper | back to summary |
|---|---|
| pack-priv GenerateJLIClassesHelper() | |
| generateBasicFormsClassBytes | back to summary |
|---|---|
| pack-priv static byte[] generateBasicFormsClassBytes(String className) Returns a | |
| generateCodeBytesForLFs | back to summary |
|---|---|
| private static byte[] generateCodeBytesForLFs(String className, String[] names, LambdaForm[] forms) | |
| generateConcreteBMHClassBytes | back to summary |
|---|---|
| pack-priv static Map. Returns a
| |
| generateDelegatingMethodHandleHolderClassBytes | back to summary |
|---|---|
| pack-priv static byte[] generateDelegatingMethodHandleHolderClassBytes(String className, MethodType[] methodTypes) Returns a | |
| generateDirectMethodHandleHolderClassBytes | back to summary |
|---|---|
| pack-priv static byte[] generateDirectMethodHandleHolderClassBytes(String className, MethodType[] methodTypes, int[] types) Returns a | |
| generateHolderClasses | back to summary |
|---|---|
| pack-priv static Map Returns a map from class names in internal form to the corresponding class bytes. A few known lambda forms, such as field accessors, can be comprehensively
generated. Most others lambda forms are associated with unique method
types; thus they are generated per the given stream of SPECIES_RESOLVE
and LF_RESOLVE trace logs, which are created according to The names of methods in the generated classes are internal tokens
recognized by
| |
| generateInvokersHolderClassBytes | back to summary |
|---|---|
| pack-priv static byte[] generateInvokersHolderClassBytes(String className, MethodType[] linkerMethodTypes, MethodType[] invokerMethodTypes, MethodType[] callSiteMethodTypes) Returns a | |
| makeDelegateFor | back to summary |
|---|---|
| private static LambdaForm makeDelegateFor(MethodType type) | |
| makeReinvokerFor | back to summary |
|---|---|
| private static LambdaForm makeReinvokerFor(MethodType type) | |
| Modifier and Type | Field and Description |
|---|---|
| private final TreeSet | |
| private final Map | |
| private final TreeSet | |
| private final TreeSet | |
| private final TreeSet |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv GenerateJLIClassesHelper. | |
| private void | |
| pack-priv GenerateJLIClassesHelper. | |
| pack-priv GenerateJLIClassesHelper. | |
| pack-priv GenerateJLIClassesHelper. | |
| public static MethodType | |
| pack-priv Map | |
| public static boolean | |
| public static boolean | |
| private static String | |
| private static void | |
| private static Class | |
| private static void |
| callSiteTypes | back to summary |
|---|---|
| private final TreeSet<String> callSiteTypes | |
| dmhMethods | back to summary |
|---|---|
| private final Map<String, Set<String>> dmhMethods | |
| invokerTypes | back to summary |
|---|---|
| private final TreeSet<String> invokerTypes | |
| linkerTypes | back to summary |
|---|---|
| private final TreeSet<String> linkerTypes | |
| speciesTypes | back to summary |
|---|---|
| private final TreeSet<String> speciesTypes | |
| HolderClassBuilder | back to summary |
|---|---|
| pack-priv HolderClassBuilder() | |
| addCallSiteType | back to summary |
|---|---|
| pack-priv GenerateJLIClassesHelper. | |
| addDMHMethodType | back to summary |
|---|---|
| private void addDMHMethodType(String dmh, String methodType) | |
| addInvokerType | back to summary |
|---|---|
| pack-priv GenerateJLIClassesHelper. | |
| addLinkerType | back to summary |
|---|---|
| pack-priv GenerateJLIClassesHelper. | |
| addSpeciesType | back to summary |
|---|---|
| pack-priv GenerateJLIClassesHelper. | |
| asMethodType | back to summary |
|---|---|
| public static MethodType asMethodType(String basicSignatureString) | |
| build | back to summary |
|---|---|
| pack-priv Map | |
| checkInvokerTypeParams | back to summary |
|---|---|
| public static boolean checkInvokerTypeParams(MethodType mt) | |
| checkLinkerTypeParams | back to summary |
|---|---|
| public static boolean checkLinkerTypeParams(MethodType mt) | |
| expandSignature | back to summary |
|---|---|
| private static String expandSignature(String signature) | |
| requireBasicType | back to summary |
|---|---|
| private static void requireBasicType(char c) | |
| simpleType | back to summary |
|---|---|
| private static Class | |
| validateMethodType | back to summary |
|---|---|
| private static void validateMethodType(String type) | |