Remove caching of array type lookups in graph lens
Bug: b/320707371
Change-Id: Ie14a40651e2b0cbb16f3d2f2a5f1dad9ccb0bd46
diff --git a/src/main/java/com/android/tools/r8/graph/lens/NonIdentityGraphLens.java b/src/main/java/com/android/tools/r8/graph/lens/NonIdentityGraphLens.java
index 7680134..8be2d6d 100644
--- a/src/main/java/com/android/tools/r8/graph/lens/NonIdentityGraphLens.java
+++ b/src/main/java/com/android/tools/r8/graph/lens/NonIdentityGraphLens.java
@@ -11,8 +11,6 @@
import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.ir.code.InvokeType;
import com.android.tools.r8.utils.ThrowingAction;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Predicate;
public abstract class NonIdentityGraphLens extends GraphLens {
@@ -20,8 +18,6 @@
private final DexItemFactory dexItemFactory;
private GraphLens previousLens;
- private final Map<DexType, DexType> arrayTypeCache = new ConcurrentHashMap<>();
-
public NonIdentityGraphLens(AppView<?> appView) {
this(appView.dexItemFactory(), appView.graphLens());
}
@@ -103,14 +99,9 @@
return lookupClassType(type, appliedLens);
}
if (type.isArrayType()) {
- DexType result = arrayTypeCache.get(type);
- if (result == null) {
- DexType baseType = type.toBaseType(dexItemFactory);
- DexType newType = lookupType(baseType, appliedLens);
- result = baseType == newType ? type : type.replaceBaseType(newType, dexItemFactory);
- arrayTypeCache.put(type, result);
- }
- return result;
+ DexType baseType = type.toBaseType(dexItemFactory);
+ DexType newType = lookupType(baseType, appliedLens);
+ return baseType.isIdenticalTo(newType) ? type : type.replaceBaseType(newType, dexItemFactory);
}
assert type.isNullValueType() || type.isPrimitiveType() || type.isVoidType();
return type;