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


Java InstructionConstants类代码示例

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


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

示例1: visitConstantInstruction

import proguard.classfile.instruction.InstructionConstants; //导入依赖的package包/类
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,代码行数:26,代码来源:BridgeMethodFixer.java

示例2: main

import proguard.classfile.instruction.InstructionConstants; //导入依赖的package包/类
public static void main(String[] args)
{
    CodeAttributeComposer composer = new CodeAttributeComposer();

    composer.beginCodeFragment(4);
    composer.appendInstruction(0, new SimpleInstruction(InstructionConstants.OP_ICONST_0));
    composer.appendInstruction(1, new VariableInstruction(InstructionConstants.OP_ISTORE, 0));
    composer.appendInstruction(2, new BranchInstruction(InstructionConstants.OP_GOTO, 1));

    composer.beginCodeFragment(4);
    composer.appendInstruction(0, new VariableInstruction(InstructionConstants.OP_IINC, 0, 1));
    composer.appendInstruction(1, new VariableInstruction(InstructionConstants.OP_ILOAD, 0));
    composer.appendInstruction(2, new SimpleInstruction(InstructionConstants.OP_ICONST_5));
    composer.appendInstruction(3, new BranchInstruction(InstructionConstants.OP_IFICMPLT, -3));
    composer.endCodeFragment();

    composer.appendInstruction(3, new SimpleInstruction(InstructionConstants.OP_RETURN));
    composer.endCodeFragment();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:20,代码来源:CodeAttributeComposer.java

示例3: visitConstantInstruction

import proguard.classfile.instruction.InstructionConstants; //导入依赖的package包/类
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,代码行数:19,代码来源:SideEffectInstructionChecker.java

示例4: visitBranchInstruction

import proguard.classfile.instruction.InstructionConstants; //导入依赖的package包/类
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,代码行数:20,代码来源:EvaluationSimplifier.java

示例5: replaceReferencePushInstruction

import proguard.classfile.instruction.InstructionConstants; //导入依赖的package包/类
/**
 * Replaces the reference pushing instruction at the given offset by a
 * simpler push instruction, if possible.
 */
private void replaceReferencePushInstruction(Clazz       clazz,
                                             int         offset,
                                             Instruction instruction)
{
    Value pushedValue = partialEvaluator.getStackAfter(offset).getTop(0);
    if (pushedValue.isParticular())
    {
        // A reference value can only be specific if it is null.
        replaceConstantPushInstruction(clazz,
                                       offset,
                                       instruction,
                                       InstructionConstants.OP_ACONST_NULL,
                                       0);
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:20,代码来源:EvaluationSimplifier.java

示例6: replaceByInfiniteLoop

import proguard.classfile.instruction.InstructionConstants; //导入依赖的package包/类
/**
 * Replaces the given instruction by an infinite loop.
 */
private void replaceByInfiniteLoop(Clazz       clazz,
                                   int         offset,
                                   Instruction instruction)
{
    // Replace the instruction by an infinite loop.
    Instruction replacementInstruction =
        new BranchInstruction(InstructionConstants.OP_GOTO, 0);

    if (DEBUG) System.out.println("  Replacing unreachable instruction by infinite loop "+replacementInstruction.toString(offset));

    codeAttributeEditor.replaceInstruction(offset, replacementInstruction);

    // Visit the instruction, if required.
    if (extraInstructionVisitor != null)
    {
        // Note: we're not passing the right arguments for now, knowing that
        // they aren't used anyway.
        instruction.accept(clazz, null, null, offset, extraInstructionVisitor);
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:24,代码来源:EvaluationSimplifier.java

示例7: visitSimpleInstruction

import proguard.classfile.instruction.InstructionConstants; //导入依赖的package包/类
public void visitSimpleInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SimpleInstruction simpleInstruction)
{
    // Mark the instruction.
    instructionMarks[offset] |= INSTRUCTION;

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

    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_ATHROW)
    {
        // Mark the branch origin.
        markBranchOrigin(offset);

        // Mark the next instruction.
        markAfterBranchOrigin(offset + simpleInstruction.length(offset));
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:24,代码来源:BranchTargetFinder.java

示例8: visitVariableInstruction

import proguard.classfile.instruction.InstructionConstants; //导入依赖的package包/类
public void visitVariableInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, VariableInstruction variableInstruction)
{
    // Mark the instruction.
    instructionMarks[offset] |= INSTRUCTION;

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

    if (variableInstruction.opcode == InstructionConstants.OP_RET)
    {
        // Mark the branch origin.
        markBranchOrigin(offset);

        // Mark the regular subroutine return.
        instructionMarks[offset] |= SUBROUTINE_RETURNING;

        // Mark the next instruction.
        markAfterBranchOrigin(offset + variableInstruction.length(offset));
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:21,代码来源:BranchTargetFinder.java

示例9: visitSimpleInstruction

import proguard.classfile.instruction.InstructionConstants; //导入依赖的package包/类
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,代码行数:15,代码来源:StackSizeComputer.java

示例10: visitVariableInstruction

import proguard.classfile.instruction.InstructionConstants; //导入依赖的package包/类
public void visitVariableInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, VariableInstruction variableInstruction)
{
    byte opcode = variableInstruction.opcode;

    // The ret instruction end the current instruction block.
    exitInstructionBlock =
        opcode == InstructionConstants.OP_RET;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:9,代码来源:StackSizeComputer.java

示例11: visitBranchInstruction

import proguard.classfile.instruction.InstructionConstants; //导入依赖的package包/类
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,代码行数:33,代码来源:StackSizeComputer.java

示例12: visitConstantInstruction

import proguard.classfile.instruction.InstructionConstants; //导入依赖的package包/类
public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
{
    byte opcode = constantInstruction.opcode;

    // Could this instruction be a .class construct?
    if (opcode == InstructionConstants.OP_LDC ||
        opcode == InstructionConstants.OP_LDC_W)
    {
        clazz.constantPoolEntryAccept(constantInstruction.constantIndex,
                                      this);
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:13,代码来源:DotClassClassVisitor.java

示例13: visitConstantInstruction

import proguard.classfile.instruction.InstructionConstants; //导入依赖的package包/类
public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
{
    if (constantInstruction.opcode == InstructionConstants.OP_LDC ||
        constantInstruction.opcode == InstructionConstants.OP_LDC_W)
    {
        clazz.constantPoolEntryAccept(constantInstruction.constantIndex, this);
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:9,代码来源:DotClassMarker.java

示例14: visitConstantInstruction

import proguard.classfile.instruction.InstructionConstants; //导入依赖的package包/类
public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
{
    byte opcode = constantInstruction.opcode;

    // Check for instructions that involve fields.
    switch (opcode)
    {
        case InstructionConstants.OP_LDC:
        case InstructionConstants.OP_LDC_W:
            // Mark the field, if any, as being read from and written to.
            reading = true;
            writing = true;
            clazz.constantPoolEntryAccept(constantInstruction.constantIndex, this);
            break;

        case InstructionConstants.OP_GETSTATIC:
        case InstructionConstants.OP_GETFIELD:
            // Mark the field as being read from.
            reading = true;
            writing = false;
            clazz.constantPoolEntryAccept(constantInstruction.constantIndex, this);
            break;

        case InstructionConstants.OP_PUTSTATIC:
        case InstructionConstants.OP_PUTFIELD:
            // Mark the field as being written to.
            reading = false;
            writing = true;
            clazz.constantPoolEntryAccept(constantInstruction.constantIndex, this);
            break;
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:33,代码来源:ReadWriteFieldMarker.java

示例15: visitSimpleInstruction

import proguard.classfile.instruction.InstructionConstants; //导入依赖的package包/类
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,代码行数:30,代码来源:SideEffectInstructionChecker.java


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