1 /* 2 * Copyright (C) 2008 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /* 18 * Dalvik classfile verification. 19 */ 20 #ifndef DALVIK_DEXVERIFY_H_ 21 #define DALVIK_DEXVERIFY_H_ 22 23 /* 24 * Global verification mode. These must be in order from least verification 25 * to most. If we're using "exact GC", we may need to perform some of 26 * the verification steps anyway. 27 */ 28 enum DexClassVerifyMode { 29 VERIFY_MODE_UNKNOWN = 0, 30 VERIFY_MODE_NONE, 31 VERIFY_MODE_REMOTE, 32 VERIFY_MODE_ALL 33 }; 34 35 /* some verifier counters, for debugging */ 36 struct VerifierStats { 37 size_t methodsExamined; /* number of methods examined */ 38 size_t monEnterMethods; /* number of methods with monitor-enter */ 39 size_t instrsExamined; /* incr on first visit of instruction */ 40 size_t instrsReexamined; /* incr on each repeat visit of instruction */ 41 size_t copyRegCount; /* calls from updateRegisters->copyRegisters */ 42 size_t mergeRegCount; /* calls from updateRegisters->merge */ 43 size_t mergeRegChanged; /* calls from updateRegisters->merge, changed */ 44 size_t uninitSearches; /* times we've had to search the uninit table */ 45 size_t biggestAlloc; /* largest RegisterLine table alloc */ 46 }; 47 48 /* 49 * Certain types of instructions can be GC points. To support precise 50 * GC, all such instructions must export the PC in the interpreter, 51 * or the GC won't be able to identify the current PC for the thread. 52 */ 53 #define VERIFY_GC_INST_MASK (kInstrCanBranch | kInstrCanSwitch |\ 54 kInstrCanThrow | kInstrCanReturn) 55 56 /* 57 * Verify a single class. 58 */ 59 bool dvmVerifyClass(ClassObject* clazz); 60 61 /* 62 * Release the storage associated with a RegisterMap. 63 */ 64 void dvmFreeRegisterMap(RegisterMap* pMap); 65 66 #endif // DALVIK_DEXVERIFY_H_ 67