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

项目:cn1    文件:ClassToXmlvmProcess.java   
private void emitConstantPushInstruction(Element xml_inst, ConstantPushInstruction inst) {
    Type type = inst.getType(cpg);
    xml_inst.setAttribute("type", type.toString());
    xml_inst.setAttribute("value", java.lang.String.valueOf(inst.getValue()));
    String op = xml_inst.getName();
    op = op.split("_")[0];
    xml_inst.setName(op);
}
项目:findbugs-all-the-bugs    文件:ValueNumberFrameModelingVisitor.java   
/**
 * This is the default instruction modeling method.
 */
@Override
public void modelNormalInstruction(Instruction ins, int numWordsConsumed, int numWordsProduced) {

    int flags = 0;
    if (ins instanceof InvokeInstruction)
        flags = ValueNumber.RETURN_VALUE;
    else if (ins instanceof ArrayInstruction)
        flags = ValueNumber.ARRAY_VALUE;
    else if (ins instanceof ConstantPushInstruction)
        flags = ValueNumber.CONSTANT_VALUE;

    // Get the input operands to this instruction.
    ValueNumber[] inputValueList = popInputValues(numWordsConsumed);

    // See if we have the output operands in the cache.
    // If not, push default (fresh) values for the output,
    // and add them to the cache.
    ValueNumber[] outputValueList = getOutputValues(inputValueList, numWordsProduced, flags);

    if (VERIFY_INTEGRITY) {
        checkConsumedAndProducedValues(ins, inputValueList, outputValueList);
    }

    // Push output operands on stack.
    pushOutputValues(outputValueList);
}
项目:findbugs-all-the-bugs    文件:ForwardTypeQualifierDataflowAnalysis.java   
private void registerInstructionSources() throws DataflowAnalysisException {
    for (Iterator<Location> i = cfg.locationIterator(); i.hasNext();) {
        Location location = i.next();
        Instruction instruction = location.getHandle().getInstruction();
        short opcode = instruction.getOpcode();

        int produces = instruction.produceStack(cpg);
        if (instruction instanceof InvokeInstruction) {
            // Model return value
            registerReturnValueSource(location);
        } else if (opcode == Constants.GETFIELD || opcode == Constants.GETSTATIC) {
            // Model field loads
            registerFieldLoadSource(location);
        } else if (instruction instanceof LDC) {
            // Model constant values
            registerLDCValueSource(location);
        } else if (instruction instanceof LDC2_W) {
            // Model constant values
            registerLDC2ValueSource(location);
        } else if (instruction instanceof ConstantPushInstruction) {
            // Model constant values
            registerConstantPushSource(location);
        } else if (instruction instanceof ACONST_NULL) {
            // Model constant values
            registerPushNullSource(location);
        } else  if ((produces == 1 || produces == 2) && !(instruction instanceof LocalVariableInstruction) && !(instruction instanceof CHECKCAST)){
            // Model other sources
            registerOtherSource(location);
        }
    }
}
项目:FindBug-for-Domino-Designer    文件:ValueNumberFrameModelingVisitor.java   
/**
 * This is the default instruction modeling method.
 */
@Override
public void modelNormalInstruction(Instruction ins, int numWordsConsumed, int numWordsProduced) {

    int flags = 0;
    if (ins instanceof InvokeInstruction)
        flags = ValueNumber.RETURN_VALUE;
    else if (ins instanceof ArrayInstruction)
        flags = ValueNumber.ARRAY_VALUE;
    else if (ins instanceof ConstantPushInstruction)
        flags = ValueNumber.CONSTANT_VALUE;

    // Get the input operands to this instruction.
    ValueNumber[] inputValueList = popInputValues(numWordsConsumed);

    // See if we have the output operands in the cache.
    // If not, push default (fresh) values for the output,
    // and add them to the cache.
    ValueNumber[] outputValueList = getOutputValues(inputValueList, numWordsProduced, flags);

    if (VERIFY_INTEGRITY) {
        checkConsumedAndProducedValues(ins, inputValueList, outputValueList);
    }

    // Push output operands on stack.
    pushOutputValues(outputValueList);
}
项目:FindBug-for-Domino-Designer    文件:ForwardTypeQualifierDataflowAnalysis.java   
private void registerInstructionSources() throws DataflowAnalysisException {
    for (Iterator<Location> i = cfg.locationIterator(); i.hasNext();) {
        Location location = i.next();
        Instruction instruction = location.getHandle().getInstruction();
        short opcode = instruction.getOpcode();

        int produces = instruction.produceStack(cpg);
        if (instruction instanceof InvokeInstruction) {
            // Model return value
            registerReturnValueSource(location);
        } else if (opcode == Constants.GETFIELD || opcode == Constants.GETSTATIC) {
            // Model field loads
            registerFieldLoadSource(location);
        } else if (instruction instanceof LDC) {
            // Model constant values
            registerLDCValueSource(location);
        } else if (instruction instanceof LDC2_W) {
            // Model constant values
            registerLDC2ValueSource(location);
        } else if (instruction instanceof ConstantPushInstruction) {
            // Model constant values
            registerConstantPushSource(location);
        } else if (instruction instanceof ACONST_NULL) {
            // Model constant values
            registerPushNullSource(location);
        } else  if ((produces == 1 || produces == 2) && !(instruction instanceof LocalVariableInstruction) && !(instruction instanceof CHECKCAST)){
            // Model other sources
            registerOtherSource(location);
        }
    }
}
项目:VestaClient    文件:BCELFactory.java   
private boolean visitInstruction( Instruction i ) {
    short opcode = i.getOpcode();
    if ((InstructionConstants.INSTRUCTIONS[opcode] != null)
            && !(i instanceof ConstantPushInstruction) && !(i instanceof ReturnInstruction)) { // Handled below
        _out.println("il.append(InstructionConstants."
                + i.getName().toUpperCase(Locale.ENGLISH) + ");");
        return true;
    }
    return false;
}
项目:cashmere    文件:LoadAwareBasicBlock.java   
/**
 * Checks that any store in this basic block to the specified variable is the
 * result of a new() or a null.
 * @param ih handle up to where to investigate.
 * @param localVarIndex the local variable index
 * @return true if all stores are OK or there are no stores.
 */
boolean noAliasesStoreWithIndexBefore(InstructionHandle ih, LocalVariableGen lg) {
    InstructionHandle prev = null;
    for (InstructionContext ic : instructions) {
        InstructionHandle current = ic.getInstruction();
        if (current.equals(ih)) {
            break;
        }

        if (methodGen.instructionStoresTo(current, lg.getIndex())) {
            LocalVariableGen l1 = methodGen.findLocalVar(current, lg.getIndex(), false);
            if (l1 != lg) {
                prev = current;
                continue;
            }
            if (prev != null) {
                Instruction i = prev.getInstruction();
                if (i instanceof INVOKESPECIAL) {
                    INVOKESPECIAL invoker = (INVOKESPECIAL) i;
                    if (invoker.getMethodName(methodGen.getConstantPool()).equals("<init>")
                        && isNonEscapingConstructor(invoker)) {
                        continue;
                    }
                }
                if (i instanceof CHECKCAST) {
                InstructionHandle pp = prev.getPrev();
                if (pp != null) {
                    i = pp.getInstruction();
                }
                }
                if (i instanceof NEWARRAY
                        || i instanceof ANEWARRAY || i instanceof MULTIANEWARRAY
                        || i instanceof ConstantPushInstruction || i instanceof ACONST_NULL) {
                     prev = current;
                     continue;
                }
            }
            return false;

        }
        prev = current;
    }
    return true;
}
项目:findbugs-all-the-bugs    文件:ForwardTypeQualifierDataflowAnalysis.java   
private void registerConstantPushSource(Location location) throws DataflowAnalysisException {

        ConstantPushInstruction instruction = (ConstantPushInstruction) location.getHandle().getInstruction();
        Number constantValue = instruction.getValue();
        registerConstantSource(location, constantValue);
    }
项目:FindBug-for-Domino-Designer    文件:ForwardTypeQualifierDataflowAnalysis.java   
private void registerConstantPushSource(Location location) throws DataflowAnalysisException {

        ConstantPushInstruction instruction = (ConstantPushInstruction) location.getHandle().getInstruction();
        Number constantValue = instruction.getValue();
        registerConstantSource(location, constantValue);
    }
项目:VestaClient    文件:BCELFactory.java   
public void visitConstantPushInstruction( ConstantPushInstruction i ) {
    createConstant(i.getValue());
}