1 /*
2  * Copyright (C) 2015 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_MIRROR_CLASS_FLAGS_H_
18 #define ART_RUNTIME_MIRROR_CLASS_FLAGS_H_
19 
20 #include <stdint.h>
21 
22 namespace art {
23 namespace mirror {
24 
25 // Normal instance with at least one ref field other than the class.
26 static constexpr uint32_t kClassFlagNormal             = 0x00000000;
27 
28 // Only normal objects which have no reference fields, e.g. string or primitive array or normal
29 // class instance with no fields other than klass.
30 static constexpr uint32_t kClassFlagNoReferenceFields  = 0x00000001;
31 
32 // Class is java.lang.String.class.
33 static constexpr uint32_t kClassFlagString             = 0x00000004;
34 
35 // Class is an object array class.
36 static constexpr uint32_t kClassFlagObjectArray        = 0x00000008;
37 
38 // Class is java.lang.Class.class.
39 static constexpr uint32_t kClassFlagClass              = 0x00000010;
40 
41 // Class is ClassLoader or one of its subclasses.
42 static constexpr uint32_t kClassFlagClassLoader        = 0x00000020;
43 
44 // Class is DexCache.
45 static constexpr uint32_t kClassFlagDexCache           = 0x00000040;
46 
47 // Class is a soft/weak/phantom class.
48 static constexpr uint32_t kClassFlagSoftReference      = 0x00000080;
49 
50 // Class is a weak reference class.
51 static constexpr uint32_t kClassFlagWeakReference      = 0x00000100;
52 
53 // Class is a finalizer reference class.
54 static constexpr uint32_t kClassFlagFinalizerReference = 0x00000200;
55 
56 // Class is the phantom reference class.
57 static constexpr uint32_t kClassFlagPhantomReference   = 0x00000400;
58 
59 // Combination of flags to figure out if the class is either the weak/soft/phantom/finalizer
60 // reference class.
61 static constexpr uint32_t kClassFlagReference =
62     kClassFlagSoftReference |
63     kClassFlagWeakReference |
64     kClassFlagFinalizerReference |
65     kClassFlagPhantomReference;
66 
67 }  // namespace mirror
68 }  // namespace art
69 
70 #endif  // ART_RUNTIME_MIRROR_CLASS_FLAGS_H_
71 
72