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

Aleksey Shipilev aleksey.shipilev at oracle.com
Mon Jun 10 17:20:06 UTC 2013


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

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.

---- 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