Deodex an invoke-object-init/range as a non-range invoke-virtual when possible

This commit is contained in:
Ben Gruver 2013-05-06 23:57:09 -07:00
parent 94565fa09e
commit 9743f4de0c

View File

@ -1487,8 +1487,17 @@ public class MethodAnalyzer {
private void analyzeInvokeObjectInitRange(@Nonnull AnalyzedInstruction analyzedInstruction, boolean analyzeResult) { private void analyzeInvokeObjectInitRange(@Nonnull AnalyzedInstruction analyzedInstruction, boolean analyzeResult) {
Instruction3rc instruction = (Instruction3rc)analyzedInstruction.instruction; Instruction3rc instruction = (Instruction3rc)analyzedInstruction.instruction;
Instruction3rc deodexedInstruction = new ImmutableInstruction3rc(Opcode.INVOKE_DIRECT_RANGE, Instruction deodexedInstruction;
instruction.getStartRegister(), instruction.getRegisterCount(), instruction.getReference());
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); analyzedInstruction.setDeodexedInstruction(deodexedInstruction);