Merge "Changes for vogar compatibility"
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 547b9f7..55ba643 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -377,8 +377,10 @@
   compiler_->Init();
 
   CHECK(!Runtime::Current()->IsStarted());
-  if (!image_) {
-    CHECK(image_classes_.get() == NULL);
+  if (image_) {
+    CHECK(image_classes_.get() != nullptr);
+  } else {
+    CHECK(image_classes_.get() == nullptr);
   }
 
   // Are we generating CFI information?
@@ -592,7 +594,7 @@
                              ThreadPool* thread_pool, TimingLogger* timings) {
   for (size_t i = 0; i != dex_files.size(); ++i) {
     const DexFile* dex_file = dex_files[i];
-    CHECK(dex_file != NULL);
+    CHECK(dex_file != nullptr);
     ResolveDexFile(class_loader, *dex_file, thread_pool, timings);
   }
 }
@@ -690,6 +692,7 @@
 // Make a list of descriptors for classes to include in the image
 void CompilerDriver::LoadImageClasses(TimingLogger* timings)
       LOCKS_EXCLUDED(Locks::mutator_lock_) {
+  CHECK(timings != nullptr);
   if (!IsImage()) {
     return;
   }
@@ -699,6 +702,7 @@
   Thread* self = Thread::Current();
   ScopedObjectAccess soa(self);
   ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
+  CHECK(image_classes_.get() != nullptr);
   for (auto it = image_classes_->begin(), end = image_classes_->end(); it != end;) {
     const std::string& descriptor(*it);
     StackHandleScope<1> hs(self);
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index cea86ae..3c1889d 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -1139,21 +1139,23 @@
   WellKnownClasses::Init(self->GetJniEnv());
 
   // If --image-classes was specified, calculate the full list of classes to include in the image
-  UniquePtr<CompilerDriver::DescriptorSet> image_classes(NULL);
-  if (image_classes_filename != NULL) {
+  UniquePtr<CompilerDriver::DescriptorSet> image_classes(nullptr);
+  if (image_classes_filename != nullptr) {
     std::string error_msg;
-    if (image_classes_zip_filename != NULL) {
+    if (image_classes_zip_filename != nullptr) {
       image_classes.reset(dex2oat->ReadImageClassesFromZip(image_classes_zip_filename,
                                                            image_classes_filename,
                                                            &error_msg));
     } else {
       image_classes.reset(dex2oat->ReadImageClassesFromFile(image_classes_filename));
     }
-    if (image_classes.get() == NULL) {
+    if (image_classes.get() == nullptr) {
       LOG(ERROR) << "Failed to create list of image classes from '" << image_classes_filename <<
           "': " << error_msg;
       return EXIT_FAILURE;
     }
+  } else if (image) {
+    image_classes.reset(new CompilerDriver::DescriptorSet);
   }
 
   std::vector<const DexFile*> dex_files;
diff --git a/runtime/parsed_options.cc b/runtime/parsed_options.cc
index 8c18dff..623b0c6 100644
--- a/runtime/parsed_options.cc
+++ b/runtime/parsed_options.cc
@@ -674,10 +674,17 @@
   // the art specific version. This can happen with on device
   // boot.art/boot.oat generation by GenerateImage which relies on the
   // value of BOOTCLASSPATH.
+#if defined(ART_TARGET)
   std::string core_jar("/core.jar");
+  std::string core_libart_jar("/core-libart.jar");
+#else
+  // The host uses hostdex files.
+  std::string core_jar("/core-hostdex.jar");
+  std::string core_libart_jar("/core-libart-hostdex.jar");
+#endif
   size_t core_jar_pos = boot_class_path_string_.find(core_jar);
   if (core_jar_pos != std::string::npos) {
-    boot_class_path_string_.replace(core_jar_pos, core_jar.size(), "/core-libart.jar");
+    boot_class_path_string_.replace(core_jar_pos, core_jar.size(), core_libart_jar);
   }
 
   if (compiler_callbacks_ == nullptr && image_.empty()) {