Working ClassLoader
Change-Id: Ia1122165e47f846a1d4506111849f830d9f14c1b
diff --git a/src/dex2oat.cc b/src/dex2oat.cc
index d5db436..b6a12835 100644
--- a/src/dex2oat.cc
+++ b/src/dex2oat.cc
@@ -124,8 +124,8 @@
return EXIT_FAILURE;
}
- if (image_filename == NULL) {
- fprintf(stderr, "--image file name not specified\n");
+ if (image_filename == NULL && boot_image_option.empty()) {
+ fprintf(stderr, "Either --image or --boot-image must be specified\n");
return EXIT_FAILURE;
}
@@ -190,7 +190,7 @@
for (size_t i = 0; i < dex_files.size(); i++) {
class_linker->RegisterDexFile(*dex_files[i]);
}
- class_loader = PathClassLoader::Alloc(dex_files);
+ class_loader = PathClassLoader::AllocCompileTime(dex_files);
}
// if we loaded an existing image, we will reuse values from the image roots.
@@ -212,7 +212,7 @@
runtime->SetCalleeSaveMethod(runtime->CreateCalleeSaveMethod(kThumb2, type), type);
}
}
- Compiler compiler(kThumb2);
+ Compiler compiler(kThumb2, image_filename != NULL);
if (method_names.empty()) {
compiler.CompileAll(class_loader);
} else {
@@ -263,6 +263,11 @@
return EXIT_FAILURE;
}
+ if (image_filename == NULL) {
+ return EXIT_SUCCESS;
+ }
+ CHECK(compiler.IsImage());
+
ImageWriter image_writer;
if (!image_writer.Write(image_filename, image_base, oat_filename, host_prefix)) {
fprintf(stderr, "Failed to create image file %s\n", image_filename);