Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7007564

Align non-static fields size on byte instead of wordSize

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • 8-pool
    • 7
    • hotspot
    • None
    • sparc
    • solaris_10

      Currently we round non-static fields size to word and subclass non-static fields start from this aligned offset. As result it could increase total instance size:

      Tom Rodriguez wrote:

      If I have this hierarchy:

      class MDecimal {
        Object _impl;
        bool _dirty;
      }

      class MByte extends MDecimal {
        byte _value;
      }

      This is the layout I'm getting:

       - ---- non-static fields (3 words):
       - protected transient '_impl' 'Ljava/lang/Object;' @8
       - protected transient '_dirty' 'Z' @12
       - private '_value' 'B' @16

      which bumps the object size up by a double word.

      Note: final changes for 6523674 allowed to compact small fields into gaps at the same subclass only.

            jiangli Jiangli Zhou
            kvn Vladimir Kozlov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: