mirror of
https://github.com/revanced/smali.git
synced 2025-05-19 07:27:06 +02:00
Use the term VtableIndex rather than MethodIndex for invoke-*-quick instructions/formats
This commit is contained in:
parent
8e51717604
commit
3bfd77dff0
@ -306,7 +306,7 @@ public class InstructionMethodItem<T extends Instruction> extends MethodItem {
|
||||
|
||||
protected void writeVtableIndex(IndentingWriter writer) throws IOException {
|
||||
writer.write("vtable@0x");
|
||||
writer.printUnsignedLongAsHex(((OdexedInvokeVirtual) instruction).getMethodIndex());
|
||||
writer.printUnsignedLongAsHex(((OdexedInvokeVirtual) instruction).getVtableIndex());
|
||||
}
|
||||
|
||||
protected void writeReference(IndentingWriter writer) throws IOException {
|
||||
|
@ -81,7 +81,7 @@ abstract class InlineMethodResolver {
|
||||
assert analyzedInstruction.instruction instanceof OdexedInvokeVirtual;
|
||||
|
||||
OdexedInvokeVirtual instruction = (OdexedInvokeVirtual)analyzedInstruction.instruction;
|
||||
int methodIndex = instruction.getMethodIndex();
|
||||
int methodIndex = instruction.getVtableIndex();
|
||||
|
||||
if (methodIndex < 0 || methodIndex >= inlineMethods.length) {
|
||||
throw new RuntimeException("Invalid method index: " + methodIndex);
|
||||
@ -146,7 +146,7 @@ abstract class InlineMethodResolver {
|
||||
assert analyzedInstruction.instruction instanceof OdexedInvokeVirtual;
|
||||
|
||||
OdexedInvokeVirtual instruction = (OdexedInvokeVirtual)analyzedInstruction.instruction;
|
||||
int methodIndex = instruction.getMethodIndex();
|
||||
int methodIndex = instruction.getVtableIndex();
|
||||
|
||||
if (methodIndex < 0 || methodIndex >= inlineMethods.length) {
|
||||
throw new RuntimeException("Invalid method index: " + methodIndex);
|
||||
|
@ -3344,7 +3344,7 @@ public class MethodAnalyzer {
|
||||
MethodIdItem inlineMethodIdItem = inlineMethod.getMethodIdItem();
|
||||
if (inlineMethodIdItem == null) {
|
||||
throw new ValidationException(String.format("Cannot load inline method with index %d",
|
||||
instruction.getMethodIndex()));
|
||||
instruction.getVtableIndex()));
|
||||
}
|
||||
|
||||
Opcode deodexedOpcode = null;
|
||||
@ -3382,7 +3382,7 @@ public class MethodAnalyzer {
|
||||
MethodIdItem inlineMethodIdItem = inlineMethod.getMethodIdItem();
|
||||
if (inlineMethodIdItem == null) {
|
||||
throw new ValidationException(String.format("Cannot load inline method with index %d",
|
||||
instruction.getMethodIndex()));
|
||||
instruction.getVtableIndex()));
|
||||
}
|
||||
|
||||
Opcode deodexedOpcode = null;
|
||||
@ -3458,11 +3458,11 @@ public class MethodAnalyzer {
|
||||
|
||||
if (isRange) {
|
||||
Instruction3rms instruction = (Instruction3rms)analyzedInstruction.instruction;
|
||||
methodIndex = instruction.getMethodIndex();
|
||||
methodIndex = instruction.getVtableIndex();
|
||||
objectRegister = instruction.getStartRegister();
|
||||
} else {
|
||||
Instruction35ms instruction = (Instruction35ms)analyzedInstruction.instruction;
|
||||
methodIndex = instruction.getMethodIndex();
|
||||
methodIndex = instruction.getVtableIndex();
|
||||
objectRegister = instruction.getRegisterD();
|
||||
}
|
||||
|
||||
|
@ -45,10 +45,10 @@ public class Instruction35ms extends Instruction implements FiveRegisterInstruct
|
||||
private byte regE;
|
||||
private byte regF;
|
||||
private byte regG;
|
||||
private short methodIndex;
|
||||
private short vtableIndex;
|
||||
|
||||
public Instruction35ms(Opcode opcode, int regCount, byte regD, byte regE, byte regF, byte regG,
|
||||
byte regA, int methodIndex) {
|
||||
byte regA, int vtableIndex) {
|
||||
super(opcode);
|
||||
if (regCount > 5) {
|
||||
throw new RuntimeException("regCount cannot be greater than 5");
|
||||
@ -62,7 +62,7 @@ public class Instruction35ms extends Instruction implements FiveRegisterInstruct
|
||||
throw new RuntimeException("All register args must fit in 4 bits");
|
||||
}
|
||||
|
||||
if (methodIndex >= 1 << 16) {
|
||||
if (vtableIndex >= 1 << 16) {
|
||||
throw new RuntimeException("The method index must be less than 65536");
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ public class Instruction35ms extends Instruction implements FiveRegisterInstruct
|
||||
this.regE = regE;
|
||||
this.regF = regF;
|
||||
this.regG = regG;
|
||||
this.methodIndex = (short)methodIndex;
|
||||
this.vtableIndex = (short)vtableIndex;
|
||||
}
|
||||
|
||||
private Instruction35ms(Opcode opcode, byte[] buffer, int bufferIndex) {
|
||||
@ -84,13 +84,13 @@ public class Instruction35ms extends Instruction implements FiveRegisterInstruct
|
||||
this.regE = NumberUtils.decodeHighUnsignedNibble(buffer[bufferIndex + 4]);
|
||||
this.regF = NumberUtils.decodeLowUnsignedNibble(buffer[bufferIndex + 5]);
|
||||
this.regG = NumberUtils.decodeHighUnsignedNibble(buffer[bufferIndex + 5]);
|
||||
this.methodIndex = (short)NumberUtils.decodeUnsignedShort(buffer, bufferIndex + 2);
|
||||
this.vtableIndex = (short)NumberUtils.decodeUnsignedShort(buffer, bufferIndex + 2);
|
||||
}
|
||||
|
||||
protected void writeInstruction(AnnotatedOutput out, int currentCodeAddress) {
|
||||
out.writeByte(opcode.value);
|
||||
out.writeByte((regCount << 4) | regA);
|
||||
out.writeShort(methodIndex);
|
||||
out.writeShort(vtableIndex);
|
||||
out.writeByte((regE << 4) | regD);
|
||||
out.writeByte((regG << 4) | regF);
|
||||
}
|
||||
@ -123,8 +123,8 @@ public class Instruction35ms extends Instruction implements FiveRegisterInstruct
|
||||
return regG;
|
||||
}
|
||||
|
||||
public int getMethodIndex() {
|
||||
return methodIndex & 0xFFFF;
|
||||
public int getVtableIndex() {
|
||||
return vtableIndex & 0xFFFF;
|
||||
}
|
||||
|
||||
private static class Factory implements Instruction.InstructionFactory {
|
||||
|
@ -40,9 +40,9 @@ public class Instruction3rms extends Instruction implements RegisterRangeInstruc
|
||||
public static final Instruction.InstructionFactory Factory = new Factory();
|
||||
private byte regCount;
|
||||
private short startReg;
|
||||
private short methodIndex;
|
||||
private short vtableIndex;
|
||||
|
||||
public Instruction3rms(Opcode opcode, short regCount, int startReg, int methodIndex) {
|
||||
public Instruction3rms(Opcode opcode, short regCount, int startReg, int vtableIndex) {
|
||||
super(opcode);
|
||||
|
||||
if (regCount >= 1 << 8) {
|
||||
@ -59,27 +59,27 @@ public class Instruction3rms extends Instruction implements RegisterRangeInstruc
|
||||
throw new RuntimeException("The beginning register of the range cannot be negative");
|
||||
}
|
||||
|
||||
if (methodIndex >= 1 << 16) {
|
||||
if (vtableIndex >= 1 << 16) {
|
||||
throw new RuntimeException("The method index must be less than 65536");
|
||||
}
|
||||
|
||||
this.regCount = (byte)regCount;
|
||||
this.startReg = (short)startReg;
|
||||
this.methodIndex = (short)methodIndex;
|
||||
this.vtableIndex = (short)vtableIndex;
|
||||
}
|
||||
|
||||
private Instruction3rms(Opcode opcode, byte[] buffer, int bufferIndex) {
|
||||
super(opcode);
|
||||
|
||||
this.regCount = (byte)NumberUtils.decodeUnsignedByte(buffer[bufferIndex + 1]);
|
||||
this.methodIndex = (short)NumberUtils.decodeUnsignedShort(buffer, bufferIndex + 2);
|
||||
this.vtableIndex = (short)NumberUtils.decodeUnsignedShort(buffer, bufferIndex + 2);
|
||||
this.startReg = (short)NumberUtils.decodeUnsignedShort(buffer, bufferIndex + 4);
|
||||
}
|
||||
|
||||
protected void writeInstruction(AnnotatedOutput out, int currentCodeAddress) {
|
||||
out.writeByte(opcode.value);
|
||||
out.writeByte(regCount);
|
||||
out.writeShort(methodIndex);
|
||||
out.writeShort(vtableIndex);
|
||||
out.writeShort(startReg);
|
||||
}
|
||||
|
||||
@ -95,8 +95,8 @@ public class Instruction3rms extends Instruction implements RegisterRangeInstruc
|
||||
return startReg & 0xFFFF;
|
||||
}
|
||||
|
||||
public int getMethodIndex() {
|
||||
return methodIndex & 0xFFFF;
|
||||
public int getVtableIndex() {
|
||||
return vtableIndex & 0xFFFF;
|
||||
}
|
||||
|
||||
private static class Factory implements Instruction.InstructionFactory {
|
||||
|
@ -29,5 +29,5 @@
|
||||
package org.jf.dexlib.Code;
|
||||
|
||||
public interface OdexedInvokeVirtual {
|
||||
int getMethodIndex();
|
||||
int getVtableIndex();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user