summaryrefslogtreecommitdiffstats
path: root/runtime/gc
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2014-02-28 15:21:07 +0000
committerNicolas Geoffray <ngeoffray@google.com>2014-03-04 16:30:48 +0000
commit9583fbcf597eff6d0b3c5359b8e8d5f70ed82c40 (patch)
tree847912709f811adda0fa63e89e4bf8af27769f2e /runtime/gc
parent093aad184b4451639951a7e012d9b55cbf8c8a07 (diff)
downloadart-9583fbcf597eff6d0b3c5359b8e8d5f70ed82c40.zip
art-9583fbcf597eff6d0b3c5359b8e8d5f70ed82c40.tar.gz
art-9583fbcf597eff6d0b3c5359b8e8d5f70ed82c40.tar.bz2
Remove oat file location in the image.
The oat file is now always in the same directory, and has the same name as the image file. Only difference is the extension. This also removes the need for host-prefix. Change-Id: I16d1f7aeb1d58372d41921694664e9c321afc1ad
Diffstat (limited to 'runtime/gc')
-rw-r--r--runtime/gc/space/image_space.cc14
-rw-r--r--runtime/gc/space/image_space.h2
2 files changed, 5 insertions, 11 deletions
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index 76c4d25..98d4eef 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -223,7 +223,7 @@ ImageSpace* ImageSpace::Init(const char* image_file_name, bool validate_oat_file
space->VerifyImageAllocations();
}
- space->oat_file_.reset(space->OpenOatFile(error_msg));
+ space->oat_file_.reset(space->OpenOatFile(image_file_name, error_msg));
if (space->oat_file_.get() == nullptr) {
DCHECK(!error_msg->empty());
return nullptr;
@@ -241,16 +241,10 @@ ImageSpace* ImageSpace::Init(const char* image_file_name, bool validate_oat_file
return space.release();
}
-OatFile* ImageSpace::OpenOatFile(std::string* error_msg) const {
- const Runtime* runtime = Runtime::Current();
+OatFile* ImageSpace::OpenOatFile(const char* image_path, std::string* error_msg) const {
const ImageHeader& image_header = GetImageHeader();
- // Grab location but don't use Object::AsString as we haven't yet initialized the roots to
- // check the down cast
- mirror::String* oat_location =
- down_cast<mirror::String*>(image_header.GetImageRoot(ImageHeader::kOatLocation));
- std::string oat_filename;
- oat_filename += runtime->GetHostPrefix();
- oat_filename += oat_location->ToModifiedUtf8();
+ std::string oat_filename = ImageHeader::GetOatLocationFromImageLocation(image_path);
+
OatFile* oat_file = OatFile::Open(oat_filename, oat_filename, image_header.GetOatDataBegin(),
!Runtime::Current()->IsCompiler(), error_msg);
if (oat_file == NULL) {
diff --git a/runtime/gc/space/image_space.h b/runtime/gc/space/image_space.h
index 9e19774..116c498 100644
--- a/runtime/gc/space/image_space.h
+++ b/runtime/gc/space/image_space.h
@@ -86,7 +86,7 @@ class ImageSpace : public MemMapSpace {
static ImageSpace* Init(const char* image, bool validate_oat_file, std::string* error_msg)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- OatFile* OpenOatFile(std::string* error_msg) const
+ OatFile* OpenOatFile(const char* image, std::string* error_msg) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
bool ValidateOatFile(std::string* error_msg) const