use of com.oracle.graal.pointsto.flow.context.object.AllocationContextSensitiveObject in project graal by oracle.
the class BytecodeAnalysisContextPolicy method calleeContext.
/**
* Captures the context of a method invocation.
* <p>
* Iterates over the list of {@linkplain BytecodeAnalysisContext context chains} of the receiver
* object, i.e. the contexts from which it's allocator method was invoked, and extends each of
* this chains with the current receiver's {@linkplain AnalysisObject analysis object}. The
* depth of each context chain is bounded to {@link PointstoOptions#MaxCallingContextDepth}.
* <p>
*
* @param bb the bigbang.
* @param receiverObject invocation's {@linkplain AnalysisObject receiver object}
* @return the list of {@link BytecodeAnalysisContext context chains} leading to this invocation
* extended with the current receiver object
*/
@Override
public BytecodeAnalysisContext calleeContext(BigBang bb, AnalysisObject receiverObject, BytecodeAnalysisContext callerContext, MethodTypeFlow callee) {
int maxCalleeContextDepth = callee.getLocalCallingContextDepth();
/*
* If the calling context depth is 0 return ContextChain.EMPTY_CONTEXT so that the unique
* clone is linked in.
*/
if (maxCalleeContextDepth == 0 || !receiverObject.isAllocationContextSensitiveObject()) {
return emptyContext();
}
AllocationContextSensitiveObject receiverHeapObject = (AllocationContextSensitiveObject) receiverObject;
/*
* If the context depth is greater than 0 and the receiver object has context information
* then extend the receiver's context by appending the receiver object allocation site,
* otherwise create a context containing the receiver object allocation site.
*/
BytecodeLocation[] labelList;
if (receiverHeapObject.allocationContext() != null) {
labelList = extend(((BytecodeAnalysisContext) receiverHeapObject.allocationContext()).labels(), receiverHeapObject.allocationLabel(), maxCalleeContextDepth);
} else {
// TODO remove branch if never taken
JVMCIError.shouldNotReachHere("CoreAnalysisContextPolicy.merge: receiverHeapObject.heapContext() is null");
labelList = new BytecodeLocation[] { receiverHeapObject.allocationLabel() };
}
return lookupContext(labelList);
}
Aggregations