From 7974e53f152a584020af1db6ef3e7612ed714ce8 Mon Sep 17 00:00:00 2001 From: "JesusFreke@JesusFreke.com" Date: Wed, 3 Mar 2010 03:25:53 +0000 Subject: [PATCH] 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 --- .../jf/dexlib/Code/Analysis/MethodAnalyzer.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/dexlib/src/main/java/org/jf/dexlib/Code/Analysis/MethodAnalyzer.java b/dexlib/src/main/java/org/jf/dexlib/Code/Analysis/MethodAnalyzer.java index 079af06b..d1315738 100644 --- a/dexlib/src/main/java/org/jf/dexlib/Code/Analysis/MethodAnalyzer.java +++ b/dexlib/src/main/java/org/jf/dexlib/Code/Analysis/MethodAnalyzer.java @@ -43,7 +43,10 @@ public class MethodAnalyzer { private SparseArray 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(); }