Shutdown the compiler thread before the dvmSlayDaemons call is made.
diff --git a/vm/Init.c b/vm/Init.c
index d624c23..3663745 100644
--- a/vm/Init.c
+++ b/vm/Init.c
@@ -1540,6 +1540,11 @@
     /* shut down stdout/stderr conversion */
     dvmStdioConverterShutdown();
 
+#ifdef WITH_JIT
+    /* tell the compiler to shut down if it was started */
+    dvmJitShutdown();
+#endif
+
     /*
      * Kill any daemon threads that still exist.  Actively-running threads
      * are likely to crash the process if they continue to execute while
@@ -1549,9 +1554,6 @@
 
     LOGD("VM cleaning up\n");
 
-#ifdef WITH_JIT
-    dvmJitShutdown();
-#endif
     dvmDebuggerShutdown();
     dvmReflectShutdown();
 #ifdef WITH_PROFILER
diff --git a/vm/compiler/Compiler.c b/vm/compiler/Compiler.c
index 0b5c211..9473834 100644
--- a/vm/compiler/Compiler.c
+++ b/vm/compiler/Compiler.c
@@ -144,6 +144,8 @@
     }
     pthread_cond_signal(&gDvmJit.compilerQueueEmpty);
     dvmUnlockMutex(&gDvmJit.compilerLock);
+
+    LOGD("Compiler thread shutting down\n");
     return NULL;
 }
 
@@ -242,6 +244,9 @@
         pthread_cond_signal(&gDvmJit.compilerQueueActivity);
         dvmUnlockMutex(&gDvmJit.compilerLock);
 
-        pthread_join(gDvmJit.compilerHandle, &threadReturn);
+        if (pthread_join(gDvmJit.compilerHandle, &threadReturn) != 0)
+            LOGW("Compiler thread join failed\n");
+        else
+            LOGD("Compiler thread has shut down\n");
     }
 }