/** * Constructor. * * @param handle * the handle of the instruction whose targets should be * enumerated * @param constPoolGen * the ConstantPoolGen object for the class */ public TargetEnumeratingVisitor(InstructionHandle handle, ConstantPoolGen constPoolGen) { this.handle = handle; this.constPoolGen = constPoolGen; targetList = new LinkedList<>(); isBranch = isReturn = isThrow = isExit = false; handle.getInstruction().accept(this); }
/** * Analyze the given Instruction. * * @param ins * the Instruction * @throws DataflowAnalysisException * if an error occurs analyzing the instruction; in most cases, * this indicates that the bytecode for the method being * analyzed is invalid */ public void analyzeInstruction(Instruction ins) throws DataflowAnalysisException { if (frame.isValid()) { try { ins.accept(this); } catch (InvalidBytecodeException e) { String message = "Invalid bytecode: could not analyze instr. " + ins + " at frame " + frame; throw new DataflowAnalysisException(message, e); } } }
/** Convenience method, simply calls accept() on the contained instruction. * * @param v Visitor object */ public void accept(Visitor v) { instruction.accept(v); } }
/** Convenience method, simply calls accept() on the contained instruction. * * @param v Visitor object */ public void accept( final Visitor v ) { instruction.accept(v); }
/** * Constructor. * * @param handle * the handle of the instruction whose targets should be * enumerated * @param constPoolGen * the ConstantPoolGen object for the class */ public TargetEnumeratingVisitor(InstructionHandle handle, ConstantPoolGen constPoolGen) { this.handle = handle; this.constPoolGen = constPoolGen; targetList = new LinkedList<Target>(); isBranch = isReturn = isThrow = isExit = false; handle.getInstruction().accept(this); }
/** * Analyze the given Instruction. * * @param ins * the Instruction * @throws DataflowAnalysisException * if an error occurs analyzing the instruction; in most cases, * this indicates that the bytecode for the method being * analyzed is invalid */ public void analyzeInstruction(Instruction ins) throws DataflowAnalysisException { if (frame.isValid()) { try { ins.accept(this); } catch (InvalidBytecodeException e) { String message = "Invalid bytecode: could not analyze instr. " + ins + " at frame " + frame; throw new DataflowAnalysisException(message, e); } } }
public void start() { if(!_mg.isAbstract() && !_mg.isNative()) { for(InstructionHandle ih = _mg.getInstructionList().getStart(); ih != null; ih = ih.getNext()) { Instruction i = ih.getInstruction(); if(i instanceof BranchInstruction) { branch_map.put(i, ih); // memorize container } if(ih.hasTargeters()) { if(i instanceof BranchInstruction) { _out.println(" InstructionHandle ih_" + ih.getPosition() + ";"); } else { _out.print(" InstructionHandle ih_" + ih.getPosition() + " = "); } } else { _out.print(" "); } if(!visitInstruction(i)) i.accept(this); } updateBranchTargets(); updateExceptionHandlers(); } }
public void start() { if (!_mg.isAbstract() && !_mg.isNative()) { for (InstructionHandle ih = _mg.getInstructionList().getStart(); ih != null; ih = ih .getNext()) { final Instruction i = ih.getInstruction(); if (i instanceof BranchInstruction) { branch_map.put(i, ih); // memorize container } if (ih.hasTargeters()) { if (i instanceof BranchInstruction) { _out.println(" InstructionHandle ih_" + ih.getPosition() + ";"); } else { _out.print(" InstructionHandle ih_" + ih.getPosition() + " = "); } } else { _out.print(" "); } if (!visitInstruction(i)) { i.accept(this); } } updateBranchTargets(); updateExceptionHandlers(); } }