< prev index next >

src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.cpp

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 2016, 2020, 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.

@@ -24,10 +24,11 @@
  
  #include "precompiled.hpp"
  #include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.hpp"
  #include "runtime/safepoint.hpp"
  
+ u2 JfrTraceIdEpoch::_generation = 0;
  JfrSignal JfrTraceIdEpoch::_tag_state;
  bool JfrTraceIdEpoch::_epoch_state = false;
  bool JfrTraceIdEpoch::_synchronizing = false;
  
  void JfrTraceIdEpoch::begin_epoch_shift() {

@@ -38,9 +39,14 @@
  
  void JfrTraceIdEpoch::end_epoch_shift() {
    assert(SafepointSynchronize::is_at_safepoint(), "invariant");
    assert(_synchronizing, "invariant");
    _epoch_state = !_epoch_state;
+   ++_generation;
+   if (0 == _generation) {
+     ++_generation;
+   }
+   assert(_generation != 0, "invariant");
    OrderAccess::storestore();
    _synchronizing = false;
  }
  
< prev index next >