summaryrefslogtreecommitdiff
path: root/runtime/class_table-inl.h
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2017-06-01 11:26:50 -0700
committer Mathieu Chartier <mathieuc@google.com> 2017-06-02 09:38:14 -0700
commitfdd513d6c522841e82f1dc144d19a8d60269b9f7 (patch)
tree1ffbfd68c1271d158de32e1aa438906d3553256d /runtime/class_table-inl.h
parent1656ca9e6996cb555b4463e5efd4bd7e3f4fb816 (diff)
Move to release CAS for updating object fields
Relaxed cas is not sufficient to make sure threads that read the field will see the copied contents of objects. Bug: 37187694 Bug: 62240510 Test: test-art-host (cherry picked from commit a1f20c3f8d0dabb9723acccf3ba760acf3ebe62d) Change-Id: I8bff8a67c2c52eb131714b52e6d842c8c08dd70a
Diffstat (limited to 'runtime/class_table-inl.h')
-rw-r--r--runtime/class_table-inl.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/runtime/class_table-inl.h b/runtime/class_table-inl.h
index dfe8949134..35fce4063b 100644
--- a/runtime/class_table-inl.h
+++ b/runtime/class_table-inl.h
@@ -93,7 +93,7 @@ inline mirror::Class* ClassTable::TableSlot::Read() const {
if (kReadBarrierOption != kWithoutReadBarrier && before_ptr != after_ptr) {
// If another thread raced and updated the reference, do not store the read barrier updated
// one.
- data_.CompareExchangeStrongRelaxed(before, Encode(after_ptr, MaskHash(before)));
+ data_.CompareExchangeStrongRelease(before, Encode(after_ptr, MaskHash(before)));
}
return after_ptr.Ptr();
}
@@ -108,7 +108,7 @@ inline void ClassTable::TableSlot::VisitRoot(const Visitor& visitor) const {
if (before_ptr != after_ptr) {
// If another thread raced and updated the reference, do not store the read barrier updated
// one.
- data_.CompareExchangeStrongRelaxed(before, Encode(after_ptr, MaskHash(before)));
+ data_.CompareExchangeStrongRelease(before, Encode(after_ptr, MaskHash(before)));
}
}