use of com.oracle.graal.pointsto.flow.context.AnalysisContext in project graal by oracle.
the class MethodTypeFlow method addContext.
/**
* Add the context, if not already added, and return the method flows clone from that context.
*/
public MethodFlowsGraph addContext(BigBang bb, AnalysisContext calleeContext, InvokeTypeFlow reason) {
// make sure that the method is parsed before attempting to clone it;
// the parsing should always happen on the same thread
this.ensureParsed(bb, reason);
AnalysisContext newContext = bb.contextPolicy().peel(calleeContext, localCallingContextDepth);
MethodFlowsGraph methodFlows = clonedMethodFlows.get(newContext);
if (methodFlows == null) {
MethodFlowsGraph newFlows = new MethodFlowsGraph(method, newContext);
newFlows.cloneOriginalFlows(bb);
MethodFlowsGraph oldFlows = clonedMethodFlows.putIfAbsent(newContext, newFlows);
methodFlows = oldFlows != null ? oldFlows : newFlows;
if (oldFlows == null) {
// link uses after adding the clone to the map since linking uses might trigger
// updates to the current method in the current context
methodFlows.linkClones(bb);
}
}
return methodFlows;
}
use of com.oracle.graal.pointsto.flow.context.AnalysisContext in project graal by oracle.
the class CloneTypeFlow method copy.
@Override
public TypeFlow<ValueNode> copy(BigBang bb, MethodFlowsGraph methodFlows) {
AnalysisContext enclosingContext = methodFlows.context();
AnalysisContext allocContext = bb.contextPolicy().allocationContext(enclosingContext, PointstoOptions.MaxHeapContextDepth.getValue(bb.getOptions()));
return new CloneTypeFlow(bb, this, methodFlows, allocContext);
}
use of com.oracle.graal.pointsto.flow.context.AnalysisContext in project graal by oracle.
the class DynamicNewInstanceTypeFlow method copy.
@Override
public TypeFlow<ValueNode> copy(BigBang bb, MethodFlowsGraph methodFlows) {
AnalysisContext enclosingContext = methodFlows.context();
AnalysisContext allocContext = bb.contextPolicy().allocationContext(enclosingContext, PointstoOptions.MaxHeapContextDepth.getValue(bb.getOptions()));
return new DynamicNewInstanceTypeFlow(bb, this, methodFlows, allocContext);
}
use of com.oracle.graal.pointsto.flow.context.AnalysisContext in project graal by oracle.
the class SpecialInvokeTypeFlow method onObservedUpdate.
@Override
public void onObservedUpdate(BigBang bb) {
assert this.isClone();
/*
* Initialize the callee lazily so that if the invoke flow is not reached in this context,
* i.e. for this clone, there is no callee linked.
*/
if (callee == null) {
MethodCallTargetNode target = (MethodCallTargetNode) invoke.callTarget();
callee = ((AnalysisMethod) target.targetMethod()).getTypeFlow();
// set the callee in the original invoke too
((DirectInvokeTypeFlow) originalInvoke).callee = callee;
}
TypeState invokeState = getReceiver().getState();
for (AnalysisObject receiverObject : invokeState.objects()) {
AnalysisContext calleeContext = bb.contextPolicy().calleeContext(bb, receiverObject, callerContext, callee);
MethodFlowsGraph calleeFlows = callee.addContext(bb, calleeContext, this);
if (calleesFlows.putIfAbsent(calleeFlows, Boolean.TRUE) == null) {
linkCallee(bb, false, calleeFlows);
}
updateReceiver(bb, calleeFlows, receiverObject);
}
}
use of com.oracle.graal.pointsto.flow.context.AnalysisContext in project graal by oracle.
the class NewInstanceTypeFlow method cloneSourceState.
/**
* Create the type state for a clone.
*/
protected TypeState cloneSourceState(BigBang bb, MethodFlowsGraph methodFlows) {
assert !this.isClone();
AnalysisContext allocatorContext = methodFlows.context();
AnalysisContext allocationContext = bb.contextPolicy().allocationContext(allocatorContext, PointstoOptions.MaxHeapContextDepth.getValue(bb.getOptions()));
if (bb.analysisPolicy().isContextSensitiveAllocation(bb, type, allocationContext)) {
/*
* If the analysis is context sensitive create a new heap object for the new context, or
* return an existing one. The original NewInstanceTypeFlow is the one that stores the
* (Context->HeapObject) mapping.
*/
AnalysisObject newHeapObject = createHeapObject(bb, allocationContext);
return TypeState.forNonNullObject(bb, newHeapObject);
} else {
/*
* In the heap insensitive case instead of more precise heap abstractions (i.e.
* allocation site) we use just the type of the object wrapped into the AbstractObject
* base class. There is no cloning in this case.
*/
return TypeState.forExactType(bb, type, false);
}
}
Aggregations