Review request 7109878: The instanceKlass EnclosingMethhod attribute fields can be folded into the _inner_class field

Dean Long dean.long at oracle.com
Fri Feb 17 17:44:18 PST 2012


In parse_classfile_inner_classes_attribute():

!   u2 size = length * 4 + (parsed_enclosingmethod_attribute ? 2 : 0);

don't you need a size bigger than u2 for "size"?  I think any value of 
"length" greater than 0x3fffffff will
cause an overflow.

dl

On 2/17/2012 3:42 PM, Jiangli Zhou wrote:
> Hi,
>
> Please review the changes that fold the 
> instanceKlass::_enclosing_method_class_index and 
> instanceKlass::_enclosing_method_method_index into the 
> instanceKlass::_inner_classes array. The 
> instanceKlass::_enclosing_method_class_index and 
> instanceKlass::_enclosing_method_method_index are only used if the 
> class contains the EnclosingMethod attribute (local class or anonymous 
> class). For majority of the classes, these two fields (4byte total) 
> are wasted. Folding them into the _inner_classes array and only 
> allocating the space for them saves 4byte for most of the loaded 
> classes. The enclosing method indexes are located at the end of the 
> _inner_classes array when exist.
>
> http://cr.openjdk.java.net/~jiangli/7109878/webrev.00/
>
> Thanks,
>
> Jiangli


More information about the hotspot-runtime-dev mailing list