Java 类org.apache.bcel.generic.StoreInstruction 实例源码

项目:Android_Code_Arbiter    文件:TaintFrameModelingVisitor.java   
@Override
public void handleStoreInstruction(StoreInstruction obj) {
    try {
        int numConsumed = obj.consumeStack(cpg);
        if (numConsumed == Constants.UNPREDICTABLE) {
            throw new InvalidBytecodeException("Unpredictable stack consumption");
        }
        int index = obj.getIndex();
        while (numConsumed-- > 0) {
            Taint value = new Taint(getFrame().popValue());
            value.setVariableIndex(index);
            getFrame().setValue(index++, value);
        }
    } catch (DataflowAnalysisException ex) {
        throw new InvalidBytecodeException(ex.toString(), ex);
    }
}
项目:cashmere    文件:Cashmerec.java   
void removeUnusedLocals(Method mOrig, MethodGen m) {
    InstructionList il = m.getInstructionList();
    InstructionHandle[] ins = il.getInstructionHandles();
    for (int i = 0; i < ins.length; i++) {
        Instruction in = ins[i].getInstruction();

        if (in instanceof LocalVariableInstruction) {
            LocalVariableInstruction curr = (LocalVariableInstruction) in;
            if (mtab.getLocal(m, curr, ins[i].getPosition()) != null
                && curr.getIndex() < m.getMaxLocals() - 5
                && !mtab.isLocalUsedInInlet(mOrig, curr.getIndex())) {
                if (curr instanceof IINC) {
                    ins[i].setInstruction(new NOP());
                } else if (curr instanceof LSTORE || curr instanceof DSTORE) {
                    ins[i].setInstruction(new POP2());
                } else if (curr instanceof StoreInstruction) {
                    ins[i].setInstruction(new POP());
                } else if (curr instanceof ALOAD) {
                    ins[i].setInstruction(new ACONST_NULL());
                } else if (curr instanceof FLOAD) {
                    ins[i].setInstruction(new FCONST((float) 0.0));
                } else if (curr instanceof ILOAD) {
                    ins[i].setInstruction(new ICONST(0));
                } else if (curr instanceof DLOAD) {
                    ins[i].setInstruction(new DCONST(0.0));
                } else if (curr instanceof LLOAD) {
                    ins[i].setInstruction(new LCONST(0L));
                } else {
                    System.out.println("unhandled ins in "
                        + "removeUnusedLocals: " + curr);
                    System.exit(1);
                }
            }
        }
    }
}
项目:cashmere    文件:MethodGen.java   
public boolean instructionStoresTo(InstructionHandle ih, int localVarIndex) {
    try {
        StoreInstruction storeInstruction = (StoreInstruction) (ih.getInstruction());
        return storeInstruction.getIndex() == localVarIndex;
    } catch(ClassCastException e) {
        return false;
    }
}
项目:parabuild-ci    文件:FindDeadLocalStores.java   
private boolean isStore(Location location) {
    Instruction ins = location.getHandle().getInstruction();
    return (ins instanceof StoreInstruction) || (ins instanceof IINC);
}
项目:cashmere    文件:Cashmerec.java   
static boolean isLocalStore(Instruction ins) {
    return (ins instanceof StoreInstruction);
}
项目:findbugs-all-the-bugs    文件:FindDeadLocalStores.java   
/**
 * Is instruction at given location a store?
 * 
 * @param location
 *            the location
 * @return true if instruction at given location is a store, false if not
 */
private boolean isStore(Location location) {
    Instruction ins = location.getHandle().getInstruction();
    return (ins instanceof StoreInstruction) || (ins instanceof IINC);
}
项目:FindBug-for-Domino-Designer    文件:FindDeadLocalStores.java   
/**
 * Is instruction at given location a store?
 *
 * @param location
 *            the location
 * @return true if instruction at given location is a store, false if not
 */
private boolean isStore(Location location) {
    Instruction ins = location.getHandle().getInstruction();
    return (ins instanceof StoreInstruction) || (ins instanceof IINC);
}