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

[mvt]Static fields support for Value Types is broken



      If a Value Type has a static field of its own type, the JVM enters an infinite recursion when trying to load this class. The issue is caused by two pieces of code which should only be applied to non-static fields, but are incorrectly apply to both static and non static fields.

      The first piece of code is the registration of class dependencies: when a class has flattened fields, it must register dependencies to the classes of these fields to prevent them from being unloaded. The registration process requires to load the class of the field. The dependency is only required for flattened fields, and static fields are never flattened. Static fields must be excluded from this logic.

      The second piece of code is the value_field_class array in InstanceKlass, used to quickly retrieve the ValueKlass of any value field of a given class. This array is populated during the construction of the InstanceKlass. The initialization of entries related to static fields can be delayed until the first access of the field, in order to break the infinite recursion.




            • Assignee:
              fparain Frederic Parain
              fparain Frederic Parain
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: