Change root visitor to use Object**.
Simplifies code and improves the performance of root visiting since
we usually don't need to check to see if the object moved.
Change-Id: Iba998f5a15ae1fa1b53ca5226dd2168a411196cf
diff --git a/runtime/hprof/hprof.cc b/runtime/hprof/hprof.cc
index ae03dd9..c5a8328 100644
--- a/runtime/hprof/hprof.cc
+++ b/runtime/hprof/hprof.cc
@@ -496,12 +496,12 @@
}
private:
- static mirror::Object* RootVisitor(mirror::Object* obj, void* arg, uint32_t thread_id,
- RootType root_type)
+ static void RootVisitor(mirror::Object** obj, void* arg, uint32_t thread_id, RootType root_type)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- DCHECK(arg != NULL);
- reinterpret_cast<Hprof*>(arg)->VisitRoot(obj, thread_id, root_type);
- return obj;
+ DCHECK(arg != nullptr);
+ DCHECK(obj != nullptr);
+ DCHECK(*obj != nullptr);
+ reinterpret_cast<Hprof*>(arg)->VisitRoot(*obj, thread_id, root_type);
}
static void VisitObjectCallback(mirror::Object* obj, void* arg)