use of org.apache.bcel.generic.InstructionHandle in project jop by jop-devel.
the class InstructionInterpreter method interpret.
public void interpret(boolean initialize) {
InstructionList il = methodInfo.getCode().getInstructionList(true, false);
InstructionHandle entry = il.getStart();
Map<InstructionHandle, T> start = new HashMap<InstructionHandle, T>();
start.put(entry, initialize ? analysis.initial(entry) : analysis.bottom());
// start at exception handler entries too?
if (startAtExceptionHandlers) {
for (CodeExceptionGen eg : methodInfo.getCode().getExceptionHandlers()) {
InstructionHandle ih = eg.getHandlerPC();
start.put(ih, initialize ? analysis.initial(eg) : analysis.bottom());
}
}
interpret(il, start, initialize);
}
use of org.apache.bcel.generic.InstructionHandle in project jop by jop-devel.
the class InstructionInterpreter method interpret.
public void interpret(InstructionHandle entry, boolean initialize) {
// TODO we could use the CFG instead if it exists ?
InstructionList il = methodInfo.getCode().getInstructionList(true, false);
Map<InstructionHandle, T> start = new HashMap<InstructionHandle, T>(1);
start.put(entry, initialize ? analysis.initial(entry) : analysis.bottom());
interpret(il, start, initialize);
}
use of org.apache.bcel.generic.InstructionHandle in project jop by jop-devel.
the class BasicBlock method getTheInvokeInstruction.
/**
* Get the invoke instruction of the basic block (which must be
* the only instruction in the basic block)
*
* @return the invoke instruction, or <code>null</code>, if the basic block doesn't
* contain an invoke instruction or if it is a special invoke.
* @throws ControlFlowGraph.ControlFlowError
* if there is more than one invoke instruction in the block.
* @see ProcessorModel#isSpecialInvoke(MethodInfo, Instruction)
*/
public InstructionHandle getTheInvokeInstruction() {
InstructionHandle theInvInstr = null;
for (InstructionHandle ih : this.instructions) {
if (!(ih.getInstruction() instanceof InvokeInstruction))
continue;
InvokeInstruction inv = (InvokeInstruction) ih.getInstruction();
if (this.getAppInfo().getProcessorModel().isSpecialInvoke(methodCode.getMethodInfo(), inv)) {
continue;
}
if (theInvInstr != null) {
throw new ControlFlowGraph.ControlFlowError("More than one invoke instruction in a basic block");
}
theInvInstr = ih;
}
return theInvInstr;
}
use of org.apache.bcel.generic.InstructionHandle in project jop by jop-devel.
the class BasicBlock method getStartLine.
/**
* @return a human readable string representation of the location of the first instruction
* in the basic block
*/
public String getStartLine() {
ClassInfo cls = null;
int line = -1;
for (InstructionHandle ih : instructions) {
cls = methodCode.getSourceClassInfo(ih);
line = methodCode.getLineNumber(this.getFirstInstruction());
if (line >= 0)
break;
}
if (line >= 0) {
return cls.getSourceFileName() + ":" + line;
} else {
return getMethodInfo().getClassInfo().getSourceFileName() + ":" + getMethodInfo().getFQMethodName();
}
}
use of org.apache.bcel.generic.InstructionHandle in project jop by jop-devel.
the class BasicBlock method getSourceLines.
/**
* @return all source code lines this basic block maps to
*/
public Map<ClassInfo, TreeSet<Integer>> getSourceLines() {
Map<ClassInfo, TreeSet<Integer>> map = new HashMap<ClassInfo, TreeSet<Integer>>(2);
for (InstructionHandle ih : instructions) {
ClassInfo cls = methodCode.getSourceClassInfo(ih);
TreeSet<Integer> lines = map.get(cls);
if (lines == null) {
lines = new TreeSet<Integer>();
map.put(cls, lines);
}
int line = methodCode.getLineNumber(ih);
if (line >= 0)
lines.add(line);
}
return map;
}
Aggregations