test/hotspot/gtest/gc/shared/test_oopStorage.cpp
changeset 50954 f85092465b0c
parent 50513 7f166e010af4
child 52421 3021c1ad958b
--- a/test/hotspot/gtest/gc/shared/test_oopStorage.cpp	Mon Jul 09 14:12:50 2018 +0200
+++ b/test/hotspot/gtest/gc/shared/test_oopStorage.cpp	Mon Jul 09 13:35:55 2018 -0400
@@ -52,23 +52,23 @@
 class OopStorage::TestAccess : public AllStatic {
 public:
   typedef OopStorage::Block Block;
-  typedef OopStorage::AllocateList AllocateList;
+  typedef OopStorage::AllocationList AllocationList;
   typedef OopStorage::ActiveArray ActiveArray;
 
   static ActiveArray& active_array(const OopStorage& storage) {
     return *storage._active_array;
   }
 
-  static AllocateList& allocate_list(OopStorage& storage) {
-    return storage._allocate_list;
+  static AllocationList& allocation_list(OopStorage& storage) {
+    return storage._allocation_list;
   }
 
-  static const AllocateList& allocate_list(const OopStorage& storage) {
-    return storage._allocate_list;
+  static const AllocationList& allocation_list(const OopStorage& storage) {
+    return storage._allocation_list;
   }
 
-  static Mutex* allocate_mutex(const OopStorage& storage) {
-    return storage._allocate_mutex;
+  static Mutex* allocation_mutex(const OopStorage& storage) {
+    return storage._allocation_mutex;
   }
 
   static bool reduce_deferred_updates(OopStorage& storage) {
@@ -109,13 +109,13 @@
 // building with precompiled headers, or for consistency with that
 // workaround.  There really should be an opto namespace.
 typedef TestAccess::Block OopBlock;
-typedef TestAccess::AllocateList AllocateList;
+typedef TestAccess::AllocationList AllocationList;
 typedef TestAccess::ActiveArray ActiveArray;
 
 // Using EXPECT_EQ can't use NULL directly. Otherwise AIX build breaks.
 const OopBlock* const NULL_BLOCK = NULL;
 
-static size_t list_length(const AllocateList& list) {
+static size_t list_length(const AllocationList& list) {
   size_t result = 0;
   for (const OopBlock* block = list.chead();
        block != NULL;
@@ -125,7 +125,7 @@
   return result;
 }
 
-static void clear_list(AllocateList& list) {
+static void clear_list(AllocationList& list) {
   OopBlock* next;
   for (OopBlock* block = list.head(); block != NULL; block = next) {
     next = list.next(*block);
@@ -133,12 +133,12 @@
   }
 }
 
-static bool is_list_empty(const AllocateList& list) {
+static bool is_list_empty(const AllocationList& list) {
   return list.chead() == NULL;
 }
 
 static bool process_deferred_updates(OopStorage& storage) {
-  MutexLockerEx ml(TestAccess::allocate_mutex(storage), Mutex::_no_safepoint_check_flag);
+  MutexLockerEx ml(TestAccess::allocation_mutex(storage), Mutex::_no_safepoint_check_flag);
   bool result = false;
   while (TestAccess::reduce_deferred_updates(storage)) {
     result = true;
@@ -155,7 +155,7 @@
 }
 
 static size_t empty_block_count(const OopStorage& storage) {
-  const AllocateList& list = TestAccess::allocate_list(storage);
+  const AllocationList& list = TestAccess::allocation_list(storage);
   size_t count = 0;
   for (const OopBlock* block = list.ctail();
        (block != NULL) && block->is_empty();
@@ -183,7 +183,7 @@
   OopStorageTest();
   ~OopStorageTest();
 
-  Mutex _allocate_mutex;
+  Mutex _allocation_mutex;
   Mutex _active_mutex;
   OopStorage _storage;
 
@@ -195,19 +195,19 @@
 };
 
 OopStorageTest::OopStorageTest() :
-  _allocate_mutex(_allocate_rank,
-                  "test_OopStorage_allocate",
-                  false,
-                  Mutex::_safepoint_check_never),
+  _allocation_mutex(_allocate_rank,
+                    "test_OopStorage_allocation",
+                    false,
+                    Mutex::_safepoint_check_never),
   _active_mutex(_active_rank,
                 "test_OopStorage_active",
                 false,
                 Mutex::_safepoint_check_never),
-  _storage("Test Storage", &_allocate_mutex, &_active_mutex)
+  _storage("Test Storage", &_allocation_mutex, &_active_mutex)
 { }
 
 OopStorageTest::~OopStorageTest() {
-  clear_list(TestAccess::allocate_list(_storage));
+  clear_list(TestAccess::allocation_list(_storage));
 }
 
 class OopStorageTestWithAllocation : public OopStorageTest {
@@ -243,10 +243,10 @@
   OopStorage* _storage;
 };
 
-static bool is_allocate_list_sorted(const OopStorage& storage) {
-  // The allocate_list isn't strictly sorted.  Rather, all empty
+static bool is_allocation_list_sorted(const OopStorage& storage) {
+  // The allocation_list isn't strictly sorted.  Rather, all empty
   // blocks are segregated to the end of the list.
-  const AllocateList& list = TestAccess::allocate_list(storage);
+  const AllocationList& list = TestAccess::allocation_list(storage);
   const OopBlock* block = list.ctail();
   for ( ; (block != NULL) && block->is_empty(); block = list.prev(*block)) {}
   for ( ; block != NULL; block = list.prev(*block)) {
@@ -269,7 +269,7 @@
 
 TEST_VM_F(OopStorageTest, allocate_one) {
   EXPECT_EQ(0u, active_count(_storage));
-  EXPECT_TRUE(is_list_empty(TestAccess::allocate_list(_storage)));
+  EXPECT_TRUE(is_list_empty(TestAccess::allocation_list(_storage)));
 
   oop* ptr = _storage.allocate();
   EXPECT_TRUE(ptr != NULL);
@@ -277,11 +277,11 @@
 
   EXPECT_EQ(1u, active_count(_storage));
   EXPECT_EQ(1u, _storage.block_count());
-  EXPECT_EQ(1u, list_length(TestAccess::allocate_list(_storage)));
+  EXPECT_EQ(1u, list_length(TestAccess::allocation_list(_storage)));
 
   EXPECT_EQ(0u, empty_block_count(_storage));
 
-  const OopBlock* block = TestAccess::allocate_list(_storage).chead();
+  const OopBlock* block = TestAccess::allocation_list(_storage).chead();
   EXPECT_NE(block, (OopBlock*)NULL);
   EXPECT_EQ(block, active_head(_storage));
   EXPECT_FALSE(TestAccess::block_is_empty(*block));
@@ -293,11 +293,11 @@
 
   EXPECT_EQ(1u, active_count(_storage));
   EXPECT_EQ(1u, _storage.block_count());
-  EXPECT_EQ(1u, list_length(TestAccess::allocate_list(_storage)));
+  EXPECT_EQ(1u, list_length(TestAccess::allocation_list(_storage)));
 
   EXPECT_EQ(1u, empty_block_count(_storage));
 
-  const OopBlock* new_block = TestAccess::allocate_list(_storage).chead();
+  const OopBlock* new_block = TestAccess::allocation_list(_storage).chead();
   EXPECT_EQ(block, new_block);
   EXPECT_EQ(block, active_head(_storage));
   EXPECT_TRUE(TestAccess::block_is_empty(*block));
@@ -309,11 +309,11 @@
   static const size_t max_entries = 1000;
   oop* entries[max_entries];
 
-  AllocateList& allocate_list = TestAccess::allocate_list(_storage);
+  AllocationList& allocation_list = TestAccess::allocation_list(_storage);
 
   EXPECT_EQ(0u, active_count(_storage));
   EXPECT_EQ(0u, _storage.block_count());
-  EXPECT_TRUE(is_list_empty(allocate_list));
+  EXPECT_TRUE(is_list_empty(allocation_list));
 
   size_t allocated = 0;
   for ( ; allocated < max_entries; ++allocated) {
@@ -326,8 +326,8 @@
       if (TestAccess::block_is_full(block)) {
         break;
       } else {
-        EXPECT_FALSE(is_list_empty(allocate_list));
-        EXPECT_EQ(&block, allocate_list.chead());
+        EXPECT_FALSE(is_list_empty(allocation_list));
+        EXPECT_EQ(&block, allocation_list.chead());
       }
     }
     entries[allocated] = _storage.allocate();
@@ -336,7 +336,7 @@
   EXPECT_EQ(allocated, _storage.allocation_count());
   EXPECT_EQ(1u, active_count(_storage));
   EXPECT_EQ(1u, _storage.block_count());
-  EXPECT_TRUE(is_list_empty(allocate_list));
+  EXPECT_TRUE(is_list_empty(allocation_list));
   const OopBlock& block = *TestAccess::active_array(_storage).at(0);
   EXPECT_TRUE(TestAccess::block_is_full(block));
   EXPECT_EQ(allocated, TestAccess::block_allocation_count(block));
@@ -346,7 +346,7 @@
     size_t remaining = allocated - (i + 1);
     EXPECT_EQ(remaining, TestAccess::block_allocation_count(block));
     EXPECT_EQ(remaining, _storage.allocation_count());
-    EXPECT_FALSE(is_list_empty(allocate_list));
+    EXPECT_FALSE(is_list_empty(allocation_list));
   }
 }
 
@@ -354,7 +354,7 @@
   static const size_t max_entries = 1000;
   oop* entries[max_entries];
 
-  AllocateList& allocate_list = TestAccess::allocate_list(_storage);
+  AllocationList& allocation_list = TestAccess::allocation_list(_storage);
 
   EXPECT_EQ(0u, empty_block_count(_storage));
 
@@ -362,12 +362,12 @@
   ASSERT_TRUE(entries[0] != NULL);
   EXPECT_EQ(1u, active_count(_storage));
   EXPECT_EQ(1u, _storage.block_count());
-  EXPECT_EQ(1u, list_length(allocate_list));
+  EXPECT_EQ(1u, list_length(allocation_list));
   EXPECT_EQ(0u, empty_block_count(_storage));
 
   const OopBlock* block = TestAccess::active_array(_storage).at(0);
   EXPECT_EQ(1u, TestAccess::block_allocation_count(*block));
-  EXPECT_EQ(block, allocate_list.chead());
+  EXPECT_EQ(block, allocation_list.chead());
 
   for (size_t i = 1; i < max_entries; ++i) {
     entries[i] = _storage.allocate();
@@ -376,40 +376,40 @@
     EXPECT_EQ(0u, empty_block_count(_storage));
 
     if (block == NULL) {
-      ASSERT_FALSE(is_list_empty(allocate_list));
-      EXPECT_EQ(1u, list_length(allocate_list));
-      block = allocate_list.chead();
+      ASSERT_FALSE(is_list_empty(allocation_list));
+      EXPECT_EQ(1u, list_length(allocation_list));
+      block = allocation_list.chead();
       EXPECT_EQ(1u, TestAccess::block_allocation_count(*block));
       EXPECT_EQ(block, active_head(_storage));
     } else if (TestAccess::block_is_full(*block)) {
-      EXPECT_TRUE(is_list_empty(allocate_list));
+      EXPECT_TRUE(is_list_empty(allocation_list));
       block = NULL;
     } else {
-      EXPECT_FALSE(is_list_empty(allocate_list));
-      EXPECT_EQ(block, allocate_list.chead());
+      EXPECT_FALSE(is_list_empty(allocation_list));
+      EXPECT_EQ(block, allocation_list.chead());
       EXPECT_EQ(block, active_head(_storage));
     }
   }
 
   if (block != NULL) {
     EXPECT_NE(0u, TestAccess::block_allocation_count(*block));
-    EXPECT_FALSE(is_list_empty(allocate_list));
-    EXPECT_EQ(block, allocate_list.chead());
+    EXPECT_FALSE(is_list_empty(allocation_list));
+    EXPECT_EQ(block, allocation_list.chead());
     EXPECT_EQ(block, active_head(_storage));
   }
 
   for (size_t i = 0; i < max_entries; ++i) {
     release_entry(_storage, entries[i]);
-    EXPECT_TRUE(is_allocate_list_sorted(_storage));
+    EXPECT_TRUE(is_allocation_list_sorted(_storage));
     EXPECT_EQ(max_entries - (i + 1), total_allocation_count(_storage));
   }
 
-  EXPECT_EQ(active_count(_storage), list_length(allocate_list));
+  EXPECT_EQ(active_count(_storage), list_length(allocation_list));
   EXPECT_EQ(active_count(_storage), _storage.block_count());
   EXPECT_EQ(active_count(_storage), empty_block_count(_storage));
-  for (const OopBlock* block = allocate_list.chead();
+  for (const OopBlock* block = allocation_list.chead();
        block != NULL;
-       block = allocate_list.next(*block)) {
+       block = allocation_list.next(*block)) {
     EXPECT_TRUE(TestAccess::block_is_empty(*block));
   }
 }
@@ -420,10 +420,10 @@
 
   EXPECT_EQ(0u, empty_block_count(_storage));
 
-  AllocateList& allocate_list = TestAccess::allocate_list(_storage);
+  AllocationList& allocation_list = TestAccess::allocation_list(_storage);
 
   EXPECT_EQ(_max_entries, total_allocation_count(_storage));
-  EXPECT_GE(1u, list_length(allocate_list));
+  EXPECT_GE(1u, list_length(allocation_list));
 
   // Release all entries in "random" order.
   size_t released = 0;
@@ -433,14 +433,14 @@
       _entries[i] = NULL;
       ++released;
       EXPECT_EQ(_max_entries - released, total_allocation_count(_storage));
-      EXPECT_TRUE(is_allocate_list_sorted(_storage));
+      EXPECT_TRUE(is_allocation_list_sorted(_storage));
     }
   }
 
-  EXPECT_EQ(active_count(_storage), list_length(allocate_list));
+  EXPECT_EQ(active_count(_storage), list_length(allocation_list));
   EXPECT_EQ(active_count(_storage), _storage.block_count());
   EXPECT_EQ(0u, total_allocation_count(_storage));
-  EXPECT_EQ(list_length(allocate_list), empty_block_count(_storage));
+  EXPECT_EQ(list_length(allocation_list), empty_block_count(_storage));
 }
 
 TEST_VM_F(OopStorageTestWithAllocation, random_allocate_release) {
@@ -450,10 +450,10 @@
 
   EXPECT_EQ(0u, empty_block_count(_storage));
 
-  AllocateList& allocate_list = TestAccess::allocate_list(_storage);
+  AllocationList& allocation_list = TestAccess::allocation_list(_storage);
 
   EXPECT_EQ(_max_entries, total_allocation_count(_storage));
-  EXPECT_GE(1u, list_length(allocate_list));
+  EXPECT_GE(1u, list_length(allocation_list));
 
   // Release all entries in "random" order, "randomly" interspersed
   // with additional allocations.
@@ -466,20 +466,20 @@
       ++released;
       ++total_released;
       EXPECT_EQ(_max_entries - released, total_allocation_count(_storage));
-      EXPECT_TRUE(is_allocate_list_sorted(_storage));
+      EXPECT_TRUE(is_allocation_list_sorted(_storage));
       if (total_released % allocate_step == 0) {
         _entries[i] = _storage.allocate();
         --released;
         EXPECT_EQ(_max_entries - released, total_allocation_count(_storage));
-        EXPECT_TRUE(is_allocate_list_sorted(_storage));
+        EXPECT_TRUE(is_allocation_list_sorted(_storage));
       }
     }
   }
 
-  EXPECT_EQ(active_count(_storage), list_length(allocate_list));
+  EXPECT_EQ(active_count(_storage), list_length(allocation_list));
   EXPECT_EQ(active_count(_storage), _storage.block_count());
   EXPECT_EQ(0u, total_allocation_count(_storage));
-  EXPECT_EQ(list_length(allocate_list), empty_block_count(_storage));
+  EXPECT_EQ(list_length(allocation_list), empty_block_count(_storage));
 }
 
 template<bool sorted>
@@ -1200,10 +1200,10 @@
 const size_t OopStorageBlockCollectionTest::nvalues;
 const void* const OopStorageBlockCollectionTest::_pseudo_owner[] = {};
 
-class OopStorageAllocateListTest : public OopStorageBlockCollectionTest {};
+class OopStorageAllocationListTest : public OopStorageBlockCollectionTest {};
 
-TEST_F(OopStorageAllocateListTest, empty_list) {
-  AllocateList list;
+TEST_F(OopStorageAllocationListTest, empty_list) {
+  AllocationList list;
 
   EXPECT_TRUE(is_list_empty(list));
   EXPECT_EQ(NULL_BLOCK, list.head());
@@ -1211,8 +1211,8 @@
   EXPECT_EQ(NULL_BLOCK, list.ctail());
 }
 
-TEST_F(OopStorageAllocateListTest, push_back) {
-  AllocateList list;
+TEST_F(OopStorageAllocationListTest, push_back) {
+  AllocationList list;
 
   for (size_t i = 0; i < nvalues; ++i) {
     list.push_back(*values[i]);
@@ -1241,8 +1241,8 @@
   clear_list(list);
 }
 
-TEST_F(OopStorageAllocateListTest, push_front) {
-  AllocateList list;
+TEST_F(OopStorageAllocationListTest, push_front) {
+  AllocationList list;
 
   for (size_t i = 0; i < nvalues; ++i) {
     list.push_front(*values[i]);
@@ -1271,22 +1271,22 @@
   clear_list(list);
 }
 
-class OopStorageAllocateListTestWithList : public OopStorageAllocateListTest {
+class OopStorageAllocationListTestWithList : public OopStorageAllocationListTest {
 public:
-  OopStorageAllocateListTestWithList() : list() {
+  OopStorageAllocationListTestWithList() : list() {
     for (size_t i = 0; i < nvalues; ++i) {
       list.push_back(*values[i]);
     }
   }
 
-  ~OopStorageAllocateListTestWithList() {
+  ~OopStorageAllocationListTestWithList() {
     clear_list(list);
   }
 
-  AllocateList list;
+  AllocationList list;
 };
 
-TEST_F(OopStorageAllocateListTestWithList, unlink_front) {
+TEST_F(OopStorageAllocationListTestWithList, unlink_front) {
   EXPECT_EQ(list.chead(), values[0]);
   EXPECT_EQ(list.ctail(), values[nvalues - 1]);
 
@@ -1304,7 +1304,7 @@
   EXPECT_EQ(NULL_BLOCK, block);
 }
 
-TEST_F(OopStorageAllocateListTestWithList, unlink_back) {
+TEST_F(OopStorageAllocationListTestWithList, unlink_back) {
   EXPECT_EQ(list.chead(), values[0]);
 
   list.unlink(*values[nvalues - 1]);
@@ -1321,7 +1321,7 @@
   EXPECT_EQ(NULL_BLOCK, block);
 }
 
-TEST_F(OopStorageAllocateListTestWithList, unlink_middle) {
+TEST_F(OopStorageAllocationListTestWithList, unlink_middle) {
   EXPECT_EQ(list.chead(), values[0]);
 
   size_t index = nvalues / 2;
@@ -1344,8 +1344,8 @@
   EXPECT_EQ(NULL_BLOCK, block);
 }
 
-TEST_F(OopStorageAllocateListTest, single) {
-  AllocateList list;
+TEST_F(OopStorageAllocationListTest, single) {
+  AllocationList list;
 
   list.push_back(*values[0]);
   EXPECT_EQ(NULL_BLOCK, list.next(*values[0]));