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

-XX:+VerifyStringTableAtExit should not do linear search

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 18
    • 18
    • hotspot
    • None
    • b07

      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;
        };
      };

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

              Created:
              Updated:
              Resolved: