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

aarch64: Subclasses of Address get sliced

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Unresolved
    • P4
    • tbd
    • 20
    • hotspot

    Description

      The aarch64 Address class has a number of subclasses for various kinds of literal addresses: RuntimeAddress, ExternalAddress, OopAddress, InternalAddress.

      OopAddress appears to be unused, so can be deleted.

      The others are all subject to slicing, since the Address dtor/copy/assign are all public. And indeed they get sliced, since (almost) all uses of these subclasses are just to construct an argument to be passed by value to a function taking an Address object. So a slicing copy, with the derived type being of no real importance. While it works, it's icky and unnecessary.

      A better approach (that avoids copy-slicing) would be to replace those subclasses with static functions with the names of those subclasses, with each function returning an appropriately initialized Address object.

      There are a couple places where one of these derived types is used as a local variable's type. Those can be changed to Address without any loss of functionality or readability.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated: