Use WaitHoldingLocks in ReferenceProcessor::GetReferent.

The caller may be holding other locks, so we must use this or else
we get bad mutexes held errors. Also added a lock level for the
reference processor.

Change-Id: I364a303a4106982bd9bfaac5b116cea1638ea6d3
diff --git a/runtime/base/mutex.h b/runtime/base/mutex.h
index b50c098..3f35670 100644
--- a/runtime/base/mutex.h
+++ b/runtime/base/mutex.h
@@ -62,6 +62,7 @@
   kRosAllocBracketLock,
   kRosAllocBulkFreeLock,
   kAllocSpaceLock,
+  kReferenceProcessorLock,
   kDexFileMethodInlinerLock,
   kDexFileToMethodInlinerMapLock,
   kMarkSweepMarkStackLock,
diff --git a/runtime/gc/reference_processor.cc b/runtime/gc/reference_processor.cc
index ef9e1d4..188b6b3 100644
--- a/runtime/gc/reference_processor.cc
+++ b/runtime/gc/reference_processor.cc
@@ -28,7 +28,7 @@
 
 ReferenceProcessor::ReferenceProcessor()
     : process_references_args_(nullptr, nullptr, nullptr), slow_path_enabled_(false),
-      preserving_references_(false), lock_("reference processor lock"),
+      preserving_references_(false), lock_("reference processor lock", kReferenceProcessorLock),
       condition_("reference processor condition", lock_) {
 }
 
@@ -71,7 +71,7 @@
         return obj;
       }
     }
-    condition_.Wait(self);
+    condition_.WaitHoldingLocks(self);
   }
   return reference->GetReferent();
 }
diff --git a/runtime/oat.cc b/runtime/oat.cc
index 4b4b3d0..c7a821a 100644
--- a/runtime/oat.cc
+++ b/runtime/oat.cc
@@ -22,7 +22,7 @@
 namespace art {
 
 const uint8_t OatHeader::kOatMagic[] = { 'o', 'a', 't', '\n' };
-const uint8_t OatHeader::kOatVersion[] = { '0', '2', '3', '\0' };
+const uint8_t OatHeader::kOatVersion[] = { '0', '2', '4', '\0' };
 
 OatHeader::OatHeader() {
   memset(this, 0, sizeof(*this));