OSDN Git Service

Fix two data races in the monitor code.
authorCarl Shapiro <cshapiro@google.com>
Tue, 2 Aug 2011 07:01:13 +0000 (00:01 -0700)
committerCarl Shapiro <cshapiro@google.com>
Tue, 16 Aug 2011 04:01:19 +0000 (21:01 -0700)
commitf28000dc9b6f596921b1a4387746bea4c8cd207f
tree98b88552538c7d3a28d93fc53a85130842be888b
parentb25e56e5e578220734f6f75b810fe7a94c69793d
Fix two data races in the monitor code.

First, the release of a lock was not preceded by a memory barrier.
This would allow stores within the critical section to move outside
the critical section violating the monitor invariant.

Second, the thin lock value was often not loaded through volatile
pointer.  This provides the compiler with the freedom to reload the
thin lock with a different value causing erroneous updates to the lock
word.

Bug: 5107390
vm/Sync.cpp