Search in sources :

Example 1 with AnalysisMethod

use of com.oracle.graal.pointsto.meta.AnalysisMethod in project graal by oracle.

the class RuntimeStrengthenStampsPhase method requireFrameInformationForMethod.

public SubstrateMethod requireFrameInformationForMethod(ResolvedJavaMethod method) {
    AnalysisMethod aMethod = (AnalysisMethod) method;
    SubstrateMethod sMethod = objectReplacer.createMethod(aMethod);
    CompilationInfoSupport.singleton().registerFrameInformationRequired(aMethod);
    return sMethod;
}
Also used : SubstrateMethod(com.oracle.svm.graal.meta.SubstrateMethod) AnalysisMethod(com.oracle.graal.pointsto.meta.AnalysisMethod)

Example 2 with AnalysisMethod

use of com.oracle.graal.pointsto.meta.AnalysisMethod in project graal by oracle.

the class RuntimeStrengthenStampsPhase method prepareMethodForRuntimeCompilation.

public SubstrateMethod prepareMethodForRuntimeCompilation(ResolvedJavaMethod method, BeforeAnalysisAccessImpl config) {
    AnalysisMethod aMethod = (AnalysisMethod) method;
    SubstrateMethod sMethod = objectReplacer.createMethod(aMethod);
    assert !methods.containsKey(aMethod);
    methods.put(aMethod, new CallTreeNode(aMethod, aMethod, null, 0, ""));
    config.registerAsInvoked(aMethod);
    return sMethod;
}
Also used : SubstrateMethod(com.oracle.svm.graal.meta.SubstrateMethod) AnalysisMethod(com.oracle.graal.pointsto.meta.AnalysisMethod)

Example 3 with AnalysisMethod

use of com.oracle.graal.pointsto.meta.AnalysisMethod in project graal by oracle.

the class GraalObjectReplacer method createMethod.

public SubstrateMethod createMethod(ResolvedJavaMethod original) {
    AnalysisMethod aMethod;
    if (original instanceof AnalysisMethod) {
        aMethod = (AnalysisMethod) original;
    } else if (original instanceof HostedMethod) {
        aMethod = ((HostedMethod) original).wrapped;
    } else {
        aMethod = aUniverse.lookup(original);
    }
    SubstrateMethod sMethod = methods.get(aMethod);
    if (sMethod == null) {
        assert !(original instanceof HostedMethod) : "too late to create new method";
        sMethod = new SubstrateMethod(aMethod, stringTable);
        methods.put(aMethod, sMethod);
        /*
             * The links to other meta objects must be set after adding to the methods to avoid
             * infinite recursion.
             */
        sMethod.setLinks(createSignature(aMethod.getSignature()), createType(aMethod.getDeclaringClass()));
        /*
             * Annotations are updated in every analysis iteration, but this is a starting point. It
             * also ensures that all types used by annotations are created eagerly.
             */
        sMethod.setAnnotationsEncoding(Inflation.encodeAnnotations(aMetaAccess, aMethod.getAnnotations(), null));
    }
    return sMethod;
}
Also used : SubstrateMethod(com.oracle.svm.graal.meta.SubstrateMethod) AnalysisMethod(com.oracle.graal.pointsto.meta.AnalysisMethod) HostedMethod(com.oracle.svm.hosted.meta.HostedMethod)

Example 4 with AnalysisMethod

use of com.oracle.graal.pointsto.meta.AnalysisMethod in project graal by oracle.

the class GraalObjectReplacer method updateSubstrateDataAfterHeapLayout.

public void updateSubstrateDataAfterHeapLayout(HostedUniverse hUniverse) {
    for (Map.Entry<AnalysisMethod, SubstrateMethod> entry : methods.entrySet()) {
        AnalysisMethod aMethod = entry.getKey();
        SubstrateMethod sMethod = entry.getValue();
        HostedMethod hMethod = hUniverse.lookup(aMethod);
        int vTableIndex = (hMethod.hasVTableIndex() ? hMethod.getVTableIndex() : -1);
        /*
             * We access the offset of methods in the image code section here. Therefore, this code
             * can only run after the heap and code cache layout was done.
             */
        sMethod.setSubstrateData(vTableIndex, hMethod.isCodeAddressOffsetValid() ? hMethod.getCodeAddressOffset() : 0, hMethod.getDeoptOffsetInImage());
    }
}
Also used : SubstrateMethod(com.oracle.svm.graal.meta.SubstrateMethod) AnalysisMethod(com.oracle.graal.pointsto.meta.AnalysisMethod) HostedMethod(com.oracle.svm.hosted.meta.HostedMethod) HashMap(java.util.HashMap) Map(java.util.Map)

Example 5 with AnalysisMethod

use of com.oracle.graal.pointsto.meta.AnalysisMethod in project graal by oracle.

the class ObjectScanner method scanMethod.

private void scanMethod(AnalysisMethod method) {
    try {
        StreamSupport.stream(method.getTypeFlow().getGraph().getNodes().spliterator(), false).filter(n -> n instanceof ConstantNode).forEach(n -> {
            ConstantNode cn = (ConstantNode) n;
            JavaConstant c = (JavaConstant) cn.getValue();
            if (c.getJavaKind() == JavaKind.Object) {
                scanConstant(c, method);
            }
        });
    } catch (UnsupportedFeatureException ex) {
        bb.getUnsupportedFeatures().addMessage(method.format("%H.%n(%p)"), method, ex.getMessage(), null, ex);
    }
}
Also used : IdentityHashMap(java.util.IdentityHashMap) ConstantNode(org.graalvm.compiler.nodes.ConstantNode) Deque(java.util.Deque) AnalysisField(com.oracle.graal.pointsto.meta.AnalysisField) ResolvedJavaField(jdk.vm.ci.meta.ResolvedJavaField) AnalysisType(com.oracle.graal.pointsto.meta.AnalysisType) JavaConstant(jdk.vm.ci.meta.JavaConstant) JavaKind(jdk.vm.ci.meta.JavaKind) Modifier(java.lang.reflect.Modifier) Map(java.util.Map) StreamSupport(java.util.stream.StreamSupport) UnsupportedFeatureException(com.oracle.graal.pointsto.constraints.UnsupportedFeatureException) ArrayDeque(java.util.ArrayDeque) Comparator(java.util.Comparator) WordBase(org.graalvm.word.WordBase) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod) AnalysisMethod(com.oracle.graal.pointsto.meta.AnalysisMethod) ConstantNode(org.graalvm.compiler.nodes.ConstantNode) UnsupportedFeatureException(com.oracle.graal.pointsto.constraints.UnsupportedFeatureException) JavaConstant(jdk.vm.ci.meta.JavaConstant)

Aggregations

AnalysisMethod (com.oracle.graal.pointsto.meta.AnalysisMethod)31 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)7 AnalysisType (com.oracle.graal.pointsto.meta.AnalysisType)6 HostedMethod (com.oracle.svm.hosted.meta.HostedMethod)6 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)6 AnalysisField (com.oracle.graal.pointsto.meta.AnalysisField)5 Map (java.util.Map)5 JavaKind (jdk.vm.ci.meta.JavaKind)5 TypeState (com.oracle.graal.pointsto.typestate.TypeState)4 SubstrateMethod (com.oracle.svm.graal.meta.SubstrateMethod)4 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)4 MetaAccessProvider (jdk.vm.ci.meta.MetaAccessProvider)3 CEntryPoint (org.graalvm.nativeimage.c.function.CEntryPoint)3 UnsupportedFeatureException (com.oracle.graal.pointsto.constraints.UnsupportedFeatureException)2 InvokeTypeFlow (com.oracle.graal.pointsto.flow.InvokeTypeFlow)2 AnalysisMetaAccess (com.oracle.graal.pointsto.meta.AnalysisMetaAccess)2 AnalysisUniverse (com.oracle.graal.pointsto.meta.AnalysisUniverse)2 HostedProviders (com.oracle.graal.pointsto.meta.HostedProviders)2 SubstrateForeignCallsProvider (com.oracle.svm.core.graal.meta.SubstrateForeignCallsProvider)2