use of com.jopdesign.dfa.framework.Interpreter in project jop by jop-devel.
the class DFATool method runLocalAnalysis.
public <K, V> Map runLocalAnalysis(Analysis<K, V> localAnalysis, ExecutionContext scope) {
Interpreter<K, V> interpreter = new Interpreter<K, V>(localAnalysis, this);
if (scope == null)
throw new AssertionError("No such method: " + scope);
Context context = new Context();
MethodCode entryCode = scope.getMethodInfo().getCode();
context.stackPtr = entryCode.getMaxLocals();
context.setMethodInfo(scope.getMethodInfo());
context.setCallString(scope.getCallString());
localAnalysis.initialize(scope.getMethodInfo(), context);
/* Here used to be a extremely-hard-to-trackdown bug!
* Without the boolean parameters, getInstructionList() will dispose
* the CFG, a very bad idea during WCET analysis which relies on
* pointer equality for CFG edges :(
*/
InstructionHandle entry = entryCode.getInstructionList(false, false).getStart();
interpreter.interpret(context, entry, new LinkedHashMap<InstructionHandle, ContextMap<K, V>>(), true);
return localAnalysis.getResult();
}
use of com.jopdesign.dfa.framework.Interpreter in project jop by jop-devel.
the class DFATool method runAnalysis.
@SuppressWarnings("unchecked")
public Map runAnalysis(Analysis analysis) {
/* use cached results if possible */
Map results;
if ((results = getCachedResults(analysis)) != null) {
logger.warn("Analysis " + analysis.getId() + ": Using cached DFA analysis results");
return results;
}
Interpreter interpreter = new Interpreter(analysis, this);
MethodInfo main = appInfo.getMainMethod();
MethodInfo prologue = main.getClassInfo().getMethodInfo(prologueName + prologueSig);
Context context = new Context();
context.stackPtr = 0;
context.syncLevel = 0;
context.setMethodInfo(prologue);
analysis.initialize(main, context);
InstructionHandle entry = prologue.getCode().getInstructionList().getStart();
interpreter.interpret(context, entry, new LinkedHashMap(), true);
/* cache results if requested */
writeCachedResults(analysis);
return analysis.getResult();
}
Aggregations