blob: 139c4cb67ae20287b0776089dc7f9617c790922b [file] [log] [blame]
Mathieu Chartier52a7f5c2015-08-18 18:35:52 -07001/*
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
22namespace art {
23namespace mirror {
24
Mathieu Chartier66c2d2d2015-08-25 14:32:32 -070025// Normal instance with at least one ref field other than the class.
Mathieu Chartier52a7f5c2015-08-18 18:35:52 -070026static constexpr uint32_t kClassFlagNormal = 0x00000000;
Mathieu Chartier66c2d2d2015-08-25 14:32:32 -070027
Mathieu Chartier52a7f5c2015-08-18 18:35:52 -070028// Only normal objects which have no reference fields, e.g. string or primitive array or normal
Mathieu Chartier66c2d2d2015-08-25 14:32:32 -070029// class instance with no fields other than klass.
Mathieu Chartier52a7f5c2015-08-18 18:35:52 -070030static constexpr uint32_t kClassFlagNoReferenceFields = 0x00000001;
Mathieu Chartier66c2d2d2015-08-25 14:32:32 -070031
32// Class is java.lang.String.class.
Mathieu Chartier52a7f5c2015-08-18 18:35:52 -070033static constexpr uint32_t kClassFlagString = 0x00000004;
Mathieu Chartier66c2d2d2015-08-25 14:32:32 -070034
35// Class is an object array class.
Mathieu Chartier52a7f5c2015-08-18 18:35:52 -070036static constexpr uint32_t kClassFlagObjectArray = 0x00000008;
Mathieu Chartier66c2d2d2015-08-25 14:32:32 -070037
38// Class is java.lang.Class.class.
Mathieu Chartier52a7f5c2015-08-18 18:35:52 -070039static constexpr uint32_t kClassFlagClass = 0x00000010;
40
Mathieu Chartier66c2d2d2015-08-25 14:32:32 -070041// Class is ClassLoader or one of its subclasses.
Mathieu Chartier52a7f5c2015-08-18 18:35:52 -070042static constexpr uint32_t kClassFlagClassLoader = 0x00000020;
43
Vladimir Marko05792b92015-08-03 11:56:49 +010044// Class is DexCache.
45static constexpr uint32_t kClassFlagDexCache = 0x00000040;
46
Mathieu Chartier66c2d2d2015-08-25 14:32:32 -070047// Class is a soft/weak/phantom class.
Vladimir Marko05792b92015-08-03 11:56:49 +010048static constexpr uint32_t kClassFlagSoftReference = 0x00000080;
Mathieu Chartier66c2d2d2015-08-25 14:32:32 -070049
50// Class is a weak reference class.
Vladimir Marko05792b92015-08-03 11:56:49 +010051static constexpr uint32_t kClassFlagWeakReference = 0x00000100;
Mathieu Chartier66c2d2d2015-08-25 14:32:32 -070052
53// Class is a finalizer reference class.
Vladimir Marko05792b92015-08-03 11:56:49 +010054static constexpr uint32_t kClassFlagFinalizerReference = 0x00000200;
Mathieu Chartier66c2d2d2015-08-25 14:32:32 -070055
56// Class is the phantom reference class.
Vladimir Marko05792b92015-08-03 11:56:49 +010057static constexpr uint32_t kClassFlagPhantomReference = 0x00000400;
Mathieu Chartier52a7f5c2015-08-18 18:35:52 -070058
Mathieu Chartier66c2d2d2015-08-25 14:32:32 -070059// Combination of flags to figure out if the class is either the weak/soft/phantom/finalizer
60// reference class.
Mathieu Chartier52a7f5c2015-08-18 18:35:52 -070061static 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