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

compactHashtable.hpp includes oop.inline.hpp file

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 9
    • hotspot
    • b99

      I was looking at why I had to recompile almost all .cpp files when I changed an .inline.hpp file. I found that oop.inline.hpp had been included in the compactHashtable.hpp file.

      The function that uses code in oop.inline.hpp needs to be moved to a .cpp file or a .inline.hpp file.

      I found:
        inline oop lookup_entry(CompactHashtable<oop, char>* const t,
                              juint* addr, const char* name, int len) {
          oop string = oopDesc::load_decode_heap_oop<BARRIER_DEFAULT>((narrowOop*)addr);
          if (java_lang_String::equals(string, (jchar*)name, len)) {
            return string;
          }

          return NULL;
        }

      which is called by:
        // Lookup an entry from the compact table
        inline T lookup(const N* name, unsigned int hash, int len) {
          if (_entry_count > 0) {
            assert(!DumpSharedSpaces, "run-time only");
            int index = hash % _bucket_count;
            juint bucket_info = _buckets[index];
            juint bucket_offset = BUCKET_OFFSET(bucket_info);
            int bucket_type = BUCKET_TYPE(bucket_info);
            juint* bucket = _buckets + bucket_offset;
            juint* bucket_end = _buckets;

            if (bucket_type == COMPACT_BUCKET_TYPE) {
              // the compact bucket has one entry with entry offset only
              T res = lookup_entry(this, &bucket[0], name, len);
              if (res != NULL) {
                return res;
              }
            } else {
              // This is a regular bucket, which has more than one
              // entries. Each entry is a pair of entry (hash, offset).
              // Seek until the end of the bucket.
              bucket_end += BUCKET_OFFSET(_buckets[index + 1]);
              while (bucket < bucket_end) {
                unsigned int h = (unsigned int)(bucket[0]);
                if (h == hash) {
                  T res = lookup_entry(this, &bucket[1], name, len);
                  if (res != NULL) {
                    return res;
                  }
                }
                bucket += 2;
              }
            }
          }
          return NULL;
        }

      Both needs to be moved.

      I'd like this to be fixed for 9, and not deferred to a later release.

            iklam Ioi Lam
            stefank Stefan Karlsson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: