use of com.oracle.graal.pointsto.flow.TypeFlow in project graal by oracle.
the class AnalysisType method updateAssignableTypes.
public static void updateAssignableTypes(BigBang bb) {
/*
* Update the assignable-state for all types. So do not post any update operations before
* the computation is finished, because update operations must not see any intermediate
* state.
*/
List<AnalysisType> allTypes = bb.getUniverse().getTypes();
List<TypeFlow<?>> changedFlows = new ArrayList<>();
Map<Integer, BitSet> newAssignableTypes = new HashMap<>();
for (AnalysisType type : allTypes) {
if (type.isInstantiated()) {
int arrayDimension = 0;
AnalysisType elementalType = type;
while (elementalType.isArray()) {
elementalType = elementalType.getComponentType();
arrayDimension++;
}
addTypeToAssignableLists(type.getId(), elementalType, arrayDimension, newAssignableTypes, true, bb);
if (arrayDimension > 0) {
addTypeToAssignableLists(type.getId(), type, 0, newAssignableTypes, true, bb);
}
for (int i = 0; i < arrayDimension; i++) {
addTypeToAssignableLists(type.getId(), bb.getObjectType(), i, newAssignableTypes, false, bb);
}
if (!elementalType.isPrimitive()) {
addTypeToAssignableLists(type.getId(), bb.getObjectType(), arrayDimension, newAssignableTypes, false, bb);
}
}
}
for (AnalysisType type : allTypes) {
if (type.assignableTypes != null) {
TypeState assignableTypeState = TypeState.forNull();
if (newAssignableTypes.get(type.getId()) != null) {
BitSet assignableTypes = newAssignableTypes.get(type.getId());
if (type.assignableTypes.getState().hasExactTypes(assignableTypes)) {
/* Avoid creation of the expensive type state. */
continue;
}
assignableTypeState = TypeState.forExactTypes(bb, newAssignableTypes.get(type.getId()), true);
}
updateFlow(bb, type.assignableTypes, assignableTypeState, changedFlows);
updateFlow(bb, type.assignableTypesNonNull, assignableTypeState.forNonNull(bb), changedFlows);
}
}
for (TypeFlow<?> changedFlow : changedFlows) {
bb.postFlow(changedFlow);
}
}
Aggregations