Fix for "Compiler thread shutdown should switch out of VMWAIT"
diff --git a/vm/compiler/Compiler.c b/vm/compiler/Compiler.c
index 39a988d..074830f 100644
--- a/vm/compiler/Compiler.c
+++ b/vm/compiler/Compiler.c
@@ -100,13 +100,14 @@
 
 static void *compilerThreadStart(void *arg)
 {
+    dvmChangeStatus(NULL, THREAD_VMWAIT);
+
     dvmLockMutex(&gDvmJit.compilerLock);
     /*
      * Since the compiler thread will not touch any objects on the heap once
      * being created, we just fake its state as VMWAIT so that it can be a
      * bit late when there is suspend request pending.
      */
-    dvmChangeStatus(NULL, THREAD_VMWAIT);
     while (!gDvmJit.haltCompilerThread) {
         if (workQueueLength() == 0) {
             int cc;
@@ -143,6 +144,13 @@
     pthread_cond_signal(&gDvmJit.compilerQueueEmpty);
     dvmUnlockMutex(&gDvmJit.compilerLock);
 
+    /*
+     * As part of detaching the thread we need to call into Java code to update
+     * the ThreadGroup, and we should not be in VMWAIT state while executing
+     * interpreted code.
+     */
+    dvmChangeStatus(NULL, THREAD_RUNNING);
+
     LOGD("Compiler thread shutting down\n");
     return NULL;
 }