Support compiler filters for boot classpath

image_writer.cc
  Remove assumption that all methods in the boot classpath are compiled

oat_writer.cc
  Don't skip writing ArtMethod::quick_code_offset_ for methods that need resolution, leave that to ImageWriter

dex2oat.cc
  Allow dex2dex compilation of image dex files by making the in memory pages writable in all cases, not just app case.

oatdump.cc
  dump new OatHeader fields
  use ImageSpace.GetImageFilename, not command line image filename, since location may be in dalvik-cache
  remove inaccurate check about non-null GC map

quick_trampoline_entrypoints.cc
  add and improve some DCHECKS that were useful while debugging

class_linker.cc
image_space.cc
  fix double facepalm

parsed_options.cc
  fix zygote logging to not skip values to two part options like -classpath <foo>

runtime.cc
  wireup parsed compiler options to runtime

Change-Id: Iad314df0b80623c0663d61713d5098297ab9ac87
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index e5ca721..7e43994 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -581,7 +581,7 @@
   argv.push_back(oat_fd_option);
   argv.push_back(oat_location_option);
   const std::vector<std::string>& compiler_options = Runtime::Current()->GetCompilerOptions();
-  for (size_t i = 0; compiler_options.size(); ++i) {
+  for (size_t i = 0; i < compiler_options.size(); ++i) {
     argv.push_back(compiler_options[i].c_str());
   }
 
diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
index ef40be8..63e0d42 100644
--- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
@@ -485,9 +485,11 @@
     ThrowAbstractMethodError(method);
     return 0;
   } else {
+    DCHECK(!method->IsNative()) << PrettyMethod(method);
     const char* old_cause = self->StartAssertNoThreadSuspension("Building interpreter shadow frame");
     MethodHelper mh(method);
     const DexFile::CodeItem* code_item = mh.GetCodeItem();
+    DCHECK(code_item != nullptr) << PrettyMethod(method);
     uint16_t num_regs = code_item->registers_size_;
     void* memory = alloca(ShadowFrame::ComputeSize(num_regs));
     ShadowFrame* shadow_frame(ShadowFrame::Create(num_regs, NULL,  // No last shadow coming from quick.
@@ -507,7 +509,7 @@
       // Ensure static method's class is initialized.
       SirtRef<mirror::Class> sirt_c(self, method->GetDeclaringClass());
       if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(sirt_c, true, true)) {
-        DCHECK(Thread::Current()->IsExceptionPending());
+        DCHECK(Thread::Current()->IsExceptionPending()) << PrettyMethod(method);
         self->PopManagedStackFragment(fragment);
         return 0;
       }
@@ -766,7 +768,8 @@
   const void* code = NULL;
   if (LIKELY(!thread->IsExceptionPending())) {
     // Incompatible class change should have been handled in resolve method.
-    CHECK(!called->CheckIncompatibleClassChange(invoke_type));
+    CHECK(!called->CheckIncompatibleClassChange(invoke_type))
+        << PrettyMethod(called) << " " << invoke_type;
     if (virtual_or_interface) {
       // Refine called method based on receiver.
       CHECK(receiver != nullptr) << invoke_type;
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index 98d4eef..8426fab 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -87,7 +87,7 @@
   }
 
   const std::vector<std::string>& compiler_options = Runtime::Current()->GetImageCompilerOptions();
-  for (size_t i = 0; compiler_options.size(); ++i) {
+  for (size_t i = 0; i < compiler_options.size(); ++i) {
     arg_vector.push_back(compiler_options[i].c_str());
   }
 
diff --git a/runtime/parsed_options.cc b/runtime/parsed_options.cc
index 765074a..b6f36b6 100644
--- a/runtime/parsed_options.cc
+++ b/runtime/parsed_options.cc
@@ -186,10 +186,12 @@
   profile_clock_source_ = kDefaultProfilerClockSource;
 
   for (size_t i = 0; i < options.size(); ++i) {
-    const std::string option(options[i].first);
     if (true && options[0].first == "-Xzygote") {
-      LOG(INFO) << "option[" << i << "]=" << option;
+      LOG(INFO) << "option[" << i << "]=" << options[i].first;
     }
+  }
+  for (size_t i = 0; i < options.size(); ++i) {
+    const std::string option(options[i].first);
     if (StartsWith(option, "-help")) {
       Usage(nullptr);
       return false;
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 7546729..de06fb8 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -490,6 +490,9 @@
   default_stack_size_ = options->stack_size_;
   stack_trace_file_ = options->stack_trace_file_;
 
+  compiler_options_ = options->compiler_options_;
+  image_compiler_options_ = options->image_compiler_options_;
+
   max_spins_before_thin_lock_inflation_ = options->max_spins_before_thin_lock_inflation_;
 
   monitor_list_ = new MonitorList;