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/instruction_set.cc b/runtime/instruction_set.cc
index 73d4279..cbcd2e0 100644
--- a/runtime/instruction_set.cc
+++ b/runtime/instruction_set.cc
@@ -21,6 +21,48 @@
namespace art {
+const char* GetInstructionSetString(const InstructionSet isa) {
+ switch (isa) {
+ case kArm:
+ case kThumb2:
+ return "arm";
+ case kArm64:
+ return "arm64";
+ case kX86:
+ return "x86";
+ case kX86_64:
+ return "x86_64";
+ case kMips:
+ return "mips";
+ case kNone:
+ return "none";
+ default:
+ LOG(FATAL) << "Unknown ISA " << isa;
+ return nullptr;
+ }
+}
+
+InstructionSet GetInstructionSetFromString(const char* isa_str) {
+ CHECK(isa_str != nullptr);
+
+ if (!strcmp("arm", isa_str)) {
+ return kArm;
+ } else if (!strcmp("arm64", isa_str)) {
+ return kArm64;
+ } else if (!strcmp("x86", isa_str)) {
+ return kX86;
+ } else if (!strcmp("x86_64", isa_str)) {
+ return kX86_64;
+ } else if (!strcmp("mips", isa_str)) {
+ return kMips;
+ } else if (!strcmp("none", isa_str)) {
+ return kNone;
+ }
+
+ LOG(FATAL) << "Unknown ISA " << isa_str;
+ return kNone;
+}
+
size_t GetInstructionSetPointerSize(InstructionSet isa) {
switch (isa) {
case kArm: