Various things.

This patch:

1. adds good-enough implementations for a couple of Class native methods we
need.

2. removes a fixed TODO from image_test.

3. adds missing null checks to the Thread native methods, and forwards
Thread.nativeCreate to Thread::Create.

4. stops jni_compiler from overwriting already-registered native methods
with the dynamic lookup stub.

5. adds workarounds to Thread::CreatePeer so we can cope better without
code, attempts to initialize thread groups correctly, dumps thread state
from the managed peer (where one exists), and implements Thread::DumpStack
for debugging (and SIGQUIT dumps).

Change-Id: I3281226dd22ec852dca5165748fc75a254904ac0
diff --git a/src/thread.h b/src/thread.h
index ed4b1e4..9717a7c 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -208,11 +208,11 @@
   class StackVisitor {
    public:
     virtual ~StackVisitor() {}
-    virtual bool VisitFrame(const Frame& frame) = 0;
+    virtual void VisitFrame(const Frame& frame) = 0;
   };
 
   // Creates a new thread.
-  static Thread* Create(const Runtime* runtime);
+  static void Create(Object* peer, size_t stack_size);
 
   // Creates a new thread from the calling thread.
   static Thread* Attach(const Runtime* runtime, const char* name, bool as_daemon);
@@ -274,7 +274,7 @@
     return pthread_;
   }
 
-  jobject GetPeer() const {
+  Object* GetPeer() const {
     return peer_;
   }
 
@@ -495,10 +495,8 @@
   // Native thread handle.
   pthread_t pthread_;
 
-  bool is_daemon_;
-
   // Our managed peer (an instance of java.lang.Thread).
-  jobject peer_;
+  Object* peer_;
 
   // Guards the 'interrupted_' and 'wait_monitor_' members.
   mutable Mutex wait_mutex_;