public UnifiedArrayElementsTypeStore(AnalysisObject object) { super(object); this.readWriteFlow = new ArrayElementsTypeFlow(object); }
@Override public void forNullArrayElement(JavaConstant array, AnalysisType arrayType, int elementIndex) { ArrayElementsTypeFlow arrayObjElementsFlow = getArrayElementsFlow(array, arrayType); if (!arrayObjElementsFlow.getState().canBeNull()) { /* Signal that the constant array can contain null. */ arrayObjElementsFlow.addState(bb, TypeState.forNull()); } }
@Override public void init(BigBang bb) { this.writeFlow.addUse(bb, readFlow); }
@Override public String toString() { return "MixedElementsFlow<" + source.getName() + "\n" + getState() + ">"; }
} 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;
for (AnalysisObject object : arrayElementsTypeStore.readFlow().getState().objects()) { objectsSet.add(object);
@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); } } }
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); }
if (this.getContextInsensitiveAnalysisObject().isObjectArray()) { for (AnalysisType type : getContextInsensitiveAnalysisObject().getArrayElementsFlow(bb, false).getState().types()) {
public SplitArrayElementsTypeStore(AnalysisObject object) { super(object); this.writeFlow = new ArrayElementsTypeFlow(object); this.readFlow = new ArrayElementsTypeFlow(object); }
@Override public ArrayElementsTypeFlow getArrayElementsFlow(BigBang bb, boolean isStore) { assert type.isArray(); assert PointstoOptions.AllocationSiteSensitiveHeap.getValue(bb.getOptions()); if (!arrayElementsTypeStore.writeFlow().getState().canBeNull()) { /* * Initialize the elements flow of all heap allocated arrays with the null type state. */ /* The constant array elements flows are initialized in BigBang.scan() ? */ arrayElementsTypeStore.writeFlow().addState(bb, TypeState.forNull()); } return isStore ? arrayElementsTypeStore.writeFlow() : arrayElementsTypeStore.readFlow(); }
srcArrayElementsFlow.addUse(bb, dstArrayElementsFlow);
originalObjectElementsFlow.addUse(bb, cloneObjectElementsFlow);