diff options
author | Narayan Kamath <narayan@google.com> | 2014-04-23 20:24:57 +0100 |
---|---|---|
committer | Narayan Kamath <narayan@google.com> | 2014-05-01 11:25:07 +0100 |
commit | 11d9f06a96a6909905c248ed684366190140095c (patch) | |
tree | 27b02ab216b98ba1656d66072fd46c5adec61242 /runtime/gc | |
parent | b3016551e5f264264dbb633a1ddf03ac97f9c66c (diff) | |
download | art-11d9f06a96a6909905c248ed684366190140095c.zip art-11d9f06a96a6909905c248ed684366190140095c.tar.gz art-11d9f06a96a6909905c248ed684366190140095c.tar.bz2 |
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
Diffstat (limited to 'runtime/gc')
-rw-r--r-- | runtime/gc/heap.cc | 5 | ||||
-rw-r--r-- | runtime/gc/heap.h | 2 | ||||
-rw-r--r-- | runtime/gc/space/image_space.cc | 8 | ||||
-rw-r--r-- | runtime/gc/space/image_space.h | 8 |
4 files changed, 15 insertions, 8 deletions
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc index 4d074f1..50ef7a6 100644 --- a/runtime/gc/heap.cc +++ b/runtime/gc/heap.cc @@ -89,7 +89,7 @@ static constexpr size_t kNonMovingSpaceCapacity = 64 * MB; Heap::Heap(size_t initial_size, size_t growth_limit, size_t min_free, size_t max_free, double target_utilization, double foreground_heap_growth_multiplier, size_t capacity, - const std::string& image_file_name, + const std::string& image_file_name, const InstructionSet image_instruction_set, CollectorType foreground_collector_type, CollectorType background_collector_type, size_t parallel_gc_threads, size_t conc_gc_threads, bool low_memory_mode, size_t long_pause_log_threshold, size_t long_gc_log_threshold, @@ -186,7 +186,8 @@ Heap::Heap(size_t initial_size, size_t growth_limit, size_t min_free, size_t max // Requested begin for the alloc space, to follow the mapped image and oat files byte* requested_alloc_space_begin = nullptr; if (!image_file_name.empty()) { - space::ImageSpace* image_space = space::ImageSpace::Create(image_file_name.c_str()); + space::ImageSpace* image_space = space::ImageSpace::Create(image_file_name.c_str(), + image_instruction_set); CHECK(image_space != nullptr) << "Failed to create space for " << image_file_name; AddSpace(image_space); // Oat files referenced by image files immediately follow them in memory, ensure alloc space diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h index c631372..5533f3d 100644 --- a/runtime/gc/heap.h +++ b/runtime/gc/heap.h @@ -31,6 +31,7 @@ #include "gc/collector_type.h" #include "globals.h" #include "gtest/gtest.h" +#include "instruction_set.h" #include "jni.h" #include "object_callbacks.h" #include "offsets.h" @@ -140,6 +141,7 @@ class Heap { size_t max_free, double target_utilization, double foreground_heap_growth_multiplier, size_t capacity, const std::string& original_image_file_name, + const InstructionSet image_instruction_set, CollectorType foreground_collector_type, CollectorType background_collector_type, size_t parallel_gc_threads, size_t conc_gc_threads, bool low_memory_mode, size_t long_pause_threshold, size_t long_gc_threshold, 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 @@ static bool GenerateImage(const std::string& image_file_name, std::string* error 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 @@ ImageSpace* ImageSpace::Create(const char* original_image_file_name) { // 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 @@ class ImageSpace : public MemMapSpace { 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. |