Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GR-60079] JFR leak profiler span fixes #10154

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2023, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2023, Red Hat Inc. All rights reserved.
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2024, Red Hat Inc. 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
Expand Down Expand Up @@ -61,9 +61,9 @@ public final class JfrOldObject implements UninterruptibleComparable, Uninterrup

@SuppressWarnings("hiding")
@Uninterruptible(reason = CALLED_FROM_UNINTERRUPTIBLE_CODE, mayBeInlined = true)
void initialize(Object obj, UnsignedWord allocatedSize, long threadId, long stackTraceId, UnsignedWord heapUsedAfterLastGC, int arrayLength) {
void initialize(Object obj, UnsignedWord span, UnsignedWord allocatedSize, long threadId, long stackTraceId, UnsignedWord heapUsedAfterLastGC, int arrayLength) {
ReferenceInternals.setReferent(reference, obj);
this.span = allocatedSize;
this.span = span;
this.objectSize = allocatedSize;
this.allocationTicks = JfrTicks.elapsedTicks();
this.threadId = threadId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2023, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2023, Red Hat Inc. All rights reserved.
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2024, Red Hat Inc. 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
Expand Down Expand Up @@ -89,7 +89,7 @@ boolean sample(Object obj, UnsignedWord allocatedSize, int arrayLength) {
}
}

store(obj, allocatedSize, arrayLength);
store(obj, span, allocatedSize, arrayLength);
return true;
}

Expand Down Expand Up @@ -142,17 +142,17 @@ private void release(JfrOldObject sample) {
}

@Uninterruptible(reason = CALLED_FROM_UNINTERRUPTIBLE_CODE, mayBeInlined = true)
private void store(Object obj, UnsignedWord allocatedSize, int arrayLength) {
private void store(Object obj, UnsignedWord span, UnsignedWord allocatedSize, int arrayLength) {
Thread thread = JavaThreads.getCurrentThreadOrNull();
long threadId = thread == null ? 0L : JavaThreads.getThreadId(thread);
long stackTraceId = thread == null ? 0L : SubstrateJVM.get().getStackTraceId(JfrEvent.OldObjectSample, 0);
UnsignedWord heapUsedAfterLastGC = Heap.getHeap().getUsedMemoryAfterLastGC();

JfrOldObject sample = (JfrOldObject) freeList.pop();
sample.initialize(obj, allocatedSize, threadId, stackTraceId, heapUsedAfterLastGC, arrayLength);
sample.initialize(obj, span, allocatedSize, threadId, stackTraceId, heapUsedAfterLastGC, arrayLength);
queue.add(sample);
usedList.append(sample);
totalInQueue.add(allocatedSize);
totalInQueue = totalInQueue.add(span);
}

@Uninterruptible(reason = CALLED_FROM_UNINTERRUPTIBLE_CODE, mayBeInlined = true)
Expand Down