Package org.apache.bcel.generic

Examples of org.apache.bcel.generic.Instruction


        }

        for (Iterator<Location> i = cfg.locationIterator(); i.hasNext();) {
            Location location = i.next();

            Instruction ins = location.getHandle().getInstruction();

            if (ins instanceof ReturnInstruction && !(ins instanceof RETURN)) {
                // Return instruction which returns a value
                modelReturn(returnValueAnnotation, location);
            } else {
                short opcode = ins.getOpcode();

                if (opcode == Constants.PUTFIELD || opcode == Constants.PUTSTATIC) {
                    modelFieldStore(location);
                } else if (location.getHandle().getInstruction() instanceof InvokeInstruction) {
                    modelArguments(location);
View Full Code Here


    }

    @Override
    public void transferInstruction(InstructionHandle handle, BasicBlock basicBlock, StackDepth fact)
            throws DataflowAnalysisException {
        Instruction ins = handle.getInstruction();
        int produced = ins.produceStack(cpg);
        int consumed = ins.consumeStack(cpg);
        if (produced == Constants.UNPREDICTABLE || consumed == Constants.UNPREDICTABLE) {
            throw new IllegalStateException("Unpredictable stack delta for instruction: " + handle);
        }
        int depth = fact.getDepth();
        depth += (produced - consumed);
View Full Code Here

    public static boolean isNullCheck(InstructionHandle h, ConstantPoolGen cpg) {
        if (!(h.getInstruction() instanceof IFNONNULL)) {
            return false;
        }
        h = h.getNext();
        final Instruction newInstruction = h.getInstruction();
        if (!(newInstruction instanceof NEW)) {
            return false;
        }
        final ObjectType loadClassType = ((NEW) newInstruction).getLoadClassType(cpg);
        if (!loadClassType.getClassName().equals("java.lang.NullPointerException")) {
View Full Code Here

    @Override
    public void transferInstruction(InstructionHandle handle, BasicBlock basicBlock, UnconditionalValueDerefSet fact)
            throws DataflowAnalysisException {

        Instruction instruction = handle.getInstruction();
        if (fact.isTop()) {
            return;
        }
        Location location = new Location(handle, basicBlock);
View Full Code Here

    }

    private void handleInstruction(InstructionHandle handle, BasicBlock basicBlock, FieldSet fact)
    {
        Instruction ins = handle.getInstruction();
        short opcode = ins.getOpcode();
        XField field;

        switch (opcode) {
        case Constants.GETFIELD:
        case Constants.GETSTATIC:
View Full Code Here

            CFG cfg = dataflow.getCFG();
            Iterator<Location> i = cfg.locationIterator();
            while (i.hasNext()) {
                Location loc = i.next();
                InstructionHandle handle = loc.getHandle();
                Instruction ins = handle.getInstruction();
                if (ins instanceof ReturnInstruction && !(ins instanceof RETURN)) {
                    ValueNumberFrame vnaFrame = vnaDataflow.getFactAtLocation(loc);
                    ValueNumber topVN = vnaFrame.getTopValue();

                    TypeQualifierValueSet flowSet = dataflow.getFactAtLocation(loc);
View Full Code Here

    }

    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
View Full Code Here

            IAnalysisCache analysisCache = Global.getAnalysisCache();
            ConstantPoolGen cpg = analysisCache.getClassAnalysis(ConstantPoolGen.class, methodDescriptor.getClassDescriptor());
            for (Iterator<Location> i = cfg.locationIterator(); i.hasNext();) {
                Location location = i.next();
                Instruction ins = location.getHandle().getInstruction();
                if (ins instanceof InvokeInstruction) {
                    XMethod called = XFactory.createXMethod((InvokeInstruction) ins, cpg);
                    addEffectiveRelevantQualifiers(result, called);
                }
View Full Code Here

                // These cases are not null dereferences,
                // but they are quite likely to indicate an error, so while
                // we've got
                // information about null values, we may as well report them.
                InstructionHandle lastHandle = basicBlock.getLastInstruction();
                Instruction last = lastHandle.getInstruction();
                switch (last.getOpcode()) {
                case Constants.IF_ACMPEQ:
                case Constants.IF_ACMPNE:
                    analyzeRefComparisonBranch(basicBlock, lastHandle);
                    break;
                case Constants.IFNULL:
View Full Code Here

            } else {
                location = Location.getLastLocation(source);
            }

            if (location != null) {
                Instruction in = location.getHandle().getInstruction();
                if (assertionMethods.isAssertionInstruction(in, classContext.getConstantPoolGen())) {
                    if (DEBUG_DEREFS) {
                        System.out.println("Skipping because it is an assertion method ");
                    }
                    continue;
View Full Code Here

TOP

Related Classes of org.apache.bcel.generic.Instruction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.