blob: e909b352ee109a07a7fcff02d21a4dee8eeac036 [file] [log] [blame]
Carl Shapiro0e5d75d2011-07-06 18:28:37 -07001// Copyright 2011 Google Inc. All Rights Reserved.
2
3#ifndef ART_SRC_DEX_VERIFY_H_
4#define ART_SRC_DEX_VERIFY_H_
5
Elliott Hughes90a33692011-08-30 13:27:07 -07006#include "dex_file.h"
7#include "dex_instruction.h"
Brian Carlstrom578bbdc2011-07-21 14:07:47 -07008#include "macros.h"
9#include "object.h"
Carl Shapiro0e5d75d2011-07-06 18:28:37 -070010
11namespace art {
12
13class DexVerify {
14 public:
jeffhaoba5ebb92011-08-25 17:24:37 -070015 enum {
16 kInsnFlagWidthMask = 0x0000ffff,
17 kInsnFlagInTry = (1 << 16),
18 kInsnFlagBranchTarget = (1 << 17),
19 kInsnFlagGcPoint = (1 << 18),
20 kInsnFlagVisited = (1 << 30),
21 kInsnFlagChanged = (1 << 31),
22 };
23
Carl Shapiro0e5d75d2011-07-06 18:28:37 -070024 static bool VerifyClass(Class* klass);
25
26 private:
27 static bool VerifyMethod(Method* method);
jeffhaoba5ebb92011-08-25 17:24:37 -070028 static bool VerifyInstructions(const DexFile* dex_file,
29 const DexFile::CodeItem* code_item,
30 uint32_t insn_flags[]);
31 static bool VerifyInstruction(const DexFile* dex_file,
32 const Instruction* inst,
33 uint32_t code_offset,
34 const DexFile::CodeItem* code_item,
35 uint32_t insn_flags[]);
Carl Shapiro0e5d75d2011-07-06 18:28:37 -070036
37 DISALLOW_COPY_AND_ASSIGN(DexVerify);
38};
39
40} // namespace art
41
42#endif // ART_SRC_DEX_VERIFY_H_