use of soot.toolkits.graph.Block in project soot by Sable.
the class GroupIntPair method calculateLogicalStackHeightCheck.
private void calculateLogicalStackHeightCheck(Block aBlock) {
int blockHeight = blockToLogicalStackHeight.get(aBlock).intValue();
for (Unit u : aBlock) {
Inst nInst = (Inst) u;
blockHeight -= nInst.getInCount();
if (blockHeight < 0) {
throw new RuntimeException("Negative Stack Logical height has been attained: \n" + "StackHeight: " + blockHeight + "\nAt instruction:" + nInst + "\nBlock:\n" + aBlock + "\n\nMethod: " + aBlock.getBody().getMethod().getName() + "\n" + aBlock.getBody().getMethod());
}
blockHeight += nInst.getOutCount();
// logger.debug(">>> " + nInst + " " + blockHeight);
}
for (Block b : aBlock.getSuccs()) {
Integer i = blockToLogicalStackHeight.get(b);
if (i != null) {
if (i.intValue() != blockHeight) {
throw new RuntimeException("incoherent logical stack height at block merge point " + b + aBlock);
}
} else {
blockToLogicalStackHeight.put(b, new Integer(blockHeight));
calculateLogicalStackHeightCheck(b);
}
}
}
Aggregations