comparison src/share/vm/oops/instanceKlass.hpp @ 4772:8f8b94305aff

7129240: backout fix for 7102776 until 7128770 is resolved Reviewed-by: phh, bobv, coleenp, dcubed Contributed-by: Jiangli Zhou <jiangli.zhou@oracle.com>
author dcubed
date Wed, 11 Jan 2012 19:54:34 -0800
parents 22cee0ee8927
children 26a08cbbf042 a79cb7c55012
comparison
equal deleted inserted replaced
4771:22cee0ee8927 4772:8f8b94305aff
229 int _static_field_size; // number words used by static fields (oop and non-oop) in this klass 229 int _static_field_size; // number words used by static fields (oop and non-oop) in this klass
230 u2 _static_oop_field_count;// number of static oop fields in this klass 230 u2 _static_oop_field_count;// number of static oop fields in this klass
231 u2 _java_fields_count; // The number of declared Java fields 231 u2 _java_fields_count; // The number of declared Java fields
232 int _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks 232 int _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks
233 233
234 bool _is_marked_dependent; // used for marking during flushing and deoptimization
235 bool _rewritten; // methods rewritten.
236 bool _has_nonstatic_fields; // for sizing with UseCompressedOops
237 bool _should_verify_class; // allow caching of preverification
234 u2 _minor_version; // minor version number of class file 238 u2 _minor_version; // minor version number of class file
235 u2 _major_version; // major version number of class file 239 u2 _major_version; // major version number of class file
236 Thread* _init_thread; // Pointer to current thread doing initialization (to handle recusive initialization) 240 Thread* _init_thread; // Pointer to current thread doing initialization (to handle recusive initialization)
237 int _vtable_len; // length of Java vtable (in words) 241 int _vtable_len; // length of Java vtable (in words)
238 int _itable_len; // length of Java itable (in words) 242 int _itable_len; // length of Java itable (in words)
259 // Class states are defined as ClassState (see above). 263 // Class states are defined as ClassState (see above).
260 // Place the _init_state here to utilize the unused 2-byte after 264 // Place the _init_state here to utilize the unused 2-byte after
261 // _idnum_allocated_count. 265 // _idnum_allocated_count.
262 u1 _init_state; // state of class 266 u1 _init_state; // state of class
263 267
264 // Compact the following four boolean flags into 1-bit each. These four flags
265 // were defined as separate boolean fields and each was 1-byte before. Since
266 // there are 2 bytes unused after the _idnum_allocated_count field, place the
267 // _misc_flags field after _idnum_allocated_count to utilize the unused bits
268 // and save total 4-bytes.
269 enum {
270 IS_MARKED_DEPENDENT = 0x1, // used for marking during flushing and deoptimization
271 REWRITTEN = 0x2, // methods rewritten.
272 HAS_NONSTATIC_FIELDS = 0x4, // for sizing with UseCompressedOops
273 SHOULD_VERIFY_CLASS = 0x8 // allow caching of preverification
274 };
275 u1 _misc_flags;
276
277 // embedded Java vtable follows here 268 // embedded Java vtable follows here
278 // embedded Java itables follows here 269 // embedded Java itables follows here
279 // embedded static fields follows here 270 // embedded static fields follows here
280 // embedded nonstatic oop-map blocks follows here 271 // embedded nonstatic oop-map blocks follows here
281 272
282 friend class instanceKlassKlass; 273 friend class instanceKlassKlass;
283 friend class SystemDictionary; 274 friend class SystemDictionary;
284 275
285 public: 276 public:
286 bool has_nonstatic_fields() const { return (_misc_flags & HAS_NONSTATIC_FIELDS) != 0; } 277 bool has_nonstatic_fields() const { return _has_nonstatic_fields; }
287 void set_has_nonstatic_fields(bool b) { 278 void set_has_nonstatic_fields(bool b) { _has_nonstatic_fields = b; }
288 if (b) {
289 _misc_flags |= HAS_NONSTATIC_FIELDS;
290 } else {
291 _misc_flags &= ~HAS_NONSTATIC_FIELDS;
292 }
293 }
294 279
295 // field sizes 280 // field sizes
296 int nonstatic_field_size() const { return _nonstatic_field_size; } 281 int nonstatic_field_size() const { return _nonstatic_field_size; }
297 void set_nonstatic_field_size(int size) { _nonstatic_field_size = size; } 282 void set_nonstatic_field_size(int size) { _nonstatic_field_size = size; }
298 283
396 bool is_not_initialized() const { return _init_state < being_initialized; } 381 bool is_not_initialized() const { return _init_state < being_initialized; }
397 bool is_being_initialized() const { return _init_state == being_initialized; } 382 bool is_being_initialized() const { return _init_state == being_initialized; }
398 bool is_in_error_state() const { return _init_state == initialization_error; } 383 bool is_in_error_state() const { return _init_state == initialization_error; }
399 bool is_reentrant_initialization(Thread *thread) { return thread == _init_thread; } 384 bool is_reentrant_initialization(Thread *thread) { return thread == _init_thread; }
400 ClassState init_state() { return (ClassState)_init_state; } 385 ClassState init_state() { return (ClassState)_init_state; }
401 bool is_rewritten() const { return (_misc_flags & REWRITTEN) != 0; } 386 bool is_rewritten() const { return _rewritten; }
402 387
403 // defineClass specified verification 388 // defineClass specified verification
404 bool should_verify_class() const { return (_misc_flags & SHOULD_VERIFY_CLASS) != 0; } 389 bool should_verify_class() const { return _should_verify_class; }
405 void set_should_verify_class(bool value) { 390 void set_should_verify_class(bool value) { _should_verify_class = value; }
406 if (value) {
407 _misc_flags |= SHOULD_VERIFY_CLASS;
408 } else {
409 _misc_flags &= ~SHOULD_VERIFY_CLASS;
410 }
411 }
412
413 391
414 // marking 392 // marking
415 bool is_marked_dependent() const { return (_misc_flags & IS_MARKED_DEPENDENT) != 0; } 393 bool is_marked_dependent() const { return _is_marked_dependent; }
416 void set_is_marked_dependent() { _misc_flags |= IS_MARKED_DEPENDENT; } 394 void set_is_marked_dependent(bool value) { _is_marked_dependent = value; }
417 void clear_is_marked_dependent() { _misc_flags &= ~IS_MARKED_DEPENDENT; }
418 395
419 // initialization (virtuals from Klass) 396 // initialization (virtuals from Klass)
420 bool should_be_initialized() const; // means that initialize should be called 397 bool should_be_initialized() const; // means that initialize should be called
421 void initialize(TRAPS); 398 void initialize(TRAPS);
422 void link_class(TRAPS); 399 void link_class(TRAPS);
782 #ifdef ASSERT 759 #ifdef ASSERT
783 void set_init_state(ClassState state); 760 void set_init_state(ClassState state);
784 #else 761 #else
785 void set_init_state(ClassState state) { _init_state = (u1)state; } 762 void set_init_state(ClassState state) { _init_state = (u1)state; }
786 #endif 763 #endif
787 void set_rewritten() { _misc_flags |= REWRITTEN; } 764 void set_rewritten() { _rewritten = true; }
788 void set_init_thread(Thread *thread) { _init_thread = thread; } 765 void set_init_thread(Thread *thread) { _init_thread = thread; }
789 766
790 u2 idnum_allocated_count() const { return _idnum_allocated_count; } 767 u2 idnum_allocated_count() const { return _idnum_allocated_count; }
791 // The RedefineClasses() API can cause new method idnums to be needed 768 // The RedefineClasses() API can cause new method idnums to be needed
792 // which will cause the caches to grow. Safety requires different 769 // which will cause the caches to grow. Safety requires different