Request for review: 8005895: Inefficient InstanceKlass field packing wasts memory

Jiangli Zhou jiangli.zhou at
Thu Jan 10 10:46:28 PST 2013

Hi Aleksey,

Good question! I don't know why _has_default_methods was not in the 
enumerated flags in the first place. Looks like it can be handled that 
way. Although packing _has_default_methods into the _misc_flags would 
not yield any memory saving currently, but it may help in the future. 
Please let me know if you prefer packing _has_default_methods into  
_misc_flags as part of this change. Or, I can file a enhancement bug so 
we can keep track of it.



On 01/10/2013 10:11 AM, Aleksey Shipilev wrote:
> Why is _has_default_methods not in the enumerated flags there in the first place?
> -Aleksey
> On 10.01.2013, at 21:57, Jiangli Zhou<jiangli.zhou at>  wrote:
>> Hi,
>> Please review the following trivial change for repacking the InstanceKlass fields to improve memory efficiency.
>> The 'bool' typed variables, '_is_marked_dependent' and '_has_default_methods' were grouped with u2 typed fields. For both, there were 1-byte padding added on 32bit machine. We can pack those two boolean variables together to avoid the padding, then move one of the u2 field to be together with '_init_state' and '_reference_type'. That saves 4 bytes without any real code change.
>> Thanks,
>> Jiangli

More information about the hotspot-runtime-dev mailing list