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

项目:cashmere    文件:Cashmerec.java   
InstructionHandle pushParams(InstructionList il, Method m) {
    Type[] params = mtab.typesOfParams(m);
    InstructionHandle pos = il.getStart();

    for (int i = 0, param = 0; i < params.length; i++, param++) {
        if (params[i].equals(Type.BOOLEAN) || params[i].equals(Type.BYTE)
            || params[i].equals(Type.SHORT) || params[i].equals(Type.CHAR)
            || params[i].equals(Type.INT)) {
            il.insert(pos, new ILOAD(param));
        } else if (params[i].equals(Type.FLOAT)) {
            il.insert(pos, new FLOAD(param));
        } else if (params[i].equals(Type.LONG)) {
            il.insert(pos, new LLOAD(param));
            param++;
        } else if (params[i].equals(Type.DOUBLE)) {
            il.insert(pos, new DLOAD(param));
            param++;
        } else {
            il.insert(pos, new ALOAD(param));
        }
    }

    return pos;
}
项目: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);
                }
            }
        }
    }
}
项目:VestaClient    文件:Pass3aVerifier.java   
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */
public void visitLLOAD(LLOAD o){
    int idx = o.getIndex();
    if (idx < 0){
        constraintViolated(o, "Index '"+idx+"' must be non-negative. [Constraint by JustIce as an analogon to the single-slot xLOAD/xSTORE instructions; may not happen anyway.]");
    }
    else{
        int maxminus2 =  max_locals()-2;
        if (idx > maxminus2){
            constraintViolated(o, "Index '"+idx+"' must not be greater than max_locals-2 '"+maxminus2+"'.");
        }
    }
}
项目:cn1    文件:JavaByteCodeOutputProcess.java   
@SuppressWarnings("unused")
// Called using reflection
private Instruction createInstructionLload(Element inst) throws IllegalXMLVMException {
    int idx = Integer.parseInt(inst.getAttributeValue("index"));
    return new LLOAD(idx);
}