Search in sources :

Example 1 with HostVM

use of com.oracle.graal.pointsto.api.HostVM in project graal by oracle.

the class Inflation method fillGenericInfo.

private void fillGenericInfo(AnalysisType type) {
    SVMHost svmHost = (SVMHost) hostVM;
    DynamicHub hub = svmHost.dynamicHub(type);
    Class<?> javaClass = type.getJavaClass();
    TypeVariable<?>[] typeParameters = javaClass.getTypeParameters();
    /* The bounds are lazily initialized. Initialize them eagerly in the native image. */
    Arrays.stream(typeParameters).forEach(TypeVariable::getBounds);
    Type[] genericInterfaces = Arrays.stream(javaClass.getGenericInterfaces()).filter(this::filterGenericInterfaces).toArray(Type[]::new);
    Type[] cachedGenericInterfaces = genericInterfacesMap.computeIfAbsent(new GenericInterfacesEncodingKey(genericInterfaces), k -> genericInterfaces);
    Type genericSuperClass = javaClass.getGenericSuperclass();
    hub.setGenericInfo(GenericInfo.factory(typeParameters, cachedGenericInterfaces, genericSuperClass));
    AnnotatedType annotatedSuperclass = javaClass.getAnnotatedSuperclass();
    AnnotatedType[] annotatedInterfaces = Arrays.stream(javaClass.getAnnotatedInterfaces()).filter(ai -> filterGenericInterfaces(ai.getType())).toArray(AnnotatedType[]::new);
    AnnotatedType[] cachedAnnotatedInterfaces = annotatedInterfacesMap.computeIfAbsent(new AnnotatedInterfacesEncodingKey(annotatedInterfaces), k -> annotatedInterfaces);
    hub.setAnnotatedSuperInfo(AnnotatedSuperInfo.factory(annotatedSuperclass, cachedAnnotatedInterfaces));
}
Also used : HostedProviders(com.oracle.graal.pointsto.meta.HostedProviders) Arrays(java.util.Arrays) ResolvedJavaType(jdk.vm.ci.meta.ResolvedJavaType) AnalysisUniverse(com.oracle.graal.pointsto.meta.AnalysisUniverse) DynamicHub(com.oracle.svm.core.hub.DynamicHub) HashMap(java.util.HashMap) SubstrateObjectConstant(com.oracle.svm.core.meta.SubstrateObjectConstant) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) SVMHost(com.oracle.svm.hosted.SVMHost) MethodTypeFlow(com.oracle.graal.pointsto.flow.MethodTypeFlow) JavaKind(jdk.vm.ci.meta.JavaKind) ObjectScanner(com.oracle.graal.pointsto.ObjectScanner) Map(java.util.Map) BigBang(com.oracle.graal.pointsto.BigBang) MethodTypeFlowBuilder(com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder) TypeNotFoundError(com.oracle.graal.pointsto.util.AnalysisError.TypeNotFoundError) GenericInfo(com.oracle.svm.core.hub.GenericInfo) AnalysisMetaAccess(com.oracle.graal.pointsto.meta.AnalysisMetaAccess) UnknownPrimitiveField(com.oracle.svm.core.annotate.UnknownPrimitiveField) AnalysisMethod(com.oracle.graal.pointsto.meta.AnalysisMethod) NodeSourcePosition(org.graalvm.compiler.graph.NodeSourcePosition) OptionValues(org.graalvm.compiler.options.OptionValues) JVMCIError(jdk.vm.ci.common.JVMCIError) SVMMethodTypeFlowBuilder(com.oracle.svm.hosted.analysis.flow.SVMMethodTypeFlowBuilder) TypeVariable(java.lang.reflect.TypeVariable) AnnotatedType(java.lang.reflect.AnnotatedType) Set(java.util.Set) AnalysisField(com.oracle.graal.pointsto.meta.AnalysisField) AnalysisType(com.oracle.graal.pointsto.meta.AnalysisType) JavaConstant(jdk.vm.ci.meta.JavaConstant) List(java.util.List) Type(java.lang.reflect.Type) ForkJoinPool(java.util.concurrent.ForkJoinPool) Modifier(java.lang.reflect.Modifier) Annotation(java.lang.annotation.Annotation) Optional(java.util.Optional) TypeFlow(com.oracle.graal.pointsto.flow.TypeFlow) UnknownObjectField(com.oracle.svm.core.annotate.UnknownObjectField) AnnotatedSuperInfo(com.oracle.svm.core.hub.AnnotatedSuperInfo) JVMCIError.shouldNotReachHere(jdk.vm.ci.common.JVMCIError.shouldNotReachHere) Pattern(java.util.regex.Pattern) HostVM(com.oracle.graal.pointsto.api.HostVM) UnsupportedFeatureException(com.oracle.graal.pointsto.constraints.UnsupportedFeatureException) WordBase(org.graalvm.word.WordBase) ResolvedJavaType(jdk.vm.ci.meta.ResolvedJavaType) AnnotatedType(java.lang.reflect.AnnotatedType) AnalysisType(com.oracle.graal.pointsto.meta.AnalysisType) Type(java.lang.reflect.Type) AnnotatedType(java.lang.reflect.AnnotatedType) TypeVariable(java.lang.reflect.TypeVariable) SVMHost(com.oracle.svm.hosted.SVMHost) DynamicHub(com.oracle.svm.core.hub.DynamicHub)

Aggregations

BigBang (com.oracle.graal.pointsto.BigBang)1 ObjectScanner (com.oracle.graal.pointsto.ObjectScanner)1 HostVM (com.oracle.graal.pointsto.api.HostVM)1 UnsupportedFeatureException (com.oracle.graal.pointsto.constraints.UnsupportedFeatureException)1 MethodTypeFlow (com.oracle.graal.pointsto.flow.MethodTypeFlow)1 MethodTypeFlowBuilder (com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder)1 TypeFlow (com.oracle.graal.pointsto.flow.TypeFlow)1 AnalysisField (com.oracle.graal.pointsto.meta.AnalysisField)1 AnalysisMetaAccess (com.oracle.graal.pointsto.meta.AnalysisMetaAccess)1 AnalysisMethod (com.oracle.graal.pointsto.meta.AnalysisMethod)1 AnalysisType (com.oracle.graal.pointsto.meta.AnalysisType)1 AnalysisUniverse (com.oracle.graal.pointsto.meta.AnalysisUniverse)1 HostedProviders (com.oracle.graal.pointsto.meta.HostedProviders)1 TypeNotFoundError (com.oracle.graal.pointsto.util.AnalysisError.TypeNotFoundError)1 UnknownObjectField (com.oracle.svm.core.annotate.UnknownObjectField)1 UnknownPrimitiveField (com.oracle.svm.core.annotate.UnknownPrimitiveField)1 AnnotatedSuperInfo (com.oracle.svm.core.hub.AnnotatedSuperInfo)1 DynamicHub (com.oracle.svm.core.hub.DynamicHub)1 GenericInfo (com.oracle.svm.core.hub.GenericInfo)1 SubstrateObjectConstant (com.oracle.svm.core.meta.SubstrateObjectConstant)1