Proxy.isProxyClass scalability

Aleksey Shipilev aleksey.shipilev at oracle.com
Fri Jan 25 16:34:03 UTC 2013


On 01/25/2013 08:02 PM, Peter Levart wrote:
> On 01/25/2013 06:35 AM, David Holmes wrote:
>> On 25/01/2013 2:36 AM, Peter Levart wrote:
>>> On 01/24/2013 04:45 PM, Peter Levart wrote:
> ...so it seems that in both cases, adding a boolean to j.l.Class wastes
> 8 bytes per Class object :-(

Seems to be the case, we are hitting the 8-byte alignment boundary.

java-object-layout [1] on jdk7u12:

$ java -jar ~/projects/java-object-layout/target/java-object-layout.jar
java.lang.Class
Running 64-bit HotSpot VM.
Using compressed references with 3-bit shift.
Objects are 8 bytes aligned.

java.lang.Class
 offset  size            type description
      0    12                 (assumed to be the object header)
     12     4     Constructor Class.cachedConstructor
     16     4           Class Class.newInstanceCallerCache
     20     4          String Class.name
     24     4   SoftReference Class.declaredFields
     28     4   SoftReference Class.publicFields
     32     4   SoftReference Class.declaredMethods
     36     4   SoftReference Class.publicMethods
     40     4   SoftReference Class.declaredConstructors
     44     4   SoftReference Class.publicConstructors
     48     4   SoftReference Class.declaredPublicFields
     52     4   SoftReference Class.declaredPublicMethods
     56     4 ClassRepository Class.genericInfo
     60     4        Object[] Class.enumConstants
     64     4             Map Class.enumConstantDirectory
     68     4             Map Class.annotations
     72     4             Map Class.declaredAnnotations
     76     4  AnnotationType Class.annotationType
     80     4   ClassValueMap Class.classValueMap
     84    12                 (alignment/padding gap)
     96     4             int Class.classRedefinedCount
    100     4             int Class.lastRedefinedCount
    104                       (object boundary, size estimate)

But, otherwise, can't we use java.lang.ClassValue to associate this flag
with each class?

-Aleksey.

[1] https://github.com/shipilev/java-field-layout




More information about the core-libs-dev mailing list