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


Java Instruction类代码示例

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


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

示例1: makeInstructionFormatMethodItem

import org.jf.dexlib.Code.Instruction; //导入依赖的package包/类
public static InstructionMethodItem makeInstructionFormatMethodItem(MethodDefinition methodDefinition,
                                                                          CodeItem codeItem,
                                                                          int codeAddress,
                                                                          Instruction instruction) {
    if (instruction instanceof OffsetInstruction) {
        return new OffsetInstructionFormatMethodItem(methodDefinition.getLabelCache(), codeItem, codeAddress,
                instruction);
    }

    switch (instruction.getFormat()) {
        case ArrayData:
            return new ArrayDataMethodItem(codeItem, codeAddress,
                    (ArrayDataPseudoInstruction)instruction);
        case PackedSwitchData:
            return new PackedSwitchMethodItem(methodDefinition, codeItem, codeAddress,
                    (PackedSwitchDataPseudoInstruction)instruction);
        case SparseSwitchData:
            return new SparseSwitchMethodItem(methodDefinition, codeItem, codeAddress,
                    (SparseSwitchDataPseudoInstruction)instruction);
        case UnresolvedOdexInstruction:
            return new UnresolvedOdexInstructionMethodItem(codeItem, codeAddress,
                    (UnresolvedOdexInstruction)instruction);
        default:
            return new InstructionMethodItem(codeItem, codeAddress, instruction);
    }
}
 
开发者ID:DocGerd,项目名称:DalvikSSA,代码行数:27,代码来源:InstructionMethodItemFactory.java

示例2: makeInstructionFormatMethodItem

import org.jf.dexlib.Code.Instruction; //导入依赖的package包/类
public static InstructionMethodItem makeInstructionFormatMethodItem(
        MethodDefinition methodDefinition, CodeItem codeItem, int codeAddress, Instruction instruction) {
    if (instruction instanceof OffsetInstruction) {
        return new OffsetInstructionFormatMethodItem(methodDefinition.getLabelCache(), codeItem,
                codeAddress, (OffsetInstruction)instruction);
    }

    switch (instruction.getFormat()) {
        case ArrayData:
            return new ArrayDataMethodItem(codeItem, codeAddress,
                    (ArrayDataPseudoInstruction)instruction);
        case PackedSwitchData:
            return new PackedSwitchMethodItem(methodDefinition, codeItem, codeAddress,
                    (PackedSwitchDataPseudoInstruction)instruction);
        case SparseSwitchData:
            return new SparseSwitchMethodItem(methodDefinition, codeItem, codeAddress,
                    (SparseSwitchDataPseudoInstruction)instruction);
        case UnresolvedOdexInstruction:
            return new UnresolvedOdexInstructionMethodItem(codeItem, codeAddress,
                    (UnresolvedOdexInstruction)instruction);
        default:
            return new InstructionMethodItem<Instruction>(codeItem, codeAddress, instruction);
    }
}
 
开发者ID:longluo,项目名称:smali,代码行数:25,代码来源:InstructionMethodItemFactory.java

示例3: AnalyzedInstruction

import org.jf.dexlib.Code.Instruction; //导入依赖的package包/类
public AnalyzedInstruction(Instruction instruction, int instructionIndex, int registerCount) {
    this.instruction = instruction;
    this.originalInstruction = instruction;
    this.instructionIndex = instructionIndex;
    this.postRegisterMap = new RegisterType[registerCount];
    this.preRegisterMap = new RegisterType[registerCount];
    RegisterType unknown = RegisterType.getRegisterType(RegisterType.Category.Unknown, null);
    for (int i = 0; i < registerCount; i++) {
        preRegisterMap[i] = unknown;
        postRegisterMap[i] = unknown;
    }
}
 
开发者ID:DocGerd,项目名称:DalvikSSA,代码行数:13,代码来源:AnalyzedInstruction.java

示例4: addInstructionMethodItems

import org.jf.dexlib.Code.Instruction; //导入依赖的package包/类
private void addInstructionMethodItems(List<MethodItem> methodItems) {
    Instruction[] instructions = encodedMethod.codeItem.getInstructions();

    int currentCodeAddress = 0;
    for (int i=0; i<instructions.length; i++) {
        Instruction instruction = instructions[i];

        MethodItem methodItem = InstructionMethodItemFactory.makeInstructionFormatMethodItem(this,
                encodedMethod.codeItem, currentCodeAddress, instruction);

        methodItems.add(methodItem);

        if (i != instructions.length - 1) {
            methodItems.add(new BlankMethodItem(currentCodeAddress));
        }

        if (baksmali.addCodeOffsets) {
            methodItems.add(new MethodItem(currentCodeAddress) {

                @Override
                public double getSortOrder() {
                    return -1000;
                }

                @Override
                public boolean writeTo(IndentingWriter writer) throws IOException {
                    writer.write("#@");
                    writer.printLongAsHex(codeAddress & 0xFFFFFFFF);
                    return true;
                }
            });
        }

        currentCodeAddress += instruction.getSize(currentCodeAddress);
    }
}
 
开发者ID:DocGerd,项目名称:DalvikSSA,代码行数:37,代码来源:MethodDefinition.java

示例5: findFieldsSetInStaticConstructor

import org.jf.dexlib.Code.Instruction; //导入依赖的package包/类
private void findFieldsSetInStaticConstructor() {
    fieldsSetInStaticConstructor = new SparseArray<FieldIdItem>();

    if (classDataItem == null) {
        return;
    }

    for (ClassDataItem.EncodedMethod directMethod: classDataItem.getDirectMethods()) {
        if (directMethod.method.getMethodName().getStringValue().equals("<clinit>") &&
                directMethod.codeItem != null) {
            for (Instruction instruction: directMethod.codeItem.getInstructions()) {
                switch (instruction.opcode) {
                    case SPUT:
                    case SPUT_BOOLEAN:
                    case SPUT_BYTE:
                    case SPUT_CHAR:
                    case SPUT_OBJECT:
                    case SPUT_SHORT:
                    case SPUT_WIDE:
                        Instruction21c ins = (Instruction21c)instruction;
                        FieldIdItem fieldIdItem = (FieldIdItem)ins.getReferencedItem();
                        fieldsSetInStaticConstructor.put(fieldIdItem.getIndex(), fieldIdItem);
                }
            }
        }
    }
}
 
开发者ID:DocGerd,项目名称:DalvikSSA,代码行数:28,代码来源:ClassDefinition.java

示例6: makeJumbo

import org.jf.dexlib.Code.Instruction; //导入依赖的package包/类
public Instruction makeJumbo() {
    Opcode jumboOpcode = opcode.getJumboOpcode();
    if (jumboOpcode == null) {
        return null;
    }

    if (jumboOpcode.format == Format.Format31c) {
        return new Instruction31c(jumboOpcode, (short)getRegisterA(), getReferencedItem());
    }

    return new Instruction41c(jumboOpcode, getRegisterA(), getReferencedItem());
}
 
开发者ID:longluo,项目名称:smali,代码行数:13,代码来源:Instruction21c.java

示例7: makeJumbo

import org.jf.dexlib.Code.Instruction; //导入依赖的package包/类
public Instruction makeJumbo() {
    Opcode jumboOpcode = opcode.getJumboOpcode();
    if (jumboOpcode == null) {
        return null;
    }

    return new Instruction52c(jumboOpcode, getRegisterA(), getRegisterB(), getReferencedItem());
}
 
开发者ID:longluo,项目名称:smali,代码行数:9,代码来源:Instruction22c.java

示例8: makeJumbo

import org.jf.dexlib.Code.Instruction; //导入依赖的package包/类
public Instruction makeJumbo() {
    Opcode jumboOpcode = opcode.getJumboOpcode();
    if (jumboOpcode == null) {
        return null;
    }

    return new Instruction5rc(jumboOpcode, getRegCount(), getStartRegister(), getReferencedItem());
}
 
开发者ID:longluo,项目名称:smali,代码行数:9,代码来源:Instruction3rc.java

示例9: getPackedSwitchBaseAddress

import org.jf.dexlib.Code.Instruction; //导入依赖的package包/类
public int getPackedSwitchBaseAddress(int packedSwitchDataAddress) {
    int packedSwitchBaseAddress = this.packedSwitchMap.get(packedSwitchDataAddress, -1);

    if (packedSwitchBaseAddress == -1) {
        Instruction[] instructions = encodedMethod.codeItem.getInstructions();
        int index = instructionMap.get(packedSwitchDataAddress);

        if (instructions[index].opcode == Opcode.NOP) {
            packedSwitchBaseAddress = this.packedSwitchMap.get(packedSwitchDataAddress+2, -1);
        }
    }

    return packedSwitchBaseAddress;
}
 
开发者ID:longluo,项目名称:smali,代码行数:15,代码来源:MethodDefinition.java

示例10: getSparseSwitchBaseAddress

import org.jf.dexlib.Code.Instruction; //导入依赖的package包/类
public int getSparseSwitchBaseAddress(int sparseSwitchDataAddress) {
    int sparseSwitchBaseAddress = this.sparseSwitchMap.get(sparseSwitchDataAddress, -1);

    if (sparseSwitchBaseAddress == -1) {
        Instruction[] instructions = encodedMethod.codeItem.getInstructions();
        int index = instructionMap.get(sparseSwitchDataAddress);

        if (instructions[index].opcode == Opcode.NOP) {
            sparseSwitchBaseAddress = this.packedSwitchMap.get(sparseSwitchDataAddress+2, -1);
        }
    }

    return sparseSwitchBaseAddress;
}
 
开发者ID:longluo,项目名称:smali,代码行数:15,代码来源:MethodDefinition.java

示例11: needsAnalyzed

import org.jf.dexlib.Code.Instruction; //导入依赖的package包/类
private boolean needsAnalyzed() {
    for (Instruction instruction: encodedMethod.codeItem.getInstructions()) {
        if (instruction.opcode.odexOnly()) {
            return true;
        }
    }
    return false;
}
 
开发者ID:longluo,项目名称:smali,代码行数:9,代码来源:MethodDefinition.java

示例12: setDeodexedInstruction

import org.jf.dexlib.Code.Instruction; //导入依赖的package包/类
protected void setDeodexedInstruction(Instruction instruction) {
    assert originalInstruction.opcode.odexOnly();
    this.instruction = instruction;
}
 
开发者ID:DocGerd,项目名称:DalvikSSA,代码行数:5,代码来源:AnalyzedInstruction.java

示例13: getInstruction

import org.jf.dexlib.Code.Instruction; //导入依赖的package包/类
public Instruction getInstruction() {
    return instruction;
}
 
开发者ID:DocGerd,项目名称:DalvikSSA,代码行数:4,代码来源:AnalyzedInstruction.java

示例14: getOriginalInstruction

import org.jf.dexlib.Code.Instruction; //导入依赖的package包/类
public Instruction getOriginalInstruction() {
    return originalInstruction;
}
 
开发者ID:DocGerd,项目名称:DalvikSSA,代码行数:4,代码来源:AnalyzedInstruction.java

示例15: InstructionNode

import org.jf.dexlib.Code.Instruction; //导入依赖的package包/类
public InstructionNode(final AnalyzedInstruction instr) {
    this.instr = instr;
    this.idx = this.instr.getInstructionIndex();
    int[] register;
    int target;
    final Instruction i = this.instr.getInstruction();
    if (i instanceof ThreeRegisterInstruction) {
        final ThreeRegisterInstruction tri = (ThreeRegisterInstruction) i;
        register = new int[3];
        register[2] = tri.getRegisterC();
        register[1] = tri.getRegisterB();
        register[0] = tri.getRegisterA();
    } else if (i instanceof TwoRegisterInstruction) {
        final TwoRegisterInstruction twori = (TwoRegisterInstruction) i;
        register = new int[2];
        register[1] = twori.getRegisterB();
        register[0] = twori.getRegisterA();
    } else if (i instanceof SingleRegisterInstruction) {
        final SingleRegisterInstruction sri = (SingleRegisterInstruction) i;
        register = new int[1];
        register[0] = sri.getRegisterA();
    } else {
        register = null;
    }

    if (register == null) {
        this.destination = null;
        this.parameters = null;
    } else {
        byte offset = 0;
        if (instr.setsRegister()) {
            target = instr.getDestinationRegister();
            if (target < 0 || target != register[0]) {
                throw new AssertionError("target was <0 or != registerA");
            }
            this.destination = Integer.toString(target);
            offset = 1;
        } else {
            this.destination = null;
        }
        this.parameters = new String[register.length - offset];
        for (int j = 0; j < parameters.length; ++j) {
            this.parameters[j] = Integer.toString(register[j + offset]);
        }
    }
    this.op = instr.getInstruction().opcode;
}
 
开发者ID:DocGerd,项目名称:DalvikSSA,代码行数:48,代码来源:InstructionNode.java


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