public class MethodMetadataEncoderImpl extends Object implements NativeImageCodeCache.MethodMetadataEncoder
Executable object at runtime.add*MethodMetadata functions). In a second
phase, the values are encoded as byte arrays and stored in MethodMetadataEncoding (see
MethodMetadataEncoderImpl.encodeAllAndInstall()).| Constructor and Description |
|---|
MethodMetadataEncoderImpl(CodeInfoEncoder.Encoders encoders) |
| Modifier and Type | Method and Description |
|---|---|
void |
addHidingMethodMetadata(HostedType declaringType,
String name,
HostedType[] parameterTypes) |
void |
addReachableMethodMetadata(HostedMethod method) |
void |
addReflectionMethodMetadata(jdk.vm.ci.meta.MetaAccessProvider metaAccess,
HostedMethod hostedMethod,
Executable reflectMethod) |
void |
encodeAllAndInstall() |
byte[] |
encodeAnnotations(Annotation[] annotations)
The following methods encode annotations attached to a method or parameter in a format based
on the one used internally by the JDK (
AnnotationParser). |
public MethodMetadataEncoderImpl(CodeInfoEncoder.Encoders encoders)
public void addReflectionMethodMetadata(jdk.vm.ci.meta.MetaAccessProvider metaAccess,
HostedMethod hostedMethod,
Executable reflectMethod)
addReflectionMethodMetadata in interface NativeImageCodeCache.MethodMetadataEncoderpublic void addHidingMethodMetadata(HostedType declaringType, String name, HostedType[] parameterTypes)
addHidingMethodMetadata in interface NativeImageCodeCache.MethodMetadataEncoderpublic void addReachableMethodMetadata(HostedMethod method)
addReachableMethodMetadata in interface NativeImageCodeCache.MethodMetadataEncoderpublic void encodeAllAndInstall()
encodeAllAndInstall in interface NativeImageCodeCache.MethodMetadataEncoderpublic byte[] encodeAnnotations(Annotation[] annotations)
AnnotationParser). The
format we use differs from that one on a few points, based on the fact that the JDK encoding
is based on constant pool indices, which are not available in that form at runtime.
Class and String values are represented by their index in the source metadata encoders
instead of their constant pool indices. Additionally, Class objects are encoded directly
instead of through their type signature. Primitive values are written directly into the
encoding. This means that our encoding can be of a different length from the JDK one.
We use a modified version of the ConstantPool and AnnotationParser classes to decode the
data, since those are not used in their original functions at runtime. (see
Target_jdk_internal_reflect_ConstantPool and
Target_sun_reflect_annotation_AnnotationParser)