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.
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.