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

Implement ResizableResourceHashtable

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 18
    • None
    • hotspot
    • b05

      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.

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

              Created:
              Updated:
              Resolved: