Carl Shapiro | 0e5d75d | 2011-07-06 18:28:37 -0700 | [diff] [blame] | 1 | // Copyright 2011 Google Inc. All Rights Reserved. |
| 2 | |
| 3 | #ifndef ART_SRC_DEX_VERIFY_H_ |
| 4 | #define ART_SRC_DEX_VERIFY_H_ |
| 5 | |
Elliott Hughes | 90a3369 | 2011-08-30 13:27:07 -0700 | [diff] [blame^] | 6 | #include "dex_file.h" |
| 7 | #include "dex_instruction.h" |
Brian Carlstrom | 578bbdc | 2011-07-21 14:07:47 -0700 | [diff] [blame] | 8 | #include "macros.h" |
| 9 | #include "object.h" |
Carl Shapiro | 0e5d75d | 2011-07-06 18:28:37 -0700 | [diff] [blame] | 10 | |
| 11 | namespace art { |
| 12 | |
| 13 | class DexVerify { |
| 14 | public: |
jeffhao | ba5ebb9 | 2011-08-25 17:24:37 -0700 | [diff] [blame] | 15 | 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 Shapiro | 0e5d75d | 2011-07-06 18:28:37 -0700 | [diff] [blame] | 24 | static bool VerifyClass(Class* klass); |
| 25 | |
| 26 | private: |
| 27 | static bool VerifyMethod(Method* method); |
jeffhao | ba5ebb9 | 2011-08-25 17:24:37 -0700 | [diff] [blame] | 28 | 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 Shapiro | 0e5d75d | 2011-07-06 18:28:37 -0700 | [diff] [blame] | 36 | |
| 37 | DISALLOW_COPY_AND_ASSIGN(DexVerify); |
| 38 | }; |
| 39 | |
| 40 | } // namespace art |
| 41 | |
| 42 | #endif // ART_SRC_DEX_VERIFY_H_ |