Fix race where class state can go between verified/initializing.
Change-Id: I99b425a3a8df937b8c349c22e32e84ad3b02231f
diff --git a/src/compiler.cc b/src/compiler.cc
index 771e3b4..af8292f 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -1272,6 +1272,7 @@
const char* descriptor = context->GetDexFile()->GetClassDescriptor(class_def);
Class* klass = context->GetClassLinker()->FindClass(descriptor, class_loader);
if (klass != NULL) {
+ ObjectLock lock(klass);
if (klass->IsVerified()) {
// Only try to initialize classes that were successfully verified.
bool compiling_boot = Runtime::Current()->GetHeap()->GetSpaces().size() == 1;