Top


定義場所(file name)

hotspot/src/share/vm/runtime/synchronizer.cpp

説明(description)

// -----------------------------------------------------------------------------
//  Fast Monitor Enter/Exit
// This the fast monitor enter. The interpreter and compiler use
// some assembly copies of this code. Make sure update those code
// if the following function is changed. The implementation is
// extremely sensitive to race condition. Be careful.

名前(function name)

void ObjectSynchronizer::fast_enter(Handle obj, BasicLock* lock, bool attempt_rebias, TRAPS) {

本体部(body)

  {- -------------------------------------------
  (1) (もし UseBiasedLocking オプションが指定されていれば, 以下の処理を行ってから ObjectSynchronizer::slow_enter() を呼び出す.
       UseBiasedLocking オプションが指定されていなければ, いきなり ObjectSynchronizer::slow_enter() を呼び出す.)
      ---------------------------------------- -}

     if (UseBiasedLocking) {

    {- -------------------------------------------
  (1.1) safepoint でなければ BiasedLocking::revoke_and_rebias() で自分への rebias を試みる.
        成功すればここでリターン.
        (失敗すればこのままフォールスルー)
        ---------------------------------------- -}

        if (!SafepointSynchronize::is_at_safepoint()) {
          BiasedLocking::Condition cond = BiasedLocking::revoke_and_rebias(obj, attempt_rebias, THREAD);
          if (cond == BiasedLocking::BIAS_REVOKED_AND_REBIASED) {
            return;
          }

    {- -------------------------------------------
  (1.1) safepoint であれば, (VM thread に rebias しても意味ないので) 
        BiasedLocking::revoke_at_safepoint() で revoke だけ行い, 
        このまま ObjectSynchronizer::slow_enter() にフォールスルー.
        ---------------------------------------- -}

        } else {
          assert(!attempt_rebias, "can not rebias toward VM thread");
          BiasedLocking::revoke_at_safepoint(obj);
        }
        assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
     }

    {- -------------------------------------------
  (1.1) ObjectSynchronizer::slow_enter() を呼び出す.
        ---------------------------------------- -}

     slow_enter (obj, lock, THREAD) ;
    }

This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.