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;
}
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;
}
Aggregations