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

ClassLoaderStats VM Op uses constant hash value

    Details

    • Subcomponent:
      jfr
    • Resolved In Build:
      b24

      Backports

        Description



        ClassLoaderStats VM Operation can take a long time when a lot of class loaders are involved.

        See: https://mail.openjdk.java.net/pipermail/hotspot-jfr-dev/2020-May/001430.html

        It iterates the CLDG and accumulates statistics per class loader over all CLDs. It uses a temporary ResourceHashTable for that.

        The hash function is wrong though.

        static unsigned oop_hash(oop const& s1) {
           unsigned hash = (unsigned)((uintptr_t)&s1);
           return hash ^ (hash >> LogMinObjAlignment);
        }

        There are two errors which independently from each other cause the hash to be constant:
        - we use &s1, so we calculate the hash based on the address of the key carrier not the key
        - we use LogMinObjAlignment instead of LogMinObjAlignmentInBytes, which is usually 0, so we xor out the hash at the end.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  stuefe Thomas Stuefe
                  Reporter:
                  stuefe Thomas Stuefe
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: