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

ZGC: Improved utility for ZPageAge

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 26
    • None
    • hotspot
    • gc
    • b02

      Converting to/from ZPageAge and its underlying type (uint8_t, often just uint) is currently done via using static_cast. This currently works fine because sane values are converted. However, to make conversion safer, we should add a to_zpageage and a corresponding untype that checks that the conversion is valid. Such conversion methods should be used instead of calling static_cast<uint/ZPageAge>.

      We currently define a value called ZPageAgeMax, which is defined as static_cast<uint>(ZPageAge::old). The majority of places that use this value actualy use (ZPageAgeMax + 1), which is equivalent to the number of ages. Instead, we should define and use a value that represents the number of possible ages, maybe ZPageAgeCount.

      Lastly, to make iterating over ages more accessible, we should create an intreface of enum iterators of ZPageAge. This will also create a foundation for generating values that require a ZPageAge in the future.

            jsikstro Joel Sikstrom
            jsikstro Joel Sikstrom
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: