Jit: fix for 2483131 - VM daemon thread shutdown with JIT enabled

As part of shutdown, the Jit needs to unchain all translations so that
they can respond to suspend requests.  This change introduces a
dvmJitUnchainAll() into shutdown, and also removes some previous
housecleaning that freed our key tables.  We can't actually free those
because suspended threads in the process of shutting down may hold
references.

Change-Id: I7aad332e7195a94970c25a25b2d9fda5607bec08
diff --git a/vm/compiler/Compiler.c b/vm/compiler/Compiler.c
index 597fbb2..e9b30de 100644
--- a/vm/compiler/Compiler.c
+++ b/vm/compiler/Compiler.c
@@ -544,6 +544,10 @@
 {
     void *threadReturn;
 
+    /* Disable new translation requests */
+    gDvmJit.pProfTable = NULL;
+    gDvmJit.pProfTableCopy = NULL;
+
     if (gDvm.verboseShutdown) {
         dvmCompilerDumpStats();
         while (gDvmJit.compilerQueueLength)
@@ -564,20 +568,16 @@
             LOGD("Compiler thread has shut down\n");
     }
 
-    dvmDestroyMutex(&gDvmJit.tableLock);
-    dvmDestroyMutex(&gDvmJit.compilerLock);
-    dvmDestroyMutex(&gDvmJit.compilerICPatchLock);
+    /* Break loops within the translation cache */
+    dvmJitUnchainAll();
 
-    if (gDvmJit.pJitEntryTable) {
-        free(gDvmJit.pJitEntryTable);
-        gDvmJit.pJitEntryTable = NULL;
-    }
-
-    if (gDvmJit.pProfTable) {
-        free(gDvmJit.pProfTable);
-        gDvmJit.pProfTable = NULL;
-    }
-
+    /*
+     * NOTE: our current implementatation doesn't allow for the compiler
+     * thread to be restarted after it exits here.  We aren't freeing
+     * the JitTable or the ProfTable because threads which still may be
+     * running or in the process of shutting down may hold references to
+     * them.
+     */
 }
 
 void dvmCompilerStateRefresh()