// Sanity check
InstructionContext lastJSR = null;
int skip_jsr = 0;
for (int ss = oldchain.size() - 1; ss >= 0; ss--) {
if (skip_jsr < 0) {
throw new AssertionViolatedException("More RET than JSR in execution chain?!");
}
// System.err.println("+"+oldchain.get(ss));
if (((InstructionContext) oldchain.get(ss)).getInstruction()
.getInstruction() instanceof JsrInstruction)
{
if (skip_jsr == 0) {
lastJSR = (InstructionContext) oldchain.get(ss);
break;
} else {
skip_jsr--;
}
}
if (((InstructionContext) oldchain.get(ss)).getInstruction()
.getInstruction() instanceof RET)
{
skip_jsr++;
}
}
if (lastJSR == null) {
throw new AssertionViolatedException("RET without a JSR before in ExecutionChain?! EC: '"
+ oldchain + "'.");
}
JsrInstruction jsr = (JsrInstruction) lastJSR.getInstruction()
.getInstruction();
if (theSuccessor != cfg.contextOf(jsr.physicalSuccessor())) {
throw new AssertionViolatedException("RET '"
+ u.getInstruction()
+ "' info inconsistent: jump back to '"
+ theSuccessor + "' or '"
+ cfg.contextOf(jsr.physicalSuccessor()) + "'?");
}