equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. |
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. |
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. |
23 */ |
23 */ |
24 |
24 |
25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
26 #include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.hpp" |
26 #include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.hpp" |
27 #include "runtime/safepoint.hpp" |
27 #include "runtime/safepoint.hpp" |
28 #include "runtime/orderAccess.hpp" |
|
29 |
28 |
30 // Alternating epochs on each rotation allow for concurrent tagging. |
29 // Alternating epochs on each rotation allow for concurrent tagging. |
31 // The regular epoch shift happens only during a safepoint. |
30 // The epoch shift happens only during a safepoint. |
32 // The fence is there only for the emergency dump case which happens outside of safepoint. |
|
33 bool JfrTraceIdEpoch::_epoch_state = false; |
31 bool JfrTraceIdEpoch::_epoch_state = false; |
|
32 bool volatile JfrTraceIdEpoch::_tag_state = false; |
|
33 |
34 void JfrTraceIdEpoch::shift_epoch() { |
34 void JfrTraceIdEpoch::shift_epoch() { |
|
35 assert(SafepointSynchronize::is_at_safepoint(), "invariant"); |
35 _epoch_state = !_epoch_state; |
36 _epoch_state = !_epoch_state; |
36 if (!SafepointSynchronize::is_at_safepoint()) { |
|
37 OrderAccess::fence(); |
|
38 } |
|
39 } |
37 } |