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

Refactor ResourceHashtable to support Hashset

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • tbd
    • 20
    • 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.

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

              Created:
              Updated:
              Resolved: