Top


定義場所(file name)

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

名前(function name)

void Thread::SpinRelease (volatile int * adr) {

本体部(body)

  {- -------------------------------------------
  (1) (assert)
      ---------------------------------------- -}

      assert (*adr != 0, "invariant") ;

  {- -------------------------------------------
  (1) OrderAccess::fence() でメモリバリアを張った後, 
      引数(adr)で指定された箇所を 0 で上書きする(= ロックを解放する)だけ.

      なお, OrderAccess::fence() が必要なのは, 
      critical section 内で行われた load/store が
      critical section 外にはみ出すのを禁止するため.
      (逆に, critical section 外の load/store が critical section 内に入ってくるのは問題ない.
       Java Memory Model と同じくゴキブリホイホイ方式(Roach-motel semantics).)
      ---------------------------------------- -}

      OrderAccess::fence() ;      // guarantee at least release consistency.
      // Roach-motel semantics.
      // It's safe if subsequent LDs and STs float "up" into the critical section,
      // but prior LDs and STs within the critical section can't be allowed
      // to reorder or float past the ST that releases the lock.
      *adr = 0 ;
    }

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