summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2014-04-04 11:09:41 -0700
committerMathieu Chartier <mathieuc@google.com>2014-04-04 11:22:27 -0700
commit7bf9f190cd33a7e2f8584299eb889e9df66e0323 (patch)
tree1817368ef167a6340129d2a59b0c423f5c87d604
parent34df691e64a6491e7312a850a1ad255e4cf02702 (diff)
downloadart-7bf9f190cd33a7e2f8584299eb889e9df66e0323.zip
art-7bf9f190cd33a7e2f8584299eb889e9df66e0323.tar.gz
art-7bf9f190cd33a7e2f8584299eb889e9df66e0323.tar.bz2
Improve invalid root dumping.
The invalid root dumping now attempts to print the root type. Change-Id: Ie821296d569f34909ba6e2705f5c347cd2143a3a
-rw-r--r--runtime/gc/collector/mark_sweep.cc15
-rw-r--r--runtime/gc/collector/mark_sweep.h6
-rw-r--r--runtime/gc/heap.h2
-rw-r--r--runtime/object_callbacks.h2
-rw-r--r--runtime/thread_list.cc4
5 files changed, 16 insertions, 13 deletions
diff --git a/runtime/gc/collector/mark_sweep.cc b/runtime/gc/collector/mark_sweep.cc
index ca2d0bd..944ef8d 100644
--- a/runtime/gc/collector/mark_sweep.cc
+++ b/runtime/gc/collector/mark_sweep.cc
@@ -76,7 +76,7 @@ static constexpr bool kCountMarkedObjects = false;
// Turn off kCheckLocks when profiling the GC since it slows the GC down by up to 40%.
static constexpr bool kCheckLocks = kDebugLocking;
-static constexpr bool kVerifyRoots = kIsDebugBuild;
+static constexpr bool kVerifyRootsMarked = kIsDebugBuild;
// If true, revoke the rosalloc thread-local buffers at the
// checkpoint, as opposed to during the pause.
@@ -466,16 +466,17 @@ void MarkSweep::MarkRootCallback(Object** root, void* arg, uint32_t /*thread_id*
}
void MarkSweep::VerifyRootCallback(const Object* root, void* arg, size_t vreg,
- const StackVisitor* visitor) {
- reinterpret_cast<MarkSweep*>(arg)->VerifyRoot(root, vreg, visitor);
+ const StackVisitor* visitor, RootType root_type) {
+ reinterpret_cast<MarkSweep*>(arg)->VerifyRoot(root, vreg, visitor, root_type);
}
-void MarkSweep::VerifyRoot(const Object* root, size_t vreg, const StackVisitor* visitor) {
+void MarkSweep::VerifyRoot(const Object* root, size_t vreg, const StackVisitor* visitor,
+ RootType root_type) {
// See if the root is on any space bitmap.
- if (GetHeap()->GetLiveBitmap()->GetContinuousSpaceBitmap(root) == NULL) {
+ if (GetHeap()->GetLiveBitmap()->GetContinuousSpaceBitmap(root) == nullptr) {
space::LargeObjectSpace* large_object_space = GetHeap()->GetLargeObjectsSpace();
if (!large_object_space->Contains(root)) {
- LOG(ERROR) << "Found invalid root: " << root;
+ LOG(ERROR) << "Found invalid root: " << root << " with type " << root_type;
if (visitor != NULL) {
LOG(ERROR) << visitor->DescribeLocation() << " in VReg: " << vreg;
}
@@ -918,7 +919,7 @@ void MarkSweep::ReMarkRoots() {
kVisitRootFlagStopLoggingNewRoots |
kVisitRootFlagClearRootLog));
timings_.EndSplit();
- if (kVerifyRoots) {
+ if (kVerifyRootsMarked) {
timings_.StartSplit("(Paused)VerifyRoots");
Runtime::Current()->VisitRoots(VerifyRootMarked, this);
timings_.EndSplit();
diff --git a/runtime/gc/collector/mark_sweep.h b/runtime/gc/collector/mark_sweep.h
index f1fd546..d49e427 100644
--- a/runtime/gc/collector/mark_sweep.h
+++ b/runtime/gc/collector/mark_sweep.h
@@ -249,10 +249,10 @@ class MarkSweep : public GarbageCollector {
size_t GetThreadCount(bool paused) const;
static void VerifyRootCallback(const mirror::Object* root, void* arg, size_t vreg,
- const StackVisitor *visitor);
+ const StackVisitor *visitor, RootType root_type);
- void VerifyRoot(const mirror::Object* root, size_t vreg, const StackVisitor* visitor)
- NO_THREAD_SAFETY_ANALYSIS;
+ void VerifyRoot(const mirror::Object* root, size_t vreg, const StackVisitor* visitor,
+ RootType root_type) NO_THREAD_SAFETY_ANALYSIS;
// Push a single reference on a mark stack.
void PushOnMarkStack(mirror::Object* obj);
diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h
index ffb4e59..a8989ec 100644
--- a/runtime/gc/heap.h
+++ b/runtime/gc/heap.h
@@ -115,6 +115,8 @@ enum ProcessState {
};
std::ostream& operator<<(std::ostream& os, const ProcessState& process_state);
+std::ostream& operator<<(std::ostream& os, const RootType& root_type);
+
class Heap {
public:
// If true, measure the total allocation time.
diff --git a/runtime/object_callbacks.h b/runtime/object_callbacks.h
index 89ee34e..9198c90 100644
--- a/runtime/object_callbacks.h
+++ b/runtime/object_callbacks.h
@@ -56,7 +56,7 @@ typedef mirror::Object* (MarkObjectCallback)(mirror::Object* obj, void* arg)
__attribute__((warn_unused_result));
// A callback for verifying roots.
typedef void (VerifyRootCallback)(const mirror::Object* root, void* arg, size_t vreg,
- const StackVisitor* visitor);
+ const StackVisitor* visitor, RootType root_type);
typedef void (MarkHeapReferenceCallback)(mirror::HeapReference<mirror::Object>* ref, void* arg);
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc
index 7de9433..8dad419 100644
--- a/runtime/thread_list.cc
+++ b/runtime/thread_list.cc
@@ -823,9 +823,9 @@ class VerifyRootWrapperArg {
};
static void VerifyRootWrapperCallback(mirror::Object** root, void* arg, uint32_t /*thread_id*/,
- RootType /*root_type*/) {
+ RootType root_type) {
VerifyRootWrapperArg* wrapperArg = reinterpret_cast<VerifyRootWrapperArg*>(arg);
- wrapperArg->callback_(*root, wrapperArg->arg_, 0, NULL);
+ wrapperArg->callback_(*root, wrapperArg->arg_, 0, NULL, root_type);
}
void ThreadList::VerifyRoots(VerifyRootCallback* callback, void* arg) const {