Add monitor_enter_object as root.
The monitor enter object was not a root, this caused issues with
compactions since the object could move and then verify object would
fail.
Bug: 13769139
Change-Id: Ia732376fb9d1de8bf137ef9894cb2bb3241d8bb2
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 29d011c..5a2410a 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -2070,6 +2070,9 @@
visitor(reinterpret_cast<mirror::Object**>(&tlsPtr_.class_loader_override), arg, thread_id,
kRootNativeStack);
}
+ if (tlsPtr_.monitor_enter_object != nullptr) {
+ visitor(&tlsPtr_.monitor_enter_object, arg, thread_id, kRootNativeStack);
+ }
tlsPtr_.jni_env->locals.VisitRoots(visitor, arg, thread_id, kRootJNILocal);
tlsPtr_.jni_env->monitors.VisitRoots(visitor, arg, thread_id, kRootJNIMonitor);
SirtVisitRoots(visitor, arg, thread_id);