1 19 20 25 26 27 28 29 30 31 32 package soot.coffi; 33 34 import java.util.Enumeration ; 35 import java.util.Vector ; 36 import java.util.*; 37 import soot.util.*; 38 import soot.*; 39 import java.util.*; 40 41 46 class BasicBlock { 47 48 public int size; 49 50 public Instruction head; 51 60 public Instruction tail; 61 64 public Vector succ; 65 68 public Vector pred; 69 70 public boolean inq; 71 72 public boolean beginException; 73 74 public boolean beginCode; 75 78 79 boolean done; 80 81 82 public BasicBlock next; 83 84 public long id; 86 private short wide; 88 91 92 private soot.jimple.Stmt stmt; 94 List statements; 95 Set addressesToFixup = new ArraySet(); 96 97 soot.jimple.Stmt getHeadJStmt() 98 { 99 return (soot.jimple.Stmt) statements.get(0); 100 } 101 102 soot.jimple.Stmt getTailJStmt() 103 { 104 return (soot.jimple.Stmt) statements.get(statements.size() - 1); 105 } 106 107 public BasicBlock(Instruction insts) { 108 id = G.v().coffi_BasicBlock_ids++; 109 head = insts; 110 tail = head; 111 size = 0; 112 if (head!=null) { 113 size++; 114 while (tail.next!=null) { 115 size++; 116 tail = tail.next; 117 } 118 } 119 succ = new Vector (2,10); 120 pred = new Vector (2,3); 121 } 122 123 public BasicBlock(Instruction headinsn, Instruction tailinsn) 124 { 125 id = G.v().coffi_BasicBlock_ids++; 126 head = headinsn; 127 tail = tailinsn; 128 succ = new Vector (2,10); 129 pred = new Vector (2,3); 130 } 131 132 137 public int hashCode() { 138 return (new Integer (head.label)).hashCode(); 139 } 140 141 146 public boolean equals(BasicBlock b) { 147 return (this == b); 148 } 149 150 152 public String toString() { return "BB: " + id; } 153 154 private int wideIndex(short b) { 157 int i = ((((int)wide)<<8)&0xff00) | (((int)b)&0xff); 158 wide = (byte)0; 159 return i; 160 } 161 162 } 163 | Popular Tags |