Java Code Examples for org.jf.dexlib2.Opcode#SPARSE_SWITCH_PAYLOAD
The following examples show how to use
org.jf.dexlib2.Opcode#SPARSE_SWITCH_PAYLOAD .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MethodImplementationTranslator.java From PATDroid with Apache License 2.0 | 5 votes |
private void applyPayload(final Instruction i, final PayloadInstruction p) { final Opcode opcode = p.getOpcode(); if (opcode == Opcode.ARRAY_PAYLOAD) { checkState(i.opcode == Instruction.OP_NEW && i.opcode_aux == Instruction.OP_NEW_FILLED_ARRAY, "payload type mismatch"); final List<Number> elements = ((ArrayPayload) p).getArrayElements(); final PrimitiveInfo[] array = new PrimitiveInfo[elements.size()]; for (int j = 0; j < array.length; ++j) { array[j] = PrimitiveInfo.fromObject(scope, elements.get(j)); } i.extra = array; } else if (opcode == Opcode.PACKED_SWITCH_PAYLOAD || opcode == Opcode.SPARSE_SWITCH_PAYLOAD) { checkState(i.opcode == Instruction.OP_SWITCH, "payload type mismatch"); final int switchAddress = (Integer) i.extra; final List<? extends SwitchElement> table = ((SwitchPayload) p).getSwitchElements(); boolean resolvable = true; int maxAddress = -1; for (final SwitchElement e: table) { final int destAddress = switchAddress + e.getOffset(); if (!addressToIndex.containsKey(destAddress)) { if (resolvable) resolvable = false; if (destAddress > maxAddress) maxAddress = destAddress; } } if (resolvable) { i.extra = resolveSwitchTable(switchAddress, table); } else { i.extra = new Pair<Integer, List<? extends SwitchElement>>( switchAddress, table); ArrayList<Instruction> insns = unresolvedInsns.get(maxAddress); if (insns == null) { insns = new ArrayList<Instruction>(); unresolvedInsns.put(maxAddress, insns); } insns.add(i); } } }
Example 2
Source File: DexBackedSparseSwitchPayload.java From ZjDroid with Apache License 2.0 | 4 votes |
public DexBackedSparseSwitchPayload(@Nonnull DexBackedDexFile dexFile, int instructionStart) { super(dexFile, Opcode.SPARSE_SWITCH_PAYLOAD, instructionStart); elementCount = dexFile.readUshort(instructionStart + ELEMENT_COUNT_OFFSET); }
Example 3
Source File: DexBackedSparseSwitchPayload.java From zjdroid with Apache License 2.0 | 4 votes |
public DexBackedSparseSwitchPayload(@Nonnull DexBackedDexFile dexFile, int instructionStart) { super(dexFile, Opcode.SPARSE_SWITCH_PAYLOAD, instructionStart); elementCount = dexFile.readUshort(instructionStart + ELEMENT_COUNT_OFFSET); }
Example 4
Source File: DexBackedSparseSwitchPayload.java From HeyGirl with Apache License 2.0 | 4 votes |
public DexBackedSparseSwitchPayload(@Nonnull DexBackedDexFile dexFile, int instructionStart) { super(dexFile, Opcode.SPARSE_SWITCH_PAYLOAD, instructionStart); elementCount = dexFile.readUshort(instructionStart + ELEMENT_COUNT_OFFSET); }
Example 5
Source File: DexBackedSparseSwitchPayload.java From ZjDroid with Apache License 2.0 | 4 votes |
public DexBackedSparseSwitchPayload(@Nonnull DexBackedDexFile dexFile, int instructionStart) { super(dexFile, Opcode.SPARSE_SWITCH_PAYLOAD, instructionStart); elementCount = dexFile.readUshort(instructionStart + ELEMENT_COUNT_OFFSET); }