Search in sources :

Example 11 with Block

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);
        }
    }
}
Also used : Block(soot.toolkits.graph.Block) Unit(soot.Unit)

Aggregations

Block (soot.toolkits.graph.Block)11 Unit (soot.Unit)5 LinkedList (java.util.LinkedList)3 DominatorNode (soot.toolkits.graph.DominatorNode)3 HashSet (java.util.HashSet)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Hashtable (java.util.Hashtable)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Set (java.util.Set)1 Body (soot.Body)1 Local (soot.Local)1 Trap (soot.Trap)1 UnitBox (soot.UnitBox)1 JasminAttribute (soot.tagkit.JasminAttribute)1 LineNumberTag (soot.tagkit.LineNumberTag)1 Tag (soot.tagkit.Tag)1 BlockGraph (soot.toolkits.graph.BlockGraph)1 BriefBlockGraph (soot.toolkits.graph.BriefBlockGraph)1