Added first pass of verifier and supporting changes.
The verifier still needs to make a second pass through the code where it
checks the code flow. A TODO marks where it will be added.
Change-Id: I0abea5bad563776186df342d8132fb1ca8869652
diff --git a/src/dex_verifier.h b/src/dex_verifier.h
index 03b2c96..29dc140 100644
--- a/src/dex_verifier.h
+++ b/src/dex_verifier.h
@@ -5,15 +5,33 @@
#include "macros.h"
#include "object.h"
+#include "dex_instruction.h"
namespace art {
class DexVerify {
public:
+ enum {
+ kInsnFlagWidthMask = 0x0000ffff,
+ kInsnFlagInTry = (1 << 16),
+ kInsnFlagBranchTarget = (1 << 17),
+ kInsnFlagGcPoint = (1 << 18),
+ kInsnFlagVisited = (1 << 30),
+ kInsnFlagChanged = (1 << 31),
+ };
+
static bool VerifyClass(Class* klass);
private:
static bool VerifyMethod(Method* method);
+ static bool VerifyInstructions(const DexFile* dex_file,
+ const DexFile::CodeItem* code_item,
+ uint32_t insn_flags[]);
+ static bool VerifyInstruction(const DexFile* dex_file,
+ const Instruction* inst,
+ uint32_t code_offset,
+ const DexFile::CodeItem* code_item,
+ uint32_t insn_flags[]);
DISALLOW_COPY_AND_ASSIGN(DexVerify);
};