src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp
branchJEP-349-branch
changeset 57987 23e3cd901cb6
parent 57983 a57907813a83
child 58049 10ecdb5d3574
--- a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp	Mon Sep 02 21:08:41 2019 +0200
+++ b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp	Tue Sep 03 11:48:31 2019 +0200
@@ -194,11 +194,11 @@
 }
 
 /*
-* If the buffer was a "lease", release back.
-*
-* The buffer is effectively invalidated for the thread post-return,
-* and the caller should take means to ensure that it is not referenced.
-*/
+ * If the buffer was a lease, release back.
+ *
+ * The buffer is effectively invalidated for the thread post-return,
+ * and the caller should take means to ensure that it is not referenced.
+ */
 static void release(BufferPtr const buffer, Thread* thread) {
   DEBUG_ONLY(assert_release(buffer);)
   buffer->clear_lease();
@@ -335,20 +335,6 @@
   _checkpoint_epoch_state = JfrTraceIdEpoch::epoch();
 }
 
-void JfrCheckpointManager::shift_epoch() {
-  debug_only(const u1 current_epoch = JfrTraceIdEpoch::current();)
-  JfrTraceIdEpoch::shift_epoch();
-  assert(current_epoch != JfrTraceIdEpoch::current(), "invariant");
-}
-
-typedef DiscardOp<DefaultDiscarder<JfrBuffer> > DiscardOperation;
-size_t JfrCheckpointManager::clear() {
-  DiscardOperation discarder(mutexed); // mutexed discard mode
-  process_free_list(discarder, _free_list_mspace);
-  process_free_list(discarder, _epoch_transition_mspace);
-  synchronize_epoch();
-  return discarder.elements();
-}
 
 size_t JfrCheckpointManager::write() {
   const size_t processed = write_mspace<MutexedWriteOp, CompositeOperation>(_free_list_mspace, _chunkwriter);
@@ -356,6 +342,10 @@
   return processed;
 }
 
+size_t JfrCheckpointManager::write_epoch_transition_mspace() {
+  return write_mspace<ExclusiveOp, CompositeOperation>(_epoch_transition_mspace, _chunkwriter);
+}
+
 typedef MutexedWriteOp<WriteOperation> FlushOperation;
 
 size_t JfrCheckpointManager::flush() {
@@ -366,6 +356,15 @@
   return wo.processed();
 }
 
+typedef DiscardOp<DefaultDiscarder<JfrBuffer> > DiscardOperation;
+size_t JfrCheckpointManager::clear() {
+  DiscardOperation discarder(mutexed); // mutexed discard mode
+  process_free_list(discarder, _free_list_mspace);
+  process_free_list(discarder, _epoch_transition_mspace);
+  synchronize_epoch();
+  return discarder.elements();
+}
+
 // Optimization for write_types() and write_threads() is to write
 // directly into the epoch transition mspace because we will immediately
 // serialize and reset this mspace post-write.
@@ -396,11 +395,6 @@
   JfrTypeManager::write_threads(writer);
   return writer.used_size();
 }
-
-size_t JfrCheckpointManager::write_epoch_transition_mspace() {
-  return write_mspace<ExclusiveOp, CompositeOperation>(_epoch_transition_mspace, _chunkwriter);
-}
-
 size_t JfrCheckpointManager::write_constants() {
   write_types();
   write_threads();
@@ -464,3 +458,10 @@
 void JfrCheckpointManager::write_thread_checkpoint(Thread* t) {
   JfrTypeManager::write_thread_checkpoint(t);
 }
+
+void JfrCheckpointManager::shift_epoch() {
+  debug_only(const u1 current_epoch = JfrTraceIdEpoch::current();)
+  JfrTraceIdEpoch::shift_epoch();
+  assert(current_epoch != JfrTraceIdEpoch::current(), "invariant");
+}
+