mirror of
https://github.com/revanced/smali.git
synced 2025-05-05 00:54:25 +02:00
- removed insn.fixed
- added a merge table for the register type merge logic git-svn-id: https://smali.googlecode.com/svn/trunk@445 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
parent
e6e9569227
commit
a3d7d2423d
@ -204,10 +204,9 @@ public class DeodexUtil {
|
|||||||
didSomething = false;
|
didSomething = false;
|
||||||
somethingLeftToDo = false;
|
somethingLeftToDo = false;
|
||||||
for (insn i: insns) {
|
for (insn i: insns) {
|
||||||
if (i.instruction.opcode.odexOnly && !i.fixed) {
|
if (i.instruction.opcode.odexOnly && i.fixedInstruction == null) {
|
||||||
if (deodexInstruction(i, offset, encodedInstructions)) {
|
if (deodexInstruction(i, offset, encodedInstructions)) {
|
||||||
didSomething = true;
|
didSomething = true;
|
||||||
i.fixed = true;
|
|
||||||
} else {
|
} else {
|
||||||
somethingLeftToDo = true;
|
somethingLeftToDo = true;
|
||||||
}
|
}
|
||||||
@ -227,7 +226,6 @@ public class DeodexUtil {
|
|||||||
for (insn i: insns) {
|
for (insn i: insns) {
|
||||||
if (i.instruction.opcode.odexOnly) {
|
if (i.instruction.opcode.odexOnly) {
|
||||||
//TODO: could probably get rid of insn.fixed
|
//TODO: could probably get rid of insn.fixed
|
||||||
assert i.fixed;
|
|
||||||
assert i.fixedInstruction != null;
|
assert i.fixedInstruction != null;
|
||||||
instructions.add(i.fixedInstruction);
|
instructions.add(i.fixedInstruction);
|
||||||
} else {
|
} else {
|
||||||
@ -764,40 +762,18 @@ public class DeodexUtil {
|
|||||||
Reference,
|
Reference,
|
||||||
Conflicted;
|
Conflicted;
|
||||||
|
|
||||||
//TODO: make a table lookup for this
|
private static RegisterType[][] mergeTable =
|
||||||
|
{
|
||||||
|
//Unknown Null Nonreference Reference Conflicted
|
||||||
|
{Unknown, Null, NonReference, Reference, Conflicted}, //Unknown
|
||||||
|
{Null, Null, NonReference, Reference, Conflicted}, //Null
|
||||||
|
{NonReference, NonReference, NonReference, Conflicted, Conflicted}, //NonReference
|
||||||
|
{Reference, Reference, Conflicted, Reference, Conflicted}, //Referenced
|
||||||
|
{Conflicted, Conflicted, Conflicted, Conflicted, Conflicted}, //Conflicted
|
||||||
|
};
|
||||||
|
|
||||||
public static RegisterType mergeRegisterTypes(RegisterType type1, RegisterType type2) {
|
public static RegisterType mergeRegisterTypes(RegisterType type1, RegisterType type2) {
|
||||||
if (type1 == type2) {
|
return mergeTable[type1.ordinal()][type2.ordinal()];
|
||||||
return type1;
|
|
||||||
}
|
|
||||||
if (type1 == Conflicted || type2 == Conflicted) {
|
|
||||||
return Conflicted;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type1 == Unknown) {
|
|
||||||
return type2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type2 == Unknown) {
|
|
||||||
return type1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type1 == Null) {
|
|
||||||
if (type2 == Reference || type2 == NonReference) {
|
|
||||||
return type2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (type2 == Null) {
|
|
||||||
if (type1 == Reference || type1 == NonReference) {
|
|
||||||
return type1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((type1 == Reference && type2 == NonReference) || (type1 == NonReference && type2 == Reference)) {
|
|
||||||
return Conflicted;
|
|
||||||
}
|
|
||||||
|
|
||||||
assert false;
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user