hotspot/src/share/vm/memory/binaryTreeDictionary.cpp
changeset 46674 a9e42ff6158f
parent 46630 75aa3e39d02c
child 46701 f559541c0daa
--- a/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp	Mon Jul 17 11:07:12 2017 +0000
+++ b/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp	Mon Jul 17 09:30:00 2017 +0200
@@ -27,7 +27,6 @@
 #include "gc/shared/spaceDecorator.hpp"
 #include "logging/logStream.inline.hpp"
 #include "memory/binaryTreeDictionary.hpp"
-#include "memory/freeBlockDictionary.hpp"
 #include "memory/freeList.hpp"
 #include "memory/metachunk.hpp"
 #include "memory/resourceArea.hpp"
@@ -423,9 +422,7 @@
 // Get a free block of size at least size from tree, or NULL.
 template <class Chunk_t, class FreeList_t>
 TreeChunk<Chunk_t, FreeList_t>*
-BinaryTreeDictionary<Chunk_t, FreeList_t>::get_chunk_from_tree(
-                              size_t size,
-                              enum FreeBlockDictionary<Chunk_t>::Dither dither)
+BinaryTreeDictionary<Chunk_t, FreeList_t>::get_chunk_from_tree(size_t size)
 {
   TreeList<Chunk_t, FreeList_t> *curTL, *prevTL;
   TreeChunk<Chunk_t, FreeList_t>* retTC = NULL;
@@ -450,8 +447,6 @@
   }
   if (curTL == NULL) { // couldn't find exact match
 
-    if (dither == FreeBlockDictionary<Chunk_t>::exactly) return NULL;
-
     // try and find the next larger size by walking back up the search path
     for (curTL = prevTL; curTL != NULL;) {
       if (curTL->size() >= size) break;
@@ -769,7 +764,7 @@
 
 template <class Chunk_t, class FreeList_t>
 size_t BinaryTreeDictionary<Chunk_t, FreeList_t>::max_chunk_size() const {
-  FreeBlockDictionary<Chunk_t>::verify_par_locked();
+  verify_par_locked();
   TreeList<Chunk_t, FreeList_t>* tc = root();
   if (tc == NULL) return 0;
   for (; tc->right() != NULL; tc = tc->right());
@@ -1109,6 +1104,27 @@
   ctc.do_tree(root());
   return ctc.count;
 }
+
+template <class Chunk_t, class FreeList_t>
+Mutex* BinaryTreeDictionary<Chunk_t, FreeList_t>::par_lock() const {
+  return _lock;
+}
+
+template <class Chunk_t, class FreeList_t>
+void BinaryTreeDictionary<Chunk_t, FreeList_t>::set_par_lock(Mutex* lock) {
+  _lock = lock;
+}
+
+template <class Chunk_t, class FreeList_t>
+void BinaryTreeDictionary<Chunk_t, FreeList_t>::verify_par_locked() const {
+#ifdef ASSERT
+  Thread* my_thread = Thread::current();
+  if (my_thread->is_GC_task_thread()) {
+    assert(par_lock() != NULL, "Should be using locking?");
+    assert_lock_strong(par_lock());
+  }
+#endif // ASSERT
+}
 #endif // PRODUCT
 
 // Calculate surpluses for the lists in the tree.
@@ -1199,7 +1215,7 @@
 // Print summary statistics
 template <class Chunk_t, class FreeList_t>
 void BinaryTreeDictionary<Chunk_t, FreeList_t>::report_statistics(outputStream* st) const {
-  FreeBlockDictionary<Chunk_t>::verify_par_locked();
+  verify_par_locked();
   st->print_cr("Statistics for BinaryTreeDictionary:");
   st->print_cr("------------------------------------");
   size_t total_size = total_chunk_size(debug_only(NULL));