当前位置: 首页>>代码示例>>Java>>正文


Java InstructionConstants.OP_RETURN属性代码示例

本文整理汇总了Java中proguard.classfile.instruction.InstructionConstants.OP_RETURN属性的典型用法代码示例。如果您正苦于以下问题:Java InstructionConstants.OP_RETURN属性的具体用法?Java InstructionConstants.OP_RETURN怎么用?Java InstructionConstants.OP_RETURN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在proguard.classfile.instruction.InstructionConstants的用法示例。


在下文中一共展示了InstructionConstants.OP_RETURN属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visitSimpleInstruction

public void visitSimpleInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SimpleInstruction simpleInstruction)
{
    byte opcode = simpleInstruction.opcode;

    // Some simple instructions exit from the current instruction block.
    exitInstructionBlock =
        opcode == InstructionConstants.OP_IRETURN ||
        opcode == InstructionConstants.OP_LRETURN ||
        opcode == InstructionConstants.OP_FRETURN ||
        opcode == InstructionConstants.OP_DRETURN ||
        opcode == InstructionConstants.OP_ARETURN ||
        opcode == InstructionConstants.OP_RETURN  ||
        opcode == InstructionConstants.OP_ATHROW;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:14,代码来源:StackSizeComputer.java

示例2: visitSimpleInstruction

public void visitSimpleInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SimpleInstruction simpleInstruction)
{
    byte opcode = simpleInstruction.opcode;

    // Check for instructions that might cause side effects.
    if (opcode == InstructionConstants.OP_IASTORE      ||
        opcode == InstructionConstants.OP_LASTORE      ||
        opcode == InstructionConstants.OP_FASTORE      ||
        opcode == InstructionConstants.OP_DASTORE      ||
        opcode == InstructionConstants.OP_AASTORE      ||
        opcode == InstructionConstants.OP_BASTORE      ||
        opcode == InstructionConstants.OP_CASTORE      ||
        opcode == InstructionConstants.OP_SASTORE      ||
        opcode == InstructionConstants.OP_ATHROW       ||
        opcode == InstructionConstants.OP_MONITORENTER ||
        opcode == InstructionConstants.OP_MONITOREXIT  ||
        (includeReturnInstructions &&
         (opcode == InstructionConstants.OP_IRETURN ||
          opcode == InstructionConstants.OP_LRETURN ||
          opcode == InstructionConstants.OP_FRETURN ||
          opcode == InstructionConstants.OP_DRETURN ||
          opcode == InstructionConstants.OP_ARETURN ||
          opcode == InstructionConstants.OP_RETURN)))
    {
        // These instructions always cause a side effect.
        hasSideEffects = true;
    }

}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:29,代码来源:SideEffectInstructionChecker.java

示例3: visitSimpleInstruction

public void visitSimpleInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SimpleInstruction simpleInstruction)
{
    byte opcode = simpleInstruction.opcode;
    if (opcode == InstructionConstants.OP_IRETURN ||
        opcode == InstructionConstants.OP_LRETURN ||
        opcode == InstructionConstants.OP_FRETURN ||
        opcode == InstructionConstants.OP_DRETURN ||
        opcode == InstructionConstants.OP_ARETURN ||
        opcode == InstructionConstants.OP_RETURN  ||
        opcode == InstructionConstants.OP_ATHROW)
    {
        next = false;
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:14,代码来源:ReachableCodeMarker.java

示例4: visitBranchInstruction

public void visitBranchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, BranchInstruction branchInstruction)
{
    // Check if the instruction is an unconditional goto instruction.
    byte opcode = branchInstruction.opcode;
    if (opcode == InstructionConstants.OP_GOTO ||
        opcode == InstructionConstants.OP_GOTO_W)
    {
        // Check if the goto instruction points to a return instruction.
        int targetOffset = offset + branchInstruction.branchOffset;

        if (!codeAttributeEditor.isModified(offset) &&
            !codeAttributeEditor.isModified(targetOffset))
        {
            Instruction targetInstruction = InstructionFactory.create(codeAttribute.code,
                                                                      targetOffset);
            switch (targetInstruction.opcode)
            {
                case InstructionConstants.OP_IRETURN:
                case InstructionConstants.OP_LRETURN:
                case InstructionConstants.OP_FRETURN:
                case InstructionConstants.OP_DRETURN:
                case InstructionConstants.OP_ARETURN:
                case InstructionConstants.OP_RETURN:
                    // Replace the goto instruction by the return instruction.
                    Instruction returnInstruction =
                         new SimpleInstruction(targetInstruction.opcode);
                    codeAttributeEditor.replaceInstruction(offset,
                                                           returnInstruction);

                    // Visit the instruction, if required.
                    if (extraInstructionVisitor != null)
                    {
                        extraInstructionVisitor.visitBranchInstruction(clazz, method, codeAttribute, offset, branchInstruction);
                    }

                    break;
            }
        }
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:40,代码来源:GotoReturnReplacer.java

示例5: visitSimpleInstruction

public void visitSimpleInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SimpleInstruction simpleInstruction)
{
    // Are we inlining this instruction?
    if (inlining)
    {
        // Replace any return instructions by branches to the end of the code.
        switch (simpleInstruction.opcode)
        {
            case InstructionConstants.OP_IRETURN:
            case InstructionConstants.OP_LRETURN:
            case InstructionConstants.OP_FRETURN:
            case InstructionConstants.OP_DRETURN:
            case InstructionConstants.OP_ARETURN:
            case InstructionConstants.OP_RETURN:
                // Are we not at the last instruction?
                if (offset < codeAttribute.u4codeLength-1)
                {
                    // Replace the return instruction by a branch instruction.
                    Instruction branchInstruction =
                        new BranchInstruction(InstructionConstants.OP_GOTO_W,
                                              codeAttribute.u4codeLength - offset);

                    codeAttributeComposer.appendInstruction(offset,
                                                            branchInstruction.shrink());
                }
                else
                {
                    // Just leave out the instruction, but put in a label,
                    // for the sake of any other branch instructions.
                    codeAttributeComposer.appendLabel(offset);
                }

                return;
        }
    }

    codeAttributeComposer.appendInstruction(offset, simpleInstruction.shrink());
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:38,代码来源:MethodInliner.java

示例6: visitConstantInstruction

public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
{
    // Is it a method invocation?
    switch (constantInstruction.opcode)
    {
        case InstructionConstants.OP_INVOKEVIRTUAL:
        case InstructionConstants.OP_INVOKESPECIAL:
        case InstructionConstants.OP_INVOKESTATIC:
        {
            // Is it a recursive call?
            clazz.constantPoolEntryAccept(constantInstruction.constantIndex, recursionChecker);

            if (recursionChecker.isRecursive())
            {
                // Is the next instruction a return?
                int nextOffset =
                    offset + constantInstruction.length(offset);

                Instruction nextInstruction =
                    InstructionFactory.create(codeAttribute.code, nextOffset);

                switch (nextInstruction.opcode)
                {
                    case InstructionConstants.OP_IRETURN:
                    case InstructionConstants.OP_LRETURN:
                    case InstructionConstants.OP_FRETURN:
                    case InstructionConstants.OP_DRETURN:
                    case InstructionConstants.OP_ARETURN:
                    case InstructionConstants.OP_RETURN:
                    {
                        // Isn't the recursive call inside a try/catch block?
                        codeAttribute.exceptionsAccept(clazz, method, offset, recursionChecker);

                        if (recursionChecker.isRecursive())
                        {
                            if (DEBUG)
                            {
                                System.out.println("TailRecursionSimplifier: ["+
                                                   clazz.getName()+"."+method.getName(clazz)+method.getDescriptor(clazz)+"], inlining "+constantInstruction.toString(offset));
                            }

                            // Append a label.
                            codeAttributeComposer.appendLabel(offset);

                            storeParameters(clazz, method);

                            // Branch back to the start of the method.
                            int gotoOffset = offset + 1;
                            codeAttributeComposer.appendInstruction(gotoOffset,
                                                                    new BranchInstruction(InstructionConstants.OP_GOTO, -gotoOffset));

                            // The original return instruction will be
                            // removed elsewhere, if possible.

                            // Remember that the code has changed.
                            inlinedAny = true;

                            if (extraTailRecursionVisitor != null)
                            {
                                extraTailRecursionVisitor.visitConstantInstruction(clazz, method, codeAttribute, offset, constantInstruction);
                            }

                            // The invocation itself is no longer necessary.
                            return;
                        }
                    }
                }
            }

            break;
        }
    }

    // Copy the instruction.
    codeAttributeComposer.appendInstruction(offset, constantInstruction.shrink());
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:76,代码来源:TailRecursionSimplifier.java


注:本文中的proguard.classfile.instruction.InstructionConstants.OP_RETURN属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。