summaryrefslogtreecommitdiff
path: root/runtime/mirror/object.cc
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2018-06-19 01:09:01 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2018-06-19 01:09:01 +0000
commit2c12bb624e91d8f1282d868fd2f2e33ba3746d6c (patch)
treeb378c9a7051ce84c3c22847be179845a04d76376 /runtime/mirror/object.cc
parente3435cb810a5c48626a1564dbed0ae4dda89d57b (diff)
parent8bb3c68422ce06f444d7c4e49c7af7b1c5cbeb7c (diff)
Merge "Use strong CAS for identity hash code"
Diffstat (limited to 'runtime/mirror/object.cc')
-rw-r--r--runtime/mirror/object.cc4
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;