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

Implement ResizableResourceHashtable

    XMLWordPrintable

Details

    • Enhancement
    • Status: Resolved
    • P4
    • Resolution: Fixed
    • None
    • 18
    • hotspot
    • b05

    Description

      In HotSpot we have (at least) two hashtable designs in the C++ code:

      - share/utilities/hashtable.hpp
      - share/utilities/resourceHash.hpp

      Of the two, the ResourceHashtable API is much cleaner and most new code has been written with it. However, one issue is that the SIZE of ResourceHashtable is a compile-time constant. This makes the hash-to-index computation very fast on x64 (gcc can avoid using the slow divq instruction for modulo). However, the downside is we cannot use ResourceHashtable when we need a hashtable whose size is determined at run time (and, optionally, resizeable).

      We should implement a new ResizableResourceHashtable template class that has the same design, but uses a instance variable to store its current size.

      See https://github.com/iklam/tools/tree/main/bench/resourceHash for a prototype. And also the comparison of hashing function speed.

      Attachments

        Issue Links

          Activity

            People

              iklam Ioi Lam
              iklam Ioi Lam
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: