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