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/jni_compiler.cc b/src/jni_compiler.cc
index 9da1ab0..11b99c8 100644
--- a/src/jni_compiler.cc
+++ b/src/jni_compiler.cc
@@ -76,7 +76,9 @@
       jni_stub_ = x86::CreateJniStub();
     }
   }
-  native_method->RegisterNative(jni_stub_->GetData());
+  if (!native_method->IsRegistered()) {
+    native_method->RegisterNative(jni_stub_->GetData());
+  }
   // TODO: Need to make sure that the stub is copied into the image. I.e.,
   // ByteArray* needs to be reachable either as a root or from the object graph.