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/mod_union_table.h b/src/mod_union_table.h
index f44004b..424f2f3 100644
--- a/src/mod_union_table.h
+++ b/src/mod_union_table.h
@@ -84,10 +84,12 @@
   void ClearCards(Space* space);
 
   // Update table based on cleared cards.
-  void Update();
+  void Update()
+      EXCLUSIVE_LOCKS_REQUIRED(GlobalSynchronization::heap_bitmap_lock_)
+      SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_);
 
   // Mark all references to the alloc space(s).
-  void MarkReferences();
+  void MarkReferences() EXCLUSIVE_LOCKS_REQUIRED(GlobalSynchronization::heap_bitmap_lock_);
 
  protected:
   // Cleared card array, used to update the mod-union table.
@@ -111,10 +113,12 @@
   void ClearCards(Space* space);
 
   // Update table based on cleared cards.
-  void Update();
+  void Update()
+      EXCLUSIVE_LOCKS_REQUIRED(GlobalSynchronization::heap_bitmap_lock_)
+      SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_);
 
   // Mark all references to the alloc space(s).
-  void MarkReferences();
+  void MarkReferences() EXCLUSIVE_LOCKS_REQUIRED(GlobalSynchronization::heap_bitmap_lock_);
 
   // Verify the mod-union table.
   void Verify();
@@ -146,7 +150,9 @@
   void Update() {}
 
   // Mark all references to the alloc space(s).
-  void MarkReferences();
+  void MarkReferences()
+      EXCLUSIVE_LOCKS_REQUIRED(GlobalSynchronization::heap_bitmap_lock_)
+      SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_);
 
   // Nothing to verify.
   void Verify() {}