@Override public void transferInstruction(InstructionHandle handle, BasicBlock basicBlock, BitSet fact) throws DataflowAnalysisException { if (!isFactValid(fact)) { return; } Instruction ins = handle.getInstruction(); if (ins instanceof StoreInstruction) { // Local is stored: any live stores on paths leading // to this instruction are now dead LocalVariableInstruction store = (LocalVariableInstruction) ins; int local = store.getIndex(); fact.clear(local); fact.set(local + killedByStoreOffset); } if (ins instanceof LoadInstruction || ins instanceof IINC || ins instanceof RET) { // Local is loaded: it will be live on any path leading // to this instruction IndexedInstruction load = (IndexedInstruction) ins; int local = load.getIndex(); fact.set(local); fact.clear(local + killedByStoreOffset); } if (!isFactValid(fact)) { throw new IllegalStateException("Fact become invalid"); } }
/** * Dump instruction as byte code to stream out. * @param out Output stream */ @Override public void dump( final DataOutputStream out ) throws IOException { if (wide) { out.writeByte(org.apache.bcel.Const.WIDE); } out.writeByte(super.getOpcode()); if (wide) { out.writeShort(super.getIndex()); out.writeShort(c); } else { out.writeByte(super.getIndex()); out.writeByte(c); } }
public void visitLocalVariableInstruction(LocalVariableInstruction i) { short opcode = i.getOpcode(); Type type = i.getType(_cp); if(opcode == Constants.IINC) { _out.println("il.append(new IINC(" + i.getIndex() + ", " + ((IINC)i).getIncrement() + "));"); } else { String kind = (opcode < Constants.ISTORE)? "Load" : "Store"; _out.println("il.append(_factory.create" + kind + "(" + BCELifier.printType(type) + ", " + i.getIndex() + "));"); } }
@Override public void visitLocalVariableInstruction( final LocalVariableInstruction i ) { final short opcode = i.getOpcode(); final Type type = i.getType(_cp); if (opcode == Const.IINC) { _out.println("il.append(new IINC(" + i.getIndex() + ", " + ((IINC) i).getIncrement() + "));"); } else { final String kind = (opcode < Const.ISTORE) ? "Load" : "Store"; _out.println("il.append(_factory.create" + kind + "(" + BCELifier.printType(type) + ", " + i.getIndex() + "));"); } }
private void setWide() { wide = super.getIndex() > org.apache.bcel.Const.MAX_BYTE; if (c > 0) { wide = wide || (c > Byte.MAX_VALUE); } else { wide = wide || (c < Byte.MIN_VALUE); } if (wide) { super.setLength(6); // wide byte included } else { super.setLength(3); } }
/** * Assures the generic preconditions of a LocalVariableInstruction instance. * That is, the index of the local variable must be valid. */ @Override public void visitLocalVariableInstruction(final LocalVariableInstruction o) { if (locals().maxLocals() <= (o.getType(cpg).getSize()==1? o.getIndex() : o.getIndex()+1) ) { constraintViolated(o, "The 'index' is not a valid index into the local variable array."); } }
/** * Assures the generic preconditions of a LocalVariableInstruction instance. * That is, the index of the local variable must be valid. */ public void visitLocalVariableInstruction(LocalVariableInstruction o){ if (locals().maxLocals() <= (o.getType(cpg).getSize()==1? o.getIndex() : o.getIndex()+1) ){ constraintViolated(o, "The 'index' is not a valid index into the local variable array."); } }
@Override public void transferInstruction(InstructionHandle handle, BasicBlock basicBlock, BitSet fact) throws DataflowAnalysisException { if (!isFactValid(fact)) { return; } Instruction ins = handle.getInstruction(); if (ins instanceof StoreInstruction) { // Local is stored: any live stores on paths leading // to this instruction are now dead LocalVariableInstruction store = (LocalVariableInstruction) ins; int local = store.getIndex(); fact.clear(local); fact.set(local + killedByStoreOffset); } if (ins instanceof LoadInstruction || ins instanceof IINC || ins instanceof RET) { // Local is loaded: it will be live on any path leading // to this instruction IndexedInstruction load = (IndexedInstruction) ins; int local = load.getIndex(); fact.set(local); fact.clear(local + killedByStoreOffset); } if (!isFactValid(fact)) { throw new IllegalStateException("Fact become invalid"); } }