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);