Ian Rogers | 08f753d | 2012-08-24 14:35:25 -0700 | [diff] [blame] | 1 | /* |
| 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 Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 17 | #ifndef ART_RUNTIME_MODIFIERS_H_ |
| 18 | #define ART_RUNTIME_MODIFIERS_H_ |
Ian Rogers | 08f753d | 2012-08-24 14:35:25 -0700 | [diff] [blame] | 19 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 20 | #include <stdint.h> |
| 21 | |
Andreas Gampe | 5182932 | 2014-08-25 15:05:04 -0700 | [diff] [blame] | 22 | static constexpr uint32_t kAccPublic = 0x0001; // class, field, method, ic |
| 23 | static constexpr uint32_t kAccPrivate = 0x0002; // field, method, ic |
| 24 | static constexpr uint32_t kAccProtected = 0x0004; // field, method, ic |
| 25 | static constexpr uint32_t kAccStatic = 0x0008; // field, method, ic |
| 26 | static constexpr uint32_t kAccFinal = 0x0010; // class, field, method, ic |
| 27 | static constexpr uint32_t kAccSynchronized = 0x0020; // method (only allowed on natives) |
| 28 | static constexpr uint32_t kAccSuper = 0x0020; // class (not used in dex) |
| 29 | static constexpr uint32_t kAccVolatile = 0x0040; // field |
| 30 | static constexpr uint32_t kAccBridge = 0x0040; // method (1.5) |
| 31 | static constexpr uint32_t kAccTransient = 0x0080; // field |
| 32 | static constexpr uint32_t kAccVarargs = 0x0080; // method (1.5) |
| 33 | static constexpr uint32_t kAccNative = 0x0100; // method |
| 34 | static constexpr uint32_t kAccInterface = 0x0200; // class, ic |
| 35 | static constexpr uint32_t kAccAbstract = 0x0400; // class, method, ic |
| 36 | static constexpr uint32_t kAccStrict = 0x0800; // method |
| 37 | static constexpr uint32_t kAccSynthetic = 0x1000; // class, field, method, ic |
| 38 | static constexpr uint32_t kAccAnnotation = 0x2000; // class, ic (1.5) |
| 39 | static constexpr uint32_t kAccEnum = 0x4000; // class, field, ic (1.5) |
Ian Rogers | 08f753d | 2012-08-24 14:35:25 -0700 | [diff] [blame] | 40 | |
Andreas Gampe | 5182932 | 2014-08-25 15:05:04 -0700 | [diff] [blame] | 41 | static constexpr uint32_t kAccJavaFlagsMask = 0xffff; // bits set from Java sources (low 16) |
Ian Rogers | 08f753d | 2012-08-24 14:35:25 -0700 | [diff] [blame] | 42 | |
Andreas Gampe | 5182932 | 2014-08-25 15:05:04 -0700 | [diff] [blame] | 43 | static constexpr uint32_t kAccConstructor = 0x00010000; // method (dex only) <(cl)init> |
| 44 | static constexpr uint32_t kAccDeclaredSynchronized = 0x00020000; // method (dex only) |
| 45 | static constexpr uint32_t kAccClassIsProxy = 0x00040000; // class (dex only) |
| 46 | static constexpr uint32_t kAccPreverified = 0x00080000; // class (runtime), |
| 47 | // method (dex only) |
| 48 | static constexpr uint32_t kAccFastNative = 0x00080000; // method (dex only) |
Andreas Gampe | 5182932 | 2014-08-25 15:05:04 -0700 | [diff] [blame] | 49 | static constexpr uint32_t kAccMiranda = 0x00200000; // method (dex only) |
Ian Rogers | 08f753d | 2012-08-24 14:35:25 -0700 | [diff] [blame] | 50 | |
Nicolas Geoffray | c0365b1 | 2015-03-18 18:31:52 +0000 | [diff] [blame] | 51 | // Flag is set if the compiler decides it is not worth trying |
| 52 | // to inline the method. This avoids other callers to try it again and again. |
| 53 | static constexpr uint32_t kAccDontInline = 0x00400000; // method (dex only) |
| 54 | |
Ian Rogers | 08f753d | 2012-08-24 14:35:25 -0700 | [diff] [blame] | 55 | // Special runtime-only flags. |
| 56 | // Note: if only kAccClassIsReference is set, we have a soft reference. |
Ian Rogers | 08f753d | 2012-08-24 14:35:25 -0700 | [diff] [blame] | 57 | |
Andreas Gampe | 5182932 | 2014-08-25 15:05:04 -0700 | [diff] [blame] | 58 | // class/ancestor overrides finalize() |
| 59 | static constexpr uint32_t kAccClassIsFinalizable = 0x80000000; |
| 60 | // class is a soft/weak/phantom ref |
| 61 | static constexpr uint32_t kAccClassIsReference = 0x08000000; |
| 62 | // class is a weak reference |
| 63 | static constexpr uint32_t kAccClassIsWeakReference = 0x04000000; |
| 64 | // class is a finalizer reference |
| 65 | static constexpr uint32_t kAccClassIsFinalizerReference = 0x02000000; |
| 66 | // class is a phantom reference |
| 67 | static constexpr uint32_t kAccClassIsPhantomReference = 0x01000000; |
Jeff Hao | 848f70a | 2014-01-15 13:49:50 -0800 | [diff] [blame] | 68 | // class is the string class |
| 69 | static constexpr uint32_t kAccClassIsStringClass = 0x00800000; |
Andreas Gampe | 5182932 | 2014-08-25 15:05:04 -0700 | [diff] [blame] | 70 | |
| 71 | static constexpr uint32_t kAccReferenceFlagsMask = (kAccClassIsReference |
| 72 | | kAccClassIsWeakReference |
| 73 | | kAccClassIsFinalizerReference |
| 74 | | kAccClassIsPhantomReference); |
| 75 | |
| 76 | // Valid (meaningful) bits for a field. |
| 77 | static constexpr uint32_t kAccValidFieldFlags = kAccPublic | kAccPrivate | kAccProtected | |
| 78 | kAccStatic | kAccFinal | kAccVolatile | kAccTransient | kAccSynthetic | kAccEnum; |
| 79 | |
| 80 | // Valid (meaningful) bits for a method. |
| 81 | static constexpr uint32_t kAccValidMethodFlags = kAccPublic | kAccPrivate | kAccProtected | |
| 82 | kAccStatic | kAccFinal | kAccSynchronized | kAccBridge | kAccVarargs | kAccNative | |
| 83 | kAccAbstract | kAccStrict | kAccSynthetic | kAccMiranda | kAccConstructor | |
| 84 | kAccDeclaredSynchronized; |
| 85 | |
| 86 | // Valid (meaningful) bits for a class (not interface). |
| 87 | // Note 1. These are positive bits. Other bits may have to be zero. |
| 88 | // Note 2. Inner classes can expose more access flags to Java programs. That is handled by libcore. |
| 89 | static constexpr uint32_t kAccValidClassFlags = kAccPublic | kAccFinal | kAccSuper | |
| 90 | kAccAbstract | kAccSynthetic | kAccEnum; |
| 91 | |
| 92 | // Valid (meaningful) bits for an interface. |
| 93 | // Note 1. Annotations are interfaces. |
| 94 | // Note 2. These are positive bits. Other bits may have to be zero. |
| 95 | // Note 3. Inner classes can expose more access flags to Java programs. That is handled by libcore. |
| 96 | static constexpr uint32_t kAccValidInterfaceFlags = kAccPublic | kAccInterface | |
| 97 | kAccAbstract | kAccSynthetic | kAccAnnotation; |
Ian Rogers | 08f753d | 2012-08-24 14:35:25 -0700 | [diff] [blame] | 98 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 99 | #endif // ART_RUNTIME_MODIFIERS_H_ |
Ian Rogers | 08f753d | 2012-08-24 14:35:25 -0700 | [diff] [blame] | 100 | |