use of com.oracle.graal.pointsto.BigBang in project graal by oracle.
the class CloneTypeFlow method onObservedUpdate.
@Override
public void onObservedUpdate(BigBang bb) {
/* Only a clone should be updated */
assert this.isClone() && context != null;
/* The input state has changed, clone its objects. */
TypeState inputState = input.getState();
TypeState currentState = getState();
TypeState resultState;
if (inputState.isEmpty() || inputState.isNull()) {
/* Nothing to be cloned if the input state is not a concrete type state. */
resultState = inputState.forNonNull(bb);
} else {
resultState = inputState.typesStream().filter(t -> !currentState.containsType(t)).map(type -> TypeState.forClone(bb, source, cloneSite, type, allocationContext)).reduce(TypeState.forEmpty(), (s1, s2) -> TypeState.forUnion(bb, s1, s2));
assert !resultState.canBeNull();
}
/* Update the clone flow state. */
addState(bb, resultState);
}
use of com.oracle.graal.pointsto.BigBang in project graal by oracle.
the class DynamicNewInstanceTypeFlow method onObservedUpdate.
@Override
public void onObservedUpdate(BigBang bb) {
/* Only a clone should be updated */
assert this.isClone();
/* The state of the new type provider has changed. */
TypeState newTypeState = newTypeFlow.getState();
TypeState currentTypeState = getState();
/* Generate a heap object for every new incoming type. */
TypeState resultState = newTypeState.typesStream().filter(t -> !currentTypeState.containsType(t)).map(type -> TypeState.forAllocation(bb, source, allocationSite, type, allocationContext)).reduce(TypeState.forEmpty(), (s1, s2) -> TypeState.forUnion(bb, s1, s2));
assert !resultState.canBeNull();
addState(bb, resultState);
}
use of com.oracle.graal.pointsto.BigBang in project graal by oracle.
the class PointsToStats method registerTypeState.
static void registerTypeState(BigBang bb, TypeState state) {
if (!bb.reportAnalysisStatistics()) {
return;
}
Integer id = stateToId.computeIfAbsent(state, (s) -> nextStateId.incrementAndGet());
TypeState actualState = idToState.computeIfAbsent(id, (i) -> state);
typeStateStats.computeIfAbsent(actualState, (s) -> new AtomicInteger()).incrementAndGet();
}
use of com.oracle.graal.pointsto.BigBang in project graal by oracle.
the class JNIAccessFeature method addField.
private static void addField(Field reflField, DuringAnalysisAccessImpl access) {
BigBang bigBang = access.getBigBang();
JNIAccessibleClass jniClass = addClass(reflField.getDeclaringClass(), access);
jniClass.addFieldIfAbsent(reflField.getName(), n -> {
AnalysisField field = access.getMetaAccess().lookupJavaField(reflField);
field.registerAsAccessed();
// Same as BigBang.addSystemField() and BigBang.addSystemStaticField():
// create type flows for any subtype of the field's declared type
TypeFlow<?> declaredTypeFlow = field.getType().getTypeFlow(bigBang, true);
if (field.isStatic()) {
declaredTypeFlow.addUse(bigBang, field.getStaticFieldFlow());
} else {
FieldTypeFlow instanceFieldFlow = field.getDeclaringClass().getContextInsensitiveAnalysisObject().getInstanceFieldFlow(bigBang, field, true);
declaredTypeFlow.addUse(bigBang, instanceFieldFlow);
}
return new JNIAccessibleField(jniClass, reflField.getName(), field.getJavaKind(), field.getModifiers());
});
}
use of com.oracle.graal.pointsto.BigBang 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();
}
}
Aggregations