summaryrefslogtreecommitdiffstats
path: root/runtime/read_barrier-inl.h
diff options
context:
space:
mode:
authorHiroshi Yamauchi <yamauchi@google.com>2014-05-21 21:10:23 -0700
committerHiroshi Yamauchi <yamauchi@google.com>2014-05-21 21:19:17 -0700
commit4cba0d979a11f955e6ec3c0f1bf61478af7aa810 (patch)
treeb3e3b61af6bd079989a1bf5259daaa8006af32d4 /runtime/read_barrier-inl.h
parent388c6e273018c753d7822d09d7cda0826f0c32ed (diff)
downloadart-4cba0d979a11f955e6ec3c0f1bf61478af7aa810.tar.gz
art-4cba0d979a11f955e6ec3c0f1bf61478af7aa810.tar.bz2
art-4cba0d979a11f955e6ec3c0f1bf61478af7aa810.zip
Add a read barrier for weak roots in monitors.
A weak root requires a read barrier for the to-space invariant to hold because the object pointed to by a weak root can't be marked/forwarded like the one pointed to by a strong root (GC does not know if it's alive or not at that point) and because, without a read barrier, a mutator could access it and obtain a from-space reference, which would violate the to-space invariant. TODO: do similar for the other types of weak roots. Bug: 12687968 Change-Id: I563a0fa4f875e0c21ac96f57696959454e13b15a
Diffstat (limited to 'runtime/read_barrier-inl.h')
-rw-r--r--runtime/read_barrier-inl.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/runtime/read_barrier-inl.h b/runtime/read_barrier-inl.h
index 88e2f8fa61..4302c9ef85 100644
--- a/runtime/read_barrier-inl.h
+++ b/runtime/read_barrier-inl.h
@@ -43,6 +43,21 @@ inline MirrorType* ReadBarrier::Barrier(
}
}
+template <typename MirrorType, ReadBarrierOption kReadBarrierOption>
+inline MirrorType* ReadBarrier::BarrierForWeakRoot(MirrorType* ref) {
+ UNUSED(ref);
+ const bool with_read_barrier = kReadBarrierOption == kWithReadBarrier;
+ if (with_read_barrier && kUseBakerReadBarrier) {
+ // To be implemented.
+ return ref;
+ } else if (with_read_barrier && kUseBrooksReadBarrier) {
+ // To be implemented.
+ return ref;
+ } else {
+ return ref;
+ }
+}
+
} // namespace art
#endif // ART_RUNTIME_READ_BARRIER_INL_H_