summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2015-04-07 10:39:04 -0700
committerMathieu Chartier <mathieuc@google.com>2015-04-07 10:42:46 -0700
commit4809d0a8a5fca85a67dd0588ead5dfbd0f1acf96 (patch)
tree12853aa2c6a6238cac7c66b5d5610735a2f31591 /runtime
parent63a99fce3ceac3c9de1f47b88a75094e3e1ffba3 (diff)
downloadart-4809d0a8a5fca85a67dd0588ead5dfbd0f1acf96.zip
art-4809d0a8a5fca85a67dd0588ead5dfbd0f1acf96.tar.gz
art-4809d0a8a5fca85a67dd0588ead5dfbd0f1acf96.tar.bz2
Fix CC root visiting bug
Also some cleanup. Change-Id: Ia3de8f2d409770be3619ec116e8b06ecd82338fe
Diffstat (limited to 'runtime')
-rw-r--r--runtime/class_linker.cc3
-rw-r--r--runtime/gc/collector/concurrent_copying.cc8
-rw-r--r--runtime/gc_root.h3
-rw-r--r--runtime/indirect_reference_table.cc2
-rw-r--r--runtime/instrumentation.cc2
-rw-r--r--runtime/intern_table.cc3
-rw-r--r--runtime/reference_table.cc2
-rw-r--r--runtime/thread.cc3
8 files changed, 16 insertions, 10 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 33d75d2..12fa546 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -914,7 +914,8 @@ void ClassLinker::InitFromImage() {
void ClassLinker::VisitClassRoots(RootVisitor* visitor, VisitRootFlags flags) {
WriterMutexLock mu(Thread::Current(), *Locks::classlinker_classes_lock_);
if ((flags & kVisitRootFlagAllRoots) != 0) {
- BufferedRootVisitor<128> buffered_visitor(visitor, RootInfo(kRootStickyClass));
+ BufferedRootVisitor<kDefaultBufferedRootCount> buffered_visitor(
+ visitor, RootInfo(kRootStickyClass));
for (GcRoot<mirror::Class>& root : class_table_) {
buffered_visitor.VisitRoot(root);
}
diff --git a/runtime/gc/collector/concurrent_copying.cc b/runtime/gc/collector/concurrent_copying.cc
index 19d4e1a..6a68880 100644
--- a/runtime/gc/collector/concurrent_copying.cc
+++ b/runtime/gc/collector/concurrent_copying.cc
@@ -1148,11 +1148,11 @@ void ConcurrentCopying::VisitRoots(
mirror::Object** root = roots[i];
mirror::Object* ref = *root;
if (ref == nullptr || region_space_->IsInToSpace(ref)) {
- return;
+ continue;
}
mirror::Object* to_ref = Mark(ref);
if (to_ref == ref) {
- return;
+ continue;
}
Atomic<mirror::Object*>* addr = reinterpret_cast<Atomic<mirror::Object*>*>(root);
mirror::Object* expected_ref = ref;
@@ -1173,11 +1173,11 @@ void ConcurrentCopying::VisitRoots(
mirror::CompressedReference<mirror::Object>* root = roots[i];
mirror::Object* ref = root->AsMirrorPtr();
if (ref == nullptr || region_space_->IsInToSpace(ref)) {
- return;
+ continue;
}
mirror::Object* to_ref = Mark(ref);
if (to_ref == ref) {
- return;
+ continue;
}
auto* addr = reinterpret_cast<Atomic<mirror::CompressedReference<mirror::Object>>*>(root);
auto expected_ref = mirror::CompressedReference<mirror::Object>::FromMirrorPtr(ref);
diff --git a/runtime/gc_root.h b/runtime/gc_root.h
index 2f4da3f..0d3c93b 100644
--- a/runtime/gc_root.h
+++ b/runtime/gc_root.h
@@ -30,6 +30,9 @@ class Object;
template <size_t kBufferSize>
class BufferedRootVisitor;
+// Dependent on pointer size so that we don't have frames that are too big on 64 bit.
+static const size_t kDefaultBufferedRootCount = 1024 / sizeof(void*);
+
enum RootType {
kRootUnknown = 0,
kRootJNIGlobal,
diff --git a/runtime/indirect_reference_table.cc b/runtime/indirect_reference_table.cc
index a3aa1de..cd59365 100644
--- a/runtime/indirect_reference_table.cc
+++ b/runtime/indirect_reference_table.cc
@@ -243,7 +243,7 @@ void IndirectReferenceTable::Trim() {
}
void IndirectReferenceTable::VisitRoots(RootVisitor* visitor, const RootInfo& root_info) {
- BufferedRootVisitor<128> root_visitor(visitor, root_info);
+ BufferedRootVisitor<kDefaultBufferedRootCount> root_visitor(visitor, root_info);
for (auto ref : *this) {
root_visitor.VisitRootIfNonNull(*ref);
}
diff --git a/runtime/instrumentation.cc b/runtime/instrumentation.cc
index dea157a..680b563 100644
--- a/runtime/instrumentation.cc
+++ b/runtime/instrumentation.cc
@@ -1082,7 +1082,7 @@ void Instrumentation::VisitRoots(RootVisitor* visitor) {
if (IsDeoptimizedMethodsEmpty()) {
return;
}
- BufferedRootVisitor<128> roots(visitor, RootInfo(kRootVMInternal));
+ BufferedRootVisitor<kDefaultBufferedRootCount> roots(visitor, RootInfo(kRootVMInternal));
for (auto pair : deoptimized_methods_) {
roots.VisitRoot(pair.second);
}
diff --git a/runtime/intern_table.cc b/runtime/intern_table.cc
index 8e85435..1f1f9e8 100644
--- a/runtime/intern_table.cc
+++ b/runtime/intern_table.cc
@@ -336,7 +336,8 @@ void InternTable::Table::Insert(mirror::String* s) {
}
void InternTable::Table::VisitRoots(RootVisitor* visitor) {
- BufferedRootVisitor<128> buffered_visitor(visitor, RootInfo(kRootInternedString));
+ BufferedRootVisitor<kDefaultBufferedRootCount> buffered_visitor(
+ visitor, RootInfo(kRootInternedString));
for (auto& intern : pre_zygote_table_) {
buffered_visitor.VisitRoot(intern);
}
diff --git a/runtime/reference_table.cc b/runtime/reference_table.cc
index ac36447..beba64f 100644
--- a/runtime/reference_table.cc
+++ b/runtime/reference_table.cc
@@ -238,7 +238,7 @@ void ReferenceTable::Dump(std::ostream& os, Table& entries) {
}
void ReferenceTable::VisitRoots(RootVisitor* visitor, const RootInfo& root_info) {
- BufferedRootVisitor<128> buffered_visitor(visitor, root_info);
+ BufferedRootVisitor<kDefaultBufferedRootCount> buffered_visitor(visitor, root_info);
for (GcRoot<mirror::Object>& root : entries_) {
buffered_visitor.VisitRoot(root);
}
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 79d2b13..d1b0464 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -1385,7 +1385,8 @@ bool Thread::HandleScopeContains(jobject obj) const {
}
void Thread::HandleScopeVisitRoots(RootVisitor* visitor, uint32_t thread_id) {
- BufferedRootVisitor<128> buffered_visitor(visitor, RootInfo(kRootNativeStack, thread_id));
+ BufferedRootVisitor<kDefaultBufferedRootCount> buffered_visitor(
+ visitor, RootInfo(kRootNativeStack, thread_id));
for (HandleScope* cur = tlsPtr_.top_handle_scope; cur; cur = cur->GetLink()) {
for (size_t j = 0, count = cur->NumberOfReferences(); j < count; ++j) {
buffered_visitor.VisitRootIfNonNull(cur->GetHandle(j).GetReference());