RFR (S) CR 8016236: Class.getGenericInterfaces performance improvement

Paul Sandoz paul.sandoz at oracle.com
Tue Jun 11 07:59:15 UTC 2013


On Jun 10, 2013, at 7:20 PM, Aleksey Shipilev <aleksey.shipilev at oracle.com> wrote:

> Thanks for taking a look, Paul!
> Can I count your review as official?

Unfortunately i am not an unofficial reviewer so can only be counted in the unofficial category for now :-(


> 
> On 06/10/2013 08:44 PM, Paul Sandoz wrote:
>>> - reuse ReflectionData to cache the interfaces and generic signatures
>> 
>> Any guess on the size impact due to those new fields in ReflectionData?
> 
> Seems to be additional 16 bytes (boolean+oop+oop+alignment, see below);
> again, since the ReflectionData is lazily-constructed, this is not the
> issue for most of the classes.
> 

In EE-land a lot more reflection tends to happen on application classes.

I see Peter has some ideas to avoid additional fields with a special lazilly initialized ClassRepository instance.

Paul.


> ---- Before:
> 
> Running 64-bit HotSpot VM.
> Using compressed references with 3-bit shift.
> Objects are 8 bytes aligned.
> 
> java.lang.Class.ReflectionData
> offset  size          type description
>      0    12               (assumed to be the object header)
>     12     4           int ReflectionData.redefinedCount
>     16     4       Field[] ReflectionData.declaredFields
>     20     4       Field[] ReflectionData.publicFields
>     24     4      Method[] ReflectionData.declaredMethods
>     28     4      Method[] ReflectionData.publicMethods
>     32     4 Constructor[] ReflectionData.declaredConstructors
>     36     4 Constructor[] ReflectionData.publicConstructors
>     40     4       Field[] ReflectionData.declaredPublicFields
>     44     4      Method[] ReflectionData.declaredPublicMethods
>     48                     (object boundary, size estimate)
> 
> ---- After:
> 
> Running 64-bit HotSpot VM.
> Using compressed references with 3-bit shift.
> Objects are 16 bytes aligned.
> 
> java.lang.Class.ReflectionData
> offset  size          type description
>      0    12               (assumed to be the object header)
>     12     4           int ReflectionData.redefinedCount
>     16     1       boolean ReflectionData.genericSignatureResolved
>     17     3               (alignment/padding gap)
>     20     4       Field[] ReflectionData.declaredFields
>     24     4       Field[] ReflectionData.publicFields
>     28     4      Method[] ReflectionData.declaredMethods
>     32     4      Method[] ReflectionData.publicMethods
>     36     4 Constructor[] ReflectionData.declaredConstructors
>     40     4 Constructor[] ReflectionData.publicConstructors
>     44     4       Field[] ReflectionData.declaredPublicFields
>     48     4      Method[] ReflectionData.declaredPublicMethods
>     52     4       Class[] ReflectionData.interfaces
>     56     4        String ReflectionData.genericSignature
>     60     4               (loss due to the next object alignment)
>     64                     (object boundary, size estimate)
> 




More information about the core-libs-dev mailing list