< prev index next >

src/share/vm/jfr/recorder/storage/jfrBuffer.cpp

Print this page
rev 9053 : 8220293: Deadlock in JFR string pool
Reviewed-by: rehn, egahlin

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -135,10 +135,18 @@
 
 void JfrBuffer::clear_identity() {
   _identity = NULL;
 }
 
+bool JfrBuffer::acquired_by(const void* id) const {
+  return identity() == id;
+}
+
+bool JfrBuffer::acquired_by_self() const {
+  return acquired_by(Thread::current());
+}
+
 #ifdef ASSERT
 static bool validate_to(const JfrBuffer* const to, size_t size) {
   assert(to != NULL, "invariant");
   if (!JfrRecorder::is_shutting_down()) assert(to->acquired_by_self(), "invariant");
   assert(to->free_size() >= size, "invariant");

@@ -152,14 +160,10 @@
 
 static bool validate_this(const JfrBuffer* const t, size_t size) {
   assert(t->top() + size <= t->pos(), "invariant");
   return true;
 }
-
-bool JfrBuffer::acquired_by_self() const {
-  return identity() == Thread::current();
-}
 #endif // ASSERT
 
 void JfrBuffer::move(JfrBuffer* const to, size_t size) {
   assert(validate_to(to, size), "invariant");
   assert(validate_this(this, size), "invariant");

@@ -182,11 +186,10 @@
   set_pos(start());
   to->release();
   set_concurrent_top(start());
 }
 
-// flags
 enum FLAG {
   RETIRED = 1,
   TRANSIENT = 2,
   LEASE = 4
 };
< prev index next >