src/hotspot/share/jfr/recorder/storage/jfrMemorySpace.inline.hpp
branchJEP-349-branch
changeset 57360 5d043a159d5c
parent 53244 9807daeb47c4
child 57870 00860d9caf4d
--- a/src/hotspot/share/jfr/recorder/storage/jfrMemorySpace.inline.hpp	Fri May 17 15:53:21 2019 +0200
+++ b/src/hotspot/share/jfr/recorder/storage/jfrMemorySpace.inline.hpp	Fri May 17 16:02:27 2019 +0200
@@ -104,6 +104,7 @@
   }
   assert(t->empty(), "invariant");
   assert(!t->retired(), "invariant");
+  assert(!t->excluded(), "invariant");
   assert(t->identity() == NULL, "invariant");
   if (!should_populate_cache()) {
     remove_free(t);
@@ -346,19 +347,19 @@
 template <typename Mspace>
 inline bool ReleaseOp<Mspace>::process(typename Mspace::Type* t) {
   assert(t != NULL, "invariant");
-  if (t->retired() || t->try_acquire(_thread)) {
-    if (t->transient()) {
-      if (_release_full) {
-        mspace_release_full_critical(t, _mspace);
-      } else {
-        mspace_release_free_critical(t, _mspace);
-      }
-      return true;
+  // assumes some means of exclusive access to t
+  if (t->transient()) {
+    if (_release_full) {
+      mspace_release_full_critical(t, _mspace);
+    } else {
+      mspace_release_free_critical(t, _mspace);
     }
-    t->reinitialize();
-    assert(t->empty(), "invariant");
-    t->release(); // publish
+    return true;
   }
+  t->reinitialize();
+  assert(t->empty(), "invariant");
+  assert(!t->retired(), "invariant");
+  t->release(); // publish
   return true;
 }