(#Under Construction)
BiasedLocking::revoke_and_rebias() の処理
-> BiasedLocking::revoke_and_rebias()
-> (1) 対象のオブジェクトに応じて以下の処理を行う. 上手くいった場合はここでリターン.
* 「対象のオブジェクトが anonymously biased な状態であり, 引数で rebias はしないと指定された」場合は,
mark フィールドを CAS で非 biased locking なパターンに置き換える.
CAS が成功したらここでリターン.
* 「対象のオブジェクトの mark フィールドは biased pattern をしているが,
そのクラス自体が bulk revoke されてしまっている」場合は,
mark フィールドを CAS で非 biased locking なパターンに置き換える.
CAS が成功しても失敗してもここでリターン.
* 「対象のオブジェクトの mark フィールドは biased pattern をしているが,
bulk rebias によって epoch がずれてしまっている」場合は,
CAS で自分に biased させる, または CAS で revoke する.
CAS が成功すれば, ここでリターン.
(2) 上記のどれでもない場合, あるいは上記のケースに当てはまったが CAS が失敗した場合は,
どうすべきかを決めるために heuristics を update する.
-> update_heuristics()
(3) heirustics 結果に応じて以下のように処理を行う
* heuristics の結果が HR_NOT_BIASED であれば, ここでリターン.
* heuristics の結果が HR_SINGLE_REVOKE であれば, 対象のオブジェクトを revoke させる.
(なお, 自分以外に biased されている場合は safepoint 停止が必要)
* 自分に biased されている場合:
-> revoke_bias()
-> get_or_compute_monitor_info()
-> JavaThread::cached_monitor_info()
-> JavaThread::set_cached_monitor_info()
-> oopDesc::set_mark()
* 自分以外に biased されている場合:
-> VM_RevokeBias::VM_RevokeBias(Handle* obj, JavaThread* requesting_thread)
-> VMThread::execute()
-> (See: here for details)
-> VM_RevokeBias::doit()
-> revoke_bias()
-> (同上)
-> clean_up_cached_monitor_info()
* heuristics の結果が HR_BULK_REVOKE か HR_BULK_REBIAS であれば, bulk revoke/rebias を起こす.
-> VMThread::execute()
-> (See: here for details)
-> VM_BulkRevokeBias::doit()
-> bulk_revoke_or_rebias_at_safepoint()
-> bulk rebias か bulk revoke かに応じて処理を行う
* bulk rebias 処理の場合:
-> Klass::set_prototype_header()
-> get_or_compute_monitor_info()
-> oopDesc::set_mark()
-> revoke_bias()
-> (同上)
* bulk revoke 処理の場合:
-> Klass::set_prototype_header()
-> get_or_compute_monitor_info()
-> revoke_bias()
-> (同上)
-> clean_up_cached_monitor_info()
BiasedLocking::revoke() の処理
-> BiasedLocking::revoke()
-> VM_RevokeBias::VM_RevokeBias(GrowableArray<Handle>* objs, JavaThread* requesting_thread)
-> VMThread::execute()
-> (See: here for details)
-> VM_RevokeBias::doit()
-> BiasedLocking::revoke_at_safepoint(GrowableArray<Handle>* objs)
-> (後述)
BiasedLocking::revoke_at_safepoint(Handle obj) の処理
-> BiasedLocking::revoke_at_safepoint(Handle obj)
-> (1) heuristic を計算する
-> update_heuristics()
(1) heuristic の結果に応じて以下のどちらかを呼び出す.
* bulk_rebias や bulk_revoke の必要はない場合:
-> revoke_bias()
-> (上述)
* bulk_rebias または bulk_revoke の必要がある場合:
-> bulk_revoke_or_rebias_at_safepoint()
-> (上述)
(1) キャッシュしていた「使用中のロック情報」を消去する.
-> clean_up_cached_monitor_info()
BiasedLocking::revoke_at_safepoint(GrowableArray<Handle>* objs) の処理
-> BiasedLocking::revoke_at_safepoint(GrowableArray<Handle>* objs)
-> (1) heuristic を計算する
-> update_heuristics()
(1) heuristic の結果に応じて以下のどちらかを呼び出す.
* bulk_rebias や bulk_revoke の必要はない場合:
-> revoke_bias()
-> (上述)
* bulk_rebias または bulk_revoke の必要がある場合:
-> bulk_revoke_or_rebias_at_safepoint()
-> (上述)
(1) キャッシュしていた「使用中のロック情報」を消去する.
-> clean_up_cached_monitor_info()
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
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
See: here for details
This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.