mirror of
https://github.com/revanced/smali.git
synced 2025-05-14 21:27:06 +02:00
Use an integer to hold the state of the MethodAnalyzer, in preparation for splitting the analysis logic into an analysis pass and a verification pass.
git-svn-id: https://smali.googlecode.com/svn/trunk@661 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
parent
e0ce06f238
commit
7974e53f15
@ -43,7 +43,10 @@ public class MethodAnalyzer {
|
|||||||
|
|
||||||
private SparseArray<AnalyzedInstruction> instructions;
|
private SparseArray<AnalyzedInstruction> instructions;
|
||||||
|
|
||||||
private boolean analyzed = false;
|
private static final int NOT_ANALYZED = 0;
|
||||||
|
private static final int ANALYZED = 1;
|
||||||
|
private static final int VERIFIED = 2;
|
||||||
|
private int analyzerState = NOT_ANALYZED;
|
||||||
|
|
||||||
private BitSet verifiedInstructions;
|
private BitSet verifiedInstructions;
|
||||||
|
|
||||||
@ -99,11 +102,19 @@ public class MethodAnalyzer {
|
|||||||
verifiedInstructions = new BitSet(instructions.size());
|
verifiedInstructions = new BitSet(instructions.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isAnalyzed() {
|
||||||
|
return analyzerState >= ANALYZED;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isVerified() {
|
||||||
|
return analyzerState == VERIFIED;
|
||||||
|
}
|
||||||
|
|
||||||
public AnalyzedInstruction[] analyze() {
|
public AnalyzedInstruction[] analyze() {
|
||||||
assert encodedMethod != null;
|
assert encodedMethod != null;
|
||||||
assert encodedMethod.codeItem != null;
|
assert encodedMethod.codeItem != null;
|
||||||
|
|
||||||
if (analyzed) {
|
if (analyzerState >= ANALYZED) {
|
||||||
return makeInstructionArray();
|
return makeInstructionArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,7 +272,7 @@ public class MethodAnalyzer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
analyzed = true;
|
analyzerState = ANALYZED;
|
||||||
return makeInstructionArray();
|
return makeInstructionArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user