diff options
| author | 2018-06-19 01:09:01 +0000 | |
|---|---|---|
| committer | 2018-06-19 01:09:01 +0000 | |
| commit | 2c12bb624e91d8f1282d868fd2f2e33ba3746d6c (patch) | |
| tree | b378c9a7051ce84c3c22847be179845a04d76376 /runtime/mirror/object.cc | |
| parent | e3435cb810a5c48626a1564dbed0ae4dda89d57b (diff) | |
| parent | 8bb3c68422ce06f444d7c4e49c7af7b1c5cbeb7c (diff) | |
Merge "Use strong CAS for identity hash code"
Diffstat (limited to 'runtime/mirror/object.cc')
| -rw-r--r-- | runtime/mirror/object.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/mirror/object.cc b/runtime/mirror/object.cc index 4240e702b5..200bc471b8 100644 --- a/runtime/mirror/object.cc +++ b/runtime/mirror/object.cc @@ -197,7 +197,9 @@ int32_t Object::IdentityHashCode() { // loop iteration. LockWord hash_word = LockWord::FromHashCode(GenerateIdentityHashCode(), lw.GCState()); DCHECK_EQ(hash_word.GetState(), LockWord::kHashCode); - if (current_this->CasLockWordWeakRelaxed(lw, hash_word)) { + // Use a strong CAS to prevent spurious failures since these can make the boot image + // non-deterministic. + if (current_this->CasLockWordStrongRelaxed(lw, hash_word)) { return hash_word.GetHashCode(); } break; |