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:
JesusFreke@JesusFreke.com 2010-03-03 03:25:53 +00:00
parent e0ce06f238
commit 7974e53f15

View File

@ -43,7 +43,10 @@ public class MethodAnalyzer {
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;
@ -99,11 +102,19 @@ public class MethodAnalyzer {
verifiedInstructions = new BitSet(instructions.size());
}
public boolean isAnalyzed() {
return analyzerState >= ANALYZED;
}
public boolean isVerified() {
return analyzerState == VERIFIED;
}
public AnalyzedInstruction[] analyze() {
assert encodedMethod != null;
assert encodedMethod.codeItem != null;
if (analyzed) {
if (analyzerState >= ANALYZED) {
return makeInstructionArray();
}
@ -261,7 +272,7 @@ public class MethodAnalyzer {
}
}
analyzed = true;
analyzerState = ANALYZED;
return makeInstructionArray();
}