blob: 116cbe9254ba096a546e54d7266fc2e5f9c61786 [file] [log] [blame]
Ian Rogers08f753d2012-08-24 14:35:25 -07001/*
2 * Copyright (C) 2012 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
Brian Carlstromfc0e3212013-07-17 14:40:12 -070017#ifndef ART_RUNTIME_MODIFIERS_H_
18#define ART_RUNTIME_MODIFIERS_H_
Ian Rogers08f753d2012-08-24 14:35:25 -070019
Ian Rogers2dd0e2c2013-01-24 12:42:14 -080020#include <stdint.h>
21
Mathieu Chartier52a7f5c2015-08-18 18:35:52 -070022namespace art {
23
Andreas Gampe51829322014-08-25 15:05:04 -070024static constexpr uint32_t kAccPublic = 0x0001; // class, field, method, ic
25static constexpr uint32_t kAccPrivate = 0x0002; // field, method, ic
26static constexpr uint32_t kAccProtected = 0x0004; // field, method, ic
27static constexpr uint32_t kAccStatic = 0x0008; // field, method, ic
28static constexpr uint32_t kAccFinal = 0x0010; // class, field, method, ic
29static constexpr uint32_t kAccSynchronized = 0x0020; // method (only allowed on natives)
30static constexpr uint32_t kAccSuper = 0x0020; // class (not used in dex)
31static constexpr uint32_t kAccVolatile = 0x0040; // field
32static constexpr uint32_t kAccBridge = 0x0040; // method (1.5)
33static constexpr uint32_t kAccTransient = 0x0080; // field
34static constexpr uint32_t kAccVarargs = 0x0080; // method (1.5)
35static constexpr uint32_t kAccNative = 0x0100; // method
36static constexpr uint32_t kAccInterface = 0x0200; // class, ic
37static constexpr uint32_t kAccAbstract = 0x0400; // class, method, ic
38static constexpr uint32_t kAccStrict = 0x0800; // method
39static constexpr uint32_t kAccSynthetic = 0x1000; // class, field, method, ic
40static constexpr uint32_t kAccAnnotation = 0x2000; // class, ic (1.5)
41static constexpr uint32_t kAccEnum = 0x4000; // class, field, ic (1.5)
Ian Rogers08f753d2012-08-24 14:35:25 -070042
Andreas Gampe51829322014-08-25 15:05:04 -070043static constexpr uint32_t kAccJavaFlagsMask = 0xffff; // bits set from Java sources (low 16)
Ian Rogers08f753d2012-08-24 14:35:25 -070044
Andreas Gampe51829322014-08-25 15:05:04 -070045static constexpr uint32_t kAccConstructor = 0x00010000; // method (dex only) <(cl)init>
46static constexpr uint32_t kAccDeclaredSynchronized = 0x00020000; // method (dex only)
47static constexpr uint32_t kAccClassIsProxy = 0x00040000; // class (dex only)
48static constexpr uint32_t kAccPreverified = 0x00080000; // class (runtime),
49 // method (dex only)
50static constexpr uint32_t kAccFastNative = 0x00080000; // method (dex only)
Andreas Gampe51829322014-08-25 15:05:04 -070051static constexpr uint32_t kAccMiranda = 0x00200000; // method (dex only)
Alex Lighteb7c1442015-08-31 13:17:42 -070052static constexpr uint32_t kAccDefault = 0x00400000; // method (runtime)
Ian Rogers08f753d2012-08-24 14:35:25 -070053
54// Special runtime-only flags.
Alex Lighteb7c1442015-08-31 13:17:42 -070055// Interface and all its super-interfaces with default methods have been recursively initialized.
56static constexpr uint32_t kAccRecursivelyInitialized = 0x20000000;
57// Interface declares some default method.
58static constexpr uint32_t kAccHasDefaultMethod = 0x40000000;
Andreas Gampe51829322014-08-25 15:05:04 -070059// class/ancestor overrides finalize()
60static constexpr uint32_t kAccClassIsFinalizable = 0x80000000;
Andreas Gampe51829322014-08-25 15:05:04 -070061
62// Valid (meaningful) bits for a field.
63static constexpr uint32_t kAccValidFieldFlags = kAccPublic | kAccPrivate | kAccProtected |
64 kAccStatic | kAccFinal | kAccVolatile | kAccTransient | kAccSynthetic | kAccEnum;
65
66// Valid (meaningful) bits for a method.
67static constexpr uint32_t kAccValidMethodFlags = kAccPublic | kAccPrivate | kAccProtected |
68 kAccStatic | kAccFinal | kAccSynchronized | kAccBridge | kAccVarargs | kAccNative |
69 kAccAbstract | kAccStrict | kAccSynthetic | kAccMiranda | kAccConstructor |
70 kAccDeclaredSynchronized;
71
72// Valid (meaningful) bits for a class (not interface).
73// Note 1. These are positive bits. Other bits may have to be zero.
74// Note 2. Inner classes can expose more access flags to Java programs. That is handled by libcore.
75static constexpr uint32_t kAccValidClassFlags = kAccPublic | kAccFinal | kAccSuper |
76 kAccAbstract | kAccSynthetic | kAccEnum;
77
78// Valid (meaningful) bits for an interface.
79// Note 1. Annotations are interfaces.
80// Note 2. These are positive bits. Other bits may have to be zero.
81// Note 3. Inner classes can expose more access flags to Java programs. That is handled by libcore.
82static constexpr uint32_t kAccValidInterfaceFlags = kAccPublic | kAccInterface |
83 kAccAbstract | kAccSynthetic | kAccAnnotation;
Ian Rogers08f753d2012-08-24 14:35:25 -070084
Mathieu Chartier52a7f5c2015-08-18 18:35:52 -070085} // namespace art
86
Brian Carlstromfc0e3212013-07-17 14:40:12 -070087#endif // ART_RUNTIME_MODIFIERS_H_
Ian Rogers08f753d2012-08-24 14:35:25 -070088