Move thread state to art::Atomic.

Leaves the CAS operations as relaxed although art::Atomic treats relaxed CAS
as a strong CAS when not compiling with clang.

Change-Id: I6d37c22173540d166b624385e52e4ad05e592adc
diff --git a/runtime/thread.h b/runtime/thread.h
index 7cd86de..0640b38 100644
--- a/runtime/thread.h
+++ b/runtime/thread.h
@@ -24,6 +24,7 @@
 #include <memory>
 #include <string>
 
+#include "atomic.h"
 #include "base/macros.h"
 #include "base/mutex.h"
 #include "entrypoints/interpreter/interpreter_entrypoints.h"
@@ -864,6 +865,7 @@
       // change to Runnable as a GC or other operation is in progress.
       volatile uint16_t state;
     } as_struct;
+    AtomicInteger as_atomic_int;
     volatile int32_t as_int;
 
    private:
@@ -871,6 +873,7 @@
     // See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47409
     DISALLOW_COPY_AND_ASSIGN(StateAndFlags);
   };
+  COMPILE_ASSERT(sizeof(StateAndFlags) == sizeof(int32_t), weird_state_and_flags_size);
 
   static void ThreadExitCallback(void* arg);