private void emitInstruction(SSAInstruction s) { if (s != null) { instructions[getCurrentInstructionIndex()] = s; for (int i = 0; i < s.getNumberOfDefs(); i++) { if (creators.length < (s.getDef(i) + 1)) { creators = Arrays.copyOf(creators, 2 * s.getDef(i)); } assert s.getDef(i) != -1 : "invalid def " + i + " for " + s; creators[s.getDef(i)] = s; } } }
/** * If we've already created the current instruction, return the value number representing the exception the instruction may * throw. Else, create a new symbol */ private int reuseOrCreateException() { if (getCurrentInstruction() != null) { assert getCurrentInstruction() instanceof SSAInvokeInstruction; } if (getCurrentInstruction() == null) { return symbolTable.newSymbol(); } else { SSAInvokeInstruction s = (SSAInvokeInstruction) getCurrentInstruction(); return s.getException(); } }
/** * If we've already created the current instruction, return the value number representing the exception the instruction may * throw. Else, create a new symbol */ private int reuseOrCreateException() { if (getCurrentInstruction() != null) { assert getCurrentInstruction() instanceof SSAInvokeInstruction; } if (getCurrentInstruction() == null) { return symbolTable.newSymbol(); } else { SSAInvokeInstruction s = (SSAInvokeInstruction) getCurrentInstruction(); return s.getException(); } }
private SSAInstruction getCurrentInstruction() { return instructions[getCurrentInstructionIndex()]; }
private SSAInstruction getCurrentInstruction() { return instructions[getCurrentInstructionIndex()]; }
private SSABuilder(IBytecodeMethod method, SSACFG cfg, ShrikeCFG scfg, SSAInstruction[] instructions, SymbolTable symbolTable, boolean buildLocalMap, SSAPiNodePolicy piNodePolicy) { super(scfg); localMap = buildLocalMap ? new SSA2LocalMap(scfg, instructions.length, cfg.getNumberOfNodes()) : null; init(new SymbolTableMeeter(symbolTable, cfg, scfg), new SymbolicPropagator(scfg, instructions, symbolTable, localMap, cfg, piNodePolicy)); this.method = method; this.symbolTable = symbolTable; this.insts = method.getDeclaringClass().getClassLoader().getInstructionFactory(); this.bytecodeIndirections = method.getIndirectionData(); this.ssaIndirections = new ShrikeIndirectionData(instructions.length); assert cfg != null : "Null CFG"; }
public SymbolicPropagator(ShrikeCFG shrikeCFG, SSAInstruction[] instructions, SymbolTable symbolTable, SSA2LocalMap localMap, SSACFG cfg, SSAPiNodePolicy piNodePolicy) { super(shrikeCFG); this.piNodePolicy = piNodePolicy; this.cfg = cfg; this.creators = new SSAInstruction[0]; this.shrikeCFG = shrikeCFG; this.instructions = instructions; this.symbolTable = symbolTable; this.loader = shrikeCFG.getMethod().getDeclaringClass().getClassLoader().getReference(); this.localMap = localMap; init(this.new NodeVisitor(), this.new EdgeVisitor()); }
private void maybeInsertPi(SSAAbstractInvokeInstruction call) { if (piNodePolicy != null) { Pair<Integer, SSAInstruction> pi = piNodePolicy.getPi(call, symbolTable); if (pi != null) { reuseOrCreatePi(pi.snd, pi.fst); } } }
public SymbolicPropagator(ShrikeCFG shrikeCFG, SSAInstruction[] instructions, SymbolTable symbolTable, SSA2LocalMap localMap, SSACFG cfg, SSAPiNodePolicy piNodePolicy) { super(shrikeCFG); this.piNodePolicy = piNodePolicy; this.cfg = cfg; this.creators = new SSAInstruction[0]; this.shrikeCFG = shrikeCFG; this.instructions = instructions; this.symbolTable = symbolTable; this.loader = shrikeCFG.getMethod().getDeclaringClass().getClassLoader().getReference(); this.localMap = localMap; init(this.new NodeVisitor(), this.new EdgeVisitor()); }
private SSABuilder(IBytecodeMethod method, SSACFG cfg, ShrikeCFG scfg, SSAInstruction[] instructions, SymbolTable symbolTable, boolean buildLocalMap, SSAPiNodePolicy piNodePolicy) { super(scfg); localMap = buildLocalMap ? new SSA2LocalMap(scfg, instructions.length, cfg.getNumberOfNodes()) : null; init(new SymbolTableMeeter(symbolTable, cfg, scfg), new SymbolicPropagator(scfg, instructions, symbolTable, localMap, cfg, piNodePolicy)); this.method = method; this.symbolTable = symbolTable; this.insts = method.getDeclaringClass().getClassLoader().getInstructionFactory(); this.bytecodeIndirections = method.getIndirectionData(); this.ssaIndirections = new ShrikeIndirectionData(instructions.length); assert cfg != null : "Null CFG"; }
private void reuseOrCreatePi(SSAInstruction piCause, int ref) { int n = getCurrentInstructionIndex(); SSACFG.BasicBlock bb = cfg.getBlockForInstruction(n); BasicBlock path = getCurrentSuccessor(); int outNum = shrikeCFG.getNumber(path); SSAPiInstruction pi = bb.getPiForRefAndPath(ref, path); if (pi == null) { pi = insts.PiInstruction(SSAInstruction.NO_INDEX, symbolTable.newSymbol(), ref, bb.getNumber(), outNum, piCause); bb.addPiForRefAndPath(ref, path, pi); } workingState.replaceValue(ref, pi.getDef()); }
private void maybeInsertPi(SSAAbstractInvokeInstruction call) { if (piNodePolicy != null) { Pair<Integer, SSAInstruction> pi = piNodePolicy.getPi(call, symbolTable); if (pi != null) { reuseOrCreatePi(pi.snd, pi.fst); } } }
/** * If we've already created the current instruction, return the value number def'ed by the current instruction. Else, create a * new symbol. */ private int reuseOrCreateDef() { if (getCurrentInstruction() == null) { return symbolTable.newSymbol(); } else { return getCurrentInstruction().getDef(); } }
/** * If we've already created the current instruction, return the value number def'ed by the current instruction. Else, create a * new symbol. */ private int reuseOrCreateDef() { if (getCurrentInstruction() == null) { return symbolTable.newSymbol(); } else { return getCurrentInstruction().getDef(); } }
private void maybeInsertPi(SSAConditionalBranchInstruction cond) { if (piNodePolicy != null) { for (Pair<Integer, SSAInstruction> pi : piNodePolicy.getPis(cond, getDef(cond.getUse(0)), getDef(cond.getUse(1)), symbolTable)) { if (pi != null) { reuseOrCreatePi(pi.snd, pi.fst); } } } }
private void emitInstruction(SSAInstruction s) { if (s != null) { instructions[getCurrentInstructionIndex()] = s; for (int i = 0; i < s.getNumberOfDefs(); i++) { if (creators.length < (s.getDef(i) + 1)) { creators = Arrays.copyOf(creators, 2 * s.getDef(i)); } assert s.getDef(i) != -1 : "invalid def " + i + " for " + s; creators[s.getDef(i)] = s; } } }
private void reuseOrCreatePi(SSAInstruction piCause, int ref) { int n = getCurrentInstructionIndex(); SSACFG.BasicBlock bb = cfg.getBlockForInstruction(n); BasicBlock path = getCurrentSuccessor(); int outNum = shrikeCFG.getNumber(path); SSAPiInstruction pi = bb.getPiForRefAndPath(ref, path); if (pi == null) { pi = insts.PiInstruction(SSAInstruction.NO_INDEX, symbolTable.newSymbol(), ref, bb.getNumber(), outNum, piCause); bb.addPiForRefAndPath(ref, path, pi); } workingState.replaceValue(ref, pi.getDef()); }
private void maybeInsertPi(SSAConditionalBranchInstruction cond) { if (piNodePolicy != null) { for (Pair<Integer, SSAInstruction> pi : piNodePolicy.getPis(cond, getDef(cond.getUse(0)), getDef(cond.getUse(1)), symbolTable)) { if (pi != null) { reuseOrCreatePi(pi.snd, pi.fst); } } } }