2 * Copyright (C) 2014 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef ART_RUNTIME_VERIFY_OBJECT_H_
18 #define ART_RUNTIME_VERIFY_OBJECT_H_
22 #include "base/macros.h"
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.
38 enum VerifyObjectFlags {
40 // Verify self when we are doing an operation.
42 // Verify reads from objects.
44 // Verify writes to objects.
47 kVerifyAll = kVerifyThis | kVerifyReads | kVerifyWrites,
50 static constexpr bool kVerifyStack = kIsDebugBuild;
51 static constexpr VerifyObjectFlags kDefaultVerifyFlags = kVerifyNone;
52 static constexpr VerifyObjectMode kVerifyObjectSupport =
53 kDefaultVerifyFlags != 0 ? kVerifyObjectModeFast : kVerifyObjectModeDisabled;
55 ALWAYS_INLINE void VerifyObject(mirror::Object* obj) NO_THREAD_SAFETY_ANALYSIS;
57 // Check that c.getClass() == c.getClass().getClass().
58 ALWAYS_INLINE bool VerifyClassClass(mirror::Class* c) NO_THREAD_SAFETY_ANALYSIS;
62 #endif // ART_RUNTIME_VERIFY_OBJECT_H_