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

Support shadow structure for rarely used fields

    XMLWordPrintable

Details

    Description

      Many Fusion Apps workloads have classes with rarely used fields. In order to assist with memory footprint reduction, we propose a feature that permits to hide rarely used fields in a shadow structure.

      So, using heap analysis tools we can determine what fields in what classes are used rarely. It is possible to automate class structure refactoring, whether statically or at run time, so that the rarely used fields are no longer declared in the class definition, but removed to a so-called shadow, and access to them is redirected through generated methods. The getter will check whether the given instance has the shadow created, and if not, return a default value for the field in question. The setter will create a shadow instance, if not already done so, and set the field value, so that later the getter can return the actual value set.

      This way we estimate to save in some cases more than 10% of the heap. We estimate that the extra steps to access the rarely used fields through the shadow structure will be bearable.

      The above steps can be done using fairly straighforward byte-code instrumentation. What is missing, is support from the JDK/JVM to completely virtualize these changes: in order for the changes to remain invisible to any code, the list of fields must be reported as before the instrumentation; serialization and reflection must support the indirection; heap dump perhaps could conceal the presence of the shadow structures.

      This is just an example list of areas where it may be important to add support for compatibility and performance reasons.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ootenko Oleksandr Otenko (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: