Compile less stuff

Don't compile class initializers, compile programs with fewer than
commmand-line specified number of methods, mildly refactor SLOW_MODE,
rename into LIGHT_MODE.

Also, walks the image for uncompiled methods and fixes up with pointers to the
interpreter entry point.

(Removed hot method list and light method limit as these are experimental.)

Change-Id: I2ae33d8add84ab9f4d76f9d910cae422c81a7832
diff --git a/src/class_linker.cc b/src/class_linker.cc
index 4774c63..7dcd511 100644
--- a/src/class_linker.cc
+++ b/src/class_linker.cc
@@ -954,10 +954,11 @@
 
   mirror::ObjectArray<mirror::Class>* class_roots =
       space->GetImageHeader().GetImageRoot(ImageHeader::kClassRoots)->AsObjectArray<mirror::Class>();
+  class_roots_ = class_roots;
 
   // Special case of setting up the String class early so that we can test arbitrary objects
   // as being Strings or not
-  mirror::String::SetClass(class_roots->Get(kJavaLangString));
+  mirror::String::SetClass(GetClassRoot(kJavaLangString));
 
   CHECK_EQ(oat_file->GetOatHeader().GetDexFileCount(),
            static_cast<uint32_t>(dex_caches->GetLength()));
@@ -978,6 +979,11 @@
     AppendToBootClassPath(*dex_file, dex_cache);
   }
 
+  // Set classes on AbstractMethod early so that IsMethod tests can be performed during the live
+  // bitmap walk.
+  mirror::AbstractMethod::SetClasses(GetClassRoot(kJavaLangReflectConstructor),
+                                     GetClassRoot(kJavaLangReflectMethod));
+
   // reinit clases_ table
   {
     ReaderMutexLock mu(self, *Locks::heap_bitmap_lock_);
@@ -994,8 +1000,6 @@
   DCHECK(array_iftable_ == GetClassRoot(kBooleanArrayClass)->GetIfTable());
   // String class root was set above
   mirror::Field::SetClass(GetClassRoot(kJavaLangReflectField));
-  mirror::AbstractMethod::SetClasses(GetClassRoot(kJavaLangReflectConstructor),
-                             GetClassRoot(kJavaLangReflectMethod));
   mirror::BooleanArray::SetArrayClass(GetClassRoot(kBooleanArrayClass));
   mirror::ByteArray::SetArrayClass(GetClassRoot(kByteArrayClass));
   mirror::CharArray::SetArrayClass(GetClassRoot(kCharArrayClass));
@@ -1029,6 +1033,15 @@
     DCHECK(existing == NULL) << kh.GetDescriptor();
     return;
   }
+
+  // Check if object is an uncompiled method and point the to the interpreter entry point.
+  if (obj->IsMethod()) {
+    mirror::AbstractMethod* method = obj->AsMethod();
+    if (method->GetCode() == NULL) {
+      const void* interpreter_entry = GetInterpreterEntryPoint();
+      method->SetCode(interpreter_entry);
+    }
+  }
 }
 
 // Keep in sync with InitCallback. Anything we visit, we need to