Use instruction specific dalvik cache dirs.
- All oat & art files are now placed under /data/dalvik-cache/<isa>/.
- GetDalvikCacheOrDie now requires a mandatory subdirectory argument,
and is implicitly rooted under /data/.
- Added helper methods to convert InstructionSet enums into strings
and vice versa.
(cherry picked from commit 2974bc3d8a5d161d449dd66826d668d87bdc3cbe)
Change-Id: Ic7986938e6a7091a2af675ebafec768f7b5fb8cd
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index 91d8820..3de1ba4 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -24,7 +24,6 @@
#include "mirror/object-inl.h"
#include "oat_file.h"
#include "os.h"
-#include "runtime.h"
#include "space-inl.h"
#include "utils.h"
@@ -99,7 +98,8 @@
return Exec(arg_vector, error_msg);
}
-ImageSpace* ImageSpace::Create(const char* original_image_file_name) {
+ImageSpace* ImageSpace::Create(const char* original_image_file_name,
+ const InstructionSet image_isa) {
if (OS::FileExists(original_image_file_name)) {
// If the /system file exists, it should be up-to-date, don't try to generate
std::string error_msg;
@@ -112,7 +112,9 @@
// If the /system file didn't exist, we need to use one from the dalvik-cache.
// If the cache file exists, try to open, but if it fails, regenerate.
// If it does not exist, generate.
- std::string image_file_name(GetDalvikCacheFilenameOrDie(original_image_file_name));
+ const std::string dalvik_cache = GetDalvikCacheOrDie(GetInstructionSetString(image_isa));
+ std::string image_file_name(GetDalvikCacheFilenameOrDie(original_image_file_name,
+ dalvik_cache.c_str()));
std::string error_msg;
if (OS::FileExists(image_file_name.c_str())) {
space::ImageSpace* image_space = ImageSpace::Init(image_file_name.c_str(), true, &error_msg);
diff --git a/runtime/gc/space/image_space.h b/runtime/gc/space/image_space.h
index f6daf89..1652ec9 100644
--- a/runtime/gc/space/image_space.h
+++ b/runtime/gc/space/image_space.h
@@ -18,6 +18,7 @@
#define ART_RUNTIME_GC_SPACE_IMAGE_SPACE_H_
#include "gc/accounting/space_bitmap.h"
+#include "runtime.h"
#include "space.h"
namespace art {
@@ -34,15 +35,16 @@
return kSpaceTypeImageSpace;
}
- // Create a Space from an image file. Cannot be used for future
- // allocation or collected.
+ // Create a Space from an image file for a specified instruction
+ // set. Cannot be used for future allocation or collected.
//
// Create also opens the OatFile associated with the image file so
// that it be contiguously allocated with the image before the
// creation of the alloc space. The ReleaseOatFile will later be
// used to transfer ownership of the OatFile to the ClassLinker when
// it is initialized.
- static ImageSpace* Create(const char* image) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ static ImageSpace* Create(const char* image, const InstructionSet image_isa)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Releases the OatFile from the ImageSpace so it can be transfer to
// the caller, presumably the ClassLinker.