diff options
author | Hiroshi Yamauchi <yamauchi@google.com> | 2014-06-18 13:47:35 -0700 |
---|---|---|
committer | Hiroshi Yamauchi <yamauchi@google.com> | 2014-06-20 11:23:58 -0700 |
commit | ea2e1bd713ca8295ba4fcd01e77a3ce532ea61e4 (patch) | |
tree | d41be4b08041c5a2b1af626d8cdf6b69280723d5 /runtime/indirect_reference_table.h | |
parent | 241fd1192dfc0f7322660343179f9fc0591ed9ff (diff) | |
download | art-ea2e1bd713ca8295ba4fcd01e77a3ce532ea61e4.tar.gz art-ea2e1bd713ca8295ba4fcd01e77a3ce532ea61e4.tar.bz2 art-ea2e1bd713ca8295ba4fcd01e77a3ce532ea61e4.zip |
Add more read barriers for JNI roots.
To make it possible to concurrently scan the JNI global roots (that
is, the roots visited by JavaVMExt::VisitRoots()), add read barriers
to the indirect reference table and the reference table.
Also, add read barriers to the jmethodID/jfieldID decode routines
(ScopedObjectAccessAlreadyRunnable::DecodeField/DecodeMethod) so that
we can concurrently handle (encoded) fields and methods.
Bug: 12687968
Change-Id: I3df4e4e622a572ff0ea8d44b2dc70a4d6b3ba058
Diffstat (limited to 'runtime/indirect_reference_table.h')
-rw-r--r-- | runtime/indirect_reference_table.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/runtime/indirect_reference_table.h b/runtime/indirect_reference_table.h index 5b3ed685c7..b3a855dfb3 100644 --- a/runtime/indirect_reference_table.h +++ b/runtime/indirect_reference_table.h @@ -27,6 +27,7 @@ #include "mem_map.h" #include "object_callbacks.h" #include "offsets.h" +#include "read_barrier.h" namespace art { namespace mirror { @@ -215,6 +216,7 @@ class IrtIterator { } mirror::Object** operator*() { + // This does not have a read barrier as this is used to visit roots. return &table_[i_]; } @@ -298,6 +300,7 @@ class IndirectReferenceTable { return segment_state_.parts.topIndex; } + // Note IrtIterator does not have a read barrier as it's used to visit roots. IrtIterator begin() { return IrtIterator(table_, 0, Capacity()); } @@ -333,7 +336,7 @@ class IndirectReferenceTable { * The object pointer itself is subject to relocation in some GC * implementations, so we shouldn't really be using it here. */ - IndirectRef ToIndirectRef(const mirror::Object* /*o*/, uint32_t tableIndex) const { + IndirectRef ToIndirectRef(uint32_t tableIndex) const { DCHECK_LT(tableIndex, 65536U); uint32_t serialChunk = slot_data_[tableIndex].serial; uintptr_t uref = serialChunk << 20 | (tableIndex << 2) | kind_; @@ -368,9 +371,8 @@ class IndirectReferenceTable { std::unique_ptr<MemMap> table_mem_map_; // Mem map where we store the extended debugging info. std::unique_ptr<MemMap> slot_mem_map_; - // bottom of the stack. If a JNI weak global table, do not directly - // access the object references in this as they are weak roots. Use - // Get() that has a read barrier. + // bottom of the stack. Do not directly access the object references + // in this as they are roots. Use Get() that has a read barrier. mirror::Object** table_; /* bit mask, ORed into all irefs */ IndirectRefKind kind_; |