/** * This method should never return null. * * @return the set of exception types that an instruction might throw ... disregarding athrows and invokes. */ public Collection<TypeReference> getExceptionTypes() { assert !isPEI(); return Collections.emptySet(); }
/** * This method should never return null. * * @return the set of exception types that an instruction might throw ... disregarding athrows and invokes. */ public Collection<TypeReference> getExceptionTypes() { assert !isPEI(); return Collections.emptySet(); }
/** * Add any exceptional edges generated by the last instruction in a basic block. * * @param last the last instruction in a basic block. */ private void addExceptionalEdges(SSAInstruction last) { if (last == null) { // XXX: Bug here? // throw new IllegalStateException("Missing last SSA-Instruction in basic block (null)."); // XXX: When does this happen? System.err.println("Missing last SSA-Instruction in basic block (null)."); return; } if (last.isPEI()) { // we don't currently model catch blocks here ... instead just link // to the exit block addExceptionalEdgeTo(exit()); } }
/** * @return an instruction which may throw exceptions, or null if this block * can't throw exceptions */ public static SSAInstruction getThrowingInstruction(ISSABasicBlock block) { SSAInstruction result = null; if (block.getLastInstructionIndex() >= 0) { SSAInstruction lastInstruction = block.getLastInstruction(); if (lastInstruction != null && lastInstruction.isPEI()) { result = lastInstruction; } } return result; }
/** * Add any exceptional edges generated by the last instruction in a basic block. * * @param last the last instruction in a basic block. */ private void addExceptionalEdges(SSAInstruction last) { if (last == null) { // XXX: Bug here? // throw new IllegalStateException("Missing last SSA-Instruction in basic block (null)."); // XXX: When does this happen? System.err.println("Missing last SSA-Instruction in basic block (null)."); return; } if (last.isPEI()) { // we don't currently model catch blocks here ... instead just link // to the exit block addExceptionalEdgeTo(exit()); } }
public boolean endsInPEI() { return getInstructions()[getLastInstructionIndex()].isPEI(); }
/** * @return an instruction which may throw exceptions, or null if this block * can't throw exceptions */ public static SSAInstruction getThrowingInstruction(ISSABasicBlock block) { SSAInstruction result = null; if (block.getLastInstructionIndex() >= 0) { SSAInstruction lastInstruction = block.getLastInstruction(); if (lastInstruction != null && lastInstruction.isPEI()) { result = lastInstruction; } } return result; }
public boolean endsInPEI() { return getInstructions()[getLastInstructionIndex()].isPEI(); }
/** * create mappings from call sites, new sites, and PEIs to instruction index */ protected void setupLocationMap() { for (int i = 0; i < instructions.length; i++) { SSAInstruction x = instructions[i]; if (x != null) { if (x instanceof SSAAbstractInvokeInstruction) { callSiteMapping.add(((SSAAbstractInvokeInstruction) x).getCallSite().getProgramCounter(), i); } if (x instanceof SSANewInstruction) { newSiteMapping.put(((SSANewInstruction) x).getNewSite(), Integer.valueOf(i)); } if (x.isPEI()) { peiMapping.put(new ProgramCounter(cfg.getProgramCounter(i)), Integer.valueOf(i)); } } } }
/** * create mappings from call sites, new sites, and PEIs to instruction index */ protected void setupLocationMap() { for (int i = 0; i < instructions.length; i++) { SSAInstruction x = instructions[i]; if (x != null) { if (x instanceof SSAAbstractInvokeInstruction) { callSiteMapping.add(((SSAAbstractInvokeInstruction) x).getCallSite().getProgramCounter(), i); } if (x instanceof SSANewInstruction) { newSiteMapping.put(((SSANewInstruction) x).getNewSite(), Integer.valueOf(i)); } if (x.isPEI()) { peiMapping.put(new ProgramCounter(cfg.getProgramCounter(i)), Integer.valueOf(i)); } } } }
for (ISSABasicBlock block : ir.getControlFlowGraph()) { SSAInstruction throwingInstruction = getThrowingInstruction(block); if (throwingInstruction != null && throwingInstruction.isPEI()) { Set<TypeReference> thrownExceptions = collectThrownExceptions(throwingInstruction); Set<TypeReference> caughtExceptions = collectCaughtExceptions(block);
for (ISSABasicBlock block : ir.getControlFlowGraph()) { SSAInstruction throwingInstruction = getThrowingInstruction(block); if (throwingInstruction != null && throwingInstruction.isPEI()) { Set<TypeReference> thrownExceptions = collectThrownExceptions(throwingInstruction); Set<TypeReference> caughtExceptions = collectCaughtExceptions(block);
/** * @return {@link IntSet} representing instruction indices of each PEI in the ir */ private static IntSet getPEIs(final IR ir) { BitVectorIntSet result = new BitVectorIntSet(); for (int i = 0; i < ir.getInstructions().length; i++) { if (ir.getInstructions()[i] != null && ir.getInstructions()[i].isPEI()) { result.add(i); } } return result; }
/** * @return {@link IntSet} representing instruction indices of each PEI in the ir */ private static IntSet getPEIs(final IR ir) { BitVectorIntSet result = new BitVectorIntSet(); for (int i = 0; i < ir.getInstructions().length; i++) { if (ir.getInstructions()[i] != null && ir.getInstructions()[i].isPEI()) { result.add(i); } } return result; }
public State nullPointerExceptionThrowState(SSAInstruction instruction) { assert instruction != null; if (instruction.isPEI() && instruction.getExceptionTypes().contains( TypeReference.JavaLangNullPointerException)) { final NullPointerState blockState = this.solver.getIn(this.ir .getBasicBlockForInstruction(instruction)); final RelevantVariableFinder finder = new RelevantVariableFinder( instruction); assert finder.getVarNum() >= 0; return blockState.getState(finder.getVarNum()); } return State.NOT_NULL; } }
public State nullPointerExceptionThrowState(SSAInstruction instruction) { assert instruction != null; if (instruction.isPEI() && instruction.getExceptionTypes().contains( TypeReference.JavaLangNullPointerException)) { final NullPointerState blockState = this.solver.getIn(this.ir .getBasicBlockForInstruction(instruction)); final RelevantVariableFinder finder = new RelevantVariableFinder( instruction); assert finder.getVarNum() >= 0; return blockState.getState(finder.getVarNum()); } return State.NOT_NULL; } }
if (pei != null && pei.isPEI()) { if (DEBUG) { System.err.println("PEI: " + pei + " index " + index + " PC " + g.getProgramCounter(index));
if (pei != null && pei.isPEI()) { if (DEBUG) { System.err.println("PEI: " + pei + " index " + index + " PC " + g.getProgramCounter(index));
private static void checkRemovingNormalOk(CGNode node, ControlFlowGraph<SSAInstruction, ISSABasicBlock> cfg, ISSABasicBlock block, ISSABasicBlock normalSucc) { if (!block.getLastInstruction().isPEI() || !filter.getFilter(node).alwaysThrowsException(block.getLastInstruction())) { specialCaseThrowFiltered(cfg, normalSucc); } else { assertTrue(block.getLastInstruction().isPEI()); assertTrue(filter.getFilter(node).alwaysThrowsException(block.getLastInstruction())); } }