Moved the context class loader init down a bit to ensure proper init.

Since we're executing interpreted code it's best if we set the context
class loader as late as possible in this function.  I also updated a few
comments while I was in there.
diff --git a/vm/Thread.c b/vm/Thread.c
index b2753f0..acfc7a9 100644
--- a/vm/Thread.c
+++ b/vm/Thread.c
@@ -627,6 +627,7 @@
 /*
  * Finish preparing the main thread, allocating some objects to represent
  * it.  As part of doing so, we finish initializing Thread and ThreadGroup.
+ * This will execute some interpreted code (e.g. class initializers).
  */
 bool dvmPrepMainThread(void)
 {
@@ -691,22 +692,6 @@
     }
 
     /*
-     * Set the context class loader.
-     */
-    Object* systemLoader = dvmGetSystemClassLoader();
-    if (systemLoader == NULL) {
-        LOGW("WARNING: system class loader is NULL (setting main ctxt)\n");
-        /* keep going */
-    }
-    int ctxtClassLoaderOffset = dvmFindFieldOffset(gDvm.classJavaLangThread,
-        "contextClassLoader", "Ljava/lang/ClassLoader;");
-    if (ctxtClassLoaderOffset < 0) {
-        LOGE("Unable to find contextClassLoader field in Thread\n");
-        return false;
-    }
-    dvmSetFieldObject(threadObj, ctxtClassLoaderOffset, systemLoader);
-
-    /*
      * Allocate and construct a VMThread.
      */
     vmThreadObj = dvmAllocObject(gDvm.classJavaLangVMThread, ALLOC_DEFAULT);
@@ -730,7 +715,8 @@
 
     /*
      * Stuff the VMThread back into the Thread.  From this point on, other
-     * Threads will see that this Thread is running.
+     * Threads will see that this Thread is running (at least, they would,
+     * if there were any).
      */
     dvmSetFieldObject(threadObj, gDvm.offJavaLangThread_vmThread,
         vmThreadObj);
@@ -738,6 +724,24 @@
     thread->threadObj = threadObj;
 
     /*
+     * Set the context class loader.  This invokes a ClassLoader method,
+     * which could conceivably call Thread.currentThread(), so we want the
+     * Thread to be fully configured before we do this.
+     */
+    Object* systemLoader = dvmGetSystemClassLoader();
+    if (systemLoader == NULL) {
+        LOGW("WARNING: system class loader is NULL (setting main ctxt)\n");
+        /* keep going */
+    }
+    int ctxtClassLoaderOffset = dvmFindFieldOffset(gDvm.classJavaLangThread,
+        "contextClassLoader", "Ljava/lang/ClassLoader;");
+    if (ctxtClassLoaderOffset < 0) {
+        LOGE("Unable to find contextClassLoader field in Thread\n");
+        return false;
+    }
+    dvmSetFieldObject(threadObj, ctxtClassLoaderOffset, systemLoader);
+
+    /*
      * Finish our thread prep.
      */