Skip to content

Commit

Permalink
Automatic merge of jdk:master into master
Browse files Browse the repository at this point in the history
  • Loading branch information
duke committed Jun 8, 2020
2 parents fa14236 + a748779 commit 8911e44
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@


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


template <typename Client, template <typename> class RetrievalPolicy, typename FreeListType, typename FullListType, bool epoch_aware> template <typename Client, template <typename> class RetrievalPolicy, typename FreeListType, typename FullListType, bool epoch_aware>
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/jfr/recorder/storage/jfrStorage.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include "jfr/utilities/jfrTime.hpp" #include "jfr/utilities/jfrTime.hpp"
#include "jfr/writers/jfrNativeEventWriter.hpp" #include "jfr/writers/jfrNativeEventWriter.hpp"
#include "logging/log.hpp" #include "logging/log.hpp"
#include "runtime/atomic.hpp"
#include "runtime/mutexLocker.hpp" #include "runtime/mutexLocker.hpp"
#include "runtime/os.inline.hpp" #include "runtime/os.inline.hpp"
#include "runtime/safepoint.hpp" #include "runtime/safepoint.hpp"
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/jfr/utilities/jfrVersionSystem.hpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class JfrVersionSystem : public JfrCHeapObj {
}; };
PaddedTip _tip; PaddedTip _tip;
NodePtr _head; NodePtr _head;
volatile int _spinlock;


NodePtr acquire(); NodePtr acquire();
void release(NodePtr node); void release(NodePtr node);
Expand Down
16 changes: 14 additions & 2 deletions src/hotspot/share/jfr/utilities/jfrVersionSystem.inline.hpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
#ifndef SHARE_JFR_UTILITIES_JFRVERSIONSYSTEM_INLINE_HPP #ifndef SHARE_JFR_UTILITIES_JFRVERSIONSYSTEM_INLINE_HPP
#define SHARE_JFR_UTILITIES_JFRVERSIONSYSTEM_INLINE_HPP #define SHARE_JFR_UTILITIES_JFRVERSIONSYSTEM_INLINE_HPP


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


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


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


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


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


inline JfrVersionSystem::Type JfrVersionSystem::increment() { 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() { inline JfrVersionSystem::NodePtr JfrVersionSystem::acquire() {
Expand Down

0 comments on commit 8911e44

Please sign in to comment.