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

aarch64: Make Address a discriminated union internally

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 20
    • 20
    • hotspot
    • b27
    • aarch64

      The aarch64 Address class is effectively a discriminated union. The _mode member provides the kind. However, it currently implements this by having all of the members needed for the various kinds, leaving members unrelated to the mode uninitialized or initialized to dummy values.

      One problem with this is that under some circumstances this might lead to accessing uninitialized data, such as when copying an Address object (which happens a lot because they are typically passed by value, which might be considered a separate problem).

      Another problem is that because unused members are always present, allocation and copying are slower than they might otherwise be. (This is probably in the noise for performance, and the copy cost would be substantially mitigated by passing Address objects by const reference rather than by value.)

      This is blocking a possible approach to resolving JDK-8160404, which triggered gcc warnings about such uninitialized accesses when copying Address objects.

            kbarrett Kim Barrett
            kbarrett Kim Barrett
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: