Fri, 11 Jan 2013 16:55:07 -0500
8005895: Inefficient InstanceKlass field packing wasts memory.
Summary: Pack _misc_has_default_methods into the _misc_flags, move _idnum_allocated_count.
Reviewed-by: coleenp, shade
src/share/vm/oops/instanceKlass.hpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/oops/instanceKlass.hpp Fri Jan 11 02:02:51 2013 -0800 1.2 +++ b/src/share/vm/oops/instanceKlass.hpp Fri Jan 11 16:55:07 2013 -0500 1.3 @@ -225,12 +225,16 @@ 1.4 u2 _java_fields_count; // The number of declared Java fields 1.5 int _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks 1.6 1.7 + // _is_marked_dependent can be set concurrently, thus cannot be part of the 1.8 + // _misc_flags. 1.9 bool _is_marked_dependent; // used for marking during flushing and deoptimization 1.10 + 1.11 enum { 1.12 _misc_rewritten = 1 << 0, // methods rewritten. 1.13 _misc_has_nonstatic_fields = 1 << 1, // for sizing with UseCompressedOops 1.14 _misc_should_verify_class = 1 << 2, // allow caching of preverification 1.15 - _misc_is_anonymous = 1 << 3 // has embedded _inner_classes field 1.16 + _misc_is_anonymous = 1 << 3, // has embedded _inner_classes field 1.17 + _misc_has_default_methods = 1 << 4 // class/superclass/implemented interfaces has default methods 1.18 }; 1.19 u2 _misc_flags; 1.20 u2 _minor_version; // minor version number of class file 1.21 @@ -253,10 +257,6 @@ 1.22 jint _cached_class_file_len; // JVMTI: length of above 1.23 JvmtiCachedClassFieldMap* _jvmti_cached_class_field_map; // JVMTI: used during heap iteration 1.24 1.25 - // true if class, superclass, or implemented interfaces have default methods 1.26 - bool _has_default_methods; 1.27 - 1.28 - volatile u2 _idnum_allocated_count; // JNI/JVMTI: increments with the addition of methods, old ids don't change 1.29 // Method array. 1.30 Array<Method*>* _methods; 1.31 // Interface (Klass*s) this class declares locally to implement. 1.32 @@ -280,6 +280,8 @@ 1.33 // ... 1.34 Array<u2>* _fields; 1.35 1.36 + volatile u2 _idnum_allocated_count; // JNI/JVMTI: increments with the addition of methods, old ids don't change 1.37 + 1.38 // Class states are defined as ClassState (see above). 1.39 // Place the _init_state here to utilize the unused 2-byte after 1.40 // _idnum_allocated_count. 1.41 @@ -616,8 +618,16 @@ 1.42 return _jvmti_cached_class_field_map; 1.43 } 1.44 1.45 - bool has_default_methods() const { return _has_default_methods; } 1.46 - void set_has_default_methods(bool b) { _has_default_methods = b; } 1.47 + bool has_default_methods() const { 1.48 + return (_misc_flags & _misc_has_default_methods) != 0; 1.49 + } 1.50 + void set_has_default_methods(bool b) { 1.51 + if (b) { 1.52 + _misc_flags |= _misc_has_default_methods; 1.53 + } else { 1.54 + _misc_flags &= ~_misc_has_default_methods; 1.55 + } 1.56 + } 1.57 1.58 // for adding methods, ConstMethod::UNSET_IDNUM means no more ids available 1.59 inline u2 next_method_idnum();