diff options
author | Mathieu Chartier <mathieuc@google.com> | 2014-11-25 10:39:12 -0800 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2014-11-25 15:34:33 -0800 |
commit | 3d38e8203d344acc9acd63c377b6a53683e1df67 (patch) | |
tree | bc8c800cb876d89eae23b79389db9775df05b52f /libart | |
parent | 06609270f635ac19a90bb01c480185b702882cf3 (diff) | |
download | libcore-3d38e8203d344acc9acd63c377b6a53683e1df67.zip libcore-3d38e8203d344acc9acd63c377b6a53683e1df67.tar.gz libcore-3d38e8203d344acc9acd63c377b6a53683e1df67.tar.bz2 |
Move dexCacheStrings from ArtMethod to ArtClass
Saves ram.
Bug: 17643507
(cherry picked from commit b9a5206b91a656c091e7055ff70e4eed2c76b8b1)
Change-Id: Ic446a8466eb877ddf680e1d312ae94df028f9e73
Diffstat (limited to 'libart')
-rw-r--r-- | libart/src/main/java/java/lang/Class.java | 4 | ||||
-rw-r--r-- | libart/src/main/java/java/lang/reflect/ArtMethod.java | 10 |
2 files changed, 4 insertions, 10 deletions
diff --git a/libart/src/main/java/java/lang/Class.java b/libart/src/main/java/java/lang/Class.java index a833f6c..d766385 100644 --- a/libart/src/main/java/java/lang/Class.java +++ b/libart/src/main/java/java/lang/Class.java @@ -138,6 +138,9 @@ public final class Class<T> implements Serializable, AnnotatedElement, GenericDe */ private transient DexCache dexCache; + /** Short-cut to dexCache.strings */ + private transient String[] dexCacheStrings; + /** static, private, and <init> methods. */ private transient ArtMethod[] directMethods; @@ -453,7 +456,6 @@ public final class Class<T> implements Serializable, AnnotatedElement, GenericDe * @hide */ public String getDexCacheString(Dex dex, int dexStringIndex) { - String[] dexCacheStrings = dexCache.strings; String s = dexCacheStrings[dexStringIndex]; if (s == null) { s = dex.strings().get(dexStringIndex).intern(); diff --git a/libart/src/main/java/java/lang/reflect/ArtMethod.java b/libart/src/main/java/java/lang/reflect/ArtMethod.java index 07cc30c..95e03c6 100644 --- a/libart/src/main/java/java/lang/reflect/ArtMethod.java +++ b/libart/src/main/java/java/lang/reflect/ArtMethod.java @@ -53,9 +53,6 @@ public final class ArtMethod { /** Short-cut to declaringClass.dexCache.resolvedTypes */ /* package */ Class<?>[] dexCacheResolvedTypes; - /** Short-cut to declaringClass.dexCache.strings */ - private String[] dexCacheStrings; - /** Bits encoding access (e.g. public, private) as well as other runtime specific flags */ private int accessFlags; @@ -180,12 +177,7 @@ public final class ArtMethod { * Method we can avoid one indirection. */ private String getDexCacheString(Dex dex, int dexStringIndex) { - String s = (String) dexCacheStrings[dexStringIndex]; - if (s == null) { - s = dex.strings().get(dexStringIndex).intern(); - dexCacheStrings[dexStringIndex] = s; - } - return s; + return declaringClass.getDexCacheString(dex, dexStringIndex); } /** |