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/dex2oat.cc b/src/dex2oat.cc
index f60699c..053575a 100644
--- a/src/dex2oat.cc
+++ b/src/dex2oat.cc
@@ -39,7 +39,7 @@
   // TODO: remove this by making boot image contain boot DexFile information?
   fprintf(stderr,
           "  --boot-dex-file=<dex-file>: specifies a .dex file that is part of the boot\n"
-          "       image specified with --boot. \n"
+          "      image specified with --boot. \n"
           "      Example: --boot-dex-file=/system/framework/core.jar\n"
           "\n");
   fprintf(stderr,
@@ -48,9 +48,19 @@
           "\n");
   fprintf(stderr,
           "  --strip-prefix may be used to strip a path prefix from dex file names in the\n"
-          "       the generated image to match the target file system layout.\n"
+          "      the generated image to match the target file system layout.\n"
           "      Example: --strip-prefix=out/target/product/crespo\n"
           "\n");
+  fprintf(stderr,
+          "  -Xms<n> may be used to specify an initial heap size for the runtime used to\n"
+          "      run dex2oat\n"
+          "      Example: -Xms256m\n"
+          "\n");
+  fprintf(stderr,
+          "  -Xmx<n> may be used to specify a maximum heap size for the runtime used to\n"
+          "      run dex2oat\n"
+          "      Example: -Xmx256m\n"
+          "\n");
   exit(EXIT_FAILURE);
 }
 
@@ -71,6 +81,8 @@
   std::vector<const char*> boot_dex_filenames;
   uintptr_t image_base = 0;
   std::string strip_location_prefix;
+  const char* Xms = NULL;
+  const char* Xmx = NULL;
 
   for (int i = 0; i < argc; i++) {
     const StringPiece option(argv[i]);
@@ -85,7 +97,7 @@
       char* end;
       image_base = strtoul(image_base_str, &end, 16);
       if (end == image_base_str || *end != '\0') {
-        fprintf(stderr, "could not parse hexadecimal value for option %s\n", option.data());
+        fprintf(stderr, "Failed to parse hexadecimal value for option %s\n", option.data());
         usage();
       }
     } else if (option.starts_with("--boot=")) {
@@ -97,6 +109,10 @@
       boot_dex_filenames.push_back(option.substr(strlen("--boot-dex-file=")).data());
     } else if (option.starts_with("--strip-prefix=")) {
       strip_location_prefix = option.substr(strlen("--strip-prefix=")).data();
+    } else if (option.starts_with("-Xms")) {
+      Xms = option.data();
+    } else if (option.starts_with("-Xmx")) {
+      Xmx = option.data();
     } else {
       fprintf(stderr, "unknown argument %s\n", option.data());
       usage();
@@ -138,6 +154,12 @@
     options.push_back(std::make_pair("bootclasspath", &boot_dex_files));
     options.push_back(std::make_pair(boot_image_option.c_str(), reinterpret_cast<void*>(NULL)));
   }
+  if (Xms != NULL) {
+    options.push_back(std::make_pair(Xms, reinterpret_cast<void*>(NULL)));
+  }
+  if (Xmx != NULL) {
+    options.push_back(std::make_pair(Xmx, reinterpret_cast<void*>(NULL)));
+  }
   UniquePtr<Runtime> runtime(Runtime::Create(options, false));
   if (runtime.get() == NULL) {
     fprintf(stderr, "could not create runtime\n");