Adding oat_process

- Added oat_process, a version of app_process use to launch frameworks apps
- Added liboat_runtime, a version of libandroid_runtime that uses art instead of dvm
  This is just a special makefile, frameworks/base/core/jni code is used for source
- Added support for build a boot.oat with the full BOOTCLASSPATH
  The older smaller boat.oat is now core.oat
- Added mem_map code for making sure a requested memory region is available
  Moved mem_map code to cc file to make easier to debug with smaller rebuild
- Moved oat base address to 0x6000000 as a work around to host addres conflict
- Added -Xms and -Xmx options to dex2oat to allow build specific memory options
- Fixed miranda method initialization problem found compiling full bootclasspath
- Made compiler.cc tolerant of verification errors found compiling full bootclasspath
- Bumped arena block alloc warning to avoid noise when compiling full bootclasspath
- Marked implicit GC unimplemented to fail fast
- Added --output argument to oatdump
- Made many object asserts tolerate access in IsErroneous state
  now that verifier is failing validation of some classes during compilation
- Made runtime tolerate unknown access as short term solution for oat_process
- Workaround SSA issue to restore full bootclasspath compilation
- Added test-art-target-processs to excercise oat_process with "am"
  "am" found bug where class_linker was using Method::GetClass and not ::GetDeclaringClass

Change-Id: I1a645a142b163e06bab9e72eb094ae1f1dbfbd97
diff --git a/src/class_linker.cc b/src/class_linker.cc
index de70fa5..a9c2005 100644
--- a/src/class_linker.cc
+++ b/src/class_linker.cc
@@ -657,7 +657,7 @@
 
   Thread* self = Thread::Current();
   DCHECK(self != NULL);
-  CHECK(!self->IsExceptionPending());
+  CHECK(!self->IsExceptionPending()) << PrettyTypeOf(self->GetException());
   // Find the class in the loaded classes table.
   Class* klass = LookupClass(descriptor, class_loader);
   if (klass == NULL) {
@@ -701,7 +701,6 @@
       LoadClass(dex_file, dex_class_def, klass, class_loader);
       // Check for a pending exception during load
       if (self->IsExceptionPending()) {
-        // TODO: free native allocations in klass
         return NULL;
       }
       ObjectLock lock(klass);
@@ -711,7 +710,6 @@
       if (!success) {
         // We may fail to insert if we raced with another thread.
         klass->SetClinitThreadId(0);
-        // TODO: free native allocations in klass
         klass = LookupClass(descriptor, class_loader);
         CHECK(klass != NULL);
         return klass;
@@ -1230,7 +1228,12 @@
     LOG(ERROR) << "Verification failed on class "
                << klass->GetDescriptor()->ToModifiedUtf8();
     Object* exception = Thread::Current()->GetException();
-    klass->SetVerifyErrorClass(exception->GetClass());
+    // CHECK(exception != NULL) << PrettyClass(klass);
+    if (exception == NULL) {
+      UNIMPLEMENTED(ERROR) << "null verification exception for " << PrettyClass(klass);
+    } else {
+      klass->SetVerifyErrorClass(exception->GetClass());
+    }
     klass->SetStatus(Class::kStatusError);
     return;
   }
@@ -1381,7 +1384,7 @@
       for (size_t j = 0; j < interface->NumVirtualMethods(); ++j) {
         const Method* method = interface_entry->GetMethodArray()->Get(j);
         if (!HasSameMethodDescriptorClasses(method, interface,
-                                            method->GetClass())) {
+                                            method->GetDeclaringClass())) {
           ThrowLinkageError("Classes resolve differently in interface");
           return false;
         }
@@ -1394,7 +1397,7 @@
 bool ClassLinker::HasSameMethodDescriptorClasses(const Method* method,
                                                  const Class* klass1,
                                                  const Class* klass2) {
-  const DexFile& dex_file = FindDexFile(method->GetClass()->GetDexCache());
+  const DexFile& dex_file = FindDexFile(method->GetDeclaringClass()->GetDexCache());
   const DexFile::ProtoId& proto_id = dex_file.GetProtoId(method->GetProtoIdx());
   DexFile::ParameterIterator *it;
   for (it = dex_file.GetParameterIterator(proto_id); it->HasNext(); it->Next()) {
@@ -1865,8 +1868,9 @@
   if (miranda_count != 0) {
     int old_method_count = klass->NumVirtualMethods();
     int new_method_count = old_method_count + miranda_count;
-    klass->SetVirtualMethods(
-        klass->GetVirtualMethods()->CopyOf(new_method_count));
+    klass->SetVirtualMethods((old_method_count == 0)
+                             ? AllocObjectArray<Method>(new_method_count)
+                             : klass->GetVirtualMethods()->CopyOf(new_method_count));
 
     ObjectArray<Method>* vtable = klass->GetVTableDuringLinking();
     CHECK(vtable != NULL);