Add default use registry implementations
Change-Id: Ib1839b0269292165b0fe433addb80f61e0a8c6b5
diff --git a/src/main/java/com/android/tools/r8/graph/DefaultUseRegistry.java b/src/main/java/com/android/tools/r8/graph/DefaultUseRegistry.java
new file mode 100644
index 0000000..b8fe0c2
--- /dev/null
+++ b/src/main/java/com/android/tools/r8/graph/DefaultUseRegistry.java
@@ -0,0 +1,66 @@
+// Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+package com.android.tools.r8.graph;
+
+public class DefaultUseRegistry<T extends Definition> extends UseRegistry<T> {
+
+ public DefaultUseRegistry(AppView<?> appView, T context) {
+ super(appView, context);
+ }
+
+ @Override
+ public void registerInitClass(DexType type) {
+ // Intentionally empty.
+ }
+
+ @Override
+ public void registerInstanceFieldRead(DexField field) {
+ // Intentionally empty.
+ }
+
+ @Override
+ public void registerInstanceFieldWrite(DexField field) {
+ // Intentionally empty.
+ }
+
+ @Override
+ public void registerInvokeDirect(DexMethod method) {
+ // Intentionally empty.
+ }
+
+ @Override
+ public void registerInvokeInterface(DexMethod method) {
+ // Intentionally empty.
+ }
+
+ @Override
+ public void registerInvokeStatic(DexMethod method) {
+ // Intentionally empty.
+ }
+
+ @Override
+ public void registerInvokeSuper(DexMethod method) {
+ // Intentionally empty.
+ }
+
+ @Override
+ public void registerInvokeVirtual(DexMethod method) {
+ // Intentionally empty.
+ }
+
+ @Override
+ public void registerStaticFieldRead(DexField field) {
+ // Intentionally empty.
+ }
+
+ @Override
+ public void registerStaticFieldWrite(DexField field) {
+ // Intentionally empty.
+ }
+
+ @Override
+ public void registerTypeReference(DexType type) {
+ // Intentionally empty.
+ }
+}
diff --git a/src/main/java/com/android/tools/r8/graph/DefaultUseRegistryWithResult.java b/src/main/java/com/android/tools/r8/graph/DefaultUseRegistryWithResult.java
new file mode 100644
index 0000000..5b3fec0
--- /dev/null
+++ b/src/main/java/com/android/tools/r8/graph/DefaultUseRegistryWithResult.java
@@ -0,0 +1,71 @@
+// Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+package com.android.tools.r8.graph;
+
+public class DefaultUseRegistryWithResult<R, T extends Definition>
+ extends UseRegistryWithResult<R, T> {
+
+ public DefaultUseRegistryWithResult(AppView<?> appView, T context) {
+ super(appView, context);
+ }
+
+ public DefaultUseRegistryWithResult(AppView<?> appView, T context, R defaultResult) {
+ super(appView, context, defaultResult);
+ }
+
+ @Override
+ public void registerInitClass(DexType type) {
+ // Intentionally empty.
+ }
+
+ @Override
+ public void registerInstanceFieldRead(DexField field) {
+ // Intentionally empty.
+ }
+
+ @Override
+ public void registerInstanceFieldWrite(DexField field) {
+ // Intentionally empty.
+ }
+
+ @Override
+ public void registerInvokeDirect(DexMethod method) {
+ // Intentionally empty.
+ }
+
+ @Override
+ public void registerInvokeInterface(DexMethod method) {
+ // Intentionally empty.
+ }
+
+ @Override
+ public void registerInvokeStatic(DexMethod method) {
+ // Intentionally empty.
+ }
+
+ @Override
+ public void registerInvokeSuper(DexMethod method) {
+ // Intentionally empty.
+ }
+
+ @Override
+ public void registerInvokeVirtual(DexMethod method) {
+ // Intentionally empty.
+ }
+
+ @Override
+ public void registerStaticFieldRead(DexField field) {
+ // Intentionally empty.
+ }
+
+ @Override
+ public void registerStaticFieldWrite(DexField field) {
+ // Intentionally empty.
+ }
+
+ @Override
+ public void registerTypeReference(DexType type) {
+ // Intentionally empty.
+ }
+}
diff --git a/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/NoClassInitializerCycles.java b/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/NoClassInitializerCycles.java
index 2e0a307..5416af5 100644
--- a/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/NoClassInitializerCycles.java
+++ b/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/NoClassInitializerCycles.java
@@ -9,8 +9,8 @@
import static com.android.tools.r8.ir.desugar.LambdaDescriptor.isLambdaMetafactoryMethod;
import static com.android.tools.r8.utils.MapUtils.ignoreKey;
-import com.android.tools.r8.dex.code.CfOrDexInstruction;
import com.android.tools.r8.graph.AppView;
+import com.android.tools.r8.graph.DefaultUseRegistry;
import com.android.tools.r8.graph.DexCallSite;
import com.android.tools.r8.graph.DexClassAndMethod;
import com.android.tools.r8.graph.DexField;
@@ -19,7 +19,6 @@
import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.graph.MethodResolutionResult;
import com.android.tools.r8.graph.ProgramMethod;
-import com.android.tools.r8.graph.UseRegistry;
import com.android.tools.r8.horizontalclassmerging.MergeGroup;
import com.android.tools.r8.horizontalclassmerging.MultiClassPolicyWithPreprocessing;
import com.android.tools.r8.horizontalclassmerging.policies.deadlock.SingleCallerInformation;
@@ -39,7 +38,6 @@
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
-import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutionException;
@@ -408,7 +406,7 @@
return true;
}
- class TracerUseRegistry extends UseRegistry<ProgramMethod> {
+ class TracerUseRegistry extends DefaultUseRegistry<ProgramMethod> {
TracerUseRegistry(ProgramMethod context) {
super(appView(), context);
@@ -570,11 +568,6 @@
}
@Override
- public void registerTypeReference(DexType type) {
- // Intentionally empty, new-array etc. does not trigger any class initialization.
- }
-
- @Override
public void registerCallSite(DexCallSite callSite) {
if (isLambdaMetafactoryMethod(callSite, appView().appInfo())) {
// Use of lambda metafactory does not trigger any class initialization.
@@ -582,39 +575,6 @@
fail();
}
}
-
- @Override
- public void registerCheckCast(DexType type, boolean ignoreCompatRules) {
- // Intentionally empty, does not trigger any class initialization.
- }
-
- @Override
- public void registerConstClass(
- DexType type,
- ListIterator<? extends CfOrDexInstruction> iterator,
- boolean ignoreCompatRules) {
- // Intentionally empty, does not trigger any class initialization.
- }
-
- @Override
- public void registerInstanceFieldRead(DexField field) {
- // Intentionally empty, does not trigger any class initialization.
- }
-
- @Override
- public void registerInstanceFieldWrite(DexField field) {
- // Intentionally empty, does not trigger any class initialization.
- }
-
- @Override
- public void registerInstanceOf(DexType type) {
- // Intentionally empty, does not trigger any class initialization.
- }
-
- @Override
- public void registerExceptionGuard(DexType guard) {
- // Intentionally empty, does not trigger any class initialization.
- }
}
}
}
diff --git a/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/deadlock/SingleCallerInformation.java b/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/deadlock/SingleCallerInformation.java
index af868d9..9552f5f 100644
--- a/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/deadlock/SingleCallerInformation.java
+++ b/src/main/java/com/android/tools/r8/horizontalclassmerging/policies/deadlock/SingleCallerInformation.java
@@ -6,12 +6,12 @@
import com.android.tools.r8.graph.AppInfoWithClassHierarchy;
import com.android.tools.r8.graph.AppView;
+import com.android.tools.r8.graph.DefaultUseRegistry;
import com.android.tools.r8.graph.DexField;
import com.android.tools.r8.graph.DexMethod;
import com.android.tools.r8.graph.DexProgramClass;
import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.graph.ProgramMethod;
-import com.android.tools.r8.graph.UseRegistry;
import com.android.tools.r8.ir.conversion.callgraph.CallGraph;
import com.android.tools.r8.utils.ThreadUtils;
import com.android.tools.r8.utils.collections.ProgramMethodMap;
@@ -94,7 +94,7 @@
method.registerCodeReferences(new InvokeExtractor(appView, method));
}
- private class InvokeExtractor extends UseRegistry<ProgramMethod> {
+ private class InvokeExtractor extends DefaultUseRegistry<ProgramMethod> {
private final AppView<? extends AppInfoWithClassHierarchy> appViewWithClassHierachy;
@@ -190,16 +190,6 @@
}
@Override
- public void registerInstanceFieldRead(DexField field) {
- // Intentionally empty.
- }
-
- @Override
- public void registerInstanceFieldWrite(DexField field) {
- // Intentionally empty.
- }
-
- @Override
public void registerInvokeDirect(DexMethod method) {
DexMethod rewrittenMethod =
appViewWithClassHierachy
@@ -267,11 +257,6 @@
DexField rewrittenField = appViewWithClassHierachy.graphLens().lookupField(field);
triggerClassInitializerIfNotAlreadyTriggeredInContext(rewrittenField.getHolderType());
}
-
- @Override
- public void registerTypeReference(DexType type) {
- // Intentionally empty.
- }
}
}
}
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/fieldaccess/TrivialFieldAccessReprocessor.java b/src/main/java/com/android/tools/r8/ir/analysis/fieldaccess/TrivialFieldAccessReprocessor.java
index e033b0b..916b595 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/fieldaccess/TrivialFieldAccessReprocessor.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/fieldaccess/TrivialFieldAccessReprocessor.java
@@ -14,19 +14,18 @@
import com.android.tools.r8.graph.AbstractAccessContexts;
import com.android.tools.r8.graph.AbstractAccessContexts.ConcreteAccessContexts;
import com.android.tools.r8.graph.AppView;
+import com.android.tools.r8.graph.DefaultUseRegistry;
import com.android.tools.r8.graph.DexClassAndField;
import com.android.tools.r8.graph.DexEncodedField;
import com.android.tools.r8.graph.DexEncodedMethod;
import com.android.tools.r8.graph.DexField;
import com.android.tools.r8.graph.DexMethod;
import com.android.tools.r8.graph.DexProgramClass;
-import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.graph.FieldAccessInfo;
import com.android.tools.r8.graph.FieldAccessInfoCollection;
import com.android.tools.r8.graph.FieldResolutionResult;
import com.android.tools.r8.graph.ProgramField;
import com.android.tools.r8.graph.ProgramMethod;
-import com.android.tools.r8.graph.UseRegistry;
import com.android.tools.r8.graph.bytecodemetadata.BytecodeInstructionMetadata;
import com.android.tools.r8.ir.analysis.type.ClassTypeElement;
import com.android.tools.r8.ir.analysis.type.ReferenceTypeElement;
@@ -321,7 +320,7 @@
return true;
}
- class TrivialFieldAccessUseRegistry extends UseRegistry<ProgramMethod> {
+ class TrivialFieldAccessUseRegistry extends DefaultUseRegistry<ProgramMethod> {
TrivialFieldAccessUseRegistry(ProgramMethod method) {
super(appView(), method);
@@ -494,32 +493,5 @@
public void registerStaticFieldWrite(DexField field) {
registerFieldAccess(field, true, true, BytecodeInstructionMetadata.none());
}
-
- @Override
- public void registerInitClass(DexType clazz) {}
-
- @Override
- public void registerInvokeVirtual(DexMethod method) {}
-
- @Override
- public void registerInvokeDirect(DexMethod method) {}
-
- @Override
- public void registerInvokeStatic(DexMethod method) {}
-
- @Override
- public void registerInvokeInterface(DexMethod method) {}
-
- @Override
- public void registerInvokeSuper(DexMethod method) {}
-
- @Override
- public void registerNewInstance(DexType type) {}
-
- @Override
- public void registerTypeReference(DexType type) {}
-
- @Override
- public void registerInstanceOf(DexType type) {}
}
}
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/callgraph/InvokeExtractor.java b/src/main/java/com/android/tools/r8/ir/conversion/callgraph/InvokeExtractor.java
index eb09ac7..809f647 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/callgraph/InvokeExtractor.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/callgraph/InvokeExtractor.java
@@ -7,16 +7,14 @@
import static com.android.tools.r8.graph.DexClassAndMethod.asProgramMethodOrNull;
import com.android.tools.r8.graph.AppView;
+import com.android.tools.r8.graph.DefaultUseRegistry;
import com.android.tools.r8.graph.DexCallSite;
import com.android.tools.r8.graph.DexClass;
import com.android.tools.r8.graph.DexClassAndMethod;
-import com.android.tools.r8.graph.DexField;
import com.android.tools.r8.graph.DexMethod;
-import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.graph.LookupResult;
import com.android.tools.r8.graph.MethodResolutionResult;
import com.android.tools.r8.graph.ProgramMethod;
-import com.android.tools.r8.graph.UseRegistry;
import com.android.tools.r8.graph.lens.MethodLookupResult;
import com.android.tools.r8.ir.code.InvokeType;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
@@ -25,7 +23,7 @@
import java.util.function.Function;
import java.util.function.Predicate;
-public class InvokeExtractor<N extends NodeBase<N>> extends UseRegistry<ProgramMethod> {
+public class InvokeExtractor<N extends NodeBase<N>> extends DefaultUseRegistry<ProgramMethod> {
protected final AppView<AppInfoWithLiveness> appViewWithLiveness;
protected final N currentMethod;
@@ -200,34 +198,4 @@
public void registerInvokeVirtual(DexMethod method) {
processInvoke(InvokeType.VIRTUAL, method);
}
-
- @Override
- public void registerInitClass(DexType type) {
- // Intentionally empty. This use registry is only tracing method calls.
- }
-
- @Override
- public void registerInstanceFieldRead(DexField field) {
- // Intentionally empty. This use registry is only tracing method calls.
- }
-
- @Override
- public void registerInstanceFieldWrite(DexField field) {
- // Intentionally empty. This use registry is only tracing method calls.
- }
-
- @Override
- public void registerStaticFieldRead(DexField field) {
- // Intentionally empty. This use registry is only tracing method calls.
- }
-
- @Override
- public void registerStaticFieldWrite(DexField field) {
- // Intentionally empty. This use registry is only tracing method calls.
- }
-
- @Override
- public void registerTypeReference(DexType type) {
- // Intentionally empty. This use registry is only tracing method calls.
- }
}
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/nest/D8NestBasedAccessDesugaring.java b/src/main/java/com/android/tools/r8/ir/desugar/nest/D8NestBasedAccessDesugaring.java
index 14257d8..4fdeb0f 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/nest/D8NestBasedAccessDesugaring.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/nest/D8NestBasedAccessDesugaring.java
@@ -6,6 +6,7 @@
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.ClasspathMethod;
+import com.android.tools.r8.graph.DefaultUseRegistry;
import com.android.tools.r8.graph.DexClass;
import com.android.tools.r8.graph.DexClassAndField;
import com.android.tools.r8.graph.DexClassAndMethod;
@@ -13,10 +14,8 @@
import com.android.tools.r8.graph.DexField;
import com.android.tools.r8.graph.DexMethod;
import com.android.tools.r8.graph.DexProgramClass;
-import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.graph.ProgramField;
import com.android.tools.r8.graph.ProgramMethod;
-import com.android.tools.r8.graph.UseRegistry;
import com.android.tools.r8.ir.conversion.D8MethodProcessor;
import com.android.tools.r8.profile.rewriting.ProfileRewritingNestBasedAccessDesugaringEventConsumer;
import com.android.tools.r8.utils.ThreadUtils;
@@ -138,7 +137,7 @@
new NestBasedAccessDesugaringUseRegistry(method, eventConsumer)));
}
- private class NestBasedAccessDesugaringUseRegistry extends UseRegistry<ClasspathMethod> {
+ private class NestBasedAccessDesugaringUseRegistry extends DefaultUseRegistry<ClasspathMethod> {
private final NestBasedAccessDesugaringEventConsumer eventConsumer;
@@ -294,25 +293,5 @@
public void registerStaticFieldWrite(DexField field) {
registerFieldAccessFromClasspath(field, false);
}
-
- @Override
- public void registerInitClass(DexType clazz) {
- // Intentionally empty.
- }
-
- @Override
- public void registerInstanceOf(DexType type) {
- // Intentionally empty.
- }
-
- @Override
- public void registerNewInstance(DexType type) {
- // Intentionally empty.
- }
-
- @Override
- public void registerTypeReference(DexType type) {
- // Intentionally empty.
- }
}
}
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/info/MethodResolutionOptimizationInfoReprocessingEnqueuer.java b/src/main/java/com/android/tools/r8/ir/optimize/info/MethodResolutionOptimizationInfoReprocessingEnqueuer.java
index 2470444..be20d5b 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/info/MethodResolutionOptimizationInfoReprocessingEnqueuer.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/info/MethodResolutionOptimizationInfoReprocessingEnqueuer.java
@@ -5,13 +5,11 @@
package com.android.tools.r8.ir.optimize.info;
import com.android.tools.r8.graph.AppView;
+import com.android.tools.r8.graph.DefaultUseRegistryWithResult;
import com.android.tools.r8.graph.DexEncodedMethod;
-import com.android.tools.r8.graph.DexField;
import com.android.tools.r8.graph.DexMethod;
-import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.graph.MethodResolutionResult.SingleResolutionResult;
import com.android.tools.r8.graph.ProgramMethod;
-import com.android.tools.r8.graph.UseRegistryWithResult;
import com.android.tools.r8.graph.lens.GraphLens;
import com.android.tools.r8.ir.conversion.PostMethodProcessor;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
@@ -72,7 +70,8 @@
postMethodProcessorBuilder.addAll(methodsToReprocessInClass, currentGraphLens));
}
- static class AffectedMethodUseRegistry extends UseRegistryWithResult<Boolean, ProgramMethod> {
+ static class AffectedMethodUseRegistry
+ extends DefaultUseRegistryWithResult<Boolean, ProgramMethod> {
private final AppView<AppInfoWithLiveness> appViewWithLiveness;
@@ -143,23 +142,5 @@
markAffected();
}
}
-
- @Override
- public void registerInstanceFieldRead(DexField field) {}
-
- @Override
- public void registerInstanceFieldWrite(DexField field) {}
-
- @Override
- public void registerStaticFieldRead(DexField field) {}
-
- @Override
- public void registerStaticFieldWrite(DexField field) {}
-
- @Override
- public void registerInitClass(DexType type) {}
-
- @Override
- public void registerTypeReference(DexType type) {}
}
}
diff --git a/src/main/java/com/android/tools/r8/optimize/MemberRebindingIdentityLensFactory.java b/src/main/java/com/android/tools/r8/optimize/MemberRebindingIdentityLensFactory.java
index dfd16e6..331d29e 100644
--- a/src/main/java/com/android/tools/r8/optimize/MemberRebindingIdentityLensFactory.java
+++ b/src/main/java/com/android/tools/r8/optimize/MemberRebindingIdentityLensFactory.java
@@ -7,17 +7,16 @@
import com.android.tools.r8.graph.AbstractAccessContexts.ConcreteAccessContexts;
import com.android.tools.r8.graph.AppInfoWithClassHierarchy;
import com.android.tools.r8.graph.AppView;
+import com.android.tools.r8.graph.DefaultUseRegistry;
import com.android.tools.r8.graph.DexClass;
import com.android.tools.r8.graph.DexField;
import com.android.tools.r8.graph.DexMethod;
-import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.graph.FieldAccessInfoCollection;
import com.android.tools.r8.graph.FieldAccessInfoCollectionImpl;
import com.android.tools.r8.graph.FieldAccessInfoImpl;
import com.android.tools.r8.graph.MethodAccessInfoCollection;
import com.android.tools.r8.graph.MethodResolutionResult.SingleResolutionResult;
import com.android.tools.r8.graph.ProgramMethod;
-import com.android.tools.r8.graph.UseRegistry;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
import com.android.tools.r8.utils.SetUtils;
import com.android.tools.r8.utils.ThreadUtils;
@@ -101,7 +100,8 @@
executorService);
}
- private static class NonReboundMemberReferencesRegistry extends UseRegistry<ProgramMethod> {
+ private static class NonReboundMemberReferencesRegistry
+ extends DefaultUseRegistry<ProgramMethod> {
private final AppInfoWithClassHierarchy appInfo;
private final FieldAccessInfoCollectionImpl fieldAccessInfoCollection;
@@ -232,25 +232,5 @@
// simply use the empty set.
invokes.put(method, ProgramMethodSet.empty());
}
-
- @Override
- public void registerInitClass(DexType type) {
- // Intentionally empty.
- }
-
- @Override
- public void registerNewInstance(DexType type) {
- // Intentionally empty.
- }
-
- @Override
- public void registerTypeReference(DexType type) {
- // Intentionally empty.
- }
-
- @Override
- public void registerInstanceOf(DexType type) {
- // Intentionally empty.
- }
}
}
diff --git a/src/main/java/com/android/tools/r8/optimize/argumentpropagation/ArgumentPropagatorMethodReprocessingEnqueuer.java b/src/main/java/com/android/tools/r8/optimize/argumentpropagation/ArgumentPropagatorMethodReprocessingEnqueuer.java
index 9b0f212..b857d7d 100644
--- a/src/main/java/com/android/tools/r8/optimize/argumentpropagation/ArgumentPropagatorMethodReprocessingEnqueuer.java
+++ b/src/main/java/com/android/tools/r8/optimize/argumentpropagation/ArgumentPropagatorMethodReprocessingEnqueuer.java
@@ -5,16 +5,15 @@
package com.android.tools.r8.optimize.argumentpropagation;
import com.android.tools.r8.graph.AppView;
+import com.android.tools.r8.graph.DefaultUseRegistryWithResult;
import com.android.tools.r8.graph.DexEncodedMethod;
import com.android.tools.r8.graph.DexField;
import com.android.tools.r8.graph.DexMethod;
import com.android.tools.r8.graph.DexProgramClass;
-import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.graph.FieldResolutionResult;
import com.android.tools.r8.graph.MethodResolutionResult.SingleResolutionResult;
import com.android.tools.r8.graph.ProgramField;
import com.android.tools.r8.graph.ProgramMethod;
-import com.android.tools.r8.graph.UseRegistryWithResult;
import com.android.tools.r8.graph.lens.GraphLens;
import com.android.tools.r8.ir.conversion.IRConverter;
import com.android.tools.r8.ir.conversion.PostMethodProcessor;
@@ -145,7 +144,8 @@
postMethodProcessorBuilder.addAll(methodsToReprocessInClass, currentGraphLens));
}
- static class AffectedMethodUseRegistry extends UseRegistryWithResult<Boolean, ProgramMethod> {
+ static class AffectedMethodUseRegistry
+ extends DefaultUseRegistryWithResult<Boolean, ProgramMethod> {
private final AppView<AppInfoWithLiveness> appViewWithLiveness;
private final ArgumentPropagatorGraphLens graphLens;
@@ -242,11 +242,5 @@
markAffected();
}
}
-
- @Override
- public void registerInitClass(DexType type) {}
-
- @Override
- public void registerTypeReference(DexType type) {}
}
}
diff --git a/src/main/java/com/android/tools/r8/verticalclassmerging/InvokeSpecialToDefaultLibraryMethodUseRegistry.java b/src/main/java/com/android/tools/r8/verticalclassmerging/InvokeSpecialToDefaultLibraryMethodUseRegistry.java
index 2451630..506a2af 100644
--- a/src/main/java/com/android/tools/r8/verticalclassmerging/InvokeSpecialToDefaultLibraryMethodUseRegistry.java
+++ b/src/main/java/com/android/tools/r8/verticalclassmerging/InvokeSpecialToDefaultLibraryMethodUseRegistry.java
@@ -1,16 +1,14 @@
package com.android.tools.r8.verticalclassmerging;
import com.android.tools.r8.graph.AppView;
+import com.android.tools.r8.graph.DefaultUseRegistryWithResult;
import com.android.tools.r8.graph.DexEncodedMethod;
-import com.android.tools.r8.graph.DexField;
import com.android.tools.r8.graph.DexMethod;
-import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.graph.ProgramMethod;
-import com.android.tools.r8.graph.UseRegistryWithResult;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
public class InvokeSpecialToDefaultLibraryMethodUseRegistry
- extends UseRegistryWithResult<Boolean, ProgramMethod> {
+ extends DefaultUseRegistryWithResult<Boolean, ProgramMethod> {
InvokeSpecialToDefaultLibraryMethodUseRegistry(
AppView<AppInfoWithLiveness> appView, ProgramMethod context) {
@@ -19,10 +17,9 @@
}
@Override
- @SuppressWarnings("ReferenceEquality")
public void registerInvokeSpecial(DexMethod method) {
ProgramMethod context = getContext();
- if (method.getHolderType() != context.getHolderType()) {
+ if (!method.getHolderType().isIdenticalTo(context.getHolderType())) {
return;
}
@@ -31,37 +28,4 @@
setResult(true);
}
}
-
- @Override
- public void registerInitClass(DexType type) {}
-
- @Override
- public void registerInvokeDirect(DexMethod method) {}
-
- @Override
- public void registerInvokeInterface(DexMethod method) {}
-
- @Override
- public void registerInvokeStatic(DexMethod method) {}
-
- @Override
- public void registerInvokeSuper(DexMethod method) {}
-
- @Override
- public void registerInvokeVirtual(DexMethod method) {}
-
- @Override
- public void registerInstanceFieldRead(DexField field) {}
-
- @Override
- public void registerInstanceFieldWrite(DexField field) {}
-
- @Override
- public void registerStaticFieldRead(DexField field) {}
-
- @Override
- public void registerStaticFieldWrite(DexField field) {}
-
- @Override
- public void registerTypeReference(DexType type) {}
}