mirror of
https://github.com/revanced/smali.git
synced 2025-05-23 18:16:23 +02:00
Fix out registers for invoke-polymorphic
The calculation of the number of output registers for invoke-polymorphic and invoke-polymorphic-range should be based on the number of registers provided.
This commit is contained in:
parent
93a4373023
commit
b84345935a
@ -38,5 +38,9 @@ public final class InstructionUtil {
|
||||
return opcode == Opcode.INVOKE_STATIC || opcode == Opcode.INVOKE_STATIC_RANGE;
|
||||
}
|
||||
|
||||
public static boolean isInvokePolymorphic(Opcode opcode) {
|
||||
return opcode == Opcode.INVOKE_POLYMORPHIC || opcode == Opcode.INVOKE_POLYMORPHIC_RANGE;
|
||||
}
|
||||
|
||||
private InstructionUtil() {}
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ import org.jf.dexlib2.iface.debug.LineNumber;
|
||||
import org.jf.dexlib2.iface.instruction.Instruction;
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction;
|
||||
import org.jf.dexlib2.iface.instruction.ReferenceInstruction;
|
||||
import org.jf.dexlib2.iface.instruction.VariableRegisterInstruction;
|
||||
import org.jf.dexlib2.iface.instruction.formats.*;
|
||||
import org.jf.dexlib2.iface.reference.*;
|
||||
import org.jf.dexlib2.util.InstructionUtil;
|
||||
@ -955,7 +956,13 @@ public abstract class DexWriter<
|
||||
if (instruction.getOpcode().referenceType == ReferenceType.METHOD) {
|
||||
ReferenceInstruction refInsn = (ReferenceInstruction)instruction;
|
||||
MethodReference methodRef = (MethodReference)refInsn.getReference();
|
||||
int paramCount = MethodUtil.getParameterRegisterCount(methodRef, InstructionUtil.isInvokeStatic(instruction.getOpcode()));
|
||||
Opcode opcode = instruction.getOpcode();
|
||||
int paramCount;
|
||||
if (InstructionUtil.isInvokePolymorphic(opcode)) {
|
||||
paramCount = ((VariableRegisterInstruction)instruction).getRegisterCount();
|
||||
} else {
|
||||
paramCount = MethodUtil.getParameterRegisterCount(methodRef, InstructionUtil.isInvokeStatic(opcode));
|
||||
}
|
||||
if (paramCount > outParamCount) {
|
||||
outParamCount = paramCount;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user