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


Java InstructionConstants.OP_JSR_W属性代码示例

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


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

示例1: visitBranchInstruction

public void visitBranchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, BranchInstruction branchInstruction)
{
    switch (branchInstruction.opcode)
    {
        case InstructionConstants.OP_GOTO:
        case InstructionConstants.OP_GOTO_W:
            // Don't replace unconditional branches.
            break;

        case InstructionConstants.OP_JSR:
        case InstructionConstants.OP_JSR_W:
            replaceJsrInstruction(clazz, offset, branchInstruction);
            break;

        default:
            replaceBranchInstruction(clazz, offset, branchInstruction);
            break;
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:19,代码来源:EvaluationSimplifier.java

示例2: visitBranchInstruction

public void visitBranchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, BranchInstruction branchInstruction)
{
    byte opcode = branchInstruction.opcode;

    // Evaluate the target instruction blocks.
    evaluateInstructionBlock(clazz,
                             method,
                             codeAttribute,
                             offset +
                             branchInstruction.branchOffset);

    // Evaluate the instructions after a subroutine branch.
    if (opcode == InstructionConstants.OP_JSR ||
        opcode == InstructionConstants.OP_JSR_W)
    {
        // We assume subroutine calls (jsr and jsr_w instructions) don't
        // change the stack, other than popping the return value.
        stackSize -= 1;

        evaluateInstructionBlock(clazz,
                                 method,
                                 codeAttribute,
                                 offset + branchInstruction.length(offset));
    }

    // Some branch instructions always end the current instruction block.
    exitInstructionBlock =
        opcode == InstructionConstants.OP_GOTO   ||
        opcode == InstructionConstants.OP_GOTO_W ||
        opcode == InstructionConstants.OP_JSR    ||
        opcode == InstructionConstants.OP_JSR_W;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:32,代码来源:StackSizeComputer.java

示例3: visitBranchInstruction

public void visitBranchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, BranchInstruction branchInstruction)
{
    byte opcode = branchInstruction.opcode;

    // Check for instructions that might cause side effects.
    if (includeReturnInstructions &&
        (opcode == InstructionConstants.OP_JSR ||
         opcode == InstructionConstants.OP_JSR_W))
    {
        hasSideEffects = true;
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:12,代码来源:SideEffectInstructionChecker.java

示例4: visitBranchInstruction

public void visitBranchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, BranchInstruction branchInstruction)
{
    // Explicitly mark the produced stack entry of a 'jsr' instruction,
    // because the consuming 'astore' instruction of the subroutine is
    // cleared every time it is traced.
    if (branchInstruction.opcode == InstructionConstants.OP_JSR ||
        branchInstruction.opcode == InstructionConstants.OP_JSR_W)
    {
        markStackEntryAfter(offset, 0);
    }
    else
    {
        markStackProducers(clazz, offset, branchInstruction);
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:15,代码来源:EvaluationShrinker.java

示例5: visitBranchInstruction

public void visitBranchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, BranchInstruction branchInstruction)
{
    // Mark the branch origin.
    markBranchOrigin(offset);

    // Check if this is the first instruction of a subroutine.
    checkSubroutine(offset);

    // Mark the branch target.
    markBranchTarget(offset, branchInstruction.branchOffset);

    byte opcode = branchInstruction.opcode;
    if (opcode == InstructionConstants.OP_JSR ||
        opcode == InstructionConstants.OP_JSR_W)
    {
        // Mark the subroutine invocation.
        instructionMarks[offset] |= SUBROUTINE_INVOCATION;

        // Mark the subroutine start.
        int targetOffset = offset + branchInstruction.branchOffset;
        subroutineStarts[targetOffset] = targetOffset;
    }
    else if (opcode == InstructionConstants.OP_GOTO ||
             opcode == InstructionConstants.OP_GOTO_W)
    {
        // Mark the next instruction.
        markAfterBranchOrigin(offset + branchInstruction.length(offset));
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:29,代码来源:BranchTargetFinder.java

示例6: visitBranchInstruction

public void visitBranchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, BranchInstruction branchInstruction)
{
    byte opcode = branchInstruction.opcode;
    if (opcode == InstructionConstants.OP_JSR ||
        opcode == InstructionConstants.OP_JSR_W)
    {
        int branchOffset = branchInstruction.branchOffset;
        int branchTarget = offset + branchOffset;

        // Is the subroutine ever returning?
        if (branchTargetFinder.isSubroutineReturning(branchTarget))
        {
            // Append a label at this offset instead of the subroutine invocation.
            codeAttributeComposer.appendLabel(offset);

            // Inline the invoked subroutine.
            inlineSubroutine(clazz,
                             method,
                             codeAttribute,
                             offset,
                             branchTarget);
        }
        else
        {
            if (DEBUG)
            {
                System.out.println("Replacing subroutine invocation at ["+offset+"] by a simple branch");
            }

            // Replace the subroutine invocation by a simple branch.
            Instruction replacementInstruction =
                new BranchInstruction(InstructionConstants.OP_GOTO,
                                      branchOffset).shrink();

            codeAttributeComposer.appendInstruction(offset, replacementInstruction);
        }
    }
    else
    {
        // Append the instruction.
        codeAttributeComposer.appendInstruction(offset, branchInstruction);
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:43,代码来源:CodeSubroutineInliner.java


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