comparison src/share/vm/utilities/accessFlags.hpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents 1d7922586cf6
children 9191895df19d
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
1 /* 1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
37 // HotSpot-specific access flags 37 // HotSpot-specific access flags
38 38
39 // flags actually put in .class file 39 // flags actually put in .class file
40 JVM_ACC_WRITTEN_FLAGS = 0x00007FFF, 40 JVM_ACC_WRITTEN_FLAGS = 0x00007FFF,
41 41
42 // methodOop flags 42 // Method* flags
43 JVM_ACC_MONITOR_MATCH = 0x10000000, // True if we know that monitorenter/monitorexit bytecodes match 43 JVM_ACC_MONITOR_MATCH = 0x10000000, // True if we know that monitorenter/monitorexit bytecodes match
44 JVM_ACC_HAS_MONITOR_BYTECODES = 0x20000000, // Method contains monitorenter/monitorexit bytecodes 44 JVM_ACC_HAS_MONITOR_BYTECODES = 0x20000000, // Method contains monitorenter/monitorexit bytecodes
45 JVM_ACC_HAS_LOOPS = 0x40000000, // Method has loops 45 JVM_ACC_HAS_LOOPS = 0x40000000, // Method has loops
46 JVM_ACC_LOOPS_FLAG_INIT = (int)0x80000000,// The loop flag has been initialized 46 JVM_ACC_LOOPS_FLAG_INIT = (int)0x80000000,// The loop flag has been initialized
47 JVM_ACC_QUEUED = 0x01000000, // Queued for compilation 47 JVM_ACC_QUEUED = 0x01000000, // Queued for compilation
52 JVM_ACC_HAS_CHECKED_EXCEPTIONS = 0x00400000, 52 JVM_ACC_HAS_CHECKED_EXCEPTIONS = 0x00400000,
53 JVM_ACC_HAS_JSRS = 0x00800000, 53 JVM_ACC_HAS_JSRS = 0x00800000,
54 JVM_ACC_IS_OLD = 0x00010000, // RedefineClasses() has replaced this method 54 JVM_ACC_IS_OLD = 0x00010000, // RedefineClasses() has replaced this method
55 JVM_ACC_IS_OBSOLETE = 0x00020000, // RedefineClasses() has made method obsolete 55 JVM_ACC_IS_OBSOLETE = 0x00020000, // RedefineClasses() has made method obsolete
56 JVM_ACC_IS_PREFIXED_NATIVE = 0x00040000, // JVMTI has prefixed this native method 56 JVM_ACC_IS_PREFIXED_NATIVE = 0x00040000, // JVMTI has prefixed this native method
57 57 JVM_ACC_ON_STACK = 0x00080000, // RedefinedClasses() is used on the stack
58 // klassOop flags 58
59 // Klass* flags
59 JVM_ACC_HAS_MIRANDA_METHODS = 0x10000000, // True if this class has miranda methods in it's vtable 60 JVM_ACC_HAS_MIRANDA_METHODS = 0x10000000, // True if this class has miranda methods in it's vtable
60 JVM_ACC_HAS_VANILLA_CONSTRUCTOR = 0x20000000, // True if klass has a vanilla default constructor 61 JVM_ACC_HAS_VANILLA_CONSTRUCTOR = 0x20000000, // True if klass has a vanilla default constructor
61 JVM_ACC_HAS_FINALIZER = 0x40000000, // True if klass has a non-empty finalize() method 62 JVM_ACC_HAS_FINALIZER = 0x40000000, // True if klass has a non-empty finalize() method
62 JVM_ACC_IS_CLONEABLE = (int)0x80000000,// True if klass supports the Clonable interface 63 JVM_ACC_IS_CLONEABLE = (int)0x80000000,// True if klass supports the Clonable interface
63 JVM_ACC_HAS_FINAL_METHOD = 0x01000000, // True if klass has final method 64 JVM_ACC_HAS_FINAL_METHOD = 0x01000000, // True if klass has final method
64 65
65 // klassOop and methodOop flags 66 // Klass* and Method* flags
66 JVM_ACC_HAS_LOCAL_VARIABLE_TABLE= 0x00200000, 67 JVM_ACC_HAS_LOCAL_VARIABLE_TABLE= 0x00200000,
67 68
68 JVM_ACC_PROMOTED_FLAGS = 0x00200000, // flags promoted from methods to the holding klass 69 JVM_ACC_PROMOTED_FLAGS = 0x00200000, // flags promoted from methods to the holding klass
69 70
70 // field flags 71 // field flags
71 // Note: these flags must be defined in the low order 16 bits because 72 // Note: these flags must be defined in the low order 16 bits because
72 // instanceKlass only stores a ushort worth of information from the 73 // InstanceKlass only stores a ushort worth of information from the
73 // AccessFlags value. 74 // AccessFlags value.
74 // These bits must not conflict with any other field-related access flags 75 // These bits must not conflict with any other field-related access flags
75 // (e.g., ACC_ENUM). 76 // (e.g., ACC_ENUM).
76 // Note that the class-related ACC_ANNOTATION bit conflicts with these flags. 77 // Note that the class-related ACC_ANNOTATION bit conflicts with these flags.
77 JVM_ACC_FIELD_ACCESS_WATCHED = 0x00002000, // field access is watched by JVMTI 78 JVM_ACC_FIELD_ACCESS_WATCHED = 0x00002000, // field access is watched by JVMTI
112 bool is_strict () const { return (_flags & JVM_ACC_STRICT ) != 0; } 113 bool is_strict () const { return (_flags & JVM_ACC_STRICT ) != 0; }
113 114
114 // Attribute flags 115 // Attribute flags
115 bool is_synthetic () const { return (_flags & JVM_ACC_SYNTHETIC ) != 0; } 116 bool is_synthetic () const { return (_flags & JVM_ACC_SYNTHETIC ) != 0; }
116 117
117 // methodOop flags 118 // Method* flags
118 bool is_monitor_matching () const { return (_flags & JVM_ACC_MONITOR_MATCH ) != 0; } 119 bool is_monitor_matching () const { return (_flags & JVM_ACC_MONITOR_MATCH ) != 0; }
119 bool has_monitor_bytecodes () const { return (_flags & JVM_ACC_HAS_MONITOR_BYTECODES ) != 0; } 120 bool has_monitor_bytecodes () const { return (_flags & JVM_ACC_HAS_MONITOR_BYTECODES ) != 0; }
120 bool has_loops () const { return (_flags & JVM_ACC_HAS_LOOPS ) != 0; } 121 bool has_loops () const { return (_flags & JVM_ACC_HAS_LOOPS ) != 0; }
121 bool loops_flag_init () const { return (_flags & JVM_ACC_LOOPS_FLAG_INIT ) != 0; } 122 bool loops_flag_init () const { return (_flags & JVM_ACC_LOOPS_FLAG_INIT ) != 0; }
122 bool queued_for_compilation () const { return (_flags & JVM_ACC_QUEUED ) != 0; } 123 bool queued_for_compilation () const { return (_flags & JVM_ACC_QUEUED ) != 0; }
128 bool has_jsrs () const { return (_flags & JVM_ACC_HAS_JSRS ) != 0; } 129 bool has_jsrs () const { return (_flags & JVM_ACC_HAS_JSRS ) != 0; }
129 bool is_old () const { return (_flags & JVM_ACC_IS_OLD ) != 0; } 130 bool is_old () const { return (_flags & JVM_ACC_IS_OLD ) != 0; }
130 bool is_obsolete () const { return (_flags & JVM_ACC_IS_OBSOLETE ) != 0; } 131 bool is_obsolete () const { return (_flags & JVM_ACC_IS_OBSOLETE ) != 0; }
131 bool is_prefixed_native () const { return (_flags & JVM_ACC_IS_PREFIXED_NATIVE ) != 0; } 132 bool is_prefixed_native () const { return (_flags & JVM_ACC_IS_PREFIXED_NATIVE ) != 0; }
132 133
133 // klassOop flags 134 // Klass* flags
134 bool has_miranda_methods () const { return (_flags & JVM_ACC_HAS_MIRANDA_METHODS ) != 0; } 135 bool has_miranda_methods () const { return (_flags & JVM_ACC_HAS_MIRANDA_METHODS ) != 0; }
135 bool has_vanilla_constructor () const { return (_flags & JVM_ACC_HAS_VANILLA_CONSTRUCTOR) != 0; } 136 bool has_vanilla_constructor () const { return (_flags & JVM_ACC_HAS_VANILLA_CONSTRUCTOR) != 0; }
136 bool has_finalizer () const { return (_flags & JVM_ACC_HAS_FINALIZER ) != 0; } 137 bool has_finalizer () const { return (_flags & JVM_ACC_HAS_FINALIZER ) != 0; }
137 bool has_final_method () const { return (_flags & JVM_ACC_HAS_FINAL_METHOD ) != 0; } 138 bool has_final_method () const { return (_flags & JVM_ACC_HAS_FINAL_METHOD ) != 0; }
138 bool is_cloneable () const { return (_flags & JVM_ACC_IS_CLONEABLE ) != 0; } 139 bool is_cloneable () const { return (_flags & JVM_ACC_IS_CLONEABLE ) != 0; }
139 // klassOop and methodOop flags 140 // Klass* and Method* flags
140 bool has_localvariable_table () const { return (_flags & JVM_ACC_HAS_LOCAL_VARIABLE_TABLE) != 0; } 141 bool has_localvariable_table () const { return (_flags & JVM_ACC_HAS_LOCAL_VARIABLE_TABLE) != 0; }
141 void set_has_localvariable_table() { atomic_set_bits(JVM_ACC_HAS_LOCAL_VARIABLE_TABLE); } 142 void set_has_localvariable_table() { atomic_set_bits(JVM_ACC_HAS_LOCAL_VARIABLE_TABLE); }
142 void clear_has_localvariable_table() { atomic_clear_bits(JVM_ACC_HAS_LOCAL_VARIABLE_TABLE); } 143 void clear_has_localvariable_table() { atomic_clear_bits(JVM_ACC_HAS_LOCAL_VARIABLE_TABLE); }
143 144
144 // field flags 145 // field flags
145 bool is_field_access_watched() const { return (_flags & JVM_ACC_FIELD_ACCESS_WATCHED) != 0; } 146 bool is_field_access_watched() const { return (_flags & JVM_ACC_FIELD_ACCESS_WATCHED) != 0; }
146 bool is_field_modification_watched() const 147 bool is_field_modification_watched() const
147 { return (_flags & JVM_ACC_FIELD_MODIFICATION_WATCHED) != 0; } 148 { return (_flags & JVM_ACC_FIELD_MODIFICATION_WATCHED) != 0; }
149 bool on_stack() const { return (_flags & JVM_ACC_ON_STACK) != 0; }
148 bool is_internal() const { return (_flags & JVM_ACC_FIELD_INTERNAL) != 0; } 150 bool is_internal() const { return (_flags & JVM_ACC_FIELD_INTERNAL) != 0; }
149 bool field_has_generic_signature() const 151 bool field_has_generic_signature() const
150 { return (_flags & JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE) != 0; } 152 { return (_flags & JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE) != 0; }
151 153
152 // get .class file flags 154 // get .class file flags
166 // Atomic update of flags 168 // Atomic update of flags
167 void atomic_set_bits(jint bits); 169 void atomic_set_bits(jint bits);
168 void atomic_clear_bits(jint bits); 170 void atomic_clear_bits(jint bits);
169 171
170 private: 172 private:
171 friend class methodOopDesc; 173 friend class Method;
172 friend class Klass; 174 friend class Klass;
173 friend class ClassFileParser; 175 friend class ClassFileParser;
174 // the functions below should only be called on the _access_flags inst var directly, 176 // the functions below should only be called on the _access_flags inst var directly,
175 // otherwise they are just changing a copy of the flags 177 // otherwise they are just changing a copy of the flags
176 178
177 // attribute flags 179 // attribute flags
178 void set_is_synthetic() { atomic_set_bits(JVM_ACC_SYNTHETIC); } 180 void set_is_synthetic() { atomic_set_bits(JVM_ACC_SYNTHETIC); }
179 181
180 // methodOop flags 182 // Method* flags
181 void set_monitor_matching() { atomic_set_bits(JVM_ACC_MONITOR_MATCH); } 183 void set_monitor_matching() { atomic_set_bits(JVM_ACC_MONITOR_MATCH); }
182 void set_has_monitor_bytecodes() { atomic_set_bits(JVM_ACC_HAS_MONITOR_BYTECODES); } 184 void set_has_monitor_bytecodes() { atomic_set_bits(JVM_ACC_HAS_MONITOR_BYTECODES); }
183 void set_has_loops() { atomic_set_bits(JVM_ACC_HAS_LOOPS); } 185 void set_has_loops() { atomic_set_bits(JVM_ACC_HAS_LOOPS); }
184 void set_loops_flag_init() { atomic_set_bits(JVM_ACC_LOOPS_FLAG_INIT); } 186 void set_loops_flag_init() { atomic_set_bits(JVM_ACC_LOOPS_FLAG_INIT); }
185 void set_not_c1_compilable() { atomic_set_bits(JVM_ACC_NOT_C1_COMPILABLE); } 187 void set_not_c1_compilable() { atomic_set_bits(JVM_ACC_NOT_C1_COMPILABLE); }
190 void set_has_jsrs() { atomic_set_bits(JVM_ACC_HAS_JSRS); } 192 void set_has_jsrs() { atomic_set_bits(JVM_ACC_HAS_JSRS); }
191 void set_is_old() { atomic_set_bits(JVM_ACC_IS_OLD); } 193 void set_is_old() { atomic_set_bits(JVM_ACC_IS_OLD); }
192 void set_is_obsolete() { atomic_set_bits(JVM_ACC_IS_OBSOLETE); } 194 void set_is_obsolete() { atomic_set_bits(JVM_ACC_IS_OBSOLETE); }
193 void set_is_prefixed_native() { atomic_set_bits(JVM_ACC_IS_PREFIXED_NATIVE); } 195 void set_is_prefixed_native() { atomic_set_bits(JVM_ACC_IS_PREFIXED_NATIVE); }
194 196
195 // klassOop flags 197 // Klass* flags
196 void set_has_vanilla_constructor() { atomic_set_bits(JVM_ACC_HAS_VANILLA_CONSTRUCTOR); } 198 void set_has_vanilla_constructor() { atomic_set_bits(JVM_ACC_HAS_VANILLA_CONSTRUCTOR); }
197 void set_has_finalizer() { atomic_set_bits(JVM_ACC_HAS_FINALIZER); } 199 void set_has_finalizer() { atomic_set_bits(JVM_ACC_HAS_FINALIZER); }
198 void set_has_final_method() { atomic_set_bits(JVM_ACC_HAS_FINAL_METHOD); } 200 void set_has_final_method() { atomic_set_bits(JVM_ACC_HAS_FINAL_METHOD); }
199 void set_is_cloneable() { atomic_set_bits(JVM_ACC_IS_CLONEABLE); } 201 void set_is_cloneable() { atomic_set_bits(JVM_ACC_IS_CLONEABLE); }
200 void set_has_miranda_methods() { atomic_set_bits(JVM_ACC_HAS_MIRANDA_METHODS); } 202 void set_has_miranda_methods() { atomic_set_bits(JVM_ACC_HAS_MIRANDA_METHODS); }
220 void set_field_has_generic_signature() 222 void set_field_has_generic_signature()
221 { 223 {
222 atomic_set_bits(JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE); 224 atomic_set_bits(JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE);
223 } 225 }
224 226
227 void set_on_stack(const bool value)
228 {
229 if (value) {
230 atomic_set_bits(JVM_ACC_ON_STACK);
231 } else {
232 atomic_clear_bits(JVM_ACC_ON_STACK);
233 }
234 }
225 // Conversion 235 // Conversion
226 jshort as_short() const { return (jshort)_flags; } 236 jshort as_short() const { return (jshort)_flags; }
227 jint as_int() const { return _flags; } 237 jint as_int() const { return _flags; }
228 238
229 inline friend AccessFlags accessFlags_from(jint flags); 239 inline friend AccessFlags accessFlags_from(jint flags);