/** * Return whether or not the given instruction can throw exceptions. * * @param handle * the instruction * @return true if the instruction can throw an exception, false otherwise */ private boolean isPEI(InstructionHandle handle) { Instruction ins = handle.getInstruction(); if (!(ins instanceof ExceptionThrower)) return false; if (ins instanceof NEW) return false; // if (ins instanceof ATHROW) return false; if (ins instanceof GETSTATIC) return false; if (ins instanceof PUTSTATIC) return false; if (ins instanceof ReturnInstruction) return false; if (ins instanceof INSTANCEOF) return false; if (ins instanceof MONITOREXIT) return false; if (ins instanceof LDC) return false; return true; }
public int getDelta(Instruction ins, ValueNumberFrame frame) throws DataflowAnalysisException { int delta = 0; if (ins instanceof MONITORENTER) { if (frame == null || !isThisValue(frame.getTopValue())) ++delta; } else if (ins instanceof MONITOREXIT) { if (frame == null || !isThisValue(frame.getTopValue())) --delta; } return delta; }
public int getDelta(Instruction ins, ValueNumberFrame frame) throws DataflowAnalysisException { int delta = 0; if (ins instanceof MONITORENTER) ++delta; else if (ins instanceof MONITOREXIT) --delta; return delta; }
/** * Scan a method for self call sites. * * @param node * the CallGraphNode for the method to be scanned */ private void scan(CallGraphNode node) throws CFGBuilderException { Method method = node.getMethod(); CFG cfg = classContext.getCFG(method); if (method.isSynchronized()) hasSynchronization = true; Iterator<BasicBlock> i = cfg.blockIterator(); while (i.hasNext()) { BasicBlock block = i.next(); Iterator<InstructionHandle> j = block.instructionIterator(); while (j.hasNext()) { InstructionHandle handle = j.next(); Instruction ins = handle.getInstruction(); if (ins instanceof InvokeInstruction) { InvokeInstruction inv = (InvokeInstruction) ins; Method called = isSelfCall(inv); if (called != null) { // Add edge to call graph CallSite callSite = new CallSite(method, block, handle); callGraph.createEdge(node, callGraph.getNodeForMethod(called), callSite); // Add to called method set calledMethodSet.add(called); } } else if (ins instanceof MONITORENTER || ins instanceof MONITOREXIT) { hasSynchronization = true; } } } }