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

G1CollectedHeap::heap_region_containing shouldn't be a template

    XMLWordPrintable

    Details

    • Subcomponent:
      gc
    • Resolved In Build:
      b09

      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:
              tschatzl Thomas Schatzl
              Reporter:
              kbarrett Kim Barrett
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: