Search in sources :

Example 1 with ArrayElementsTypeFlow

use of com.oracle.graal.pointsto.flow.ArrayElementsTypeFlow in project graal by oracle.

the class AnalysisObjectScanner method forNonNullArrayElement.

@Override
public void forNonNullArrayElement(JavaConstant array, AnalysisType arrayType, JavaConstant elementConstant, AnalysisType elementType, int elementIndex) {
    assert elementType.isInstantiated();
    /*
         * *ALL* constants are scanned after each analysis iteration, thus the elementType will
         * eventually be added to the AllInstantiatedTypeFlow and the array elements flow will
         * eventually be updated.
         */
    if (bb.getAllInstantiatedTypeFlow().getState().containsType(elementType)) {
        ArrayElementsTypeFlow arrayObjElementsFlow = getArrayElementsFlow(array, arrayType);
        AnalysisObject constantObject = bb.analysisPolicy().createConstantObject(bb, elementConstant, elementType);
        if (!arrayObjElementsFlow.getState().isUnknown() && !arrayObjElementsFlow.getState().containsObject(constantObject)) {
            /* Add the constant element to the constant's array type flow. */
            TypeState elementTypeState = TypeState.forNonNullObject(bb, constantObject);
            arrayObjElementsFlow.addState(bb, elementTypeState);
        }
    }
}
Also used : ArrayElementsTypeFlow(com.oracle.graal.pointsto.flow.ArrayElementsTypeFlow) AnalysisObject(com.oracle.graal.pointsto.flow.context.object.AnalysisObject) TypeState(com.oracle.graal.pointsto.typestate.TypeState)

Example 2 with ArrayElementsTypeFlow

use of com.oracle.graal.pointsto.flow.ArrayElementsTypeFlow in project graal by oracle.

the class ContextSensitiveAnalysisObject method mergeArrayElementsFlow.

private void mergeArrayElementsFlow(BigBang bb) {
    assert this.isObjectArray();
    ArrayElementsTypeFlow contextInsensitiveWriteArrayElementsFlow = type.getContextInsensitiveAnalysisObject().getArrayElementsFlow(bb, true);
    contextInsensitiveWriteArrayElementsFlow.addUse(bb, this.arrayElementsTypeStore.writeFlow());
    ArrayElementsTypeFlow contextInsensitiveReadArrayElementsFlow = type.getContextInsensitiveAnalysisObject().getArrayElementsFlow(bb, false);
    this.arrayElementsTypeStore.readFlow().addUse(bb, contextInsensitiveReadArrayElementsFlow);
}
Also used : ArrayElementsTypeFlow(com.oracle.graal.pointsto.flow.ArrayElementsTypeFlow)

Example 3 with ArrayElementsTypeFlow

use of com.oracle.graal.pointsto.flow.ArrayElementsTypeFlow in project graal by oracle.

the class PointsToStats method asString.

private static String asString(TypeFlow<?> flow) {
    if (flow instanceof AllInstantiatedTypeFlow) {
        return "AllInstantiated(" + formatType(flow.getDeclaredType(), true) + ")";
    } else if (flow instanceof AllSynchronizedTypeFlow) {
        return "AllSynchronized";
    } else if (flow instanceof UnknownTypeFlow) {
        return "Unknown";
    } else if (flow instanceof FieldSinkTypeFlow) {
        FieldSinkTypeFlow sink = (FieldSinkTypeFlow) flow;
        return "FieldSink(" + formatField(sink.getSource()) + ")";
    } else if (flow instanceof FieldTypeFlow) {
        FieldTypeFlow fieldFlow = (FieldTypeFlow) flow;
        AnalysisField field = fieldFlow.getSource();
        return (field.isStatic() ? "StaticField" : "InstanceField") + "(" + formatField(field) + ")";
    } else if (flow instanceof StoreInstanceFieldTypeFlow) {
        StoreInstanceFieldTypeFlow store = (StoreInstanceFieldTypeFlow) flow;
        return "InstanceStore(" + formatField(store.field()) + ")@" + formatSource(flow);
    } else if (flow instanceof StoreStaticFieldTypeFlow) {
        StoreStaticFieldTypeFlow store = (StoreStaticFieldTypeFlow) flow;
        return "StaticStore(" + formatField(store.field()) + ")@" + formatSource(flow);
    } else if (flow instanceof LoadInstanceFieldTypeFlow) {
        LoadInstanceFieldTypeFlow load = (LoadInstanceFieldTypeFlow) flow;
        return "InstanceLoad(" + formatField(load.field()) + ")@" + formatSource(flow);
    } else if (flow instanceof LoadStaticFieldTypeFlow) {
        LoadStaticFieldTypeFlow load = (LoadStaticFieldTypeFlow) flow;
        return "StaticLoad(" + formatField(load.field()) + ")@" + formatSource(flow);
    } else if (flow instanceof StoreIndexedTypeFlow) {
        return "IndexedStore @ " + formatSource(flow);
    } else if (flow instanceof UnsafeStoreTypeFlow) {
        return "UnsafeStore @ " + formatSource(flow);
    } else if (flow instanceof UnsafePartitionStoreTypeFlow) {
        return "UnsafePartitionStore @ " + formatSource(flow);
    } else if (flow instanceof UnsafeWriteSinkTypeFlow) {
        UnsafeWriteSinkTypeFlow sink = (UnsafeWriteSinkTypeFlow) flow;
        return "UnsafeWriteSink(" + formatField(sink.getSource()) + ")";
    } else if (flow instanceof JavaWriteTypeFlow) {
        return "JavaWrite @ " + formatSource(flow);
    } else if (flow instanceof AtomicWriteTypeFlow) {
        return "AtomicWrite @ " + formatSource(flow);
    } else if (flow instanceof CompareAndSwapTypeFlow) {
        return "CompareAndSwap @ " + formatSource(flow);
    } else if (flow instanceof LoadIndexedTypeFlow) {
        return "IndexedLoad @ " + formatSource(flow);
    } else if (flow instanceof UnsafeLoadTypeFlow) {
        return "UnsafeLoad @ " + formatSource(flow);
    } else if (flow instanceof UnsafePartitionLoadTypeFlow) {
        return "UnsafePartitionLoad @ " + formatSource(flow);
    } else if (flow instanceof JavaReadTypeFlow) {
        return "JavaRead @ " + formatSource(flow);
    } else if (flow instanceof AtomicReadTypeFlow) {
        return "AtomicRead @ " + formatSource(flow);
    } else if (flow instanceof ArrayElementsTypeFlow) {
        ArrayElementsTypeFlow arrayFlow = (ArrayElementsTypeFlow) flow;
        return "ArrayElements(" + (arrayFlow.object() != null ? arrayFlow.object().type().toJavaName(false) : "?") + ")";
    } else if (flow instanceof NullCheckTypeFlow) {
        NullCheckTypeFlow nullCheck = (NullCheckTypeFlow) flow;
        return "NullCheck(" + (nullCheck.isFilterNull() ? "not-null" : "only-null") + ")@" + formatSource(flow);
    } else if (flow instanceof FilterTypeFlow) {
        FilterTypeFlow filter = (FilterTypeFlow) flow;
        String properties = filter.isExact() ? "exact" : "not-exact";
        properties += ", " + (filter.isAssignable() ? "assignable" : "not-assignable");
        properties += ", " + (filter.includeNull() ? "include-null" : "not-include-null");
        return "Filter(" + properties + ", " + formatType(filter.getType(), true) + ")@" + formatSource(flow);
    } else if (flow instanceof FieldFilterTypeFlow) {
        FieldFilterTypeFlow filter = (FieldFilterTypeFlow) flow;
        return "FieldFilter(" + formatField(filter.getSource()) + ")";
    } else if (flow instanceof FrozenFieldFilterTypeFlow) {
        FrozenFieldFilterTypeFlow filter = (FrozenFieldFilterTypeFlow) flow;
        return "FrozenFieldFilter(" + formatField(filter.getSource()) + ")";
    } else if (flow instanceof InstanceOfTypeFlow) {
        InstanceOfTypeFlow instanceOf = (InstanceOfTypeFlow) flow;
        return "InstanceOf(" + formatType(instanceOf.getDeclaredType(), true) + ")@" + formatSource(flow);
    } else if (flow instanceof NewInstanceTypeFlow) {
        return "NewInstance(" + flow.getDeclaredType().toJavaName(false) + ")@" + formatSource(flow);
    } else if (flow instanceof DynamicNewInstanceTypeFlow) {
        return "DynamicNewInstance @ " + formatSource(flow);
    } else if (flow instanceof InvokeTypeFlow) {
        InvokeTypeFlow invoke = (InvokeTypeFlow) flow;
        return "Invoke(" + formatMethod(invoke.getTargetMethod()) + ")@" + formatSource(flow);
    } else if (flow instanceof InitialParamTypeFlow) {
        InitialParamTypeFlow param = (InitialParamTypeFlow) flow;
        return "InitialParam(" + param.position() + ")@" + formatMethod(param.method());
    } else if (flow instanceof FormalParamTypeFlow) {
        FormalParamTypeFlow param = (FormalParamTypeFlow) flow;
        return "Parameter(" + param.position() + ")@" + formatMethod(param.method());
    } else if (flow instanceof FormalReturnTypeFlow) {
        return "Return @ " + formatSource(flow);
    } else if (flow instanceof ActualReturnTypeFlow) {
        ActualReturnTypeFlow ret = (ActualReturnTypeFlow) flow;
        InvokeTypeFlow invoke = ret.invokeFlow();
        return "ActualReturn(" + formatMethod(invoke.getTargetMethod()) + ")@ " + formatSource(flow);
    } else if (flow instanceof MergeTypeFlow) {
        return "Merge @ " + formatSource(flow);
    } else if (flow instanceof SourceTypeFlow) {
        return "Source @ " + formatSource(flow);
    } else if (flow instanceof CloneTypeFlow) {
        return "Clone @ " + formatSource(flow);
    } else if (flow instanceof MonitorEnterTypeFlow) {
        MonitorEnterTypeFlow monitor = (MonitorEnterTypeFlow) flow;
        return "MonitorEnter @ " + formatMethod(monitor.getMethod());
    } else {
        return flow.getClass().getSimpleName() + "@" + formatSource(flow);
    }
}
Also used : MonitorEnterTypeFlow(com.oracle.graal.pointsto.flow.MonitorEnterTypeFlow) JavaReadTypeFlow(com.oracle.graal.pointsto.flow.OffsetLoadTypeFlow.JavaReadTypeFlow) LoadInstanceFieldTypeFlow(com.oracle.graal.pointsto.flow.LoadFieldTypeFlow.LoadInstanceFieldTypeFlow) FieldFilterTypeFlow(com.oracle.graal.pointsto.flow.FieldFilterTypeFlow) FrozenFieldFilterTypeFlow(com.oracle.graal.pointsto.flow.FrozenFieldFilterTypeFlow) FormalParamTypeFlow(com.oracle.graal.pointsto.flow.FormalParamTypeFlow) SourceTypeFlow(com.oracle.graal.pointsto.flow.SourceTypeFlow) ActualReturnTypeFlow(com.oracle.graal.pointsto.flow.ActualReturnTypeFlow) NullCheckTypeFlow(com.oracle.graal.pointsto.flow.NullCheckTypeFlow) DynamicNewInstanceTypeFlow(com.oracle.graal.pointsto.flow.DynamicNewInstanceTypeFlow) UnsafeWriteSinkTypeFlow(com.oracle.graal.pointsto.flow.UnsafeWriteSinkTypeFlow) InvokeTypeFlow(com.oracle.graal.pointsto.flow.InvokeTypeFlow) LoadIndexedTypeFlow(com.oracle.graal.pointsto.flow.OffsetLoadTypeFlow.LoadIndexedTypeFlow) ArrayElementsTypeFlow(com.oracle.graal.pointsto.flow.ArrayElementsTypeFlow) DynamicNewInstanceTypeFlow(com.oracle.graal.pointsto.flow.DynamicNewInstanceTypeFlow) NewInstanceTypeFlow(com.oracle.graal.pointsto.flow.NewInstanceTypeFlow) UnsafeLoadTypeFlow(com.oracle.graal.pointsto.flow.OffsetLoadTypeFlow.UnsafeLoadTypeFlow) AllInstantiatedTypeFlow(com.oracle.graal.pointsto.flow.AllInstantiatedTypeFlow) UnsafePartitionLoadTypeFlow(com.oracle.graal.pointsto.flow.OffsetLoadTypeFlow.UnsafePartitionLoadTypeFlow) CloneTypeFlow(com.oracle.graal.pointsto.flow.CloneTypeFlow) FieldSinkTypeFlow(com.oracle.graal.pointsto.flow.FieldSinkTypeFlow) JavaWriteTypeFlow(com.oracle.graal.pointsto.flow.OffsetStoreTypeFlow.JavaWriteTypeFlow) AtomicWriteTypeFlow(com.oracle.graal.pointsto.flow.OffsetStoreTypeFlow.AtomicWriteTypeFlow) StoreStaticFieldTypeFlow(com.oracle.graal.pointsto.flow.StoreFieldTypeFlow.StoreStaticFieldTypeFlow) StoreInstanceFieldTypeFlow(com.oracle.graal.pointsto.flow.StoreFieldTypeFlow.StoreInstanceFieldTypeFlow) LoadStaticFieldTypeFlow(com.oracle.graal.pointsto.flow.LoadFieldTypeFlow.LoadStaticFieldTypeFlow) FieldTypeFlow(com.oracle.graal.pointsto.flow.FieldTypeFlow) LoadInstanceFieldTypeFlow(com.oracle.graal.pointsto.flow.LoadFieldTypeFlow.LoadInstanceFieldTypeFlow) FormalReturnTypeFlow(com.oracle.graal.pointsto.flow.FormalReturnTypeFlow) MergeTypeFlow(com.oracle.graal.pointsto.flow.MergeTypeFlow) UnsafePartitionStoreTypeFlow(com.oracle.graal.pointsto.flow.OffsetStoreTypeFlow.UnsafePartitionStoreTypeFlow) UnknownTypeFlow(com.oracle.graal.pointsto.flow.UnknownTypeFlow) AnalysisField(com.oracle.graal.pointsto.meta.AnalysisField) InstanceOfTypeFlow(com.oracle.graal.pointsto.flow.InstanceOfTypeFlow) FilterTypeFlow(com.oracle.graal.pointsto.flow.FilterTypeFlow) FieldFilterTypeFlow(com.oracle.graal.pointsto.flow.FieldFilterTypeFlow) FrozenFieldFilterTypeFlow(com.oracle.graal.pointsto.flow.FrozenFieldFilterTypeFlow) AtomicReadTypeFlow(com.oracle.graal.pointsto.flow.OffsetLoadTypeFlow.AtomicReadTypeFlow) AllSynchronizedTypeFlow(com.oracle.graal.pointsto.flow.AllSynchronizedTypeFlow) CompareAndSwapTypeFlow(com.oracle.graal.pointsto.flow.OffsetStoreTypeFlow.CompareAndSwapTypeFlow) StoreStaticFieldTypeFlow(com.oracle.graal.pointsto.flow.StoreFieldTypeFlow.StoreStaticFieldTypeFlow) StoreIndexedTypeFlow(com.oracle.graal.pointsto.flow.OffsetStoreTypeFlow.StoreIndexedTypeFlow) InitialParamTypeFlow(com.oracle.graal.pointsto.flow.InitialParamTypeFlow) LoadStaticFieldTypeFlow(com.oracle.graal.pointsto.flow.LoadFieldTypeFlow.LoadStaticFieldTypeFlow) FrozenFieldFilterTypeFlow(com.oracle.graal.pointsto.flow.FrozenFieldFilterTypeFlow) StoreInstanceFieldTypeFlow(com.oracle.graal.pointsto.flow.StoreFieldTypeFlow.StoreInstanceFieldTypeFlow) UnsafeStoreTypeFlow(com.oracle.graal.pointsto.flow.OffsetStoreTypeFlow.UnsafeStoreTypeFlow)

Aggregations

ArrayElementsTypeFlow (com.oracle.graal.pointsto.flow.ArrayElementsTypeFlow)3 ActualReturnTypeFlow (com.oracle.graal.pointsto.flow.ActualReturnTypeFlow)1 AllInstantiatedTypeFlow (com.oracle.graal.pointsto.flow.AllInstantiatedTypeFlow)1 AllSynchronizedTypeFlow (com.oracle.graal.pointsto.flow.AllSynchronizedTypeFlow)1 CloneTypeFlow (com.oracle.graal.pointsto.flow.CloneTypeFlow)1 DynamicNewInstanceTypeFlow (com.oracle.graal.pointsto.flow.DynamicNewInstanceTypeFlow)1 FieldFilterTypeFlow (com.oracle.graal.pointsto.flow.FieldFilterTypeFlow)1 FieldSinkTypeFlow (com.oracle.graal.pointsto.flow.FieldSinkTypeFlow)1 FieldTypeFlow (com.oracle.graal.pointsto.flow.FieldTypeFlow)1 FilterTypeFlow (com.oracle.graal.pointsto.flow.FilterTypeFlow)1 FormalParamTypeFlow (com.oracle.graal.pointsto.flow.FormalParamTypeFlow)1 FormalReturnTypeFlow (com.oracle.graal.pointsto.flow.FormalReturnTypeFlow)1 FrozenFieldFilterTypeFlow (com.oracle.graal.pointsto.flow.FrozenFieldFilterTypeFlow)1 InitialParamTypeFlow (com.oracle.graal.pointsto.flow.InitialParamTypeFlow)1 InstanceOfTypeFlow (com.oracle.graal.pointsto.flow.InstanceOfTypeFlow)1 InvokeTypeFlow (com.oracle.graal.pointsto.flow.InvokeTypeFlow)1 LoadInstanceFieldTypeFlow (com.oracle.graal.pointsto.flow.LoadFieldTypeFlow.LoadInstanceFieldTypeFlow)1 LoadStaticFieldTypeFlow (com.oracle.graal.pointsto.flow.LoadFieldTypeFlow.LoadStaticFieldTypeFlow)1 MergeTypeFlow (com.oracle.graal.pointsto.flow.MergeTypeFlow)1 MonitorEnterTypeFlow (com.oracle.graal.pointsto.flow.MonitorEnterTypeFlow)1