@Nullable @Override public Iterable<? extends Instruction> getInstructions(@Nonnull PoolMethod method) { MethodImplementation impl = method.getImplementation(); if (impl != null) { return impl.getInstructions(); } return null; }
private boolean needsAnalyzed() { for (Instruction instruction: methodImpl.getInstructions()) { if (instruction.getOpcode().odexOnly()) { return true; } } return false; }
/** * Extracts the list of dalvik instructions from dexlib and converts them into our own instruction data model * * @param code * The dexlib method implementation */ protected void extractDexInstructions(MethodImplementation code) { int address = 0; for (Instruction instruction : code.getInstructions()) { DexlibAbstractInstruction dexInstruction = fromInstruction(instruction, address); instructions.add(dexInstruction); instructionAtAddress.put(address, dexInstruction); address += instruction.getCodeUnits(); } }
int index = 0; for (Instruction instruction : methodImplementation.getInstructions()) { codeAddress += instruction.getCodeUnits(); index++; for (final Instruction instruction : methodImplementation.getInstructions()) { final MethodLocation location = instructionList.get(index); final Opcode opcode = instruction.getOpcode();
instructions = ImmutableList.copyOf(methodImpl.getInstructions()); methodParameters = ImmutableList.copyOf(method.getParameters());
if (Iterables.isEmpty(methodImplementation.getInstructions())) { if (!isAbstract && !isNative) { throw new SemanticException(input, I_METHOD72, "A non-abstract/non-native method must have at least 1 instruction");
private void buildInstructionList() { int registerCount = methodImpl.getRegisterCount(); ImmutableList<Instruction> instructions = ImmutableList.copyOf(methodImpl.getInstructions());
for (Instruction instruction: methodImpl.getInstructions()) { hasInstruction = true; if (instruction instanceof ReferenceInstruction) {
@Nullable @Override public Iterable<? extends Instruction> getInstructions(@Nonnull BuilderMethod builderMethod) { MethodImplementation impl = builderMethod.getImplementation(); if (impl == null) { return null; } return impl.getInstructions(); }
@Nullable @Override public Iterable<? extends Instruction> getInstructions(@Nonnull BuilderMethod builderMethod) { MethodImplementation impl = builderMethod.getImplementation(); if (impl == null) { return null; } return impl.getInstructions(); }
@Nullable @Override public Iterable<? extends Instruction> getInstructions(@Nonnull PoolMethod method) { MethodImplementation impl = method.getImplementation(); if (impl != null) { return impl.getInstructions(); } return null; }
@Nullable @Override public Iterable<? extends Instruction> getInstructions(@Nonnull PoolMethod method) { MethodImplementation impl = method.getImplementation(); if (impl != null) { return impl.getInstructions(); } return null; }
@Nullable @Override public Iterable<? extends Instruction> getInstructions(@Nonnull BuilderMethod builderMethod) { MethodImplementation impl = builderMethod.getImplementation(); if (impl == null) { return null; } return impl.getInstructions(); }
@Override @Nonnull public Iterable<? extends Instruction> getInstructions() { return RewriterUtils.rewriteIterable(rewriters.getInstructionRewriter(), methodImplementation.getInstructions()); }
private boolean needsAnalyzed() { for (Instruction instruction : methodImpl.getInstructions()) { if (instruction.getOpcode().odexOnly()) { return true; } } return false; }
private boolean needsAnalyzed() { for (Instruction instruction: methodImpl.getInstructions()) { if (instruction.getOpcode().odexOnly()) { return true; } } return false; }
private boolean odexMethod() { for(org.jf.dexlib2.iface.instruction.Instruction inst : eMethod.getImplementation().getInstructions()) { if (inst.getOpcode().odexOnly()) { return true; } } return false; }
private boolean odexMethod() { for(org.jf.dexlib2.iface.instruction.Instruction inst : eMethod.getImplementation().getInstructions()) { if (inst.getOpcode().odexOnly()) { return true; } } return false; }
@Override protected MethodImplementation reMethodImpl(MethodImplementation methodImplementation) { if (methodImplementation == null){ return null; } Iterable<? extends Instruction> instructions = methodImplementation.getInstructions(); Iterable<? extends DebugItem> debugItems = methodImplementation.getDebugItems(); List<? extends TryBlock<? extends ExceptionHandler>> tryBlocks = methodImplementation.getTryBlocks(); return new ImmutableMethodImplementation(methodImplementation.getRegisterCount(), reInstructions(instructions), reTryCatchBlock(methodImplementation.getTryBlocks()), reDebugItem(methodImplementation.getDebugItems())); }
@Test public void testPayloadAlignmentRemoveNop() { MethodImplementationBuilder implBuilder = new MethodImplementationBuilder(10); implBuilder.addInstruction(new BuilderInstruction10x(Opcode.NOP)); implBuilder.addInstruction(new BuilderArrayPayload(4, null)); List<? extends Instruction> instructions = Lists.newArrayList(implBuilder.getMethodImplementation().getInstructions()); Assert.assertEquals(instructions.size(), 1); Instruction instruction = instructions.get(0); Assert.assertEquals(instruction.getOpcode(), Opcode.ARRAY_PAYLOAD); }