diff options
author | Mathieu Chartier <mathieuc@google.com> | 2014-11-25 10:39:12 -0800 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2014-11-25 10:39:20 -0800 |
commit | b9a5206b91a656c091e7055ff70e4eed2c76b8b1 (patch) | |
tree | 855ad5074bd082f975870700b5661a34e593fc9e /libart/src | |
parent | 2a07a84877854d357d9cf508112f0ebb578cdfdd (diff) | |
download | libcore-b9a5206b91a656c091e7055ff70e4eed2c76b8b1.zip libcore-b9a5206b91a656c091e7055ff70e4eed2c76b8b1.tar.gz libcore-b9a5206b91a656c091e7055ff70e4eed2c76b8b1.tar.bz2 |
Move dexCacheStrings from ArtMethod to ArtClass
Saves ram.
Bug: 17643507
Change-Id: Iabfb224db0de47ceff3806c491ce33b772af6fbe
Diffstat (limited to 'libart/src')
-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 3ac359b..8833776 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); } /** |