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

-XX:+VerifyStringTableAtExit should not do linear search

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 18
    • Fix Version/s: 18
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b07

      Description

      https://github.com/openjdk/jdk/blob/a4e5f08fefac50a1ced7ff4178d9d76f90797949/src/hotspot/share/classfile/stringTable.cpp#L610

      The linear search is very slow. It should be replaced with a hashtable lookup.

      class VerifyCompStrings : StackObj {
        GrowableArray<oop>* _oops;
       public:
        size_t _errors;
        VerifyCompStrings(GrowableArray<oop>* oops) : _oops(oops), _errors(0) {}
        bool operator()(WeakHandle* val) {
          oop s = val->resolve();
          if (s == NULL) {
            return true;
          }
          int len = _oops->length();
          for (int i = 0; i < len; i++) {
            bool eq = java_lang_String::equals(s, _oops->at(i));
            assert(!eq, "Duplicate strings");
            if (eq) {
              _errors++;
            }
          }
          _oops->push(s);
          return true;
        };
      };

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: