Search in sources :

Example 6 with SubstrateMethod

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

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

the class GraalObjectReplacer method updateDataDuringAnalysis.

/**
 * Some meta data must be updated during analysis. This is done here.
 */
public boolean updateDataDuringAnalysis(AnalysisMetaAccess metaAccess) {
    boolean result = false;
    List<AnalysisMethod> aMethods = new ArrayList<>();
    aMethods.addAll(methods.keySet());
    int index = 0;
    while (index < aMethods.size()) {
        AnalysisMethod aMethod = aMethods.get(index++);
        SubstrateMethod sMethod = methods.get(aMethod);
        SubstrateMethod[] implementations = new SubstrateMethod[aMethod.getImplementations().length];
        int idx = 0;
        for (AnalysisMethod impl : aMethod.getImplementations()) {
            SubstrateMethod sImpl = methods.get(impl);
            if (sImpl == null) {
                sImpl = createMethod(impl);
                aMethods.add(impl);
                result = true;
            }
            implementations[idx++] = sImpl;
        }
        if (sMethod.setImplementations(implementations)) {
            result = true;
        }
    }
    for (Map.Entry<AnalysisMethod, SubstrateMethod> entry : methods.entrySet()) {
        if (entry.getValue().setAnnotationsEncoding(Inflation.encodeAnnotations(metaAccess, entry.getKey().getAnnotations(), entry.getValue().getAnnotationsEncoding()))) {
            result = true;
        }
    }
    for (Map.Entry<AnalysisField, SubstrateField> entry : fields.entrySet()) {
        if (entry.getValue().setAnnotationsEncoding(Inflation.encodeAnnotations(metaAccess, entry.getKey().getAnnotations(), entry.getValue().getAnnotationsEncoding()))) {
            result = true;
        }
    }
    return result;
}
Also used : SubstrateMethod(com.oracle.svm.graal.meta.SubstrateMethod) AnalysisMethod(com.oracle.graal.pointsto.meta.AnalysisMethod) ArrayList(java.util.ArrayList) AnalysisField(com.oracle.graal.pointsto.meta.AnalysisField) SubstrateField(com.oracle.svm.graal.meta.SubstrateField) HashMap(java.util.HashMap) Map(java.util.Map)

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