Search in sources :

Example 1 with AppInfoException

use of com.jopdesign.common.misc.AppInfoException in project jop by jop-devel.

the class MethodCacheAnalysis method checkCache.

/**
 * Check that cache is big enough to hold any method possibly invoked
 * Return largest method
 */
public static MethodInfo checkCache(WCETTool wcetTool, Iterable<MethodInfo> methods) throws AppInfoException {
    MethodCache methodCache = wcetTool.getWCETProcessorModel().getMethodCache();
    int maxWords = 0;
    MethodInfo largestMethod = null;
    // for (ClassInfo ci : project.getAppInfo().getClassInfos()) {
    for (MethodInfo mi : methods) {
        MethodCode code = mi.getCode();
        if (code == null)
            continue;
        // FIXME: using getNumberOfBytes(false) here to be compatible to old behaviour.
        // should probably be getNumberOfBytes()
        int size = code.getNumberOfBytes(false);
        int words = MiscUtils.bytesToWords(size);
        if (!methodCache.fitsInCache(words)) {
            throw new AppInfoException("Cache to small for target method: " + mi.getFQMethodName() + " / " + words + " words");
        }
        if (words >= maxWords) {
            largestMethod = mi;
            maxWords = words;
        }
    }
    return largestMethod;
}
Also used : MethodCache(com.jopdesign.wcet.jop.MethodCache) MethodInfo(com.jopdesign.common.MethodInfo) AppInfoException(com.jopdesign.common.misc.AppInfoException) MethodCode(com.jopdesign.common.MethodCode)

Example 2 with AppInfoException

use of com.jopdesign.common.misc.AppInfoException in project jop by jop-devel.

the class WCETTool method rebuildCallGraph.

/**
 * Rebuild the WCET callgraph, starting at the target method.
 * The new callgraph will be based on (but not backed by) the AppInfo callgraph, if available.
 *
 * @return the new callgraph.
 */
public CallGraph rebuildCallGraph() {
    /* This would be the ideal solution, but this way the root
    	 * does NOT have an empty callstring
    	 */
    // callGraph = appInfo.getCallGraph().getSubGraph(projectConfig.getTargetMethodInfo());
    /* Instead, we create a new "subgraph" based on the appInfo callgraph (which has been created using
         * DFA results if available in initialize() or by some other tool), where the target method has an empty
         * callstring, using the callstring length configured for the WCET tool (which is currently the same
         * as the global setting).
         */
    DefaultCallgraphBuilder callGraphBuilder = new CFGCallgraphBuilder(getCallstringLength());
    // we do not want natives in the callgraph
    callGraphBuilder.setSkipNatives(true);
    callGraph = CallGraph.buildCallGraph(getTargetMethod(), callGraphBuilder);
    try {
        callGraph.checkAcyclicity();
    } catch (AppInfoException e) {
        throw new AssertionError(e);
    }
    return callGraph;
}
Also used : CFGCallgraphBuilder(com.jopdesign.common.code.CFGCallgraphBuilder) DefaultCallgraphBuilder(com.jopdesign.common.code.DefaultCallgraphBuilder) AppInfoException(com.jopdesign.common.misc.AppInfoException)

Aggregations

AppInfoException (com.jopdesign.common.misc.AppInfoException)2 MethodCode (com.jopdesign.common.MethodCode)1 MethodInfo (com.jopdesign.common.MethodInfo)1 CFGCallgraphBuilder (com.jopdesign.common.code.CFGCallgraphBuilder)1 DefaultCallgraphBuilder (com.jopdesign.common.code.DefaultCallgraphBuilder)1 MethodCache (com.jopdesign.wcet.jop.MethodCache)1