1b1994897Sopenharmony_ci/**
2b1994897Sopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3b1994897Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4b1994897Sopenharmony_ci * you may not use this file except in compliance with the License.
5b1994897Sopenharmony_ci * You may obtain a copy of the License at
6b1994897Sopenharmony_ci *
7b1994897Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0
8b1994897Sopenharmony_ci *
9b1994897Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10b1994897Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11b1994897Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12b1994897Sopenharmony_ci * See the License for the specific language governing permissions and
13b1994897Sopenharmony_ci * limitations under the License.
14b1994897Sopenharmony_ci */
15b1994897Sopenharmony_ci
16b1994897Sopenharmony_ci#ifndef LIBPANDAFILE_MODIFIERS_H
17b1994897Sopenharmony_ci#define LIBPANDAFILE_MODIFIERS_H
18b1994897Sopenharmony_ci
19b1994897Sopenharmony_ci#include "utils/bit_utils.h"
20b1994897Sopenharmony_ci
21b1994897Sopenharmony_ci#include <cstdint>
22b1994897Sopenharmony_ci
23b1994897Sopenharmony_cinamespace panda {
24b1994897Sopenharmony_ci
25b1994897Sopenharmony_cistatic constexpr uint32_t ACC_PUBLIC = 0x0001;        // field, method, class
26b1994897Sopenharmony_cistatic constexpr uint32_t ACC_PRIVATE = 0x0002;       // field, method
27b1994897Sopenharmony_cistatic constexpr uint32_t ACC_PROTECTED = 0x0004;     // field, method
28b1994897Sopenharmony_cistatic constexpr uint32_t ACC_STATIC = 0x0008;        // field, method
29b1994897Sopenharmony_cistatic constexpr uint32_t ACC_FINAL = 0x0010;         // field, method, class
30b1994897Sopenharmony_cistatic constexpr uint32_t ACC_SUPER = 0x0020;         // class
31b1994897Sopenharmony_cistatic constexpr uint32_t ACC_SYNCHRONIZED = 0x0020;  // method
32b1994897Sopenharmony_cistatic constexpr uint32_t ACC_BRIDGE = 0x0040;        // method
33b1994897Sopenharmony_cistatic constexpr uint32_t ACC_VOLATILE = 0x0040;      // field
34b1994897Sopenharmony_cistatic constexpr uint32_t ACC_TRANSIENT = 0x0080;     // field,
35b1994897Sopenharmony_cistatic constexpr uint32_t ACC_VARARGS = 0x0080;       // method
36b1994897Sopenharmony_cistatic constexpr uint32_t ACC_NATIVE = 0x0100;        // method
37b1994897Sopenharmony_cistatic constexpr uint32_t ACC_INTERFACE = 0x0200;     // class
38b1994897Sopenharmony_cistatic constexpr uint32_t ACC_ABSTRACT = 0x0400;      // method, class
39b1994897Sopenharmony_cistatic constexpr uint32_t ACC_STRICT = 0x0800;        // method
40b1994897Sopenharmony_cistatic constexpr uint32_t ACC_SYNTHETIC = 0x1000;     // field, method, class
41b1994897Sopenharmony_cistatic constexpr uint32_t ACC_ANNOTATION = 0x2000;    // class
42b1994897Sopenharmony_cistatic constexpr uint32_t ACC_ENUM = 0x4000;          // field, class
43b1994897Sopenharmony_ci
44b1994897Sopenharmony_cistatic constexpr uint32_t ACC_FILE_MASK = 0xFFFF;
45b1994897Sopenharmony_ci
46b1994897Sopenharmony_ci// Field type
47b1994897Sopenharmony_cistatic constexpr uint32_t ACC_TYPE = 0x00FF0000;  // field
48b1994897Sopenharmony_cistatic constexpr uint32_t ACC_TYPE_SHIFT = Ctz(ACC_TYPE);
49b1994897Sopenharmony_ci
50b1994897Sopenharmony_ci// Runtime internal modifiers
51b1994897Sopenharmony_cistatic constexpr uint32_t ACC_HAS_DEFAULT_METHODS = 0x00010000;       // class (runtime)
52b1994897Sopenharmony_cistatic constexpr uint32_t ACC_CONSTRUCTOR = 0x00010000;               // method (runtime)
53b1994897Sopenharmony_cistatic constexpr uint32_t ACC_DEFAULT_INTERFACE_METHOD = 0x00020000;  // method (runtime)
54b1994897Sopenharmony_cistatic constexpr uint32_t ACC_SINGLE_IMPL = 0x00040000;               // method (runtime)
55b1994897Sopenharmony_cistatic constexpr uint32_t ACC_INTRINSIC = 0x00200000;                 // method (runtime)
56b1994897Sopenharmony_ci
57b1994897Sopenharmony_cistatic constexpr uint32_t INTRINSIC_SHIFT = MinimumBitsToStore(ACC_INTRINSIC);
58b1994897Sopenharmony_cistatic constexpr uint32_t INTRINSIC_MASK = static_cast<uint32_t>(0xffffffff) << INTRINSIC_SHIFT;
59b1994897Sopenharmony_cistatic constexpr uint32_t MAX_INTRINSIC_NUMBER = INTRINSIC_MASK >> INTRINSIC_SHIFT;
60b1994897Sopenharmony_ci
61b1994897Sopenharmony_ci// Runtime internal language specific modifiers
62b1994897Sopenharmony_cistatic constexpr uint32_t ACC_PROXY = 0x00020000;            // class (java runtime)
63b1994897Sopenharmony_cistatic constexpr uint32_t ACC_FAST_NATIVE = 0x00080000;      // method (java runtime)
64b1994897Sopenharmony_cistatic constexpr uint32_t ACC_CRITICAL_NATIVE = 0x00100000;  // method (java runtime)
65b1994897Sopenharmony_ci
66b1994897Sopenharmony_cistatic constexpr uint32_t ACC_VERIFICATION_STATUS = 0x00400000;  // method (runtime)
67b1994897Sopenharmony_cistatic constexpr uint32_t VERIFICATION_STATUS_SHIFT = MinimumBitsToStore(ACC_VERIFICATION_STATUS);
68b1994897Sopenharmony_cistatic constexpr uint32_t VERIFICATION_STATUS_MASK = static_cast<uint32_t>(0x7) << VERIFICATION_STATUS_SHIFT;
69b1994897Sopenharmony_ci
70b1994897Sopenharmony_cistatic constexpr uint32_t ACC_COMPILATION_STATUS = 0x02000000;  // method (runtime)
71b1994897Sopenharmony_cistatic constexpr uint32_t COMPILATION_STATUS_SHIFT = MinimumBitsToStore(ACC_COMPILATION_STATUS);
72b1994897Sopenharmony_cistatic constexpr uint32_t COMPILATION_STATUS_MASK = static_cast<uint32_t>(0x7) << COMPILATION_STATUS_SHIFT;
73b1994897Sopenharmony_ci}  // namespace panda
74b1994897Sopenharmony_ci
75b1994897Sopenharmony_ci#endif  // LIBPANDAFILE_MODIFIERS_H
76