OSDN Git Service

Revert "Prune uses library classes even without profile DO NOT MERGE"
[android-x86/art.git] / runtime / verify_object.h
1 /*
2  * Copyright (C) 2014 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 #ifndef ART_RUNTIME_VERIFY_OBJECT_H_
18 #define ART_RUNTIME_VERIFY_OBJECT_H_
19
20 #include <stdint.h>
21
22 #include "base/macros.h"
23
24 namespace art {
25
26 namespace mirror {
27   class Class;
28   class Object;
29 }  // namespace mirror
30
31 // How we want to sanity check the heap's correctness.
32 enum VerifyObjectMode {
33   kVerifyObjectModeDisabled,  // Heap verification is disabled.
34   kVerifyObjectModeFast,  // Sanity heap accesses quickly by using VerifyClassClass.
35   kVerifyObjectModeAll  // Sanity heap accesses thoroughly.
36 };
37
38 enum VerifyObjectFlags {
39   kVerifyNone = 0x0,
40   // Verify self when we are doing an operation.
41   kVerifyThis = 0x1,
42   // Verify reads from objects.
43   kVerifyReads = 0x2,
44   // Verify writes to objects.
45   kVerifyWrites = 0x4,
46   // Verify all things.
47   kVerifyAll = kVerifyThis | kVerifyReads | kVerifyWrites,
48 };
49
50 static constexpr bool kVerifyStack = kIsDebugBuild;
51 static constexpr VerifyObjectFlags kDefaultVerifyFlags = kVerifyNone;
52 static constexpr VerifyObjectMode kVerifyObjectSupport =
53     kDefaultVerifyFlags != 0 ? kVerifyObjectModeFast : kVerifyObjectModeDisabled;
54
55 ALWAYS_INLINE void VerifyObject(mirror::Object* obj) NO_THREAD_SAFETY_ANALYSIS;
56
57 // Check that c.getClass() == c.getClass().getClass().
58 ALWAYS_INLINE bool VerifyClassClass(mirror::Class* c) NO_THREAD_SAFETY_ANALYSIS;
59
60 }  // namespace art
61
62 #endif  // ART_RUNTIME_VERIFY_OBJECT_H_