mirror of
https://github.com/openjdk/jdk19u.git
synced 2025-12-11 09:24:36 -06:00
8286496: Improve Thread labels
Backport-of: e733e55de88e63e129f15edefc602c050339b38a
This commit is contained in:
parent
12b22ec367
commit
6e41863f8f
@ -119,7 +119,9 @@ bool JfrCheckpointManager::initialize() {
|
||||
|
||||
#ifdef ASSERT
|
||||
static void assert_lease(const BufferPtr buffer) {
|
||||
assert(buffer != NULL, "invariant");
|
||||
if (buffer == nullptr) {
|
||||
return;
|
||||
}
|
||||
assert(buffer->acquired_by_self(), "invariant");
|
||||
assert(buffer->lease(), "invariant");
|
||||
}
|
||||
@ -243,8 +245,9 @@ BufferPtr JfrCheckpointManager::flush(BufferPtr old, size_t used, size_t request
|
||||
return NULL;
|
||||
}
|
||||
BufferPtr new_buffer = lease(old, thread, used + requested);
|
||||
assert(new_buffer != NULL, "invariant");
|
||||
migrate_outstanding_writes(old, new_buffer, used, requested);
|
||||
if (new_buffer != nullptr) {
|
||||
migrate_outstanding_writes(old, new_buffer, used, requested);
|
||||
}
|
||||
retire(old);
|
||||
return new_buffer;
|
||||
}
|
||||
|
||||
@ -35,13 +35,15 @@ JfrBuffer::JfrBuffer() : _next(NULL),
|
||||
_size(0),
|
||||
_header_size(0),
|
||||
_flags(0),
|
||||
_context(0) {}
|
||||
_context(0)
|
||||
LP64_ONLY(COMMA _pad(0)) {}
|
||||
|
||||
bool JfrBuffer::initialize(size_t header_size, size_t size) {
|
||||
assert(_next == NULL, "invariant");
|
||||
assert(_identity == NULL, "invariant");
|
||||
_header_size = (u2)header_size;
|
||||
_size = (u4)(size / BytesPerWord);
|
||||
assert(header_size <= max_jushort, "invariant");
|
||||
_header_size = static_cast<u2>(header_size);
|
||||
_size = size;
|
||||
set_pos(start());
|
||||
set_top(start());
|
||||
assert(free_size() == size, "invariant");
|
||||
|
||||
@ -70,10 +70,11 @@ class JfrBuffer {
|
||||
const void* _identity;
|
||||
u1* _pos;
|
||||
mutable const u1* _top;
|
||||
u4 _size;
|
||||
size_t _size;
|
||||
u2 _header_size;
|
||||
u1 _flags;
|
||||
u1 _context;
|
||||
LP64_ONLY(const u4 _pad;)
|
||||
|
||||
const u1* stable_top() const;
|
||||
|
||||
@ -125,7 +126,7 @@ class JfrBuffer {
|
||||
void release_critical_section_top(const u1* new_top);
|
||||
|
||||
size_t size() const {
|
||||
return _size * BytesPerWord;
|
||||
return _size;
|
||||
}
|
||||
|
||||
size_t total_size() const {
|
||||
|
||||
@ -202,16 +202,24 @@ inline bool JfrMemorySpace< Client, RetrievalPolicy, FreeListType, FullListType,
|
||||
|
||||
// allocations are even multiples of the mspace min size
|
||||
static inline size_t align_allocation_size(size_t requested_size, size_t min_element_size) {
|
||||
if (requested_size > static_cast<size_t>(min_intx)) {
|
||||
assert(false, "requested size: " SIZE_FORMAT " is too large", requested_size);
|
||||
return 0;
|
||||
}
|
||||
u8 alloc_size_bytes = min_element_size;
|
||||
while (requested_size > alloc_size_bytes) {
|
||||
alloc_size_bytes <<= 1;
|
||||
}
|
||||
return (size_t)alloc_size_bytes;
|
||||
assert(alloc_size_bytes <= static_cast<size_t>(min_intx), "invariant");
|
||||
return static_cast<size_t>(alloc_size_bytes);
|
||||
}
|
||||
|
||||
template <typename Client, template <typename> class RetrievalPolicy, typename FreeListType, typename FullListType, bool epoch_aware>
|
||||
inline typename FreeListType::NodePtr JfrMemorySpace<Client, RetrievalPolicy, FreeListType, FullListType, epoch_aware>::allocate(size_t size) {
|
||||
const size_t aligned_size_bytes = align_allocation_size(size, _min_element_size);
|
||||
if (aligned_size_bytes == 0) {
|
||||
return NULL;
|
||||
}
|
||||
void* const allocation = JfrCHeapObj::new_array<u1>(aligned_size_bytes + sizeof(Node));
|
||||
if (allocation == NULL) {
|
||||
return NULL;
|
||||
|
||||
@ -73,6 +73,7 @@ template <typename T>
|
||||
inline void WriterHost<BE, IE, WriterPolicyImpl>::write(const T* value, size_t len) {
|
||||
assert(value != NULL, "invariant");
|
||||
assert(len > 0, "invariant");
|
||||
assert(len <= max_jint, "invariant");
|
||||
// Might need T + 1 size
|
||||
u1* const pos = ensure_size(sizeof(T) * len + len);
|
||||
if (pos) {
|
||||
@ -125,8 +126,9 @@ template <typename T>
|
||||
inline void WriterHost<BE, IE, WriterPolicyImpl>::be_write(const T* value, size_t len) {
|
||||
assert(value != NULL, "invariant");
|
||||
assert(len > 0, "invariant");
|
||||
// Might need T + 1 size
|
||||
u1* const pos = ensure_size(sizeof(T) * len + len);
|
||||
assert(len <= max_jint, "invariant");
|
||||
// Big endian writes map one-to-one for length, so no extra space is needed.
|
||||
u1* const pos = ensure_size(sizeof(T) * len);
|
||||
if (pos) {
|
||||
this->set_current_pos(BE::be_write(value, len, pos));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user