< prev index next >

test/hotspot/gtest/utilities/test_concurrentHashtable.cpp

Print this page
rev 50787 : 8205583: Crash in ConcurrentHashTable do_bulk_delete_locked_for
Reviewed-by:


 196   SimpleTestTable* cht = new SimpleTestTable();
 197   cht_getinsert_bulkdelete_insert_verified(thr, cht, val1, false, true);
 198   cht_getinsert_bulkdelete_insert_verified(thr, cht, val2, false, true);
 199   cht_getinsert_bulkdelete_insert_verified(thr, cht, val3, false, true);
 200 
 201   EXPECT_TRUE(cht->remove(thr, stl2)) << "Remove did not find value.";
 202 
 203   cht_getinsert_bulkdelete_insert_verified(thr, cht, val1, true, false); // val1 should be present
 204   cht_getinsert_bulkdelete_insert_verified(thr, cht, val2, false, true); // val2 should be inserted
 205   cht_getinsert_bulkdelete_insert_verified(thr, cht, val3, true, false); // val3 should be present
 206 
 207   EXPECT_EQ(cht->get_copy(thr, stl1), val1) << "Get did not find value.";
 208   EXPECT_EQ(cht->get_copy(thr, stl2), val2) << "Get did not find value.";
 209   EXPECT_EQ(cht->get_copy(thr, stl3), val3) << "Get did not find value.";
 210 
 211   // Removes all odd values.
 212   SimpleTestTable::BulkDeleteTask bdt(cht);
 213   if (bdt.prepare(thr)) {
 214     while(bdt.do_task(thr, getinsert_bulkdelete_eval, getinsert_bulkdelete_del)) {
 215       bdt.pause(thr);
 216       EXPECT_TRUE(bdt.cont(thr)) << "Uncontended continue should work.";
 217     }
 218     bdt.done(thr);
 219   }
 220 
 221   EXPECT_EQ(cht->get_copy(thr, stl1), (uintptr_t)0) << "Odd value should not exist.";
 222   EXPECT_FALSE(cht->remove(thr, stl1)) << "Odd value should not exist.";
 223   EXPECT_EQ(cht->get_copy(thr, stl2), val2) << "Even value should not have been removed.";
 224   EXPECT_EQ(cht->get_copy(thr, stl3), (uintptr_t)0) << "Add value should not exists.";
 225   EXPECT_FALSE(cht->remove(thr, stl3)) << "Odd value should not exists.";
 226 
 227   delete cht;
 228 }
 229 
 230 static void cht_scope(Thread* thr) {
 231   uintptr_t val = 0x2;
 232   SimpleTestLookup stl(val);
 233   SimpleTestTable* cht = new SimpleTestTable();
 234   EXPECT_TRUE(cht->insert(thr, stl, val)) << "Insert unique value failed.";
 235   {
 236     SimpleTestGetHandle get_handle(thr, cht);




 196   SimpleTestTable* cht = new SimpleTestTable();
 197   cht_getinsert_bulkdelete_insert_verified(thr, cht, val1, false, true);
 198   cht_getinsert_bulkdelete_insert_verified(thr, cht, val2, false, true);
 199   cht_getinsert_bulkdelete_insert_verified(thr, cht, val3, false, true);
 200 
 201   EXPECT_TRUE(cht->remove(thr, stl2)) << "Remove did not find value.";
 202 
 203   cht_getinsert_bulkdelete_insert_verified(thr, cht, val1, true, false); // val1 should be present
 204   cht_getinsert_bulkdelete_insert_verified(thr, cht, val2, false, true); // val2 should be inserted
 205   cht_getinsert_bulkdelete_insert_verified(thr, cht, val3, true, false); // val3 should be present
 206 
 207   EXPECT_EQ(cht->get_copy(thr, stl1), val1) << "Get did not find value.";
 208   EXPECT_EQ(cht->get_copy(thr, stl2), val2) << "Get did not find value.";
 209   EXPECT_EQ(cht->get_copy(thr, stl3), val3) << "Get did not find value.";
 210 
 211   // Removes all odd values.
 212   SimpleTestTable::BulkDeleteTask bdt(cht);
 213   if (bdt.prepare(thr)) {
 214     while(bdt.do_task(thr, getinsert_bulkdelete_eval, getinsert_bulkdelete_del)) {
 215       bdt.pause(thr);
 216       bdt.cont(thr);
 217     }
 218     bdt.done(thr);
 219   }
 220 
 221   EXPECT_EQ(cht->get_copy(thr, stl1), (uintptr_t)0) << "Odd value should not exist.";
 222   EXPECT_FALSE(cht->remove(thr, stl1)) << "Odd value should not exist.";
 223   EXPECT_EQ(cht->get_copy(thr, stl2), val2) << "Even value should not have been removed.";
 224   EXPECT_EQ(cht->get_copy(thr, stl3), (uintptr_t)0) << "Add value should not exists.";
 225   EXPECT_FALSE(cht->remove(thr, stl3)) << "Odd value should not exists.";
 226 
 227   delete cht;
 228 }
 229 
 230 static void cht_scope(Thread* thr) {
 231   uintptr_t val = 0x2;
 232   SimpleTestLookup stl(val);
 233   SimpleTestTable* cht = new SimpleTestTable();
 234   EXPECT_TRUE(cht->insert(thr, stl, val)) << "Insert unique value failed.";
 235   {
 236     SimpleTestGetHandle get_handle(thr, cht);


< prev index next >