diff options
author | Narayan Kamath <narayan@google.com> | 2014-04-16 11:19:57 +0100 |
---|---|---|
committer | Narayan Kamath <narayan@google.com> | 2014-05-01 11:19:48 +0100 |
commit | a607cc9c4cd4e21df39e549c14dac81c5cd18922 (patch) | |
tree | bee44f9f73302ad391f1f6ea092acc33407638ea /libart/src/main/java/dalvik | |
parent | 68a60cd947d394b27d9d44a72d95de8d4448ef32 (diff) | |
download | libcore-a607cc9c4cd4e21df39e549c14dac81c5cd18922.zip libcore-a607cc9c4cd4e21df39e549c14dac81c5cd18922.tar.gz libcore-a607cc9c4cd4e21df39e549c14dac81c5cd18922.tar.bz2 |
Add a mapping between ABIs and instruction sets.
Bridges the android ABI lists (TARGET_CPU_ABI, TARGET_CPU_ABI2
from the BoardConfig and android.os.Build.CPU_ABI) and the
runtime concept of an instruction set used for compilation
(the --instruction-set to dex2oat and so on).
(cherry picked from commit 6174cff204aa36e622e9bd93569b4a1eb2ed222c)
Change-Id: Id2eaa60f0546d6c88770f8981adac2a896ed7d49
Diffstat (limited to 'libart/src/main/java/dalvik')
-rw-r--r-- | libart/src/main/java/dalvik/system/VMRuntime.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/libart/src/main/java/dalvik/system/VMRuntime.java b/libart/src/main/java/dalvik/system/VMRuntime.java index 042bcd1..ae65950 100644 --- a/libart/src/main/java/dalvik/system/VMRuntime.java +++ b/libart/src/main/java/dalvik/system/VMRuntime.java @@ -16,6 +16,9 @@ package dalvik.system; +import java.util.HashMap; +import java.util.Map; + /** * Provides an interface to VM-global, Dalvik-specific features. * An application cannot create its own Runtime instance, and must obtain @@ -30,6 +33,17 @@ public final class VMRuntime { */ private static final VMRuntime THE_ONE = new VMRuntime(); + private static final Map<String, String> ABI_TO_INSTRUCTION_SET_MAP + = new HashMap<String, String>(); + static { + ABI_TO_INSTRUCTION_SET_MAP.put("armeabi", "arm"); + ABI_TO_INSTRUCTION_SET_MAP.put("armeabi-v7a", "arm"); + ABI_TO_INSTRUCTION_SET_MAP.put("mips", "mips"); + ABI_TO_INSTRUCTION_SET_MAP.put("x86", "x86"); + ABI_TO_INSTRUCTION_SET_MAP.put("x86_64", "x86_64"); + ABI_TO_INSTRUCTION_SET_MAP.put("arm64-v8a", "arm64"); + } + private int targetSdkVersion; /** @@ -280,4 +294,20 @@ public final class VMRuntime { * Register application info */ public static native void registerAppInfo(String appDir, String processName, String pkgname); + + /** + * Returns the runtime instruction set corresponding to a given ABI. Multiple + * compatible ABIs might map to the same instruction set. For example + * {@code armeabi-v7a} and {@code armeabi} might map to the instruction set {@code arm}. + * + * This influences the compilation of the applications classes. + */ + public static String getInstructionSet(String abi) { + final String instructionSet = ABI_TO_INSTRUCTION_SET_MAP.get(abi); + if (instructionSet == null) { + throw new IllegalArgumentException("Unsupported ABI: " + abi); + } + + return instructionSet; + } } |