use of com.jopdesign.dfa.analyses.SymbolicAddress in project jop by jop-devel.
the class ObjectCacheAnalysis method addMissOnceConstraints.
/**
* Add miss once constraints for all subsegments in the persistence cover of the given segment
* @param segment
* @param ipetSolver
* @return
* @throws LpSolveException
* @throws InvalidFlowFactException
*/
@Override
public Set<SuperGraphEdge> addMissOnceConstraints(Segment segment, IPETSolver<SuperGraphEdge> ipetSolver) throws InvalidFlowFactException, LpSolveException {
Set<SuperGraphEdge> missEdges = new HashSet<SuperGraphEdge>();
Set<SuperGraphNode> alwaysMissNodes = new HashSet<SuperGraphNode>();
Collection<Segment> cover = findPersistenceSegmentCover(segment, EnumSet.allOf(PersistenceCheck.class), false, alwaysMissNodes);
int segmentCounter = 0;
for (Segment persistenceSegment : cover) {
/* we need to distinguish edges which are shared between persistence segments */
String key = KEY + "_" + (++segmentCounter);
LocalPointsToResult usedRefs = getUsedRefs(persistenceSegment);
/* Compute worst-case cost */
HashSet<SymbolicAddress> usedObjectsSet = new HashSet<SymbolicAddress>();
ObjectCacheIPETModel ocim = addObjectCacheCostEdges(persistenceSegment, usedRefs, objectCache.getCostModel(), ipetSolver);
missEdges.addAll(ocim.staticCostEdges);
missEdges.addAll(ocim.refMissEdges);
missEdges.addAll(ocim.blockMissEdges);
}
AccessCostInfo alwaysMissAccessInfo = extractAccessesAndCosts(alwaysMissNodes, null, objectCache.getCostModel());
missEdges.addAll(addStaticCost(segment, alwaysMissAccessInfo, ipetSolver));
return missEdges;
}
use of com.jopdesign.dfa.analyses.SymbolicAddress in project jop by jop-devel.
the class ObjectCacheAnalysis method countDistinctCachedTagsAccessed.
/**
* return number of distinct cached tags which might be accessed in the given scope
* <p>XXX: use segment instead of scope</p>
* @param scope
* @return the maximum number of distinct cached tags accessed
* @throws InvalidFlowFactException
* @throws LpSolveException
*/
public long countDistinctCachedTagsAccessed(ExecutionContext scope) throws InvalidFlowFactException, LpSolveException {
Long maxCachedTags = this.maxCachedTagsAccessed.get(scope);
if (maxCachedTags != null)
return maxCachedTags;
LocalPointsToResult usedRefs = getUsedRefs(scope);
/* Create an analysis segment */
Segment segment = Segment.methodSegment(scope.getMethodInfo(), scope.getCallString(), project, project.getCallstringLength(), project);
this.saturatedTypes.put(scope, getSaturatedTypes(segment, usedRefs));
/* Compute worst-case number of objects/fields accessed */
HashSet<SymbolicAddress> usedObjectsSet = new HashSet<SymbolicAddress>();
ObjectCacheCostModel costModel;
if (this.fieldAsTag) {
costModel = ObjectCacheCostModel.COUNT_FIELD_TAGS;
} else {
costModel = ObjectCacheCostModel.COUNT_REF_TAGS;
}
maxCachedTags = computeCacheCost(segment, usedRefs, costModel, usedObjectsSet).getCost();
this.tagSet.put(scope, usedObjectsSet);
maxCachedTagsAccessed.put(scope, maxCachedTags);
return maxCachedTags;
}
Aggregations