private static int[] buildRegisters3rc(Instruction3rc instruction) { int registerCount = instruction.getRegisterCount(); int start = instruction.getStartRegister(); int end = start + registerCount; int[] registers = new int[registerCount]; for (int i = start; i < end; i++) { registers[i - start] = i; } return registers; }
@Nonnull private BuilderInstruction3rc newBuilderInstruction3rc(@Nonnull Instruction3rc instruction) { return new BuilderInstruction3rc( instruction.getOpcode(), instruction.getStartRegister(), instruction.getRegisterCount(), convertReference(instruction.getReference())); }
@Override boolean isUsedAsFloatingPoint(DexBody body, int register) { Instruction3rc i = (Instruction3rc) instruction; Type arrayType = DexType.toSoot((TypeReference) i.getReference()); int startRegister = i.getStartRegister(); int endRegister = startRegister + i.getRegisterCount(); return register >= startRegister && register <= endRegister && isFloatLike(arrayType); }
private void analyzeInvokeObjectInitRange(@Nonnull AnalyzedInstruction analyzedInstruction, boolean analyzeResult) { Instruction3rc instruction = (Instruction3rc)analyzedInstruction.instruction; Instruction deodexedInstruction; int startRegister = instruction.getStartRegister(); // hack: we should be using instruction.getRegisterCount, but some tweaked versions of dalvik appear // to generate invoke-object-init/range instructions with an invalid register count. We know it should // always be 1, so just use that. int registerCount = 1; if (startRegister < 16) { deodexedInstruction = new ImmutableInstruction35c(Opcode.INVOKE_DIRECT, registerCount, startRegister, 0, 0, 0, 0, instruction.getReference()); } else { deodexedInstruction = new ImmutableInstruction3rc(Opcode.INVOKE_DIRECT_RANGE, startRegister, registerCount, instruction.getReference()); } analyzedInstruction.setDeodexedInstruction(deodexedInstruction); if (analyzeResult) { analyzeInstruction(analyzedInstruction); } }
private boolean analyzeInvokeVirtual(@Nonnull AnalyzedInstruction analyzedInstruction, boolean isRange) { MethodReference targetMethod; if (!normalizeVirtualMethods) { return true; } if (isRange) { Instruction3rc instruction = (Instruction3rc)analyzedInstruction.instruction; targetMethod = (MethodReference)instruction.getReference(); } else { Instruction35c instruction = (Instruction35c)analyzedInstruction.instruction; targetMethod = (MethodReference)instruction.getReference(); } MethodReference replacementMethod = normalizeMethodReference(targetMethod); if (replacementMethod == null || replacementMethod.equals(targetMethod)) { return true; } Instruction deodexedInstruction; if (isRange) { Instruction3rc instruction = (Instruction3rc)analyzedInstruction.instruction; deodexedInstruction = new ImmutableInstruction3rc(instruction.getOpcode(), instruction.getStartRegister(), instruction.getRegisterCount(), replacementMethod); } else { Instruction35c instruction = (Instruction35c)analyzedInstruction.instruction; deodexedInstruction = new ImmutableInstruction35c(instruction.getOpcode(), instruction.getRegisterCount(), instruction.getRegisterC(), instruction.getRegisterD(), instruction.getRegisterE(), instruction.getRegisterF(), instruction.getRegisterG(), replacementMethod); } analyzedInstruction.setDeodexedInstruction(deodexedInstruction); return true; }
if (opName.endsWith("/range")) { Instruction3rc instr = (Instruction3rc) location.getInstruction(); int startRegister = instr.getStartRegister(); for (int i = 0; i < dimensionRegisters.length; i++) { dimensionRegisters[i] = startRegister + i;
= Jimple.v().newAssignStmt(arrayRef, body.getRegisterLocal(i + filledNewArrayInstr.getStartRegister())); addTags(assign); body.add(assign);
public int getStartRegister() { return instruction.getStartRegister(); }
@Nonnull private BuilderInstruction3rc newBuilderInstruction3rc(@Nonnull Instruction3rc instruction) { return new BuilderInstruction3rc( instruction.getOpcode(), instruction.getStartRegister(), instruction.getRegisterCount(), instruction.getReference()); }
@Nonnull private BuilderInstruction3rc newBuilderInstruction3rc(@Nonnull Instruction3rc instruction) { return new BuilderInstruction3rc( instruction.getOpcode(), instruction.getStartRegister(), instruction.getRegisterCount(), instruction.getReference()); }
@Nonnull private BuilderInstruction3rc newBuilderInstruction3rc(@Nonnull Instruction3rc instruction) { return new BuilderInstruction3rc( instruction.getOpcode(), instruction.getStartRegister(), instruction.getRegisterCount(), instruction.getReference()); }
@Nonnull private BuilderInstruction3rc newBuilderInstruction3rc(@Nonnull Instruction3rc instruction) { return new BuilderInstruction3rc( instruction.getOpcode(), instruction.getStartRegister(), instruction.getRegisterCount(), convertReference(instruction.getReference())); }
private void annotateInstruction3rc(@Nonnull AnnotatedBytes out, @Nonnull Instruction3rc instruction) { int startRegister = instruction.getStartRegister(); int endRegister = startRegister + instruction.getRegisterCount() - 1; String reference = ReferenceUtil.getReferenceString(instruction.getReference()); out.annotate(6, String.format("%s {%s .. %s}, %s", instruction.getOpcode().name, formatRegister(startRegister), formatRegister(endRegister), reference)); }
private void annotateInstruction3rc(@Nonnull AnnotatedBytes out, @Nonnull Instruction3rc instruction) { int startRegister = instruction.getStartRegister(); int endRegister = startRegister + instruction.getRegisterCount() - 1; String reference = ReferenceUtil.getReferenceString(instruction.getReference()); out.annotate(6, String.format("%s {%s .. %s}, %s", instruction.getOpcode().name, formatRegister(startRegister), formatRegister(endRegister), reference)); }
private void annotateInstruction3rc(@Nonnull AnnotatedBytes out, @Nonnull Instruction3rc instruction) { int startRegister = instruction.getStartRegister(); int endRegister = startRegister + instruction.getRegisterCount() - 1; String reference = ReferenceUtil.getReferenceString(instruction.getReference()); out.annotate(6, String.format("%s {%s .. %s}, %s", instruction.getOpcode().name, formatRegister(startRegister), formatRegister(endRegister), reference)); }
public static ImmutableInstruction3rc of(Instruction3rc instruction) { if (instruction instanceof ImmutableInstruction3rc) { return (ImmutableInstruction3rc)instruction; } return new ImmutableInstruction3rc( instruction.getOpcode(), instruction.getStartRegister(), instruction.getRegisterCount(), instruction.getReference()); }
public static ImmutableInstruction3rc of(Instruction3rc instruction) { if (instruction instanceof ImmutableInstruction3rc) { return (ImmutableInstruction3rc)instruction; } return new ImmutableInstruction3rc( instruction.getOpcode(), instruction.getStartRegister(), instruction.getRegisterCount(), instruction.getReference()); }
public void write(@Nonnull Instruction3rc instruction) { try { writer.write(getOpcodeValue(instruction.getOpcode())); writer.write(instruction.getRegisterCount()); writer.writeUshort(getReferenceIndex(instruction)); writer.writeUshort(instruction.getStartRegister()); } catch (IOException ex) { throw new RuntimeException(ex); } }
public static ImmutableInstruction3rc of(Instruction3rc instruction) { if (instruction instanceof ImmutableInstruction3rc) { return (ImmutableInstruction3rc)instruction; } return new ImmutableInstruction3rc( instruction.getOpcode(), instruction.getStartRegister(), instruction.getRegisterCount(), instruction.getReference()); }
public void write(@Nonnull Instruction3rc instruction) { try { writer.write(getOpcodeValue(instruction.getOpcode())); writer.write(instruction.getRegisterCount()); writer.writeUshort(getReferenceIndex(instruction)); writer.writeUshort(instruction.getStartRegister()); } catch (IOException ex) { throw new RuntimeException(ex); } }