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/native/java_lang_Object.cc b/src/native/java_lang_Object.cc
index d6b1bd6..89019f7 100644
--- a/src/native/java_lang_Object.cc
+++ b/src/native/java_lang_Object.cc
@@ -16,31 +16,31 @@
 
 #include "jni_internal.h"
 #include "object.h"
-#include "scoped_jni_thread_state.h"
+#include "scoped_thread_state_change.h"
 
 namespace art {
 
 static jobject Object_internalClone(JNIEnv* env, jobject javaThis) {
-  ScopedJniThreadState ts(env);
-  Object* o = ts.Decode<Object*>(javaThis);
-  return ts.AddLocalReference<jobject>(o->Clone());
+  ScopedObjectAccess soa(env);
+  Object* o = soa.Decode<Object*>(javaThis);
+  return soa.AddLocalReference<jobject>(o->Clone());
 }
 
 static void Object_notify(JNIEnv* env, jobject javaThis) {
-  ScopedJniThreadState ts(env);
-  Object* o = ts.Decode<Object*>(javaThis);
+  ScopedObjectAccess soa(env);
+  Object* o = soa.Decode<Object*>(javaThis);
   o->Notify();
 }
 
 static void Object_notifyAll(JNIEnv* env, jobject javaThis) {
-  ScopedJniThreadState ts(env);
-  Object* o = ts.Decode<Object*>(javaThis);
+  ScopedObjectAccess soa(env);
+  Object* o = soa.Decode<Object*>(javaThis);
   o->NotifyAll();
 }
 
 static void Object_wait(JNIEnv* env, jobject javaThis, jlong ms, jint ns) {
-  ScopedJniThreadState ts(env);
-  Object* o = ts.Decode<Object*>(javaThis);
+  ScopedObjectAccess soa(env);
+  Object* o = soa.Decode<Object*>(javaThis);
   o->Wait(ms, ns);
 }