Search in sources :

Example 1 with ComputedValueField

use of com.oracle.svm.hosted.substitute.ComputedValueField in project graal by oracle.

the class UniverseBuilder method build.

/**
 * This step is single threaded, i.e., all the maps are modified only by a single thread, so no
 * synchronization is necessary. Accesses (the lookup methods) are multi-threaded.
 */
@SuppressWarnings("try")
public void build(DebugContext debug) {
    for (AnalysisField aField : aUniverse.getFields()) {
        if (aField.wrapped instanceof ComputedValueField) {
            ((ComputedValueField) aField.wrapped).processAnalysis(aMetaAccess);
        }
    }
    aUniverse.seal();
    try (Indent indent = debug.logAndIndent("build universe")) {
        for (AnalysisType aType : aUniverse.getTypes()) {
            makeType(aType);
        }
        for (AnalysisField aField : aUniverse.getFields()) {
            makeField(aField);
        }
        for (AnalysisMethod aMethod : aUniverse.getMethods()) {
            makeMethod(aMethod);
        }
        BigBang bb = staticAnalysisResultsBuilder.getBigBang();
        ForkJoinTask<?> profilingInformationBuildTask = ForkJoinTask.adapt(this::buildProfilingInformation).fork();
        buildSubTypes();
        buildOrderedTypes();
        buildTypeCheckIDs();
        collectDeclaredMethods();
        collectMonitorFieldInfo(bb);
        collectHashCodeFieldInfo(bb);
        layoutInstanceFields();
        layoutStaticFields();
        collectMethodImplementations();
        buildVTables();
        buildHubs();
        setConstantFieldValues();
        hUniverse.orderedMethods = new ArrayList<>(hUniverse.methods.values());
        Collections.sort(hUniverse.orderedMethods);
        hUniverse.orderedFields = new ArrayList<>(hUniverse.fields.values());
        Collections.sort(hUniverse.orderedFields);
        profilingInformationBuildTask.join();
    }
}
Also used : AnalysisType(com.oracle.graal.pointsto.meta.AnalysisType) Indent(org.graalvm.compiler.debug.Indent) AnalysisMethod(com.oracle.graal.pointsto.meta.AnalysisMethod) ComputedValueField(com.oracle.svm.hosted.substitute.ComputedValueField) AnalysisField(com.oracle.graal.pointsto.meta.AnalysisField) BigBang(com.oracle.graal.pointsto.BigBang)

Example 2 with ComputedValueField

use of com.oracle.svm.hosted.substitute.ComputedValueField in project graal by oracle.

the class SVMMethodTypeFlowBuilder method checkUnsafeOffset.

@Override
protected void checkUnsafeOffset(ValueNode offsetNode) {
    if (!NativeImageOptions.ThrowUnsafeOffsetErrors.getValue()) {
        /* Skip the checks bellow. */
        return;
    }
    if (offsetNode instanceof LoadFieldNode) {
        LoadFieldNode offsetLoadNode = (LoadFieldNode) offsetNode;
        AnalysisField field = (AnalysisField) offsetLoadNode.field();
        if (!(field.wrapped instanceof ComputedValueField)) {
            UnsafeOffsetError.report("Field " + field + " is used as an offset in an unsafe operation, but no value recomputation found. \n Wrapped field: " + field.wrapped);
        }
    } else if (NativeImageOptions.ReportUnsafeOffsetWarnings.getValue()) {
        String message = "Offset used in an unsafe operation. Cannot determine if the offset value is recomputed.";
        message += "Location: " + offsetNode.getNodeSourcePosition() + "\n";
        message += "Node class: " + offsetNode.getClass().getName() + "\n";
        if (NativeImageOptions.UnsafeOffsetWarningsAreFatal.getValue()) {
            UnsafeOffsetError.report(message);
        } else {
            System.out.println(message);
        }
    }
}
Also used : ComputedValueField(com.oracle.svm.hosted.substitute.ComputedValueField) AnalysisField(com.oracle.graal.pointsto.meta.AnalysisField) LoadFieldNode(org.graalvm.compiler.nodes.java.LoadFieldNode)

Aggregations

AnalysisField (com.oracle.graal.pointsto.meta.AnalysisField)2 ComputedValueField (com.oracle.svm.hosted.substitute.ComputedValueField)2 BigBang (com.oracle.graal.pointsto.BigBang)1 AnalysisMethod (com.oracle.graal.pointsto.meta.AnalysisMethod)1 AnalysisType (com.oracle.graal.pointsto.meta.AnalysisType)1 Indent (org.graalvm.compiler.debug.Indent)1 LoadFieldNode (org.graalvm.compiler.nodes.java.LoadFieldNode)1