< prev index next >

src/share/vm/jfr/recorder/checkpoint/jfrCheckpointManager.cpp

Print this page
rev 9053 : 8220293: Deadlock in JFR string pool
Reviewed-by: rehn, egahlin
   1 /*
   2  * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 118 }
 119 
 120 void JfrCheckpointManager::synchronize_epoch() {
 121   assert(_checkpoint_epoch_state != JfrTraceIdEpoch::current(), "invariant");
 122   OrderAccess::storestore();
 123   _checkpoint_epoch_state = JfrTraceIdEpoch::current();
 124 }
 125 
 126 void JfrCheckpointManager::shift_epoch() {
 127   debug_only(const u1 current_epoch = JfrTraceIdEpoch::current();)
 128   JfrTraceIdEpoch::shift_epoch();
 129   assert(current_epoch != JfrTraceIdEpoch::current(), "invariant");
 130 }
 131 
 132 void JfrCheckpointManager::register_service_thread(const Thread* thread) {
 133   _service_thread = thread;
 134 }
 135 
 136 void JfrCheckpointManager::register_full(BufferPtr t, Thread* thread) {
 137   // nothing here at the moment


 138   assert(t->retired(), "invariant");
 139 }
 140 
 141 void JfrCheckpointManager::lock() {
 142   assert(!_lock->owned_by_self(), "invariant");
 143   _lock->lock_without_safepoint_check();
 144 }
 145 
 146 void JfrCheckpointManager::unlock() {
 147   _lock->unlock();
 148 }
 149 
 150 #ifdef ASSERT
 151 
 152 bool JfrCheckpointManager::is_locked() const {
 153   return _lock->owned_by_self();
 154 }
 155 
 156 static void assert_free_lease(const BufferPtr buffer) {
 157   assert(buffer != NULL, "invariant");


   1 /*
   2  * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 118 }
 119 
 120 void JfrCheckpointManager::synchronize_epoch() {
 121   assert(_checkpoint_epoch_state != JfrTraceIdEpoch::current(), "invariant");
 122   OrderAccess::storestore();
 123   _checkpoint_epoch_state = JfrTraceIdEpoch::current();
 124 }
 125 
 126 void JfrCheckpointManager::shift_epoch() {
 127   debug_only(const u1 current_epoch = JfrTraceIdEpoch::current();)
 128   JfrTraceIdEpoch::shift_epoch();
 129   assert(current_epoch != JfrTraceIdEpoch::current(), "invariant");
 130 }
 131 
 132 void JfrCheckpointManager::register_service_thread(const Thread* thread) {
 133   _service_thread = thread;
 134 }
 135 
 136 void JfrCheckpointManager::register_full(BufferPtr t, Thread* thread) {
 137   // nothing here at the moment
 138   assert(t != NULL, "invariant");
 139   assert(t->acquired_by(thread), "invariant");
 140   assert(t->retired(), "invariant");
 141 }
 142 
 143 void JfrCheckpointManager::lock() {
 144   assert(!_lock->owned_by_self(), "invariant");
 145   _lock->lock_without_safepoint_check();
 146 }
 147 
 148 void JfrCheckpointManager::unlock() {
 149   _lock->unlock();
 150 }
 151 
 152 #ifdef ASSERT
 153 
 154 bool JfrCheckpointManager::is_locked() const {
 155   return _lock->owned_by_self();
 156 }
 157 
 158 static void assert_free_lease(const BufferPtr buffer) {
 159   assert(buffer != NULL, "invariant");


< prev index next >