Search in sources :

Example 1 with SubstrateMethod

use of com.oracle.svm.graal.meta.SubstrateMethod 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 SubstrateMethod

use of com.oracle.svm.graal.meta.SubstrateMethod in project graal by oracle.

the class RuntimeStrengthenStampsPhase method duringAnalysis.

@Override
public void duringAnalysis(DuringAnalysisAccess c) {
    DuringAnalysisAccessImpl config = (DuringAnalysisAccessImpl) c;
    GraalSupport.registerPhaseStatistics(config);
    Deque<CallTreeNode> worklist = new ArrayDeque<>();
    worklist.addAll(methods.values());
    while (!worklist.isEmpty()) {
        processMethod(worklist.removeFirst(), worklist, config.getBigBang());
    }
    SubstrateMethod[] methodsToCompileArr = new SubstrateMethod[methods.size()];
    int idx = 0;
    for (CallTreeNode node : methods.values()) {
        methodsToCompileArr[idx++] = objectReplacer.createMethod(node.implementationMethod);
    }
    if (GraalSupport.setMethodsToCompile(methodsToCompileArr)) {
        config.requireAnalysisIteration();
    }
    graphEncoder.finishPrepare();
    AnalysisMetaAccess metaAccess = config.getMetaAccess();
    NodeClass<?>[] nodeClasses = graphEncoder.getNodeClasses();
    for (NodeClass<?> nodeClass : nodeClasses) {
        metaAccess.lookupJavaType(nodeClass.getClazz()).registerAsAllocated(null);
    }
    if (GraalSupport.setGraphEncoding(graphEncoder.getEncoding(), graphEncoder.getObjects(), nodeClasses)) {
        config.requireAnalysisIteration();
    }
    if (objectReplacer.updateDataDuringAnalysis(config.getMetaAccess())) {
        config.requireAnalysisIteration();
    }
}
Also used : SubstrateMethod(com.oracle.svm.graal.meta.SubstrateMethod) NodeClass(org.graalvm.compiler.graph.NodeClass) DuringAnalysisAccessImpl(com.oracle.svm.hosted.FeatureImpl.DuringAnalysisAccessImpl) AnalysisMetaAccess(com.oracle.graal.pointsto.meta.AnalysisMetaAccess) ArrayDeque(java.util.ArrayDeque)

Example 3 with SubstrateMethod

use of com.oracle.svm.graal.meta.SubstrateMethod 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 4 with SubstrateMethod

use of com.oracle.svm.graal.meta.SubstrateMethod 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 5 with SubstrateMethod

use of com.oracle.svm.graal.meta.SubstrateMethod in project graal by oracle.

the class GraalObjectReplacer method registerImmutableObjects.

public void registerImmutableObjects(CompilationAccess access) {
    for (SubstrateMethod method : methods.values()) {
        access.registerAsImmutable(method);
        access.registerAsImmutable(method.getRawImplementations());
        access.registerAsImmutable(method.getEncodedLineNumberTable());
    }
    for (SubstrateField field : fields.values()) {
        access.registerAsImmutable(field);
    }
    for (FieldLocationIdentity fieldLocationIdentity : fieldLocationIdentities.values()) {
        access.registerAsImmutable(fieldLocationIdentity);
    }
    for (SubstrateType type : types.values()) {
        access.registerAsImmutable(type);
        access.registerAsImmutable(type.getRawInstanceFields());
    }
    for (SubstrateSignature signature : signatures.values()) {
        access.registerAsImmutable(signature);
        access.registerAsImmutable(signature.getRawParameterTypes());
    }
}
Also used : SubstrateMethod(com.oracle.svm.graal.meta.SubstrateMethod) FieldLocationIdentity(org.graalvm.compiler.nodes.FieldLocationIdentity) SubstrateFieldLocationIdentity(com.oracle.svm.core.graal.nodes.SubstrateFieldLocationIdentity) SubstrateField(com.oracle.svm.graal.meta.SubstrateField) SubstrateType(com.oracle.svm.graal.meta.SubstrateType) SubstrateSignature(com.oracle.svm.graal.meta.SubstrateSignature)

Aggregations

SubstrateMethod (com.oracle.svm.graal.meta.SubstrateMethod)7 AnalysisMethod (com.oracle.graal.pointsto.meta.AnalysisMethod)5 SubstrateField (com.oracle.svm.graal.meta.SubstrateField)2 HostedMethod (com.oracle.svm.hosted.meta.HostedMethod)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 AnalysisField (com.oracle.graal.pointsto.meta.AnalysisField)1 AnalysisMetaAccess (com.oracle.graal.pointsto.meta.AnalysisMetaAccess)1 SubstrateFieldLocationIdentity (com.oracle.svm.core.graal.nodes.SubstrateFieldLocationIdentity)1 SubstrateSignature (com.oracle.svm.graal.meta.SubstrateSignature)1 SubstrateType (com.oracle.svm.graal.meta.SubstrateType)1 DuringAnalysisAccessImpl (com.oracle.svm.hosted.FeatureImpl.DuringAnalysisAccessImpl)1 ArrayDeque (java.util.ArrayDeque)1 ArrayList (java.util.ArrayList)1 NodeClass (org.graalvm.compiler.graph.NodeClass)1 FieldLocationIdentity (org.graalvm.compiler.nodes.FieldLocationIdentity)1