RFR: 8191786: Thread-SMR hash table size should be dynamic

Robbin Ehn rehn at openjdk.java.net
Tue May 25 07:55:07 UTC 2021


On Mon, 24 May 2021 16:06:23 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

> Small change to switch Thread-SMR's hash table from ResourceHashtable to KVHashtable
> so that a variable sized hash table is used instead of a fixed size hash table (1031 elements).
> Also refactor common hash table size calculation code into static hash_table_size()
> function and call it from both places.
> 
> Test with Mach5 Tier[1-7] testing.

Marked as reviewed by rehn (Reviewer).

Hi Dan, it looks like someone confused x-macros and templates. The issue is that there is code in the CPP file which requires expansion, so when compiling the CPP file it must know all templates instances.... the CPP should removed!

This is the temporary fix until we have removed that CPP file.

diff --git a/src/hotspot/share/runtime/threadSMR.cpp b/src/hotspot/share/runtime/threadSMR.cpp
index f08320a9a95..c1daf26e7da 100644
--- a/src/hotspot/share/runtime/threadSMR.cpp
+++ b/src/hotspot/share/runtime/threadSMR.cpp
@@ -195,13 +195,3 @@ class ThreadScanHashtable : public CHeapObj<mtThread> {
   int _table_size;
-  // Note: I want this to be mtThread, but that causes linkage errors:
-  //
-  //   Undefined symbols for architecture x86_64:
-  //   "BasicHashtable<(MEMFLAGS)2>::free_buckets()", referenced from:
-  //   ThreadsSMRSupport::free_list(ThreadsList*) in threadSMR.o
-  //   ThreadsSMRSupport::is_a_protected_JavaThread(JavaThread*) in threadSMR.o
-  //   "BasicHashtable<(MEMFLAGS)2>::new_entry(unsigned int)", referenced from:
-  //   KVHashtable<void*, bool, (MEMFLAGS)2, &(unsigned int primitive_hash<void*>(void* const&)), &(bool primitive_equals<void*>(void* const&, void* const&))>::add_if_absent(void*, bool, bool*) in threadSMR.o
-  //
-  // so I'm using mtInternal instead.
-  KVHashtable<void *, bool, mtInternal, &ThreadScanHashtable::ptr_hash,
+  KVHashtable<void *, bool, mtThread, &ThreadScanHashtable::ptr_hash,
                             &ThreadScanHashtable::ptr_equals> _ptrs;
diff --git a/src/hotspot/share/utilities/hashtable.cpp b/src/hotspot/share/utilities/hashtable.cpp
index c3c62e4c20b..0b0d3de72af 100644
--- a/src/hotspot/share/utilities/hashtable.cpp
+++ b/src/hotspot/share/utilities/hashtable.cpp
@@ -281,2 +281,3 @@ template class BasicHashtable<mtTracing>;
 template class BasicHashtable<mtServiceability>;
+template class BasicHashtable<mtThread>;

``` 

Thanks, Robbin

-------------

PR: https://git.openjdk.java.net/jdk/pull/4168


More information about the hotspot-runtime-dev mailing list