mirror of
https://github.com/revanced/smali.git
synced 2025-06-13 04:27:38 +02:00
Add the logic to iterate over all the instructions as the register information for them is updated
git-svn-id: https://smali.googlecode.com/svn/trunk@612 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
@ -15,6 +15,8 @@ public class MethodAnalyzer {
|
|||||||
|
|
||||||
private boolean analyzed = false;
|
private boolean analyzed = false;
|
||||||
|
|
||||||
|
private BitSet instructionsToVerify;
|
||||||
|
|
||||||
//This is a dummy instruction that occurs immediately before the first real instruction. We can initialize the
|
//This is a dummy instruction that occurs immediately before the first real instruction. We can initialize the
|
||||||
//register types for this instruction to the parameter types, in order to have them propagate to all of its
|
//register types for this instruction to the parameter types, in order to have them propagate to all of its
|
||||||
//successors, e.g. the first real instruction, the first instructions in any exception handlers covering the first
|
//successors, e.g. the first real instruction, the first instructions in any exception handlers covering the first
|
||||||
@ -54,6 +56,8 @@ public class MethodAnalyzer {
|
|||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
instructionsToVerify = new BitSet(instructions.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
public AnalyzedInstruction[] analyze() {
|
public AnalyzedInstruction[] analyze() {
|
||||||
@ -106,6 +110,19 @@ public class MethodAnalyzer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BitSet analyzedInstructions = new BitSet(instructionsToVerify.size());
|
||||||
|
|
||||||
|
//make sure all of the "first instructions" are marked for processing
|
||||||
|
for (AnalyzedInstruction successor: startOfMethod.successors) {
|
||||||
|
instructionsToVerify.set(successor.instructionIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!instructionsToVerify.isEmpty()) {
|
||||||
|
for(int i=instructionsToVerify.nextSetBit(0); i>=0; i=instructionsToVerify.nextSetBit(i+1)) {
|
||||||
|
analyzeInstruction(instructions.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
analyzed = true;
|
analyzed = true;
|
||||||
return makeInstructionArray();
|
return makeInstructionArray();
|
||||||
}
|
}
|
||||||
@ -234,6 +251,7 @@ public class MethodAnalyzer {
|
|||||||
|
|
||||||
if (successor.setPostRegisterType(registerNumber, registerType)) {
|
if (successor.setPostRegisterType(registerNumber, registerType)) {
|
||||||
changedInstructions.set(successor.instructionIndex);
|
changedInstructions.set(successor.instructionIndex);
|
||||||
|
instructionsToVerify.set(successor.instructionIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -397,7 +415,7 @@ public class MethodAnalyzer {
|
|||||||
return exceptionHandlers;
|
return exceptionHandlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean setDestinationRegisterTypeForInstruction(AnalyzedInstruction analyzedInstruction) {
|
private boolean analyzeInstruction(AnalyzedInstruction analyzedInstruction) {
|
||||||
Instruction instruction = analyzedInstruction.instruction;
|
Instruction instruction = analyzedInstruction.instruction;
|
||||||
|
|
||||||
switch (instruction.opcode) {
|
switch (instruction.opcode) {
|
||||||
|
Reference in New Issue
Block a user