本文整理汇总了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);
}
}
示例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);
}
}
示例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;
}
}
示例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);
}
}
示例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);
}
}
}
}
}
示例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());
}
示例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());
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}
示例12: setDeodexedInstruction
import org.jf.dexlib.Code.Instruction; //导入依赖的package包/类
protected void setDeodexedInstruction(Instruction instruction) {
assert originalInstruction.opcode.odexOnly();
this.instruction = instruction;
}
示例13: getInstruction
import org.jf.dexlib.Code.Instruction; //导入依赖的package包/类
public Instruction getInstruction() {
return instruction;
}
示例14: getOriginalInstruction
import org.jf.dexlib.Code.Instruction; //导入依赖的package包/类
public Instruction getOriginalInstruction() {
return originalInstruction;
}
示例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;
}