Skip to content

Commit

Permalink
review: nit: move curly bracket down
Browse files Browse the repository at this point in the history
  • Loading branch information
sspitsyn committed Jan 15, 2025
1 parent 7312011 commit 9611d02
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions src/hotspot/share/runtime/objectMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,45 +492,45 @@ void ObjectMonitor::enter_with_contention_mark(JavaThread *current, ObjectMonito

freeze_result result;

{
assert(current->current_pending_monitor() == nullptr, "invariant");
current->set_current_pending_monitor(this);

DTRACE_MONITOR_PROBE(contended__enter, this, object(), current);
if (JvmtiExport::should_post_monitor_contended_enter()) {
JvmtiExport::post_monitor_contended_enter(current, this);

// The current thread does not yet own the monitor and does not
// yet appear on any queues that would get it made the successor.
// This means that the JVMTI_EVENT_MONITOR_CONTENDED_ENTER event
// handler cannot accidentally consume an unpark() meant for the
// ParkEvent associated with this ObjectMonitor.
}
assert(current->current_pending_monitor() == nullptr, "invariant");
current->set_current_pending_monitor(this);

ContinuationEntry* ce = current->last_continuation();
if (ce != nullptr && ce->is_virtual_thread()) {
result = Continuation::try_preempt(current, ce->cont_oop(current));
if (result == freeze_ok) {
bool acquired = VThreadMonitorEnter(current);
if (acquired) {
// We actually acquired the monitor while trying to add the vthread to the
// _cxq so cancel preemption. We will still go through the preempt stub
// but instead of unmounting we will call thaw to continue execution.
current->set_preemption_cancelled(true);
if (JvmtiExport::should_post_monitor_contended_entered()) {
// We are going to call thaw again after this and finish the VMTS
// transition so no need to do it here. We will post the event there.
current->set_contended_entered_monitor(this);
}
DTRACE_MONITOR_PROBE(contended__enter, this, object(), current);
if (JvmtiExport::should_post_monitor_contended_enter()) {
JvmtiExport::post_monitor_contended_enter(current, this);

// The current thread does not yet own the monitor and does not
// yet appear on any queues that would get it made the successor.
// This means that the JVMTI_EVENT_MONITOR_CONTENDED_ENTER event
// handler cannot accidentally consume an unpark() meant for the
// ParkEvent associated with this ObjectMonitor.
}

ContinuationEntry* ce = current->last_continuation();
if (ce != nullptr && ce->is_virtual_thread()) {
result = Continuation::try_preempt(current, ce->cont_oop(current));
if (result == freeze_ok) {
bool acquired = VThreadMonitorEnter(current);
if (acquired) {
// We actually acquired the monitor while trying to add the vthread to the
// _cxq so cancel preemption. We will still go through the preempt stub
// but instead of unmounting we will call thaw to continue execution.
current->set_preemption_cancelled(true);
if (JvmtiExport::should_post_monitor_contended_entered()) {
// We are going to call thaw again after this and finish the VMTS
// transition so no need to do it here. We will post the event there.
current->set_contended_entered_monitor(this);
}
current->set_current_pending_monitor(nullptr);
DEBUG_ONLY(int state = java_lang_VirtualThread::state(current->vthread()));
assert((acquired && current->preemption_cancelled() && state == java_lang_VirtualThread::RUNNING) ||
(!acquired && !current->preemption_cancelled() && state == java_lang_VirtualThread::BLOCKING), "invariant");
return;
}
current->set_current_pending_monitor(nullptr);
DEBUG_ONLY(int state = java_lang_VirtualThread::state(current->vthread()));
assert((acquired && current->preemption_cancelled() && state == java_lang_VirtualThread::RUNNING) ||
(!acquired && !current->preemption_cancelled() && state == java_lang_VirtualThread::BLOCKING), "invariant");
return;
}
}

{
// Change java thread status to indicate blocked on monitor enter.
JavaThreadBlockedOnMonitorEnterState jtbmes(current, this);

Expand Down

0 comments on commit 9611d02

Please sign in to comment.