當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。