Move thread flags and state into 32bits.

We need to ensure that transitions to Runnable are atomic wrt to a
thread modifying the suspend count. Currently this is achieved by
holding the thread_suspend_count_lock_. This change creates a set of bit
flags that summarize that the suspend_count_ is raised and also others
flags that signify the managed code should go into a slow path.

The effect of this change are two-fold:
1) transitions from suspended to runnable can CAS the thread state
rather than holding the suspend_count_lock_. This will make JNI
transitions cheaper.
2) the exception/suspend/interpreter poll needed for shadow frames can
be rolled into a single compare of the bit fields against 0.

Change-Id: I589f84e3dca396c3db448bf32d814565acf3d11f
diff --git a/src/oat/runtime/mips/oat_support_entrypoints_mips.cc b/src/oat/runtime/mips/oat_support_entrypoints_mips.cc
index e39ec81..334ca95 100644
--- a/src/oat/runtime/mips/oat_support_entrypoints_mips.cc
+++ b/src/oat/runtime/mips/oat_support_entrypoints_mips.cc
@@ -42,6 +42,9 @@
 extern "C" void* art_initialize_type_and_verify_access_from_code(uint32_t, void*);
 extern "C" void* art_resolve_string_from_code(void*, uint32_t);
 
+// Exception entrypoints.
+extern "C" void* GetAndClearException(Thread*);
+
 // Field entrypoints.
 extern "C" int art_set32_instance_from_code(uint32_t, void*, int32_t);
 extern "C" int art_set32_static_from_code(uint32_t, int32_t);
@@ -171,6 +174,9 @@
   points->pInitializeTypeFromCode = art_initialize_type_from_code;
   points->pResolveStringFromCode = art_resolve_string_from_code;
 
+  // Exceptions
+  points->pGetAndClearException = GetAndClearException;
+
   // Field
   points->pSet32Instance = art_set32_instance_from_code;
   points->pSet32Static = art_set32_static_from_code;
diff --git a/src/oat/runtime/mips/runtime_support_mips.S b/src/oat/runtime/mips/runtime_support_mips.S
index ec9d269..6946825 100644
--- a/src/oat/runtime/mips/runtime_support_mips.S
+++ b/src/oat/runtime/mips/runtime_support_mips.S
@@ -787,7 +787,7 @@
      */
     ALIGN_FUNCTION_ENTRY
 art_test_suspend:
-    lw     $a0, THREAD_SUSPEND_COUNT_OFFSET(rSELF)
+    lh     $a0, THREAD_FLAGS_OFFSET(rSELF)
     bnez   $a0, 1f
     addi  rSUSPEND, $zero, SUSPEND_CHECK_INTERVAL   # reset rSUSPEND to SUSPEND_CHECK_INTERVAL
     jr     $ra