Filling in some Class, Method, and Field native code needed during startup and I/O

Change-Id: Ia2f2a0ec295d1bd848e6f65254bd9fec2fde56f6
diff --git a/src/runtime.cc b/src/runtime.cc
index e0a0b20..b9120fa 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -361,9 +361,20 @@
   // Finish attaching the main thread.
   Thread::Current()->CreatePeer("main", false);
 
+  RunImageClinits();
+
   StartDaemonThreads();
 }
 
+// initialize classes that have instances in the image but that have
+// <clinit> methods so they could not be initialized by the compiler.
+void Runtime::RunImageClinits() {
+  Class* Field_class = class_linker_->FindSystemClass("Ljava/lang/reflect/Field;");
+  CHECK(Field_class->FindDeclaredDirectMethod("<clinit>", "()V") != NULL);
+  class_linker_->EnsureInitialized(Field_class);
+  CHECK(!Thread::Current()->IsExceptionPending());
+}
+
 void Runtime::StartDaemonThreads() {
   signal_catcher_ = new SignalCatcher;
 
@@ -372,8 +383,6 @@
   Method* m = c->FindDirectMethod("start", "()V");
   CHECK(m != NULL);
 //  m->Invoke(Thread::Current(), NULL, NULL, NULL);
-
-  signal_catcher_->HandleSigQuit();
 }
 
 bool Runtime::IsStarted() {
@@ -458,8 +467,8 @@
   //REGISTER(register_java_lang_reflect_AccessibleObject);
   //REGISTER(register_java_lang_reflect_Array);
   //REGISTER(register_java_lang_reflect_Constructor);
-  //REGISTER(register_java_lang_reflect_Field);
-  //REGISTER(register_java_lang_reflect_Method);
+  REGISTER(register_java_lang_reflect_Field);
+  REGISTER(register_java_lang_reflect_Method);
   //REGISTER(register_java_lang_reflect_Proxy);
   REGISTER(register_java_util_concurrent_atomic_AtomicLong);
   //REGISTER(register_org_apache_harmony_dalvik_ddmc_DdmServer);