61 JVM_ACC_HAS_VANILLA_CONSTRUCTOR = 0x20000000, // True if klass has a vanilla default constructor
62 JVM_ACC_HAS_FINALIZER = 0x40000000, // True if klass has a non-empty finalize() method
63 JVM_ACC_IS_CLONEABLE = (int)0x80000000,// True if klass supports the Clonable interface
64 JVM_ACC_HAS_FINAL_METHOD = 0x01000000, // True if klass has final method
65
66 // Klass* and Method* flags
67 JVM_ACC_HAS_LOCAL_VARIABLE_TABLE= 0x00200000,
68
69 JVM_ACC_PROMOTED_FLAGS = 0x00200000, // flags promoted from methods to the holding klass
70
71 // field flags
72 // Note: these flags must be defined in the low order 16 bits because
73 // InstanceKlass only stores a ushort worth of information from the
74 // AccessFlags value.
75 // These bits must not conflict with any other field-related access flags
76 // (e.g., ACC_ENUM).
77 // Note that the class-related ACC_ANNOTATION bit conflicts with these flags.
78 JVM_ACC_FIELD_ACCESS_WATCHED = 0x00002000, // field access is watched by JVMTI
79 JVM_ACC_FIELD_MODIFICATION_WATCHED = 0x00008000, // field modification is watched by JVMTI
80 JVM_ACC_FIELD_INTERNAL = 0x00000400, // internal field, same as JVM_ACC_ABSTRACT
81 JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE = 0x00000800, // field has generic signature
82
83 JVM_ACC_FIELD_INTERNAL_FLAGS = JVM_ACC_FIELD_ACCESS_WATCHED |
84 JVM_ACC_FIELD_MODIFICATION_WATCHED |
85 JVM_ACC_FIELD_INTERNAL |
86 JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE,
87
88 // flags accepted by set_field_flags()
89 JVM_ACC_FIELD_FLAGS = JVM_RECOGNIZED_FIELD_MODIFIERS | JVM_ACC_FIELD_INTERNAL_FLAGS
90
91 };
92
93
94 class AccessFlags VALUE_OBJ_CLASS_SPEC {
95 friend class VMStructs;
96 private:
97 jint _flags;
98
99 public:
100 // Java access flags
101 bool is_public () const { return (_flags & JVM_ACC_PUBLIC ) != 0; }
102 bool is_private () const { return (_flags & JVM_ACC_PRIVATE ) != 0; }
103 bool is_protected () const { return (_flags & JVM_ACC_PROTECTED ) != 0; }
104 bool is_static () const { return (_flags & JVM_ACC_STATIC ) != 0; }
105 bool is_final () const { return (_flags & JVM_ACC_FINAL ) != 0; }
131 bool is_obsolete () const { return (_flags & JVM_ACC_IS_OBSOLETE ) != 0; }
132 bool is_prefixed_native () const { return (_flags & JVM_ACC_IS_PREFIXED_NATIVE ) != 0; }
133
134 // Klass* flags
135 bool has_miranda_methods () const { return (_flags & JVM_ACC_HAS_MIRANDA_METHODS ) != 0; }
136 bool has_vanilla_constructor () const { return (_flags & JVM_ACC_HAS_VANILLA_CONSTRUCTOR) != 0; }
137 bool has_finalizer () const { return (_flags & JVM_ACC_HAS_FINALIZER ) != 0; }
138 bool has_final_method () const { return (_flags & JVM_ACC_HAS_FINAL_METHOD ) != 0; }
139 bool is_cloneable () const { return (_flags & JVM_ACC_IS_CLONEABLE ) != 0; }
140 // Klass* and Method* flags
141 bool has_localvariable_table () const { return (_flags & JVM_ACC_HAS_LOCAL_VARIABLE_TABLE) != 0; }
142 void set_has_localvariable_table() { atomic_set_bits(JVM_ACC_HAS_LOCAL_VARIABLE_TABLE); }
143 void clear_has_localvariable_table() { atomic_clear_bits(JVM_ACC_HAS_LOCAL_VARIABLE_TABLE); }
144
145 // field flags
146 bool is_field_access_watched() const { return (_flags & JVM_ACC_FIELD_ACCESS_WATCHED) != 0; }
147 bool is_field_modification_watched() const
148 { return (_flags & JVM_ACC_FIELD_MODIFICATION_WATCHED) != 0; }
149 bool on_stack() const { return (_flags & JVM_ACC_ON_STACK) != 0; }
150 bool is_internal() const { return (_flags & JVM_ACC_FIELD_INTERNAL) != 0; }
151 bool field_has_generic_signature() const
152 { return (_flags & JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE) != 0; }
153
154 // get .class file flags
155 jint get_flags () const { return (_flags & JVM_ACC_WRITTEN_FLAGS); }
156
157 // Initialization
158 void add_promoted_flags(jint flags) { _flags |= (flags & JVM_ACC_PROMOTED_FLAGS); }
159 void set_field_flags(jint flags) {
160 assert((flags & JVM_ACC_FIELD_FLAGS) == flags, "only recognized flags");
161 _flags = (flags & JVM_ACC_FIELD_FLAGS);
162 }
163 void set_flags(jint flags) { _flags = (flags & JVM_ACC_WRITTEN_FLAGS); }
164
165 void set_queued_for_compilation() { atomic_set_bits(JVM_ACC_QUEUED); }
166 void clear_queued_for_compilation() { atomic_clear_bits(JVM_ACC_QUEUED); }
167
168 // Atomic update of flags
169 void atomic_set_bits(jint bits);
170 void atomic_clear_bits(jint bits);
|
61 JVM_ACC_HAS_VANILLA_CONSTRUCTOR = 0x20000000, // True if klass has a vanilla default constructor
62 JVM_ACC_HAS_FINALIZER = 0x40000000, // True if klass has a non-empty finalize() method
63 JVM_ACC_IS_CLONEABLE = (int)0x80000000,// True if klass supports the Clonable interface
64 JVM_ACC_HAS_FINAL_METHOD = 0x01000000, // True if klass has final method
65
66 // Klass* and Method* flags
67 JVM_ACC_HAS_LOCAL_VARIABLE_TABLE= 0x00200000,
68
69 JVM_ACC_PROMOTED_FLAGS = 0x00200000, // flags promoted from methods to the holding klass
70
71 // field flags
72 // Note: these flags must be defined in the low order 16 bits because
73 // InstanceKlass only stores a ushort worth of information from the
74 // AccessFlags value.
75 // These bits must not conflict with any other field-related access flags
76 // (e.g., ACC_ENUM).
77 // Note that the class-related ACC_ANNOTATION bit conflicts with these flags.
78 JVM_ACC_FIELD_ACCESS_WATCHED = 0x00002000, // field access is watched by JVMTI
79 JVM_ACC_FIELD_MODIFICATION_WATCHED = 0x00008000, // field modification is watched by JVMTI
80 JVM_ACC_FIELD_INTERNAL = 0x00000400, // internal field, same as JVM_ACC_ABSTRACT
81 JVM_ACC_FIELD_STABLE = 0x00000020, // @Stable field, same as JVM_ACC_SYNCHRONIZED
82 JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE = 0x00000800, // field has generic signature
83
84 JVM_ACC_FIELD_INTERNAL_FLAGS = JVM_ACC_FIELD_ACCESS_WATCHED |
85 JVM_ACC_FIELD_MODIFICATION_WATCHED |
86 JVM_ACC_FIELD_INTERNAL |
87 JVM_ACC_FIELD_STABLE |
88 JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE,
89
90 // flags accepted by set_field_flags()
91 JVM_ACC_FIELD_FLAGS = JVM_RECOGNIZED_FIELD_MODIFIERS | JVM_ACC_FIELD_INTERNAL_FLAGS
92
93 };
94
95
96 class AccessFlags VALUE_OBJ_CLASS_SPEC {
97 friend class VMStructs;
98 private:
99 jint _flags;
100
101 public:
102 // Java access flags
103 bool is_public () const { return (_flags & JVM_ACC_PUBLIC ) != 0; }
104 bool is_private () const { return (_flags & JVM_ACC_PRIVATE ) != 0; }
105 bool is_protected () const { return (_flags & JVM_ACC_PROTECTED ) != 0; }
106 bool is_static () const { return (_flags & JVM_ACC_STATIC ) != 0; }
107 bool is_final () const { return (_flags & JVM_ACC_FINAL ) != 0; }
133 bool is_obsolete () const { return (_flags & JVM_ACC_IS_OBSOLETE ) != 0; }
134 bool is_prefixed_native () const { return (_flags & JVM_ACC_IS_PREFIXED_NATIVE ) != 0; }
135
136 // Klass* flags
137 bool has_miranda_methods () const { return (_flags & JVM_ACC_HAS_MIRANDA_METHODS ) != 0; }
138 bool has_vanilla_constructor () const { return (_flags & JVM_ACC_HAS_VANILLA_CONSTRUCTOR) != 0; }
139 bool has_finalizer () const { return (_flags & JVM_ACC_HAS_FINALIZER ) != 0; }
140 bool has_final_method () const { return (_flags & JVM_ACC_HAS_FINAL_METHOD ) != 0; }
141 bool is_cloneable () const { return (_flags & JVM_ACC_IS_CLONEABLE ) != 0; }
142 // Klass* and Method* flags
143 bool has_localvariable_table () const { return (_flags & JVM_ACC_HAS_LOCAL_VARIABLE_TABLE) != 0; }
144 void set_has_localvariable_table() { atomic_set_bits(JVM_ACC_HAS_LOCAL_VARIABLE_TABLE); }
145 void clear_has_localvariable_table() { atomic_clear_bits(JVM_ACC_HAS_LOCAL_VARIABLE_TABLE); }
146
147 // field flags
148 bool is_field_access_watched() const { return (_flags & JVM_ACC_FIELD_ACCESS_WATCHED) != 0; }
149 bool is_field_modification_watched() const
150 { return (_flags & JVM_ACC_FIELD_MODIFICATION_WATCHED) != 0; }
151 bool on_stack() const { return (_flags & JVM_ACC_ON_STACK) != 0; }
152 bool is_internal() const { return (_flags & JVM_ACC_FIELD_INTERNAL) != 0; }
153 bool is_stable() const { return (_flags & JVM_ACC_FIELD_STABLE) != 0; }
154 bool field_has_generic_signature() const
155 { return (_flags & JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE) != 0; }
156
157 // get .class file flags
158 jint get_flags () const { return (_flags & JVM_ACC_WRITTEN_FLAGS); }
159
160 // Initialization
161 void add_promoted_flags(jint flags) { _flags |= (flags & JVM_ACC_PROMOTED_FLAGS); }
162 void set_field_flags(jint flags) {
163 assert((flags & JVM_ACC_FIELD_FLAGS) == flags, "only recognized flags");
164 _flags = (flags & JVM_ACC_FIELD_FLAGS);
165 }
166 void set_flags(jint flags) { _flags = (flags & JVM_ACC_WRITTEN_FLAGS); }
167
168 void set_queued_for_compilation() { atomic_set_bits(JVM_ACC_QUEUED); }
169 void clear_queued_for_compilation() { atomic_clear_bits(JVM_ACC_QUEUED); }
170
171 // Atomic update of flags
172 void atomic_set_bits(jint bits);
173 void atomic_clear_bits(jint bits);
|