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

BasicHashtable does not support small table_size

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 14
    • 14
    • hotspot
    • None
    • b24

      I ran into this bug when trying to use KVHashtable. Simple repro is to build fastdebug JDK with a patch like this:

      diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp
      --- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp
      +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp
      @@ -1855,6 +1855,9 @@ jint G1CollectedHeap::initialize() {
       
         _collection_set.initialize(max_regions());
       
      + KVHashtable<size_t, size_t, mtGC> kv_map(1);
      + kv_map.add(42, 42);
      +
         return JNI_OK;
       }

      Then it fails with:
      # Internal Error (usr/local/google/home/manc/ws/jdkHeadOpen1/src/hotspot/share/utilities/hashtable.cpp:67), pid=73195, tid=73249
      # Error: assert(len >= _entry_size) failed

      The root cause is missing a minimum bound to compute block_size in BasicHashtableEntry<F>* BasicHashtable<F>::new_entry(unsigned int hashValue). The minimum bound has to be 2 in order to accommodate rounding down len to power of 2.

            manc Man Cao
            manc Man Cao
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: