From 9743f4de0ccdff01c731433d86735af041a4ad3a Mon Sep 17 00:00:00 2001 From: Ben Gruver Date: Mon, 6 May 2013 23:57:09 -0700 Subject: [PATCH] Deodex an invoke-object-init/range as a non-range invoke-virtual when possible --- .../org/jf/dexlib2/analysis/MethodAnalyzer.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dexlib2/src/main/java/org/jf/dexlib2/analysis/MethodAnalyzer.java b/dexlib2/src/main/java/org/jf/dexlib2/analysis/MethodAnalyzer.java index 30cdff30..8c7b049f 100644 --- a/dexlib2/src/main/java/org/jf/dexlib2/analysis/MethodAnalyzer.java +++ b/dexlib2/src/main/java/org/jf/dexlib2/analysis/MethodAnalyzer.java @@ -1487,8 +1487,17 @@ public class MethodAnalyzer { private void analyzeInvokeObjectInitRange(@Nonnull AnalyzedInstruction analyzedInstruction, boolean analyzeResult) { Instruction3rc instruction = (Instruction3rc)analyzedInstruction.instruction; - Instruction3rc deodexedInstruction = new ImmutableInstruction3rc(Opcode.INVOKE_DIRECT_RANGE, - instruction.getStartRegister(), instruction.getRegisterCount(), instruction.getReference()); + Instruction deodexedInstruction; + + int startRegister = instruction.getStartRegister(); + int registerCount = instruction.getRegisterCount(); + if (registerCount == 1 && 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);