public ResourceValueAnalysis(MethodGen methodGen, CFG cfg, DepthFirstSearch dfs, ResourceTracker<Resource> resourceTracker, Resource resource) { super(dfs); this.methodGen = methodGen; this.cfg = cfg; this.resourceTracker = resourceTracker; this.resource = resource; this.visitor = resourceTracker.createVisitor(resource, methodGen.getConstantPool()); this.ignoreImplicitExceptions = resourceTracker.ignoreImplicitExceptions(resource); }
@Override public void initEntryFact(ResourceValueFrame result) { result.setValid(); result.clearStack(); final int numSlots = result.getNumSlots(); for (int i = 0; i < numSlots; ++i) { boolean slotContainsInstance = resourceTracker.isParamInstance(resource, i); result.setValue(i, slotContainsInstance ? ResourceValue.instance() : ResourceValue.notInstance()); } }
private ResourceCollection<Resource> buildResourceCollection(ClassContext classContext, Method method, ResourceTrackerType resourceTracker) throws CFGBuilderException, DataflowAnalysisException { ResourceCollection<Resource> resourceCollection = new ResourceCollection<>(); CFG cfg = classContext.getCFG(method); ConstantPoolGen cpg = classContext.getConstantPoolGen(); for (Iterator<Location> i = cfg.locationIterator(); i.hasNext();) { Location location = i.next(); Resource resource = resourceTracker.isResourceCreation(location.getBasicBlock(), location.getHandle(), cpg); if (resource != null) { resourceCollection.addCreatedResource(location, resource); } } return resourceCollection; }
if (resourceTracker.ignoreExceptionEdge(edge, resource, methodGen.getConstantPool())) { return; && resourceTracker.isResourceClose(fallThroughSuccessor, exceptionThrower, methodGen.getConstantPool(), resource, fact)) { tmpFact = modifyFrame(fact, tmpFact);
private boolean mightCloseResource(ClassContext classContext, Method method, ResourceTrackerType resourceTracker) throws CFGBuilderException, DataflowAnalysisException { CFG cfg = classContext.getCFG(method); ConstantPoolGen cpg = classContext.getConstantPoolGen(); for (Iterator<Location> i = cfg.locationIterator(); i.hasNext();) { Location location = i.next(); if (resourceTracker.mightCloseResource(location.getBasicBlock(), location.getHandle(), cpg)) { return true; } } return false; }
if (resourceTracker.ignoreExceptionEdge(edge, resource, methodGen.getConstantPool())) { return; && resourceTracker.isResourceClose(fallThroughSuccessor, exceptionThrower, methodGen.getConstantPool(), resource, fact)) { tmpFact = modifyFrame(fact, tmpFact);
private boolean mightCloseResource(ClassContext classContext, Method method, ResourceTrackerType resourceTracker) throws CFGBuilderException, DataflowAnalysisException { CFG cfg = classContext.getCFG(method); ConstantPoolGen cpg = classContext.getConstantPoolGen(); for (Iterator<Location> i = cfg.locationIterator(); i.hasNext();) { Location location = i.next(); if (resourceTracker.mightCloseResource(location.getBasicBlock(), location.getHandle(), cpg)) { return true; } } return false; }
public ResourceValueAnalysis(MethodGen methodGen, CFG cfg, DepthFirstSearch dfs, ResourceTracker<Resource> resourceTracker, Resource resource) { super(dfs); this.methodGen = methodGen; this.cfg = cfg; this.resourceTracker = resourceTracker; this.resource = resource; this.visitor = resourceTracker.createVisitor(resource, methodGen.getConstantPool()); this.ignoreImplicitExceptions = resourceTracker.ignoreImplicitExceptions(resource); }
@Override public void initEntryFact(ResourceValueFrame result) { result.setValid(); result.clearStack(); final int numSlots = result.getNumSlots(); for (int i = 0; i < numSlots; ++i) { boolean slotContainsInstance = resourceTracker.isParamInstance(resource, i); result.setValue(i, slotContainsInstance ? ResourceValue.instance() : ResourceValue.notInstance()); } }
private ResourceCollection<Resource> buildResourceCollection(ClassContext classContext, Method method, ResourceTrackerType resourceTracker) throws CFGBuilderException, DataflowAnalysisException { ResourceCollection<Resource> resourceCollection = new ResourceCollection<Resource>(); CFG cfg = classContext.getCFG(method); ConstantPoolGen cpg = classContext.getConstantPoolGen(); for (Iterator<Location> i = cfg.locationIterator(); i.hasNext();) { Location location = i.next(); Resource resource = resourceTracker.isResourceCreation(location.getBasicBlock(), location.getHandle(), cpg); if (resource != null) { resourceCollection.addCreatedResource(location, resource); } } return resourceCollection; }