Dex2oat support for multiple oat file and image file outputs.
Multiple changes to dex2oat and the runtime to support a --multi-image
option. This generates a separate oat file and image file output for
each dex file input.
Change-Id: Ie1d6f0b8afa8aed5790065b8c2eb177990c60129
diff --git a/runtime/oat_file_assistant.cc b/runtime/oat_file_assistant.cc
index 0f3a013..cb80cc9 100644
--- a/runtime/oat_file_assistant.cc
+++ b/runtime/oat_file_assistant.cc
@@ -846,11 +846,7 @@
std::string OatFileAssistant::ImageLocation() {
Runtime* runtime = Runtime::Current();
- const gc::space::ImageSpace* image_space = runtime->GetHeap()->GetBootImageSpace();
- if (image_space == nullptr) {
- return "";
- }
- return image_space->GetImageLocation();
+ return runtime->GetHeap()->GetBootImageSpaces()[0]->GetImageLocation();
}
const uint32_t* OatFileAssistant::GetRequiredDexChecksum() {
@@ -949,12 +945,13 @@
image_info_load_attempted_ = true;
Runtime* runtime = Runtime::Current();
- const gc::space::ImageSpace* image_space = runtime->GetHeap()->GetBootImageSpace();
- if (image_space != nullptr) {
- cached_image_info_.location = image_space->GetImageLocation();
+ std::vector<gc::space::ImageSpace*> image_spaces = runtime->GetHeap()->GetBootImageSpaces();
+ if (!image_spaces.empty()) {
+ // TODO: Better support multi-images? b/26317072
+ cached_image_info_.location = image_spaces[0]->GetImageLocation();
if (isa_ == kRuntimeISA) {
- const ImageHeader& image_header = image_space->GetImageHeader();
+ const ImageHeader& image_header = image_spaces[0]->GetImageHeader();
cached_image_info_.oat_checksum = image_header.GetOatChecksum();
cached_image_info_.oat_data_begin = reinterpret_cast<uintptr_t>(
image_header.GetOatDataBegin());
@@ -969,7 +966,7 @@
cached_image_info_.patch_delta = image_header->GetPatchDelta();
}
}
- image_info_load_succeeded_ = (image_space != nullptr);
+ image_info_load_succeeded_ = (!image_spaces.empty());
}
return image_info_load_succeeded_ ? &cached_image_info_ : nullptr;
}