8352256: ObjectSynchronizer::quick_notify misses JFR event notification path

Reviewed-by: dholmes, coleenp, mgronlun
This commit is contained in:
Aleksey Shipilev 2025-04-08 08:12:59 +00:00
parent 9844c1c52b
commit ea07e719ca
3 changed files with 17 additions and 7 deletions

View File

@ -2058,6 +2058,12 @@ void ObjectMonitor::notify(TRAPS) {
return;
}
quick_notify(current);
}
void ObjectMonitor::quick_notify(JavaThread* current) {
assert(has_owner(current), "Precondition");
EventJavaMonitorNotify event;
DTRACE_MONITOR_PROBE(notify, this, object(), current);
int tally = notify_internal(current) ? 1 : 0;
@ -2080,6 +2086,12 @@ void ObjectMonitor::notifyAll(TRAPS) {
return;
}
quick_notifyAll(current);
}
void ObjectMonitor::quick_notifyAll(JavaThread* current) {
assert(has_owner(current), "Precondition");
EventJavaMonitorNotify event;
DTRACE_MONITOR_PROBE(notifyAll, this, object(), current);
int tally = 0;

View File

@ -385,6 +385,8 @@ class ObjectMonitor : public CHeapObj<mtObjectMonitor> {
void wait(jlong millis, bool interruptible, TRAPS);
void notify(TRAPS);
void notifyAll(TRAPS);
void quick_notify(JavaThread* current);
void quick_notifyAll(JavaThread* current);
void print() const;
#ifdef ASSERT

View File

@ -368,16 +368,12 @@ bool ObjectSynchronizer::quick_notify(oopDesc* obj, JavaThread* current, bool al
if (mon->first_waiter() != nullptr) {
// We have one or more waiters. Since this is an inflated monitor
// that we own, we can transfer one or more threads from the waitset
// to the entry_list here and now, avoiding the slow-path.
// that we own, we quickly notify them here and now, avoiding the slow-path.
if (all) {
DTRACE_MONITOR_PROBE(notifyAll, mon, obj, current);
mon->quick_notifyAll(current);
} else {
DTRACE_MONITOR_PROBE(notify, mon, obj, current);
mon->quick_notify(current);
}
do {
mon->notify_internal(current);
} while (mon->first_waiter() != nullptr && all);
}
return true;
}