< prev index next > src/hotspot/share/runtime/lightweightSynchronizer.cpp
Print this page
if (obj->klass()->is_value_based()) {
ObjectSynchronizer::handle_sync_on_value_based_class(obj, locking_thread);
}
- locking_thread->inc_held_monitor_count();
-
CacheSetter cache_setter(locking_thread, lock);
LockStack& lock_stack = locking_thread->lock_stack();
ObjectMonitor* monitor = nullptr;
if (obj->klass()->is_value_based()) {
ObjectSynchronizer::handle_sync_on_value_based_class(obj, current);
}
- current->inc_held_monitor_count();
-
CacheSetter cache_setter(current, lock);
// Used when deflation is observed. Progress here requires progress
// from the deflator. After observing that the deflator is not
// making progress (after two yields), switch to sleeping.
#ifndef _LP64
// Only for 32bit which has limited support for fast locking outside the runtime.
if (lock_stack.try_recursive_enter(obj)) {
// Recursive lock successful.
- current->inc_held_monitor_count();
return true;
}
if (mark.is_unlocked()) {
markWord locked_mark = mark.set_fast_locked();
if (obj->cas_set_mark(locked_mark, mark) == mark) {
// Successfully fast-locked, push object to lock-stack and return.
lock_stack.push(obj);
- current->inc_held_monitor_count();
return true;
}
}
#endif
}
if (monitor->try_enter(current)) {
// ObjectMonitor enter successful.
cache_setter.set_monitor(monitor);
- current->inc_held_monitor_count();
return true;
}
}
// Slow-path.
< prev index next >