--- a/src/hotspot/share/jfr/recorder/storage/jfrBuffer.cpp Fri May 17 15:53:21 2019 +0200
+++ b/src/hotspot/share/jfr/recorder/storage/jfrBuffer.cpp Fri May 17 16:02:27 2019 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, 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
@@ -54,10 +54,18 @@
return true;
}
-void JfrBuffer::reinitialize() {
+void JfrBuffer::reinitialize(bool exclusion /* false */) {
assert(!lease(), "invariant");
assert(!transient(), "invariant");
set_pos(start());
+ if (exclusion != excluded()) {
+ // update
+ if (exclusion) {
+ set_excluded();
+ } else {
+ clear_excluded();
+ }
+ }
clear_retired();
set_top(start());
}
@@ -136,6 +144,14 @@
_identity = NULL;
}
+bool JfrBuffer::acquired_by(const void* id) const {
+ return identity() == id;
+}
+
+bool JfrBuffer::acquired_by_self() const {
+ return acquired_by(Thread::current());
+}
+
#ifdef ASSERT
static bool validate_to(const JfrBuffer* const to, size_t size) {
assert(to != NULL, "invariant");
@@ -153,10 +169,6 @@
assert(t->top() + size <= t->pos(), "invariant");
return true;
}
-
-bool JfrBuffer::acquired_by_self() const {
- return identity() == Thread::current();
-}
#endif // ASSERT
void JfrBuffer::move(JfrBuffer* const to, size_t size) {
@@ -183,11 +195,11 @@
set_concurrent_top(start());
}
-// flags
enum FLAG {
RETIRED = 1,
TRANSIENT = 2,
- LEASE = 4
+ LEASE = 4,
+ EXCLUDED = 8
};
bool JfrBuffer::transient() const {
@@ -222,6 +234,22 @@
assert(!lease(), "invariant");
}
+bool JfrBuffer::excluded() const {
+ return (u1)EXCLUDED == (_flags & (u1)EXCLUDED);
+}
+
+void JfrBuffer::set_excluded() {
+ _flags |= (u1)EXCLUDED;
+ assert(excluded(), "invariant");
+}
+
+void JfrBuffer::clear_excluded() {
+ if (excluded()) {
+ _flags ^= (u1)EXCLUDED;
+ }
+ assert(!excluded(), "invariant");
+}
+
static u2 load_acquire_flags(const u2* const flags) {
return OrderAccess::load_acquire(flags);
}