+ mg.getName()
+ " is a special method and won't be modified.");
return orig;
}
InstructionList il = null;
InstructionHandle handle = null;
Instruction inst = null;
GETSTATIC getStatic = null;
Method m = null;
try {
il = mg.getInstructionList();
handle = il.getStart();
if (level_enters == SIMPLEENTER) {
insertEnter(mg, il, handle, cp);
insertFork(il, il.getStart(), handle.getPrev(), cp);
}
for (; handle != null; handle = handle.getNext()) {
inst = handle.getInstruction();
logger.info("next instruction: " + inst);
if (level_exits == SIMPLEEXIT
&& inst instanceof ReturnInstruction) {
InstructionHandle lastLogHandle = handle;
logger.info(
"Found a ReturnInstruction of type: "
+ inst.toString());
int stackSize =
inst.consumeStack(cp) - inst.produceStack(cp);
while (stackSize != 0) {
handle = handle.getPrev();
inst = handle.getInstruction();
logger.info("prev instruction: " + inst);
stackSize += inst.consumeStack(cp)
- inst.produceStack(cp);
}
InstructionHandle insertHandle =
insertExit(mg, il, handle, cp);
if (insertHandle != null) {
// We need to redirect branches etc.... twice
// so that the if fork doesn't get erroneous modified.
il.redirectBranches(handle, insertHandle);