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

Remove unneeded AdaptivePaddedAverage::operator new

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 22
    • 22
    • hotspot
    • gc
    • b14

      The class AdaptivePaddedAverage has two overloads for operator new.

      The first is equivalent to `::operator new(size_t, void*)`, i.e. global placement new. This one is unused. It has existed since before the mercurial age. It can (and should) be removed.

      The second, `operator new(size_t)`, just forwards to `CHeapObj` with the same memflags as used by the base class. It exists only to provide "normal" allocation because the derived `CHeapObj` function is shadowed by the first overload. (A simplier implementation would have been a `using` directive to bring the base class function into scope.) Removing the first overload makes this one unnecessary.

      Note that `AdaptivePaddedAverage` doesn't have any corresponding `operator delete`, simply using the one from the base class. There is a gcc warning option (-Wmismatched-new-delete) that I think should complain about this, except I think the classes involved are never deleted.

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

              Created:
              Updated:
              Resolved: