fast-path や slow-path 1 が失敗した場合, どの処理パスも最終的には ObjectSynchronizer::slow_enter() または ObjectSynchronizer::fast_enter() に到達する.
この ObjectSynchronizer::slow_enter()/ObjectSynchronizer::fast_enter() の処理は, インタープリタ種別/JIT 種別/CPU 等によらず共通.
なお, 実際の slow-path の処理は ObjectSynchronizer::slow_enter() の方に実装されている. ObjectSynchronizer::fast_enter() は, Biased Locking 機能を使用している場合に条件を変えてもう一度 fast-path 処理を試みるための関数で (See: here for details), 失敗した場合は ObjectSynchronizer::slow_enter() にフォールバックする.
この処理中で使われる ObjectMonitor::TrySpin_VaryDuration() が "Adaptive Spinning" 機能を実装した関数 (See: here for details).
なお, 実際の使用箇所では "TrySpin()" という名称で使用されている.
((cite: hotspot/src/share/vm/runtime/objectMonitor.cpp))
#define TrySpin TrySpin_VaryDuration
-> ObjectSynchronizer::slow_enter()
-> ObjectSynchronizer::inflate()
-> ReadStableMark()
-> ObjectSynchronizer::omAlloc()
-> ObjectMonitor::enter()
-> ObjectMonitor::TrySpin_VaryDuration()
-> ObjectMonitor::TryLock()
-> SpinPause()
-> ObjectMonitor::EnterI()
-> ObjectMonitor::TryLock()
-> DeferredInitialize()
-> ObjectMonitor::TrySpin_VaryDuration()
-> (同上)
-> os::PlatformEvent::park() or os::PlatformEvent::park(jlong millis)
-> (See: here for details)
-> ObjectMonitor::UnlinkAfterAcquire()
-> ObjectMonitor::ExitSuspendEquivalent()
-> ObjectSynchronizer::fast_enter()
-> (1) UseBiasedLocking オプションが指定されている場合は, safepoint かどうかに応じてどちらかを実行.
(UseBiasedLocking オプションが指定されていなければ, 何もしない)
* safepoint 中ではない場合: (自分への rebias を試みる. 成功すればここでリターン)
-> BiasedLocking::revoke_and_rebias()
-> (See: here for details)
* safepoint 中の場合: (VM thread に rebias しても意味がないので revoke だけしておく)
-> BiasedLocking::revoke_at_safepoint()
-> (See: here for details)
(2) slow-path にフォールバックする
-> ObjectSynchronizer::slow_enter()
-> (同上)
See: here for details
See: here for details
(#Under Construction)
(#Under Construction)
(#Under Construction)
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
(#Under Construction)
See: here for details
See: here for details
(#Under Construction)
See: here for details
(#Under Construction)
See: here for details
See: here for details
See: here for details
(#Under Construction)
See: here for details
See: here for details
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.