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

G1CollectedHeap::heap_region_containing shouldn't be a template.

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 15
    • Fix Version/s: tbd
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
      gc

      Description

      In G1CollectedHeap::heap_region_containing, JDK-8237637 replaced a cast to HeapWord* with a cast sequence to void* then to HeapWord*. This was needed because this function template may be applied to an oop, and the direct cast to HeapWord* no longer works for oop when CHECK_UNHANDLED_OOPS is enabled.

      But the problem here is really that heap_region_containing with an oop argument is sharing that common template definition. It could instead be a separate overload that calls the other on the result of cast_from_oop. But we don't actually need a template there at all; two ordinary function overloads, for HeapWord* and for oop (the latter calling the former on the cast-from-oop) suffices, and simplifies the code.

      Similarly for heap_region_containing_or_null.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kbarrett Kim Barrett
                Reporter:
                kbarrett Kim Barrett
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: