fix metachunk gtest stuefe-new-metaspace-branch
authorstuefe
Fri, 27 Sep 2019 19:03:34 +0200
branchstuefe-new-metaspace-branch
changeset 58383 04d2c850ab4f
parent 58382 2e16658b7776
child 58475 e3aa9f95b85e
fix metachunk gtest
test/hotspot/gtest/metaspace/test_metachunk.cpp
--- a/test/hotspot/gtest/metaspace/test_metachunk.cpp	Fri Sep 27 19:03:13 2019 +0200
+++ b/test/hotspot/gtest/metaspace/test_metachunk.cpp	Fri Sep 27 19:03:34 2019 +0200
@@ -24,7 +24,7 @@
 
 #include "precompiled.hpp"
 #include "metaspace/metaspaceTestsCommon.hpp"
-
+#include "runtime/mutexLocker.hpp"
 
 
 class MetachunkTest {
@@ -56,8 +56,12 @@
 
     if (c->next() != NULL) EXPECT_EQ(c->next()->prev(), c);
     if (c->prev() != NULL) EXPECT_EQ(c->prev()->next(), c);
-    if (c->next_in_vs() != NULL) EXPECT_EQ(c->next_in_vs()->prev_in_vs(), c);
-    if (c->prev_in_vs() != NULL) EXPECT_EQ(c->prev_in_vs()->next_in_vs(), c);
+
+    {
+      MutexLocker fcl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
+      if (c->next_in_vs() != NULL) EXPECT_EQ(c->next_in_vs()->prev_in_vs(), c);
+      if (c->prev_in_vs() != NULL) EXPECT_EQ(c->prev_in_vs()->next_in_vs(), c);
+    }
 
     DEBUG_ONLY(c->verify(true);)
   }