comparison src/share/vm/oops/instanceKlass.hpp @ 4739:52b5d32fbfaf

7117052: instanceKlass::_init_state can be u1 type Summary: Change instanceKlass::_init_state field to u1 type. Reviewed-by: bdelsart, coleenp, dholmes, phh, never Contributed-by: Jiangli Zhou <jiangli.zhou@oracle.com>
author coleenp
date Tue, 06 Dec 2011 18:28:51 -0500
parents 75c0a73eee98
children cd5d8cafcc84
comparison
equal deleted inserted replaced
4738:da4dd142ea01 4739:52b5d32fbfaf
231 int _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks 231 int _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks
232 int _java_fields_count; // The number of declared Java fields 232 int _java_fields_count; // The number of declared Java fields
233 233
234 u2 _minor_version; // minor version number of class file 234 u2 _minor_version; // minor version number of class file
235 u2 _major_version; // major version number of class file 235 u2 _major_version; // major version number of class file
236 ClassState _init_state; // state of class
237 Thread* _init_thread; // Pointer to current thread doing initialization (to handle recusive initialization) 236 Thread* _init_thread; // Pointer to current thread doing initialization (to handle recusive initialization)
238 int _vtable_len; // length of Java vtable (in words) 237 int _vtable_len; // length of Java vtable (in words)
239 int _itable_len; // length of Java itable (in words) 238 int _itable_len; // length of Java itable (in words)
240 ReferenceType _reference_type; // reference type 239 ReferenceType _reference_type; // reference type
241 OopMapCache* volatile _oop_map_cache; // OopMapCache for all methods in the klass (allocated lazily) 240 OopMapCache* volatile _oop_map_cache; // OopMapCache for all methods in the klass (allocated lazily)
255 unsigned char * _cached_class_file_bytes; // JVMTI: cached class file, before retransformable agent modified it in CFLH 254 unsigned char * _cached_class_file_bytes; // JVMTI: cached class file, before retransformable agent modified it in CFLH
256 jint _cached_class_file_len; // JVMTI: length of above 255 jint _cached_class_file_len; // JVMTI: length of above
257 JvmtiCachedClassFieldMap* _jvmti_cached_class_field_map; // JVMTI: used during heap iteration 256 JvmtiCachedClassFieldMap* _jvmti_cached_class_field_map; // JVMTI: used during heap iteration
258 volatile u2 _idnum_allocated_count; // JNI/JVMTI: increments with the addition of methods, old ids don't change 257 volatile u2 _idnum_allocated_count; // JNI/JVMTI: increments with the addition of methods, old ids don't change
259 258
259 // Class states are defined as ClassState (see above).
260 // Place the _init_state here to utilize the unused 2-byte after
261 // _idnum_allocated_count.
262 u1 _init_state; // state of class
263
260 // Compact the following four boolean flags into 1-bit each. These four flags 264 // Compact the following four boolean flags into 1-bit each. These four flags
261 // were defined as separate boolean fields and each was 1-byte before. Since 265 // were defined as separate boolean fields and each was 1-byte before. Since
262 // there are 2 bytes unused after the _idnum_allocated_count field, place the 266 // there are 2 bytes unused after the _idnum_allocated_count field, place the
263 // _misc_flags field after _idnum_allocated_count to utilize the unused bits 267 // _misc_flags field after _idnum_allocated_count to utilize the unused bits
264 // and save total 4-bytes. 268 // and save total 4-bytes.
391 bool is_initialized() const { return _init_state == fully_initialized; } 395 bool is_initialized() const { return _init_state == fully_initialized; }
392 bool is_not_initialized() const { return _init_state < being_initialized; } 396 bool is_not_initialized() const { return _init_state < being_initialized; }
393 bool is_being_initialized() const { return _init_state == being_initialized; } 397 bool is_being_initialized() const { return _init_state == being_initialized; }
394 bool is_in_error_state() const { return _init_state == initialization_error; } 398 bool is_in_error_state() const { return _init_state == initialization_error; }
395 bool is_reentrant_initialization(Thread *thread) { return thread == _init_thread; } 399 bool is_reentrant_initialization(Thread *thread) { return thread == _init_thread; }
396 int get_init_state() { return _init_state; } // Useful for debugging 400 ClassState init_state() { return (ClassState)_init_state; }
397 bool is_rewritten() const { return (_misc_flags & REWRITTEN) != 0; } 401 bool is_rewritten() const { return (_misc_flags & REWRITTEN) != 0; }
398 402
399 // defineClass specified verification 403 // defineClass specified verification
400 bool should_verify_class() const { return (_misc_flags & SHOULD_VERIFY_CLASS) != 0; } 404 bool should_verify_class() const { return (_misc_flags & SHOULD_VERIFY_CLASS) != 0; }
401 void set_should_verify_class(bool value) { 405 void set_should_verify_class(bool value) {
776 private: 780 private:
777 // initialization state 781 // initialization state
778 #ifdef ASSERT 782 #ifdef ASSERT
779 void set_init_state(ClassState state); 783 void set_init_state(ClassState state);
780 #else 784 #else
781 void set_init_state(ClassState state) { _init_state = state; } 785 void set_init_state(ClassState state) { _init_state = (u1)state; }
782 #endif 786 #endif
783 void set_rewritten() { _misc_flags |= REWRITTEN; } 787 void set_rewritten() { _misc_flags |= REWRITTEN; }
784 void set_init_thread(Thread *thread) { _init_thread = thread; } 788 void set_init_thread(Thread *thread) { _init_thread = thread; }
785 789
786 u2 idnum_allocated_count() const { return _idnum_allocated_count; } 790 u2 idnum_allocated_count() const { return _idnum_allocated_count; }