Tighten the safe points for code cache resets to happen.

Add a new flag in the Thread struct to track the whereabout of the top frame
in each Java thread. It is not safe to blow away the code cache if any thread
is in the JIT'ed land.
diff --git a/vm/Thread.h b/vm/Thread.h
index a6ad832..5e0ad4d 100644
--- a/vm/Thread.h
+++ b/vm/Thread.h
@@ -157,6 +157,16 @@
     /* internal reference tracking */
     ReferenceTable  internalLocalRefTable;
 
+#if defined(WITH_JIT)
+    /*
+     * Whether the current top VM frame is in the interpreter or JIT cache:
+     *   NULL    : in the interpreter
+     *   non-NULL: entry address of the JIT'ed code (the actual value doesn't
+     *             matter)
+     */
+    void*       inJitCodeCache;
+#endif
+
     /* JNI local reference tracking */
 #ifdef USE_INDIRECT_REF
     IndirectRefTable jniLocalRefTable;
@@ -426,6 +436,11 @@
 char* dvmGetThreadName(Thread* thread);
 
 /*
+ * Convert ThreadStatus to a string.
+ */
+const char* dvmGetThreadStatusStr(ThreadStatus status);
+
+/*
  * Return true if a thread is on the internal list.  If it is, the
  * thread is part of the GC's root set.
  */