mirror of
https://github.com/revanced/smali.git
synced 2025-05-05 00:54:25 +02:00
Changed the instruction map to a Sparse array, plus various cleanup
git-svn-id: https://smali.googlecode.com/svn/trunk@447 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
parent
c2c37aed3b
commit
8b260a1d81
@ -140,7 +140,7 @@ public class DeodexUtil {
|
||||
private List<insn> makeInsnList(final CodeItem codeItem) {
|
||||
|
||||
final ArrayList<insn> insns = new ArrayList<insn>();
|
||||
final HashMap<Integer, insn> insnsMap = new HashMap<Integer, insn>();
|
||||
final SparseArray<insn> insnsMap = new SparseArray<insn>();
|
||||
|
||||
byte[] encodedInstructions = codeItem.getEncodedInstructions().clone();
|
||||
|
||||
@ -149,7 +149,7 @@ public class DeodexUtil {
|
||||
public void ProcessInstruction(int index, Instruction instruction) {
|
||||
insn i = new insn(codeItem, instruction, insnsMap, index/2);
|
||||
insns.add(i);
|
||||
insnsMap.put(index/2, i);
|
||||
insnsMap.append(index/2, i);
|
||||
}
|
||||
});
|
||||
|
||||
@ -793,11 +793,11 @@ public class DeodexUtil {
|
||||
* True if this instruction can throw an exception
|
||||
*/
|
||||
public final boolean canThrow;
|
||||
//TODO: ugh, boxed Integers. need to find/write a primitive integer hash map
|
||||
|
||||
/**
|
||||
* maps an instruction stream offset to an insn
|
||||
*/
|
||||
public final HashMap<Integer, insn> insnsMap;
|
||||
public final SparseArray<insn> insnsMap;
|
||||
|
||||
/**
|
||||
* Instructions that can execution could pass on to next
|
||||
@ -857,7 +857,7 @@ public class DeodexUtil {
|
||||
public final RegisterType[] registerMap;
|
||||
public final TypeIdItem[] registerTypes;
|
||||
|
||||
public insn(CodeItem codeItem, Instruction instruction, HashMap<Integer, insn> insnsMap, int offset) {
|
||||
public insn(CodeItem codeItem, Instruction instruction, SparseArray<insn> insnsMap, int offset) {
|
||||
this.codeItem = codeItem;
|
||||
this.instruction = instruction;
|
||||
this.offset = offset;
|
||||
@ -1323,8 +1323,6 @@ public class DeodexUtil {
|
||||
|
||||
if (exceptionHandlers != null && canThrow) {
|
||||
for (insn handlerinsn: exceptionHandlers) {
|
||||
//TODO: we should be able to copy the register map info from this instruction, recursively
|
||||
//if needed, i.e. if the first instruction in a handler is also covered by a try block
|
||||
handlerinsn.initializeRegistersFromParams();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user