OSDN Git Service

Fix monitor visit for class initializer
authorSebastien Hertz <shertz@google.com>
Mon, 8 Sep 2014 08:15:19 +0000 (10:15 +0200)
committerSebastien Hertz <shertz@google.com>
Mon, 8 Sep 2014 08:18:18 +0000 (10:18 +0200)
We do not hold class object's lock when invoking class initializer. Therefore
it is wrong to visit it when looking for monitors owned by a thread.

Bug: 17377924

Change-Id: I7fddcdb9a554301e040c571971eec9be6cba5eda

runtime/monitor.cc

index 0b6e3b2..03f8687 100644 (file)
@@ -999,12 +999,6 @@ void Monitor::VisitLocks(StackVisitor* stack_visitor, void (*callback)(mirror::O
     return;
   }
 
-  // <clinit> is another special case. The runtime holds the class lock while calling <clinit>.
-  if (m->IsClassInitializer()) {
-    callback(m->GetDeclaringClass(), callback_context);
-    // Fall through because there might be synchronization in the user code too.
-  }
-
   // Is there any reason to believe there's any synchronization in this method?
   const DexFile::CodeItem* code_item = m->GetCodeItem();
   CHECK(code_item != NULL) << PrettyMethod(m);