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


Java InstructionConstants.OP_INVOKESPECIAL属性代码示例

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


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

示例1: visitConstantInstruction

public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
{
    switch (constantInstruction.opcode)
    {
        case InstructionConstants.OP_INVOKEVIRTUAL:
        case InstructionConstants.OP_INVOKESPECIAL:
        case InstructionConstants.OP_INVOKESTATIC:
        case InstructionConstants.OP_INVOKEINTERFACE:
            // Get the name of the bridged method.
            clazz.constantPoolEntryAccept(constantInstruction.constantIndex, this);

            // Check if the name is different.
            if (!method.getName(clazz).equals(bridgedMethodName))
            {
                if (DEBUG)
                {
                    System.out.println("BridgeMethodFixer: ["+clazz.getName()+"."+method.getName(clazz)+method.getDescriptor(clazz)+"] does not bridge to ["+bridgedMethodName+"]");
                }

                // Clear the bridge flag.
                ((ProgramMethod)method).u2accessFlags &= ~ClassConstants.INTERNAL_ACC_BRIDGE;
            }
            break;
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:25,代码来源:BridgeMethodFixer.java

示例2: visitConstantInstruction

public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
{
    byte opcode = constantInstruction.opcode;
    // Check for instructions that might cause side effects.
    if (opcode == InstructionConstants.OP_GETSTATIC     ||
        opcode == InstructionConstants.OP_PUTSTATIC     ||
        opcode == InstructionConstants.OP_GETFIELD      ||
        opcode == InstructionConstants.OP_PUTFIELD      ||
        opcode == InstructionConstants.OP_INVOKEVIRTUAL ||
        opcode == InstructionConstants.OP_INVOKESPECIAL ||
        opcode == InstructionConstants.OP_INVOKESTATIC  ||
        opcode == InstructionConstants.OP_INVOKEINTERFACE)
    {
        // Check if the field is write-only or volatile, or if the invoked
        // method is causing any side effects.
        clazz.constantPoolEntryAccept(constantInstruction.constantIndex, this);
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:18,代码来源:SideEffectInstructionChecker.java

示例3: visitConstantInstruction

public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
{
    if (constantInstruction.opcode == InstructionConstants.OP_INVOKESPECIAL)
    {
        invokesSuperMethods = false;

        clazz.constantPoolEntryAccept(constantInstruction.constantIndex, this);

        if (invokesSuperMethods)
        {
            setInvokesSuperMethods(method);
        }
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:14,代码来源:SuperInvocationMarker.java

示例4: visitConstantInstruction

public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
    {
        byte opcode = constantInstruction.opcode;

        // Check for instructions that may throw exceptions.
        switch (opcode)
        {
            case InstructionConstants.OP_GETSTATIC:
            case InstructionConstants.OP_PUTSTATIC:
            case InstructionConstants.OP_GETFIELD:
            case InstructionConstants.OP_PUTFIELD:
            case InstructionConstants.OP_INVOKEVIRTUAL:
            case InstructionConstants.OP_INVOKESPECIAL:
            case InstructionConstants.OP_INVOKESTATIC:
            case InstructionConstants.OP_INVOKEINTERFACE:
            case InstructionConstants.OP_NEW:
            case InstructionConstants.OP_ANEWARRAY:
            case InstructionConstants.OP_CHECKCAST:
            case InstructionConstants.OP_INSTANCEOF:
            case InstructionConstants.OP_MULTIANEWARRAY:
                // These instructions may throw exceptions.
                mayThrowExceptions = true;
        }

//          case InstructionConstants.OP_INVOKEVIRTUAL:
//          case InstructionConstants.OP_INVOKESPECIAL:
//          case InstructionConstants.OP_INVOKESTATIC:
//          case InstructionConstants.OP_INVOKEINTERFACE:
//            // Check if the invoking the method may throw an exception.
//            clazz.constantPoolEntryAccept(constantInstruction.constantIndex, this);
    }
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:31,代码来源:ExceptionInstructionChecker.java

示例5: visitConstantInstruction

public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
{
    switch (constantInstruction.opcode)
    {
        case InstructionConstants.OP_INVOKEVIRTUAL:
        case InstructionConstants.OP_INVOKESPECIAL:
        case InstructionConstants.OP_INVOKESTATIC:
        case InstructionConstants.OP_INVOKEINTERFACE:
            this.invocationOffset      = offset;
            this.invocationInstruction = constantInstruction;
            clazz.constantPoolEntryAccept(constantInstruction.constantIndex, this);
            break;
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:14,代码来源:EvaluationShrinker.java

示例6: visitConstantInstruction

public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
{
    switch (constantInstruction.opcode)
    {
        case InstructionConstants.OP_GETSTATIC:
        case InstructionConstants.OP_GETFIELD:
            replaceAnyPushInstruction(clazz, offset, constantInstruction);
            break;

        case InstructionConstants.OP_INVOKEVIRTUAL:
        case InstructionConstants.OP_INVOKESPECIAL:
        case InstructionConstants.OP_INVOKESTATIC:
        case InstructionConstants.OP_INVOKEINTERFACE:
            if (constantInstruction.stackPushCount(clazz) > 0 &&
                !sideEffectInstructionChecker.hasSideEffects(clazz,
                                                             method,
                                                             codeAttribute,
                                                             offset,
                                                             constantInstruction))
            {
                replaceAnyPushInstruction(clazz, offset, constantInstruction);
            }

            break;

        case InstructionConstants.OP_CHECKCAST:
            replaceReferencePushInstruction(clazz, offset, constantInstruction);
            break;
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:30,代码来源:EvaluationSimplifier.java

示例7: visitConstantInstruction

public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
{
    if (constantInstruction.opcode == InstructionConstants.OP_INVOKESPECIAL)
    {
        hasBeenFixed = false;
        clazz.constantPoolEntryAccept(constantInstruction.constantIndex, this);

        if (hasBeenFixed)
        {
            Instruction extraInstruction =
                new SimpleInstruction(InstructionConstants.OP_ICONST_0);

            codeAttributeEditor.insertBeforeInstruction(offset,
                                                        extraInstruction);

            if (DEBUG)
            {
                System.out.println("  ["+clazz.getName()+"."+method.getName(clazz)+method.getDescriptor(clazz)+"] Inserting "+extraInstruction.toString()+" before "+constantInstruction.toString(offset));
            }

            if (extraAddedInstructionVisitor != null)
            {
                extraInstruction.accept(null, null, null, offset, extraAddedInstructionVisitor);
            }
        }
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:27,代码来源:DuplicateInitializerInvocationFixer.java

示例8: invokeMember

public void invokeMember(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction, Stack stack)
{
    int constantIndex = constantInstruction.constantIndex;

    switch (constantInstruction.opcode)
    {
        case InstructionConstants.OP_GETSTATIC:
            isStatic = true;
            isLoad   = true;
            break;

        case InstructionConstants.OP_PUTSTATIC:
            isStatic = true;
            isLoad   = false;
            break;

        case InstructionConstants.OP_GETFIELD:
            isStatic = false;
            isLoad   = true;
            break;

        case InstructionConstants.OP_PUTFIELD:
            isStatic = false;
            isLoad   = false;
            break;

        case InstructionConstants.OP_INVOKESTATIC:
            isStatic = true;
            break;

        case InstructionConstants.OP_INVOKEVIRTUAL:
        case InstructionConstants.OP_INVOKESPECIAL:
        case InstructionConstants.OP_INVOKEINTERFACE:
            isStatic = false;
            break;
    }

    // Pop the parameters and push the return value.
    this.stack = stack;
    clazz.constantPoolEntryAccept(constantIndex, this);
    this.stack = null;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:42,代码来源:BasicInvocationUnit.java

示例9: 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

示例10: 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_NEW:
            uninitializedObjectCount++;
            break;

        case InstructionConstants.OP_INVOKEVIRTUAL:
        case InstructionConstants.OP_INVOKESPECIAL:
        case InstructionConstants.OP_INVOKESTATIC:
        case InstructionConstants.OP_INVOKEINTERFACE:
            // See if we can inline it.
            inlined = false;

            // Append a label, in case the invocation will be inlined.
            codeAttributeComposer.appendLabel(offset);

            emptyInvokingStack =
                !inlining &&
                stackSizeComputer.isReachable(offset) &&
                stackSizeComputer.getStackSize(offset) == 0;

            variableOffset += codeAttribute.u2maxLocals;

            clazz.constantPoolEntryAccept(constantInstruction.constantIndex, this);

            variableOffset -= codeAttribute.u2maxLocals;

            // Was the method inlined?
            if (inlined)
            {
                if (extraInlinedInvocationVisitor != null)
                {
                    extraInlinedInvocationVisitor.visitConstantInstruction(clazz, method, codeAttribute, offset, constantInstruction);
                }

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

            break;
    }

    // Are we inlining this instruction?
    if (inlining)
    {
        // Make sure the constant is present in the constant pool of the
        // target class.
        constantInstruction.constantIndex =
            constantAdder.addConstant(clazz, constantInstruction.constantIndex);
    }

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


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