Search in sources :

Example 6 with SymbolicAddress

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;
}
Also used : CallString(com.jopdesign.common.code.CallString) Segment(com.jopdesign.common.code.Segment) AccessCostInfo(com.jopdesign.wcet.analysis.cache.ObjectCacheAnalysis.AccessCostInfo) SuperGraphEdge(com.jopdesign.common.code.SuperGraph.SuperGraphEdge) SuperGraphNode(com.jopdesign.common.code.SuperGraph.SuperGraphNode) SymbolicAddress(com.jopdesign.dfa.analyses.SymbolicAddress) HashSet(java.util.HashSet)

Example 7 with SymbolicAddress

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;
}
Also used : SymbolicAddress(com.jopdesign.dfa.analyses.SymbolicAddress) Segment(com.jopdesign.common.code.Segment) HashSet(java.util.HashSet)

Aggregations

SymbolicAddress (com.jopdesign.dfa.analyses.SymbolicAddress)7 HashSet (java.util.HashSet)5 CallString (com.jopdesign.common.code.CallString)4 Segment (com.jopdesign.common.code.Segment)4 SuperGraphNode (com.jopdesign.common.code.SuperGraph.SuperGraphNode)4 AccessCostInfo (com.jopdesign.wcet.analysis.cache.ObjectCacheAnalysis.AccessCostInfo)3 BasicBlock (com.jopdesign.common.code.BasicBlock)2 SuperGraphEdge (com.jopdesign.common.code.SuperGraph.SuperGraphEdge)2 ObjectCacheCost (com.jopdesign.wcet.jop.ObjectCache.ObjectCacheCost)2 InstructionHandle (org.apache.bcel.generic.InstructionHandle)2 ContextEdge (com.jopdesign.common.code.CallGraph.ContextEdge)1 ExecutionContext (com.jopdesign.common.code.ExecutionContext)1 ObjectCacheAnalysis (com.jopdesign.wcet.analysis.cache.ObjectCacheAnalysis)1 ObjectCacheAnalysisDemo (com.jopdesign.wcet.analysis.cache.ObjectCacheAnalysisDemo)1 OCacheAnalysisResult (com.jopdesign.wcet.analysis.cache.ObjectCacheEvaluationResult.OCacheAnalysisResult)1 OCacheMode (com.jopdesign.wcet.analysis.cache.ObjectCacheEvaluationResult.OCacheMode)1 ObjectCache (com.jopdesign.wcet.jop.ObjectCache)1 FileNotFoundException (java.io.FileNotFoundException)1 PrintStream (java.io.PrintStream)1 ArrayList (java.util.ArrayList)1