Refactor ResourceHashtable to support Hashset

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Won't Fix
    • Priority: P4
    • tbd
    • Affects Version/s: 20
    • Component/s: hotspot

      We have code that uses ResourceHashtable as a HashSet. E.g., in the following code, the bool value is always ignored. We just need to check if the oop key is in the table

      https://github.com/openjdk/jdk/blob/6e248279cfb44cf6a1b5156a41200bf9c166388f/src/hotspot/share/cds/heapShared.hpp#L323-L327

        typedef ResourceHashtable<oop, bool,
            15889, // prime number
            ResourceObj::C_HEAP,
            mtClassShared,
            HeapShared::oop_hash> SeenObjectsTable;

      ResourceHashtable should be refactored to also support HashSet operations, where the value is not used.

      This is more space efficient. It also makes the code faster and clearer when the key type has complex behavior inside its constructor/destructor.

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

              Created:
              Updated:
              Resolved: