mirror of
https://github.com/revanced/smali.git
synced 2025-05-29 04:10:13 +02:00
Remove the expanded opcode stuff
This commit is contained in:
parent
7c71ad420d
commit
b5e40f2abd
@ -286,7 +286,6 @@ public enum Opcode
|
|||||||
SPUT_OBJECT_VOLATILE((short)0xfe, "sput-object-volatile", ReferenceType.FIELD, Format.Format21c, Opcode.ODEX_ONLY | Opcode.ODEXED_STATIC_VOLATILE | Opcode.CAN_THROW | Opcode.CAN_CONTINUE);
|
SPUT_OBJECT_VOLATILE((short)0xfe, "sput-object-volatile", ReferenceType.FIELD, Format.Format21c, Opcode.ODEX_ONLY | Opcode.ODEXED_STATIC_VOLATILE | Opcode.CAN_THROW | Opcode.CAN_CONTINUE);
|
||||||
|
|
||||||
private static Opcode[] opcodesByValue;
|
private static Opcode[] opcodesByValue;
|
||||||
private static Opcode[] expandedOpcodesByValue;
|
|
||||||
private static HashMap<Integer, Opcode> opcodesByName;
|
private static HashMap<Integer, Opcode> opcodesByName;
|
||||||
|
|
||||||
//if the instruction can throw an exception
|
//if the instruction can throw an exception
|
||||||
@ -314,18 +313,12 @@ public enum Opcode
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
opcodesByValue = new Opcode[256];
|
opcodesByValue = new Opcode[256];
|
||||||
expandedOpcodesByValue = new Opcode[256];
|
|
||||||
opcodesByName = new HashMap<Integer, Opcode>();
|
opcodesByName = new HashMap<Integer, Opcode>();
|
||||||
|
|
||||||
for (Opcode opcode: Opcode.values()) {
|
for (Opcode opcode: Opcode.values()) {
|
||||||
//INVOKE_DIRECT_EMPTY was changed to INVOKE_OBJECT_INIT_RANGE in ICS
|
//INVOKE_DIRECT_EMPTY was changed to INVOKE_OBJECT_INIT_RANGE in ICS
|
||||||
if (opcode != INVOKE_DIRECT_EMPTY) {
|
if (opcode != INVOKE_DIRECT_EMPTY) {
|
||||||
if (((opcode.value >> 8) & 0xFF) == 0x00) {
|
opcodesByValue[opcode.value] = opcode;
|
||||||
opcodesByValue[opcode.value & 0xFF] = opcode;
|
|
||||||
} else {
|
|
||||||
assert ((opcode.value >> 8) & 0xFF) == 0xFF;
|
|
||||||
expandedOpcodesByValue[opcode.value & 0xFF] = opcode;
|
|
||||||
}
|
|
||||||
opcodesByName.put(opcode.name.hashCode(), opcode);
|
opcodesByName.put(opcode.name.hashCode(), opcode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -336,34 +329,19 @@ public enum Opcode
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Opcode getOpcodeByValue(short opcodeValue) {
|
public static Opcode getOpcodeByValue(short opcodeValue) {
|
||||||
if (((opcodeValue >> 8) & 0xFF) == 0x00) {
|
return opcodesByValue[opcodeValue];
|
||||||
return opcodesByValue[opcodeValue & 0xFF];
|
|
||||||
} else {
|
|
||||||
assert ((opcodeValue >> 8) & 0xFF) == 0xFF;
|
|
||||||
return expandedOpcodesByValue[opcodeValue & 0xFF];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void removeOpcodes(Opcode... toRemove) {
|
private static void removeOpcodes(Opcode... toRemove) {
|
||||||
for (Opcode opcode: toRemove) {
|
for (Opcode opcode: toRemove) {
|
||||||
opcodesByName.remove(opcode.name.toLowerCase().hashCode());
|
opcodesByName.remove(opcode.name.toLowerCase().hashCode());
|
||||||
|
opcodesByValue[opcode.value] = null;
|
||||||
if (((opcode.value >> 8) & 0xFF) == 0x00) {
|
|
||||||
opcodesByValue[opcode.value] = null;
|
|
||||||
} else {
|
|
||||||
expandedOpcodesByValue[opcode.value & 0xFF] = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addOpcodes(Opcode... toAdd) {
|
private static void addOpcodes(Opcode... toAdd) {
|
||||||
for (Opcode opcode: toAdd) {
|
for (Opcode opcode: toAdd) {
|
||||||
if (((opcode.value >> 8) & 0xFF) == 0x00) {
|
opcodesByValue[opcode.value] = opcode;
|
||||||
opcodesByValue[opcode.value & 0xFF] = opcode;
|
|
||||||
} else {
|
|
||||||
assert ((opcode.value >> 8) & 0xFF) == 0xFF;
|
|
||||||
expandedOpcodesByValue[opcode.value & 0xFF] = opcode;
|
|
||||||
}
|
|
||||||
opcodesByName.put(opcode.name.hashCode(), opcode);
|
opcodesByName.put(opcode.name.hashCode(), opcode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user