Mathieu Chartier | 52a7f5c | 2015-08-18 18:35:52 -0700 | [diff] [blame] | 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 | |
Mathieu Chartier | 66c2d2d | 2015-08-25 14:32:32 -0700 | [diff] [blame] | 25 | // Normal instance with at least one ref field other than the class. |
Mathieu Chartier | 52a7f5c | 2015-08-18 18:35:52 -0700 | [diff] [blame] | 26 | static constexpr uint32_t kClassFlagNormal = 0x00000000; |
Mathieu Chartier | 66c2d2d | 2015-08-25 14:32:32 -0700 | [diff] [blame] | 27 | |
Mathieu Chartier | 52a7f5c | 2015-08-18 18:35:52 -0700 | [diff] [blame] | 28 | // Only normal objects which have no reference fields, e.g. string or primitive array or normal |
Mathieu Chartier | 66c2d2d | 2015-08-25 14:32:32 -0700 | [diff] [blame] | 29 | // class instance with no fields other than klass. |
Mathieu Chartier | 52a7f5c | 2015-08-18 18:35:52 -0700 | [diff] [blame] | 30 | static constexpr uint32_t kClassFlagNoReferenceFields = 0x00000001; |
Mathieu Chartier | 66c2d2d | 2015-08-25 14:32:32 -0700 | [diff] [blame] | 31 | |
| 32 | // Class is java.lang.String.class. |
Mathieu Chartier | 52a7f5c | 2015-08-18 18:35:52 -0700 | [diff] [blame] | 33 | static constexpr uint32_t kClassFlagString = 0x00000004; |
Mathieu Chartier | 66c2d2d | 2015-08-25 14:32:32 -0700 | [diff] [blame] | 34 | |
| 35 | // Class is an object array class. |
Mathieu Chartier | 52a7f5c | 2015-08-18 18:35:52 -0700 | [diff] [blame] | 36 | static constexpr uint32_t kClassFlagObjectArray = 0x00000008; |
Mathieu Chartier | 66c2d2d | 2015-08-25 14:32:32 -0700 | [diff] [blame] | 37 | |
| 38 | // Class is java.lang.Class.class. |
Mathieu Chartier | 52a7f5c | 2015-08-18 18:35:52 -0700 | [diff] [blame] | 39 | static constexpr uint32_t kClassFlagClass = 0x00000010; |
| 40 | |
Mathieu Chartier | 66c2d2d | 2015-08-25 14:32:32 -0700 | [diff] [blame] | 41 | // Class is ClassLoader or one of its subclasses. |
Mathieu Chartier | 52a7f5c | 2015-08-18 18:35:52 -0700 | [diff] [blame] | 42 | static constexpr uint32_t kClassFlagClassLoader = 0x00000020; |
| 43 | |
Vladimir Marko | 05792b9 | 2015-08-03 11:56:49 +0100 | [diff] [blame] | 44 | // Class is DexCache. |
| 45 | static constexpr uint32_t kClassFlagDexCache = 0x00000040; |
| 46 | |
Mathieu Chartier | 66c2d2d | 2015-08-25 14:32:32 -0700 | [diff] [blame] | 47 | // Class is a soft/weak/phantom class. |
Vladimir Marko | 05792b9 | 2015-08-03 11:56:49 +0100 | [diff] [blame] | 48 | static constexpr uint32_t kClassFlagSoftReference = 0x00000080; |
Mathieu Chartier | 66c2d2d | 2015-08-25 14:32:32 -0700 | [diff] [blame] | 49 | |
| 50 | // Class is a weak reference class. |
Vladimir Marko | 05792b9 | 2015-08-03 11:56:49 +0100 | [diff] [blame] | 51 | static constexpr uint32_t kClassFlagWeakReference = 0x00000100; |
Mathieu Chartier | 66c2d2d | 2015-08-25 14:32:32 -0700 | [diff] [blame] | 52 | |
| 53 | // Class is a finalizer reference class. |
Vladimir Marko | 05792b9 | 2015-08-03 11:56:49 +0100 | [diff] [blame] | 54 | static constexpr uint32_t kClassFlagFinalizerReference = 0x00000200; |
Mathieu Chartier | 66c2d2d | 2015-08-25 14:32:32 -0700 | [diff] [blame] | 55 | |
| 56 | // Class is the phantom reference class. |
Vladimir Marko | 05792b9 | 2015-08-03 11:56:49 +0100 | [diff] [blame] | 57 | static constexpr uint32_t kClassFlagPhantomReference = 0x00000400; |
Mathieu Chartier | 52a7f5c | 2015-08-18 18:35:52 -0700 | [diff] [blame] | 58 | |
Mathieu Chartier | 66c2d2d | 2015-08-25 14:32:32 -0700 | [diff] [blame] | 59 | // Combination of flags to figure out if the class is either the weak/soft/phantom/finalizer |
| 60 | // reference class. |
Mathieu Chartier | 52a7f5c | 2015-08-18 18:35:52 -0700 | [diff] [blame] | 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 | |