Skip to content
Permalink
Browse files

Automatic merge of jdk:master into master

  • Loading branch information
duke
duke committed Jun 8, 2020
2 parents fa14236 + a748779 commit 8911e4487789a70179b62ede10a63b53811d99fe
@@ -27,6 +27,7 @@

#include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.hpp"
#include "jfr/recorder/storage/jfrMemorySpace.hpp"
#include "runtime/atomic.hpp"
#include "runtime/os.hpp"

template <typename Client, template <typename> class RetrievalPolicy, typename FreeListType, typename FullListType, bool epoch_aware>
@@ -40,7 +40,6 @@
#include "jfr/utilities/jfrTime.hpp"
#include "jfr/writers/jfrNativeEventWriter.hpp"
#include "logging/log.hpp"
#include "runtime/atomic.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/os.inline.hpp"
#include "runtime/safepoint.hpp"
@@ -108,6 +108,7 @@ class JfrVersionSystem : public JfrCHeapObj {
};
PaddedTip _tip;
NodePtr _head;
volatile int _spinlock;

NodePtr acquire();
void release(NodePtr node);
@@ -25,9 +25,11 @@
#ifndef SHARE_JFR_UTILITIES_JFRVERSIONSYSTEM_INLINE_HPP
#define SHARE_JFR_UTILITIES_JFRVERSIONSYSTEM_INLINE_HPP

#include "jfr/utilities/jfrSpinlockHelper.hpp"
#include "jfr/utilities/jfrVersionSystem.hpp"
#include "runtime/atomic.hpp"
#include "runtime/os.inline.hpp"
#include "runtime/vm_version.hpp"

inline JfrVersionSystem::Node::Node() : _next(NULL), _version(0), _live(true) {}

@@ -39,7 +41,7 @@ inline void JfrVersionSystem::Node::set(traceid version) {
Atomic::release_store_fence(&_version, version);
}

inline JfrVersionSystem::JfrVersionSystem() : _tip(), _head(NULL) {
inline JfrVersionSystem::JfrVersionSystem() : _tip(), _head(NULL), _spinlock(0) {
_tip._value = 1;
}

@@ -63,7 +65,17 @@ inline JfrVersionSystem::Type JfrVersionSystem::tip() const {
}

inline JfrVersionSystem::Type JfrVersionSystem::increment() {
return Atomic::add(&_tip._value, (traceid)1);
if (!VM_Version::supports_cx8()) {
JfrSpinlockHelper lock(&_spinlock);
return ++_tip._value;
}
traceid cmp;
traceid xchg;
do {
cmp = _tip._value;
xchg = cmp + 1;
} while (Atomic::cmpxchg(&_tip._value, cmp, xchg) != cmp);
return xchg;
}

inline JfrVersionSystem::NodePtr JfrVersionSystem::acquire() {

0 comments on commit 8911e44

Please sign in to comment.
You can’t perform that action at this time.