src/hotspot/share/jfr/recorder/storage/jfrStorage.cpp
changeset 54623 1126f0607c70
parent 50429 83aec1d357d4
child 54964 ec7d6d8effc7
child 57360 5d043a159d5c
equal deleted inserted replaced
54622:a8dcacf95bff 54623:1126f0607c70
     1 /*
     1 /*
     2  * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   319 
   319 
   320 static bool full_buffer_registration(BufferPtr buffer, JfrStorageAgeMspace* age_mspace, JfrStorageControl& control, Thread* thread) {
   320 static bool full_buffer_registration(BufferPtr buffer, JfrStorageAgeMspace* age_mspace, JfrStorageControl& control, Thread* thread) {
   321   assert(buffer != NULL, "invariant");
   321   assert(buffer != NULL, "invariant");
   322   assert(buffer->retired(), "invariant");
   322   assert(buffer->retired(), "invariant");
   323   assert(age_mspace != NULL, "invariant");
   323   assert(age_mspace != NULL, "invariant");
   324   MutexLockerEx lock(JfrBuffer_lock, Mutex::_no_safepoint_check_flag);
   324   MutexLocker lock(JfrBuffer_lock, Mutex::_no_safepoint_check_flag);
   325   JfrAgeNode* age_node = get_free_age_node(age_mspace, thread);
   325   JfrAgeNode* age_node = get_free_age_node(age_mspace, thread);
   326   if (age_node == NULL) {
   326   if (age_node == NULL) {
   327     age_node = new_age_node(buffer, age_mspace, thread);
   327     age_node = new_age_node(buffer, age_mspace, thread);
   328     if (age_node == NULL) {
   328     if (age_node == NULL) {
   329       return false;
   329       return false;
   621 static void insert_free_age_nodes(JfrStorageAgeMspace* age_mspace, JfrAgeNode* head, JfrAgeNode* tail, size_t count) {
   621 static void insert_free_age_nodes(JfrStorageAgeMspace* age_mspace, JfrAgeNode* head, JfrAgeNode* tail, size_t count) {
   622   if (tail != NULL) {
   622   if (tail != NULL) {
   623     assert(tail->next() == NULL, "invariant");
   623     assert(tail->next() == NULL, "invariant");
   624     assert(head != NULL, "invariant");
   624     assert(head != NULL, "invariant");
   625     assert(head->prev() == NULL, "invariant");
   625     assert(head->prev() == NULL, "invariant");
   626     MutexLockerEx buffer_lock(JfrBuffer_lock, Mutex::_no_safepoint_check_flag);
   626     MutexLocker buffer_lock(JfrBuffer_lock, Mutex::_no_safepoint_check_flag);
   627     age_mspace->insert_free_tail(head, tail, count);
   627     age_mspace->insert_free_tail(head, tail, count);
   628   }
   628   }
   629 }
   629 }
   630 
   630 
   631 template <typename Processor>
   631 template <typename Processor>
   672   }
   672   }
   673   size_t count;
   673   size_t count;
   674   JfrAgeNode* head;
   674   JfrAgeNode* head;
   675   {
   675   {
   676     // fetch age list
   676     // fetch age list
   677     MutexLockerEx buffer_lock(JfrBuffer_lock, Mutex::_no_safepoint_check_flag);
   677     MutexLocker buffer_lock(JfrBuffer_lock, Mutex::_no_safepoint_check_flag);
   678     count = age_mspace->full_count();
   678     count = age_mspace->full_count();
   679     head = age_mspace->clear_full();
   679     head = age_mspace->clear_full();
   680     control.reset_full();
   680     control.reset_full();
   681   }
   681   }
   682   assert(head != NULL, "invariant");
   682   assert(head != NULL, "invariant");