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

Add KVHashtable::add_if_absent

XMLWordPrintable

    • b15

      Similar to JDK-8244733, we should add an add_if_absent to speed up code like this:

      http://hg.openjdk.java.net/jdk/jdk/file/f25a5b35e983/src/hotspot/share/memory/metaspaceClosure.cpp#l86

      bool UniqueMetaspaceClosure::do_ref(MetaspaceClosure::Ref* ref, bool read_only) {
        bool* found = _has_been_visited.lookup(ref->obj());
        if (found != NULL) {
          assert(*found == read_only, "must be");
          return false; // Already visited: no need to iterate embedded pointers.
        } else {
          _has_been_visited.add(ref->obj(), read_only);
         ...

      (It would be more ideal to add BasicHashtable::add_if_absent, but the BasicHashtable is so convoluted which makes this difficult).

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

              Created:
              Updated:
              Resolved: