diff options
author | Mathieu Chartier <mathieuc@google.com> | 2016-09-21 15:24:18 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2016-09-21 17:18:55 -0700 |
commit | 25adcfb7dc81131add3a0a681ae18bced6f7a0e0 (patch) | |
tree | 0363b16ef6bc17a35a89419e3c693b3b89c31a27 /dex2oat/dex2oat.cc | |
parent | 949ce9c1daa2aec83ad4d90d42d2d449141886eb (diff) | |
download | android_art-25adcfb7dc81131add3a0a681ae18bced6f7a0e0.tar.gz android_art-25adcfb7dc81131add3a0a681ae18bced6f7a0e0.tar.bz2 android_art-25adcfb7dc81131add3a0a681ae18bced6f7a0e0.zip |
Make image test multi image
Required for testing multi image layout in future CLs.
Bug: 28640955
Test: clean-oat-hos, test-art-host, device booting
Change-Id: I14809f56e711b4a87e01056c327eddbbd087f4ee
Diffstat (limited to 'dex2oat/dex2oat.cc')
-rw-r--r-- | dex2oat/dex2oat.cc | 48 |
1 files changed, 4 insertions, 44 deletions
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc index cfb905ba3b..729d712a54 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -1329,7 +1329,10 @@ class Dex2Oat FINAL { if (IsBootImage() && image_filenames_.size() > 1) { // If we're compiling the boot image, store the boot classpath into the Key-Value store. // We need this for the multi-image case. - key_value_store_->Put(OatHeader::kBootClassPathKey, GetMultiImageBootClassPath()); + key_value_store_->Put(OatHeader::kBootClassPathKey, + gc::space::ImageSpace::GetMultiImageBootClassPath(dex_locations_, + oat_filenames_, + image_filenames_)); } if (!IsBootImage()) { @@ -1960,49 +1963,6 @@ class Dex2Oat FINAL { return result; } - std::string GetMultiImageBootClassPath() { - DCHECK(IsBootImage()); - DCHECK_GT(oat_filenames_.size(), 1u); - // If the image filename was adapted (e.g., for our tests), we need to change this here, - // too, but need to strip all path components (they will be re-established when loading). - std::ostringstream bootcp_oss; - bool first_bootcp = true; - for (size_t i = 0; i < dex_locations_.size(); ++i) { - if (!first_bootcp) { - bootcp_oss << ":"; - } - - std::string dex_loc = dex_locations_[i]; - std::string image_filename = image_filenames_[i]; - - // Use the dex_loc path, but the image_filename name (without path elements). - size_t dex_last_slash = dex_loc.rfind('/'); - - // npos is max(size_t). That makes this a bit ugly. - size_t image_last_slash = image_filename.rfind('/'); - size_t image_last_at = image_filename.rfind('@'); - size_t image_last_sep = (image_last_slash == std::string::npos) - ? image_last_at - : (image_last_at == std::string::npos) - ? std::string::npos - : std::max(image_last_slash, image_last_at); - // Note: whenever image_last_sep == npos, +1 overflow means using the full string. - - if (dex_last_slash == std::string::npos) { - dex_loc = image_filename.substr(image_last_sep + 1); - } else { - dex_loc = dex_loc.substr(0, dex_last_slash + 1) + - image_filename.substr(image_last_sep + 1); - } - - // Image filenames already end with .art, no need to replace. - - bootcp_oss << dex_loc; - first_bootcp = false; - } - return bootcp_oss.str(); - } - std::vector<std::string> GetClassPathLocations(const std::string& class_path) { // This function is used only for apps and for an app we have exactly one oat file. DCHECK(!IsBootImage()); |