8379917: JFR: Method timing event can have incorrect minimum value

Reviewed-by: mgronlun
This commit is contained in:
Erik Gahlin 2026-03-13 13:29:11 +00:00
parent 1ea8ef92bc
commit 28830e2155

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2025, 2026, 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
@ -46,10 +46,10 @@ record TimedMethod(AtomicLong invocations, AtomicLong time, AtomicLong minimum,
while (true) {
long max = maximum.get();
if (duration <= max) {
return;
break;
}
if (maximum.weakCompareAndSetVolatile(max, duration)) {
return;
break;
}
}
}