Fix interpreter debug attach

Fix a few miscellaneous bugs from the interpreter restructuring that were
causing a segfault on debugger attach.

Added a sanity checking routine for debugging.

Fixed a problem in which the JIT's threshold and on/off switch
wouldn't get initialized properly on thread creation.

Renamed dvmCompilerStateRefresh() to dvmCompilerUpdateGlobalState() to
better reflect its function.

Change-Id: I5b8af1ce2175e3c6f53cda19dd8e052a5f355587
diff --git a/vm/interp/Jit.c b/vm/interp/Jit.c
index 0274a24..936bbc8 100644
--- a/vm/interp/Jit.c
+++ b/vm/interp/Jit.c
@@ -440,7 +440,7 @@
      * free it because some thread may be holding a reference.
      */
     gDvmJit.pProfTable = NULL;
-    dvmJitUpdateState();
+    dvmJitUpdateThreadStateAll();
 }
 
 #if defined(WITH_JIT_TUNING)
@@ -1479,18 +1479,26 @@
 }
 
 /*
+ * Update JIT-specific info in Thread structure for a single thread
+ */
+void dvmJitUpdateThreadStateSingle(Thread* thread)
+{
+    thread->pJitProfTable = gDvmJit.pProfTable;
+    thread->jitThreshold = gDvmJit.threshold;
+}
+
+/*
  * Walk through the thread list and refresh all local copies of
  * JIT global state (which was placed there for fast access).
  */
-void dvmJitUpdateState()
+void dvmJitUpdateThreadStateAll()
 {
     Thread* self = dvmThreadSelf();
     Thread* thread;
 
     dvmLockThreadList(self);
     for (thread = gDvm.threadList; thread != NULL; thread = thread->next) {
-        thread->pJitProfTable = gDvmJit.pProfTable;
-        thread->jitThreshold = gDvmJit.threshold;
+        dvmJitUpdateThreadStateSingle(thread);
     }
     dvmUnlockThreadList();