Global lock levels.

Introduce the notion of the mutators/GC being a shared-exclusive (aka
reader-writer) lock. Introduce globally ordered locks, analysable by
annotalysis, statically at compile time. Add locking attributes to
methods.

More subtly, remove the heap_lock_ and split between various locks that
are held for smaller periods (where work doesn't get blocked). Remove
buggy Dalvik style thread transitions. Make GC use CMS in all cases when
concurrent is enabled. Fix bug where suspend counts rather than debug
suspend counts were sent to JDWP. Move the PathClassLoader to
WellKnownClasses. In debugger refactor calls to send request and
possibly suspend. Break apart different VmWait thread states. Move
identity hash code to a shared method.

Change-Id: Icdbfc3ce3fcccd14341860ac7305d8e97b51f5c6
diff --git a/src/logging.cc b/src/logging.cc
index 30063a1..712c02b 100644
--- a/src/logging.cc
+++ b/src/logging.cc
@@ -29,11 +29,6 @@
 static std::string* gProgramInvocationName;
 static std::string* gProgramInvocationShortName;
 
-static Mutex& GetLoggingLock() {
-  static Mutex logging_lock("LogMessage lock");
-  return logging_lock;
-}
-
 const char* GetCmdLine() {
   return (gCmdLine != NULL) ? gCmdLine->c_str() : NULL;
 }
@@ -55,6 +50,9 @@
 // and a letter indicating the minimum priority level we're expected to log.
 // This can be used to reveal or conceal logs with specific tags.
 void InitLogging(char* argv[]) {
+  // TODO: Move this to a more obvious InitART...
+  GlobalSynchronization::Init();
+
   // Stash the command line for later use. We can use /proc/self/cmdline on Linux to recover this,
   // but we don't have that luxury on the Mac, and there are a couple of argv[0] variants that are
   // commonly used.
@@ -106,7 +104,7 @@
 
   // Do the actual logging with the lock held.
   {
-    MutexLock mu(GetLoggingLock());
+    MutexLock mu(*GlobalSynchronization::logging_lock_);
     if (msg.find('\n') == std::string::npos) {
       LogLine(msg.c_str());
     } else {