src/hotspot/share/gc/shared/oopStorage.cpp
changeset 50513 7f166e010af4
parent 50429 83aec1d357d4
child 50954 f85092465b0c
--- a/src/hotspot/share/gc/shared/oopStorage.cpp	Tue Jun 12 08:51:28 2018 +0800
+++ b/src/hotspot/share/gc/shared/oopStorage.cpp	Mon Jun 11 22:35:07 2018 -0400
@@ -52,9 +52,7 @@
   assert(_next == NULL, "deleting attached block");
 }
 
-OopStorage::AllocateList::AllocateList(const AllocateEntry& (*get_entry)(const Block& block)) :
-  _head(NULL), _tail(NULL), _get_entry(get_entry)
-{}
+OopStorage::AllocateList::AllocateList() : _head(NULL), _tail(NULL) {}
 
 OopStorage::AllocateList::~AllocateList() {
   // ~OopStorage() empties its lists before destroying them.
@@ -68,8 +66,8 @@
     assert(_tail == NULL, "invariant");
     _head = _tail = █
   } else {
-    _get_entry(block)._next = old;
-    _get_entry(*old)._prev = █
+    block.allocate_entry()._next = old;
+    old->allocate_entry()._prev = █
     _head = █
   }
 }
@@ -80,14 +78,14 @@
     assert(_head == NULL, "invariant");
     _head = _tail = █
   } else {
-    _get_entry(*old)._next = █
-    _get_entry(block)._prev = old;
+    old->allocate_entry()._next = █
+    block.allocate_entry()._prev = old;
     _tail = █
   }
 }
 
 void OopStorage::AllocateList::unlink(const Block& block) {
-  const AllocateEntry& block_entry = _get_entry(block);
+  const AllocateEntry& block_entry = block.allocate_entry();
   const Block* prev_blk = block_entry._prev;
   const Block* next_blk = block_entry._next;
   block_entry._prev = NULL;
@@ -98,15 +96,15 @@
     _head = _tail = NULL;
   } else if (prev_blk == NULL) {
     assert(_head == &block, "invariant");
-    _get_entry(*next_blk)._prev = NULL;
+    next_blk->allocate_entry()._prev = NULL;
     _head = next_blk;
   } else if (next_blk == NULL) {
     assert(_tail == &block, "invariant");
-    _get_entry(*prev_blk)._next = NULL;
+    prev_blk->allocate_entry()._next = NULL;
     _tail = prev_blk;
   } else {
-    _get_entry(*next_blk)._prev = prev_blk;
-    _get_entry(*prev_blk)._next = next_blk;
+    next_blk->allocate_entry()._prev = prev_blk;
+    prev_blk->allocate_entry()._next = next_blk;
   }
 }
 
@@ -232,10 +230,6 @@
   const_cast<OopStorage* volatile&>(_owner) = NULL;
 }
 
-const OopStorage::AllocateEntry& OopStorage::Block::get_allocate_entry(const Block& block) {
-  return block._allocate_entry;
-}
-
 size_t OopStorage::Block::allocation_size() {
   // _data must be first member, so aligning Block aligns _data.
   STATIC_ASSERT(_data_pos == 0);
@@ -769,7 +763,7 @@
                        Mutex* active_mutex) :
   _name(dup_name(name)),
   _active_array(ActiveArray::create(initial_active_array_size)),
-  _allocate_list(&Block::get_allocate_entry),
+  _allocate_list(),
   _deferred_updates(NULL),
   _allocate_mutex(allocate_mutex),
   _active_mutex(active_mutex),