Rename GraphLens.
Change-Id: I10d8af7d4cf21fdd259da8d3e026431823bb1001
diff --git a/src/main/java/com/android/tools/r8/D8.java b/src/main/java/com/android/tools/r8/D8.java
index b456ecb..e502f2f 100644
--- a/src/main/java/com/android/tools/r8/D8.java
+++ b/src/main/java/com/android/tools/r8/D8.java
@@ -14,7 +14,7 @@
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DexApplication;
import com.android.tools.r8.graph.DexProgramClass;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.InitClassLens;
import com.android.tools.r8.graph.ProgramMethod;
import com.android.tools.r8.graph.analysis.ClassInitializerAssertionEnablingAnalysis;
@@ -244,7 +244,7 @@
appView,
options,
marker,
- GraphLense.getIdentityLense(),
+ GraphLens.getIdentityLens(),
NamingLens.getIdentityLens(),
null)
.write(options.getClassFileConsumer());
@@ -272,7 +272,7 @@
appView,
options,
marker == null ? null : ImmutableList.copyOf(markers),
- GraphLense.getIdentityLense(),
+ GraphLens.getIdentityLens(),
InitClassLens.getDefault(),
namingLens,
null)
@@ -327,7 +327,7 @@
null,
options,
null,
- GraphLense.getIdentityLense(),
+ GraphLens.getIdentityLens(),
InitClassLens.getDefault(),
prefixRewritingNamingLens,
null,
diff --git a/src/main/java/com/android/tools/r8/DexFileMergerHelper.java b/src/main/java/com/android/tools/r8/DexFileMergerHelper.java
index 94ea634..1171440 100644
--- a/src/main/java/com/android/tools/r8/DexFileMergerHelper.java
+++ b/src/main/java/com/android/tools/r8/DexFileMergerHelper.java
@@ -12,7 +12,7 @@
import com.android.tools.r8.graph.AppInfo;
import com.android.tools.r8.graph.DexApplication;
import com.android.tools.r8.graph.DexProgramClass;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.InitClassLens;
import com.android.tools.r8.naming.NamingLens;
import com.android.tools.r8.utils.AndroidApp;
@@ -102,7 +102,7 @@
null,
options,
markers,
- GraphLense.getIdentityLense(),
+ GraphLens.getIdentityLens(),
InitClassLens.getDefault(),
NamingLens.getIdentityLens(),
null);
diff --git a/src/main/java/com/android/tools/r8/DexSplitterHelper.java b/src/main/java/com/android/tools/r8/DexSplitterHelper.java
index a9d4644..8d2d47d 100644
--- a/src/main/java/com/android/tools/r8/DexSplitterHelper.java
+++ b/src/main/java/com/android/tools/r8/DexSplitterHelper.java
@@ -13,7 +13,7 @@
import com.android.tools.r8.graph.AppInfo;
import com.android.tools.r8.graph.DexApplication;
import com.android.tools.r8.graph.DexProgramClass;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.InitClassLens;
import com.android.tools.r8.graph.LazyLoadedDexApplication;
import com.android.tools.r8.naming.ClassNameMapper;
@@ -101,7 +101,7 @@
null,
options,
markers,
- GraphLense.getIdentityLense(),
+ GraphLens.getIdentityLens(),
InitClassLens.getDefault(),
NamingLens.getIdentityLens(),
null,
diff --git a/src/main/java/com/android/tools/r8/GenerateLintFiles.java b/src/main/java/com/android/tools/r8/GenerateLintFiles.java
index bbee24d..7913783 100644
--- a/src/main/java/com/android/tools/r8/GenerateLintFiles.java
+++ b/src/main/java/com/android/tools/r8/GenerateLintFiles.java
@@ -24,7 +24,7 @@
import com.android.tools.r8.graph.DexProgramClass.ChecksumSupplier;
import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.graph.DirectMappedDexApplication;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.ParameterAnnotationsList;
import com.android.tools.r8.ir.desugar.DesugaredLibraryConfiguration;
import com.android.tools.r8.ir.desugar.DesugaredLibraryConfigurationParser;
@@ -319,7 +319,7 @@
appView,
options,
options.getMarker(Tool.L8),
- GraphLense.getIdentityLense(),
+ GraphLens.getIdentityLens(),
NamingLens.getIdentityLens(),
null);
ClassFileConsumer consumer =
diff --git a/src/main/java/com/android/tools/r8/L8.java b/src/main/java/com/android/tools/r8/L8.java
index f5059e4..8049508 100644
--- a/src/main/java/com/android/tools/r8/L8.java
+++ b/src/main/java/com/android/tools/r8/L8.java
@@ -11,7 +11,7 @@
import com.android.tools.r8.graph.AppInfo;
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DexApplication;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.LazyLoadedDexApplication;
import com.android.tools.r8.ir.conversion.IRConverter;
import com.android.tools.r8.ir.desugar.PrefixRewritingMapper;
@@ -145,7 +145,7 @@
appView,
options,
options.getMarker(Tool.L8),
- GraphLense.getIdentityLense(),
+ GraphLens.getIdentityLens(),
namingLens,
null)
.write(options.getClassFileConsumer());
diff --git a/src/main/java/com/android/tools/r8/R8.java b/src/main/java/com/android/tools/r8/R8.java
index 17ee9af..93f229c 100644
--- a/src/main/java/com/android/tools/r8/R8.java
+++ b/src/main/java/com/android/tools/r8/R8.java
@@ -32,8 +32,8 @@
import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.graph.DirectMappedDexApplication;
import com.android.tools.r8.graph.EnumValueInfoMapCollection;
-import com.android.tools.r8.graph.GraphLense;
-import com.android.tools.r8.graph.GraphLense.NestedGraphLense;
+import com.android.tools.r8.graph.GraphLens;
+import com.android.tools.r8.graph.GraphLens.NestedGraphLens;
import com.android.tools.r8.graph.InitClassLens;
import com.android.tools.r8.graph.SubtypingInfo;
import com.android.tools.r8.graph.analysis.ClassInitializerAssertionEnablingAnalysis;
@@ -43,16 +43,16 @@
import com.android.tools.r8.ir.desugar.BackportedMethodRewriter;
import com.android.tools.r8.ir.desugar.DesugaredLibraryRetargeter;
import com.android.tools.r8.ir.desugar.InterfaceMethodRewriter;
-import com.android.tools.r8.ir.desugar.NestedPrivateMethodLense;
+import com.android.tools.r8.ir.desugar.NestedPrivateMethodLens;
import com.android.tools.r8.ir.desugar.R8NestBasedAccessDesugaring;
import com.android.tools.r8.ir.optimize.AssertionsRewriter;
import com.android.tools.r8.ir.optimize.MethodPoolCollection;
import com.android.tools.r8.ir.optimize.NestReducer;
import com.android.tools.r8.ir.optimize.SwitchMapCollector;
import com.android.tools.r8.ir.optimize.UninstantiatedTypeOptimization;
-import com.android.tools.r8.ir.optimize.UninstantiatedTypeOptimization.UninstantiatedTypeOptimizationGraphLense;
+import com.android.tools.r8.ir.optimize.UninstantiatedTypeOptimization.UninstantiatedTypeOptimizationGraphLens;
import com.android.tools.r8.ir.optimize.UnusedArgumentsCollector;
-import com.android.tools.r8.ir.optimize.UnusedArgumentsCollector.UnusedArgumentsGraphLense;
+import com.android.tools.r8.ir.optimize.UnusedArgumentsCollector.UnusedArgumentsGraphLens;
import com.android.tools.r8.ir.optimize.enums.EnumUnboxingCfMethods;
import com.android.tools.r8.ir.optimize.enums.EnumUnboxingRewriter;
import com.android.tools.r8.ir.optimize.enums.EnumValueInfoMapCollector;
@@ -94,7 +94,7 @@
import com.android.tools.r8.shaking.TreePruner;
import com.android.tools.r8.shaking.TreePrunerConfiguration;
import com.android.tools.r8.shaking.VerticalClassMerger;
-import com.android.tools.r8.shaking.VerticalClassMergerGraphLense;
+import com.android.tools.r8.shaking.VerticalClassMergerGraphLens;
import com.android.tools.r8.shaking.WhyAreYouKeepingConsumer;
import com.android.tools.r8.utils.AndroidApiLevel;
import com.android.tools.r8.utils.AndroidApp;
@@ -206,7 +206,7 @@
ExecutorService executorService,
DexApplication application,
AppView<?> appView,
- GraphLense graphLense,
+ GraphLens graphLens,
InitClassLens initClassLens,
NamingLens namingLens,
InternalOptions options,
@@ -222,7 +222,7 @@
markers.remove(marker);
if (options.isGeneratingClassFiles()) {
new CfApplicationWriter(
- application, appView, options, marker, graphLense, namingLens, proguardMapSupplier)
+ application, appView, options, marker, graphLens, namingLens, proguardMapSupplier)
.write(options.getClassFileConsumer());
} else {
new ApplicationWriter(
@@ -231,7 +231,7 @@
options,
// Ensure that the marker for this compilation is the first in the list.
ImmutableList.<Marker>builder().add(marker).addAll(markers).build(),
- graphLense,
+ graphLens,
initClassLens,
namingLens,
proguardMapSupplier)
@@ -438,7 +438,7 @@
RootSet mainDexRootSet = null;
MainDexClasses mainDexClasses = MainDexClasses.NONE;
if (!options.mainDexKeepRules.isEmpty()) {
- assert appView.graphLense().isIdentityLense();
+ assert appView.graphLens().isIdentityLens();
// Find classes which may have code executed before secondary dex files installation.
SubtypingInfo subtypingInfo =
new SubtypingInfo(appView.appInfo().app().asDirect().allClasses(), appView);
@@ -462,10 +462,10 @@
if (options.getProguardConfiguration().isAccessModificationAllowed()) {
AppView<AppInfoWithLiveness> appViewWithLiveness = appView.withLiveness();
SubtypingInfo subtypingInfo = appViewWithLiveness.appInfo().computeSubtypingInfo();
- GraphLense publicizedLense =
+ GraphLens publicizedLens =
ClassAndMemberPublicizer.run(
executorService, timing, application, appViewWithLiveness, subtypingInfo);
- boolean changed = appView.setGraphLense(publicizedLense);
+ boolean changed = appView.setGraphLens(publicizedLens);
if (changed) {
// We can now remove visibility bridges. Note that we do not need to update the
// invoke-targets here, as the existing invokes will simply dispatch to the now
@@ -475,15 +475,15 @@
}
AppView<AppInfoWithLiveness> appViewWithLiveness = appView.withLiveness();
- appView.setGraphLense(new MemberRebindingAnalysis(appViewWithLiveness).run());
+ appView.setGraphLens(new MemberRebindingAnalysis(appViewWithLiveness).run());
appView.appInfo().withLiveness().getFieldAccessInfoCollection().restrictToProgram(appView);
if (options.shouldDesugarNests()) {
timing.begin("NestBasedAccessDesugaring");
R8NestBasedAccessDesugaring analyzer = new R8NestBasedAccessDesugaring(appViewWithLiveness);
- NestedPrivateMethodLense lens = analyzer.run(executorService, application.builder());
+ NestedPrivateMethodLens lens = analyzer.run(executorService, application.builder());
if (lens != null) {
- boolean changed = appView.setGraphLense(lens);
+ boolean changed = appView.setGraphLens(lens);
assert changed;
appViewWithLiveness.setAppInfo(
appViewWithLiveness.appInfo().rewrittenWithLens(application.asDirect(), lens));
@@ -508,9 +508,9 @@
timing.begin("HorizontalStaticClassMerger");
StaticClassMerger staticClassMerger =
new StaticClassMerger(appViewWithLiveness, options, mainDexClasses);
- NestedGraphLense lens = staticClassMerger.run();
+ NestedGraphLens lens = staticClassMerger.run();
if (lens != null) {
- boolean changed = appView.setGraphLense(lens);
+ boolean changed = appView.setGraphLens(lens);
assert changed;
appViewWithLiveness.setAppInfo(
appViewWithLiveness.appInfo().rewrittenWithLens(application.asDirect(), lens));
@@ -522,9 +522,9 @@
VerticalClassMerger verticalClassMerger =
new VerticalClassMerger(
application, appViewWithLiveness, executorService, timing, mainDexClasses);
- VerticalClassMergerGraphLense lens = verticalClassMerger.run();
+ VerticalClassMergerGraphLens lens = verticalClassMerger.run();
if (lens != null) {
- boolean changed = appView.setGraphLense(lens);
+ boolean changed = appView.setGraphLens(lens);
assert changed;
appView.setVerticallyMergedClasses(verticalClassMerger.getMergedClasses());
application = application.asDirect().rewrittenWithLens(lens);
@@ -537,13 +537,13 @@
SubtypingInfo subtypingInfo = appViewWithLiveness.appInfo().computeSubtypingInfo();
{
timing.begin("UnusedArgumentRemoval");
- UnusedArgumentsGraphLense lens =
+ UnusedArgumentsGraphLens lens =
new UnusedArgumentsCollector(
appViewWithLiveness,
new MethodPoolCollection(appViewWithLiveness, subtypingInfo))
.run(executorService, timing);
if (lens != null) {
- boolean changed = appView.setGraphLense(lens);
+ boolean changed = appView.setGraphLens(lens);
assert changed;
assert application.asDirect().verifyNothingToRewrite(appView, lens);
appViewWithLiveness.setAppInfo(
@@ -553,7 +553,7 @@
}
if (options.enableUninstantiatedTypeOptimization) {
timing.begin("UninstantiatedTypeOptimization");
- UninstantiatedTypeOptimizationGraphLense lens =
+ UninstantiatedTypeOptimizationGraphLens lens =
new UninstantiatedTypeOptimization(appViewWithLiveness)
.strenghtenOptimizationInfo()
.run(
@@ -561,7 +561,7 @@
executorService,
timing);
if (lens != null) {
- boolean changed = appView.setGraphLense(lens);
+ boolean changed = appView.setGraphLens(lens);
assert changed;
assert application.asDirect().verifyNothingToRewrite(appView, lens);
appViewWithLiveness.setAppInfo(
@@ -583,7 +583,7 @@
appViewWithLiveness.setAppInfo(new EnumValueInfoMapCollector(appViewWithLiveness).run());
}
- appView.setAppServices(appView.appServices().rewrittenWithLens(appView.graphLense()));
+ appView.setAppServices(appView.appServices().rewrittenWithLens(appView.graphLens()));
timing.begin("Create IR");
CfgPrinter printer = options.printCfg ? new CfgPrinter() : null;
@@ -601,7 +601,7 @@
// graph lens entirely, though, since it is needed for mapping all field and method signatures
// back to the original program.
timing.begin("AppliedGraphLens construction");
- appView.setGraphLense(new AppliedGraphLens(appView, application.classes()));
+ appView.setGraphLens(new AppliedGraphLens(appView, application.classes()));
timing.end();
if (options.printCfg) {
@@ -702,7 +702,7 @@
timing)
.withEnumValueInfoMaps(enumValueInfoMapCollection));
// Rerunning the enqueuer should not give rise to any method rewritings.
- assert enqueuer.buildGraphLense(appView) == appView.graphLense();
+ assert enqueuer.buildGraphLens(appView) == appView.graphLens();
appView.withGeneratedMessageLiteBuilderShrinker(
shrinker ->
shrinker.rewriteDeadBuilderReferencesFromDynamicMethods(
@@ -861,7 +861,7 @@
assert appView.rootSet().verifyKeptItemsAreKept(application, appView.appInfo());
}
assert appView
- .graphLense()
+ .graphLens()
.verifyMappingToOriginalProgram(
application.classesWithDeterministicOrder(),
new ApplicationReader(inputApp.withoutMainDexList(), options, timing)
@@ -885,7 +885,7 @@
executorService,
application,
appView,
- appView.graphLense(),
+ appView.graphLens(),
appView.initClassLens(),
prefixRewritingNamingLens,
options,
@@ -912,11 +912,11 @@
clazz.forEachProgramMethod(
method -> {
DexMethod originalMethod =
- appView.graphLense().getOriginalMethodSignature(method.getReference());
+ appView.graphLens().getOriginalMethodSignature(method.getReference());
if (originalMethod != method.getReference()) {
DexMethod originalMethod2 =
- appView.graphLense().getOriginalMethodSignature(method.getReference());
- appView.graphLense().getOriginalMethodSignature(method.getReference());
+ appView.graphLens().getOriginalMethodSignature(method.getReference());
+ appView.graphLens().getOriginalMethodSignature(method.getReference());
DexEncodedMethod definition = method.getDefinition();
Code code = definition.getCode();
if (code == null) {
@@ -979,7 +979,7 @@
options.getProguardConfiguration().getDontWarnPatterns(),
executorService,
timing));
- appView.setGraphLense(enqueuer.buildGraphLense(appView));
+ appView.setGraphLens(enqueuer.buildGraphLens(appView));
if (InternalOptions.assertionsEnabled()) {
// Register the dead proto types. These are needed to verify that no new missing types are
// reported and that no dead proto types are referenced in the generated application.
diff --git a/src/main/java/com/android/tools/r8/cf/code/CfInvoke.java b/src/main/java/com/android/tools/r8/cf/code/CfInvoke.java
index 8889e81..a7949db 100644
--- a/src/main/java/com/android/tools/r8/cf/code/CfInvoke.java
+++ b/src/main/java/com/android/tools/r8/cf/code/CfInvoke.java
@@ -15,8 +15,8 @@
import com.android.tools.r8.graph.DexProgramClass;
import com.android.tools.r8.graph.DexProto;
import com.android.tools.r8.graph.DexType;
-import com.android.tools.r8.graph.GraphLense;
-import com.android.tools.r8.graph.GraphLense.GraphLenseLookupResult;
+import com.android.tools.r8.graph.GraphLens;
+import com.android.tools.r8.graph.GraphLens.GraphLensLookupResult;
import com.android.tools.r8.graph.InitClassLens;
import com.android.tools.r8.graph.UseRegistry;
import com.android.tools.r8.ir.code.Invoke;
@@ -202,7 +202,7 @@
@Override
public ConstraintWithTarget inliningConstraint(
InliningConstraints inliningConstraints, DexProgramClass context) {
- GraphLense graphLense = inliningConstraints.getGraphLense();
+ GraphLens graphLens = inliningConstraints.getGraphLens();
AppView<?> appView = inliningConstraints.getAppView();
DexMethod target = method;
// Find the DEX invocation type.
@@ -211,17 +211,17 @@
case Opcodes.INVOKEINTERFACE:
// Could have changed to an invoke-virtual instruction due to vertical class merging
// (if an interface is merged into a class).
- type = graphLense.lookupMethod(target, null, Type.INTERFACE).getType();
+ type = graphLens.lookupMethod(target, null, Type.INTERFACE).getType();
assert type == Type.INTERFACE || type == Type.VIRTUAL;
break;
case Opcodes.INVOKESPECIAL:
if (appView.dexItemFactory().isConstructor(target)) {
type = Type.DIRECT;
- assert noNeedToUseGraphLense(target, type, graphLense);
+ assert noNeedToUseGraphLens(target, type, graphLens);
} else if (target.holder == context.type) {
// The method could have been publicized.
- type = graphLense.lookupMethod(target, null, Type.DIRECT).getType();
+ type = graphLens.lookupMethod(target, null, Type.DIRECT).getType();
assert type == Type.DIRECT || type == Type.VIRTUAL;
} else {
// This is a super call. Note that the vertical class merger translates some invoke-super
@@ -229,17 +229,17 @@
// the target method end up being in the same class, and therefore, we will allow inlining
// it. The result of using type=SUPER below will be the same, since it leads to the
// inlining constraint SAMECLASS.
- // TODO(christofferqa): Consider using graphLense.lookupMethod (to do this, we need the
- // context for the graph lense, though).
+ // TODO(christofferqa): Consider using graphLens.lookupMethod (to do this, we need the
+ // context for the graph lens, though).
type = Type.SUPER;
- assert noNeedToUseGraphLense(target, type, graphLense);
+ assert noNeedToUseGraphLens(target, type, graphLens);
}
break;
case Opcodes.INVOKESTATIC:
{
// Static invokes may have changed as a result of horizontal class merging.
- GraphLenseLookupResult lookup = graphLense.lookupMethod(target, null, Type.STATIC);
+ GraphLensLookupResult lookup = graphLens.lookupMethod(target, null, Type.STATIC);
target = lookup.getMethod();
type = lookup.getType();
}
@@ -258,7 +258,7 @@
}
// Virtual invokes may have changed to interface invokes as a result of member rebinding.
- GraphLenseLookupResult lookup = graphLense.lookupMethod(target, null, type);
+ GraphLensLookupResult lookup = graphLens.lookupMethod(target, null, type);
target = lookup.getMethod();
type = lookup.getType();
}
@@ -271,9 +271,9 @@
return inliningConstraints.forInvoke(target, type, context);
}
- private static boolean noNeedToUseGraphLense(
- DexMethod method, Invoke.Type type, GraphLense graphLense) {
- assert graphLense.lookupMethod(method, null, type).getType() == type;
+ private static boolean noNeedToUseGraphLens(
+ DexMethod method, Invoke.Type type, GraphLens graphLens) {
+ assert graphLens.lookupMethod(method, null, type).getType() == type;
return true;
}
@@ -304,8 +304,8 @@
}
private DexEncodedMethod lookupMethod(AppView<?> appView, DexMethod method) {
- GraphLenseLookupResult lookupResult =
- appView.graphLense().lookupMethod(method, method, Type.DIRECT);
+ GraphLensLookupResult lookupResult =
+ appView.graphLens().lookupMethod(method, method, Type.DIRECT);
DexMethod rewrittenMethod = lookupResult.getMethod();
DexProgramClass clazz = appView.definitionForProgramType(rewrittenMethod.holder);
assert clazz != null;
diff --git a/src/main/java/com/android/tools/r8/dex/ApplicationWriter.java b/src/main/java/com/android/tools/r8/dex/ApplicationWriter.java
index 8986801..f0e8da6 100644
--- a/src/main/java/com/android/tools/r8/dex/ApplicationWriter.java
+++ b/src/main/java/com/android/tools/r8/dex/ApplicationWriter.java
@@ -33,7 +33,7 @@
import com.android.tools.r8.graph.DexTypeList;
import com.android.tools.r8.graph.DexValue;
import com.android.tools.r8.graph.EnclosingMethodAttribute;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.InitClassLens;
import com.android.tools.r8.graph.InnerClassAttribute;
import com.android.tools.r8.graph.ObjectToOffsetMapping;
@@ -69,7 +69,7 @@
public final DexApplication application;
public final AppView<?> appView;
- public final GraphLense graphLense;
+ public final GraphLens graphLens;
public final InitClassLens initClassLens;
public final NamingLens namingLens;
public final InternalOptions options;
@@ -148,7 +148,7 @@
AppView<?> appView,
InternalOptions options,
List<Marker> markers,
- GraphLense graphLense,
+ GraphLens graphLens,
InitClassLens initClassLens,
NamingLens namingLens,
ProguardMapSupplier proguardMapSupplier) {
@@ -157,7 +157,7 @@
appView,
options,
markers,
- graphLense,
+ graphLens,
initClassLens,
namingLens,
proguardMapSupplier,
@@ -169,7 +169,7 @@
AppView<?> appView,
InternalOptions options,
List<Marker> markers,
- GraphLense graphLense,
+ GraphLens graphLens,
InitClassLens initClassLens,
NamingLens namingLens,
ProguardMapSupplier proguardMapSupplier,
@@ -181,7 +181,7 @@
this.options = options;
this.desugaredLibraryCodeToKeep = CodeToKeep.createCodeToKeep(options, namingLens);
this.markers = markers;
- this.graphLense = graphLense;
+ this.graphLens = graphLens;
this.initClassLens = initClassLens;
this.namingLens = namingLens;
this.proguardMapSupplier = proguardMapSupplier;
@@ -338,7 +338,7 @@
// Fail if there are pending errors, e.g., the program consumers may have reported errors.
options.reporter.failIfPendingErrors();
// Supply info to all additional resource consumers.
- supplyAdditionalConsumers(application, appView, graphLense, namingLens, options);
+ supplyAdditionalConsumers(application, appView, graphLens, namingLens, options);
} finally {
application.timing.end();
}
@@ -347,7 +347,7 @@
public static void supplyAdditionalConsumers(
DexApplication application,
AppView<?> appView,
- GraphLense graphLense,
+ GraphLens graphLens,
NamingLens namingLens,
InternalOptions options) {
if (options.configurationConsumer != null) {
@@ -366,7 +366,7 @@
if (dataResourceConsumer != null) {
ImmutableList<DataResourceProvider> dataResourceProviders = application.dataResourceProviders;
ResourceAdapter resourceAdapter =
- new ResourceAdapter(appView, application.dexItemFactory, graphLense, namingLens, options);
+ new ResourceAdapter(appView, application.dexItemFactory, graphLens, namingLens, options);
adaptAndPassDataResources(
options, dataResourceConsumer, dataResourceProviders, resourceAdapter);
@@ -402,7 +402,7 @@
options.featureSplitConfiguration.getDataResourceProvidersAndConsumers()) {
ResourceAdapter resourceAdapter =
new ResourceAdapter(
- appView, application.dexItemFactory, graphLense, namingLens, options);
+ appView, application.dexItemFactory, graphLens, namingLens, options);
adaptAndPassDataResources(
options, entry.getConsumer(), entry.getProviders(), resourceAdapter);
}
diff --git a/src/main/java/com/android/tools/r8/dex/ResourceAdapter.java b/src/main/java/com/android/tools/r8/dex/ResourceAdapter.java
index 14a8261..536515d 100644
--- a/src/main/java/com/android/tools/r8/dex/ResourceAdapter.java
+++ b/src/main/java/com/android/tools/r8/dex/ResourceAdapter.java
@@ -13,7 +13,7 @@
import com.android.tools.r8.graph.DexItemFactory;
import com.android.tools.r8.graph.DexString;
import com.android.tools.r8.graph.DexType;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.naming.NamingLens;
import com.android.tools.r8.shaking.ProguardPathFilter;
import com.android.tools.r8.utils.DescriptorUtils;
@@ -31,20 +31,20 @@
private final AppView<?> appView;
private final DexItemFactory dexItemFactory;
- private final GraphLense graphLense;
- private final NamingLens namingLense;
+ private final GraphLens graphLens;
+ private final NamingLens namingLens;
private final InternalOptions options;
public ResourceAdapter(
AppView<?> appView,
DexItemFactory dexItemFactory,
- GraphLense graphLense,
- NamingLens namingLense,
+ GraphLens graphLens,
+ NamingLens namingLens,
InternalOptions options) {
this.appView = appView;
this.dexItemFactory = dexItemFactory;
- this.graphLense = graphLense;
- this.namingLense = namingLense;
+ this.graphLens = graphLens;
+ this.namingLens = namingLens;
this.options = options;
}
@@ -268,7 +268,7 @@
DescriptorUtils.javaTypeToDescriptorIgnorePrimitives(javaType));
DexType dexType = descriptor != null ? dexItemFactory.lookupType(descriptor) : null;
if (dexType != null) {
- DexString renamedDescriptor = namingLense.lookupDescriptor(graphLense.lookupType(dexType));
+ DexString renamedDescriptor = namingLens.lookupDescriptor(graphLens.lookupType(dexType));
if (!descriptor.equals(renamedDescriptor)) {
String renamedJavaType =
DescriptorUtils.descriptorToJavaType(renamedDescriptor.toSourceString());
@@ -293,7 +293,7 @@
if (getClassNameSeparator() != '/') {
javaPackage = javaPackage.replace(getClassNameSeparator(), '/');
}
- String minifiedJavaPackage = namingLense.lookupPackageName(javaPackage);
+ String minifiedJavaPackage = namingLens.lookupPackageName(javaPackage);
if (!javaPackage.equals(minifiedJavaPackage)) {
outputRangeFromInput(outputFrom, from);
outputJavaType(
diff --git a/src/main/java/com/android/tools/r8/graph/AppServices.java b/src/main/java/com/android/tools/r8/graph/AppServices.java
index 0dbaa30..f853b30 100644
--- a/src/main/java/com/android/tools/r8/graph/AppServices.java
+++ b/src/main/java/com/android/tools/r8/graph/AppServices.java
@@ -101,7 +101,7 @@
return false;
}
- public AppServices rewrittenWithLens(GraphLense graphLens) {
+ public AppServices rewrittenWithLens(GraphLens graphLens) {
ImmutableMap.Builder<DexType, Map<FeatureSplit, List<DexType>>> rewrittenFeatureMappings =
ImmutableMap.builder();
for (Entry<DexType, Map<FeatureSplit, List<DexType>>> entry : services.entrySet()) {
@@ -157,10 +157,10 @@
private boolean verifyRewrittenWithLens() {
for (Entry<DexType, Map<FeatureSplit, List<DexType>>> entry : services.entrySet()) {
- assert entry.getKey() == appView.graphLense().lookupType(entry.getKey());
+ assert entry.getKey() == appView.graphLens().lookupType(entry.getKey());
for (Entry<FeatureSplit, List<DexType>> featureEntry : entry.getValue().entrySet()) {
for (DexType type : featureEntry.getValue()) {
- assert type == appView.graphLense().lookupType(type);
+ assert type == appView.graphLens().lookupType(type);
}
}
}
diff --git a/src/main/java/com/android/tools/r8/graph/AppView.java b/src/main/java/com/android/tools/r8/graph/AppView.java
index 245a9ab..7b0c80f 100644
--- a/src/main/java/com/android/tools/r8/graph/AppView.java
+++ b/src/main/java/com/android/tools/r8/graph/AppView.java
@@ -45,7 +45,7 @@
private AppInfoWithClassHierarchy appInfoForDesugaring;
private AppServices appServices;
private final WholeProgramOptimizations wholeProgramOptimizations;
- private GraphLense graphLense;
+ private GraphLens graphLens;
private InitClassLens initClassLens;
private RootSet rootSet;
// This should perferably always be obtained via AppInfoWithLiveness.
@@ -82,7 +82,7 @@
assert appInfo != null;
this.appInfo = appInfo;
this.wholeProgramOptimizations = wholeProgramOptimizations;
- this.graphLense = GraphLense.getIdentityLense();
+ this.graphLens = GraphLens.getIdentityLens();
this.initClassLens = InitClassLens.getDefault();
this.methodProcessingIdFactory =
new MethodProcessingId.Factory(options().testing.methodProcessingIdConsumer);
@@ -196,8 +196,8 @@
allCodeProcessed = true;
}
- public GraphLense clearCodeRewritings() {
- return graphLense = graphLense.withCodeRewritingsApplied();
+ public GraphLens clearCodeRewritings() {
+ return graphLens = graphLens.withCodeRewritingsApplied();
}
public AppServices appServices() {
@@ -329,14 +329,14 @@
return defaultValue;
}
- public GraphLense graphLense() {
- return graphLense;
+ public GraphLens graphLens() {
+ return graphLens;
}
/** @return true if the graph lens changed, otherwise false. */
- public boolean setGraphLense(GraphLense graphLense) {
- if (graphLense != this.graphLense) {
- this.graphLense = graphLense;
+ public boolean setGraphLens(GraphLens graphLens) {
+ if (graphLens != this.graphLens) {
+ this.graphLens = graphLens;
return true;
}
return false;
diff --git a/src/main/java/com/android/tools/r8/graph/AppliedGraphLens.java b/src/main/java/com/android/tools/r8/graph/AppliedGraphLens.java
index 7e46aad..b602135 100644
--- a/src/main/java/com/android/tools/r8/graph/AppliedGraphLens.java
+++ b/src/main/java/com/android/tools/r8/graph/AppliedGraphLens.java
@@ -17,7 +17,7 @@
*
* <p>The mappings from the original program to the generated program are kept, though.
*/
-public class AppliedGraphLens extends GraphLense {
+public class AppliedGraphLens extends GraphLens {
private final AppView<?> appView;
@@ -37,7 +37,7 @@
DexType type = clazz.type;
if (appView.verticallyMergedClasses() != null
&& !appView.verticallyMergedClasses().hasBeenMergedIntoSubtype(type)) {
- DexType original = appView.graphLense().getOriginalType(type);
+ DexType original = appView.graphLens().getOriginalType(type);
if (original != type) {
DexType existing = originalTypeNames.forcePut(type, original);
assert existing == null;
@@ -48,7 +48,7 @@
// Record original field signatures.
for (DexEncodedField encodedField : clazz.fields()) {
DexField field = encodedField.field;
- DexField original = appView.graphLense().getOriginalFieldSignature(field);
+ DexField original = appView.graphLens().getOriginalFieldSignature(field);
if (original != field) {
DexField existing = originalFieldSignatures.forcePut(field, original);
assert existing == null;
@@ -58,7 +58,7 @@
// Record original method signatures.
for (DexEncodedMethod encodedMethod : clazz.methods()) {
DexMethod method = encodedMethod.method;
- DexMethod original = appView.graphLense().getOriginalMethodSignature(method);
+ DexMethod original = appView.graphLens().getOriginalMethodSignature(method);
if (original != method) {
DexMethod existing = originalMethodSignatures.inverse().get(original);
if (existing == null) {
@@ -101,7 +101,7 @@
}
@Override
- public DexMethod getRenamedMethodSignature(DexMethod originalMethod, GraphLense applied) {
+ public DexMethod getRenamedMethodSignature(DexMethod originalMethod, GraphLens applied) {
return this != applied
? originalMethodSignatures.inverse().getOrDefault(originalMethod, originalMethod)
: originalMethod;
@@ -117,9 +117,8 @@
}
@Override
- public GraphLenseLookupResult lookupMethod(
- DexMethod method, DexMethod context, Invoke.Type type) {
- return new GraphLenseLookupResult(method, type);
+ public GraphLensLookupResult lookupMethod(DexMethod method, DexMethod context, Invoke.Type type) {
+ return new GraphLensLookupResult(method, type);
}
@Override
diff --git a/src/main/java/com/android/tools/r8/graph/CfCode.java b/src/main/java/com/android/tools/r8/graph/CfCode.java
index 0b9b084..24237bb 100644
--- a/src/main/java/com/android/tools/r8/graph/CfCode.java
+++ b/src/main/java/com/android/tools/r8/graph/CfCode.java
@@ -94,7 +94,7 @@
// The original holder is a reference to the holder type that the method was in from input and
// for which the invokes still refer to. The holder is needed to determine if an invoke-special
// maps to an invoke-direct or invoke-super.
- // TODO(b/135969130): Make IR building lense aware and avoid caching the holder type.
+ // TODO(b/135969130): Make IR building lens aware and avoid caching the holder type.
private final DexType originalHolder;
private final int maxStack;
@@ -381,7 +381,7 @@
this,
localVariables,
method,
- appView.graphLense().getOriginalMethodSignature(method.getReference()),
+ appView.graphLens().getOriginalMethodSignature(method.getReference()),
callerPosition,
origin,
appView);
@@ -507,9 +507,9 @@
public ConstraintWithTarget computeInliningConstraint(
ProgramMethod method,
AppView<AppInfoWithLiveness> appView,
- GraphLense graphLense,
+ GraphLens graphLens,
DexProgramClass context) {
- InliningConstraints inliningConstraints = new InliningConstraints(appView, graphLense);
+ InliningConstraints inliningConstraints = new InliningConstraints(appView, graphLens);
if (appView.options().isInterfaceMethodDesugaringEnabled()) {
// TODO(b/120130831): Conservatively need to say "no" at this point if there are invocations
// to static interface methods. This should be fixed by making sure that the desugared
diff --git a/src/main/java/com/android/tools/r8/graph/DexCode.java b/src/main/java/com/android/tools/r8/graph/DexCode.java
index b4eeb9e..76bead8 100644
--- a/src/main/java/com/android/tools/r8/graph/DexCode.java
+++ b/src/main/java/com/android/tools/r8/graph/DexCode.java
@@ -219,7 +219,7 @@
new DexSourceCode(
this,
method,
- appView.graphLense().getOriginalMethodSignature(method.getReference()),
+ appView.graphLens().getOriginalMethodSignature(method.getReference()),
null);
return IRBuilder.create(method, appView, source, origin).build(method);
}
@@ -237,7 +237,7 @@
new DexSourceCode(
this,
method,
- appView.graphLense().getOriginalMethodSignature(method.getReference()),
+ appView.graphLens().getOriginalMethodSignature(method.getReference()),
callerPosition);
return IRBuilder.createForInlining(
method, appView, source, origin, methodProcessor, valueNumberGenerator)
diff --git a/src/main/java/com/android/tools/r8/graph/DexEncodedMethod.java b/src/main/java/com/android/tools/r8/graph/DexEncodedMethod.java
index 4c0c7c5..019d295 100644
--- a/src/main/java/com/android/tools/r8/graph/DexEncodedMethod.java
+++ b/src/main/java/com/android/tools/r8/graph/DexEncodedMethod.java
@@ -170,7 +170,7 @@
public boolean isObsolete() {
// Do not be cheating. This util can be used only if you're going to do appropriate action,
- // e.g., using GraphLense#mapDexEncodedMethod to look up the correct, up-to-date instance.
+ // e.g., using GraphLens#mapDexEncodedMethod to look up the correct, up-to-date instance.
return obsolete;
}
diff --git a/src/main/java/com/android/tools/r8/graph/DirectMappedDexApplication.java b/src/main/java/com/android/tools/r8/graph/DirectMappedDexApplication.java
index ab9be40..3a78118 100644
--- a/src/main/java/com/android/tools/r8/graph/DirectMappedDexApplication.java
+++ b/src/main/java/com/android/tools/r8/graph/DirectMappedDexApplication.java
@@ -120,7 +120,7 @@
return "DexApplication (direct)";
}
- public DirectMappedDexApplication rewrittenWithLens(GraphLense lens) {
+ public DirectMappedDexApplication rewrittenWithLens(GraphLens lens) {
// As a side effect, this will rebuild the program classes and library classes maps.
DirectMappedDexApplication rewrittenApplication = builder().build().asDirect();
assert rewrittenApplication.mappingIsValid(lens, allClasses.keySet());
@@ -128,7 +128,7 @@
return rewrittenApplication;
}
- public boolean verifyNothingToRewrite(AppView<?> appView, GraphLense lens) {
+ public boolean verifyNothingToRewrite(AppView<?> appView, GraphLens lens) {
assert allClasses.keySet().stream()
.allMatch(
type ->
@@ -138,12 +138,12 @@
return true;
}
- private boolean mappingIsValid(GraphLense graphLense, Iterable<DexType> types) {
+ private boolean mappingIsValid(GraphLens graphLens, Iterable<DexType> types) {
// The lens might either map to a different type that is already present in the application
// (e.g. relinking a type) or it might encode a type that was renamed, in which case the
// original type will point to a definition that was renamed.
for (DexType type : types) {
- DexType renamed = graphLense.lookupType(type);
+ DexType renamed = graphLens.lookupType(type);
if (renamed != type) {
if (definitionFor(type) == null && definitionFor(renamed) != null) {
continue;
diff --git a/src/main/java/com/android/tools/r8/graph/EnumValueInfoMapCollection.java b/src/main/java/com/android/tools/r8/graph/EnumValueInfoMapCollection.java
index e5f7c51..4ee6be1 100644
--- a/src/main/java/com/android/tools/r8/graph/EnumValueInfoMapCollection.java
+++ b/src/main/java/com/android/tools/r8/graph/EnumValueInfoMapCollection.java
@@ -38,7 +38,7 @@
return maps.keySet();
}
- public EnumValueInfoMapCollection rewrittenWithLens(GraphLense lens) {
+ public EnumValueInfoMapCollection rewrittenWithLens(GraphLens lens) {
Builder builder = builder();
maps.forEach(
(type, map) -> {
@@ -100,7 +100,7 @@
map.forEach(consumer);
}
- EnumValueInfoMap rewrittenWithLens(GraphLense lens) {
+ EnumValueInfoMap rewrittenWithLens(GraphLens lens) {
LinkedHashMap<DexField, EnumValueInfo> rewritten = new LinkedHashMap<>();
map.forEach(
(field, valueInfo) ->
@@ -124,7 +124,7 @@
return ordinal + 1;
}
- EnumValueInfo rewrittenWithLens(GraphLense lens) {
+ EnumValueInfo rewrittenWithLens(GraphLens lens) {
DexType newType = lens.lookupType(type);
if (type == newType) {
return this;
diff --git a/src/main/java/com/android/tools/r8/graph/FieldAccessInfoCollectionImpl.java b/src/main/java/com/android/tools/r8/graph/FieldAccessInfoCollectionImpl.java
index 9dd6c41..6224914 100644
--- a/src/main/java/com/android/tools/r8/graph/FieldAccessInfoCollectionImpl.java
+++ b/src/main/java/com/android/tools/r8/graph/FieldAccessInfoCollectionImpl.java
@@ -54,7 +54,7 @@
}
public FieldAccessInfoCollectionImpl rewrittenWithLens(
- DexDefinitionSupplier definitions, GraphLense lens) {
+ DexDefinitionSupplier definitions, GraphLens lens) {
FieldAccessInfoCollectionImpl collection = new FieldAccessInfoCollectionImpl();
infos.forEach(
(field, info) ->
diff --git a/src/main/java/com/android/tools/r8/graph/FieldAccessInfoImpl.java b/src/main/java/com/android/tools/r8/graph/FieldAccessInfoImpl.java
index 383c6e2..ae8a212 100644
--- a/src/main/java/com/android/tools/r8/graph/FieldAccessInfoImpl.java
+++ b/src/main/java/com/android/tools/r8/graph/FieldAccessInfoImpl.java
@@ -313,7 +313,7 @@
writesWithContexts = null;
}
- public FieldAccessInfoImpl rewrittenWithLens(DexDefinitionSupplier definitions, GraphLense lens) {
+ public FieldAccessInfoImpl rewrittenWithLens(DexDefinitionSupplier definitions, GraphLens lens) {
FieldAccessInfoImpl rewritten = new FieldAccessInfoImpl(lens.lookupField(field));
rewritten.flags = flags;
if (readsWithContexts != null) {
diff --git a/src/main/java/com/android/tools/r8/graph/GenericSignature.java b/src/main/java/com/android/tools/r8/graph/GenericSignature.java
index 3b4d284..beb391d 100644
--- a/src/main/java/com/android/tools/r8/graph/GenericSignature.java
+++ b/src/main/java/com/android/tools/r8/graph/GenericSignature.java
@@ -750,7 +750,7 @@
}
String originalDescriptor = getDescriptorFromClassBinaryName(name);
DexType type =
- appView.graphLense().lookupType(appView.dexItemFactory().createType(originalDescriptor));
+ appView.graphLens().lookupType(appView.dexItemFactory().createType(originalDescriptor));
if (appView.appInfo().wasPruned(type)) {
type = appView.dexItemFactory().objectType;
}
@@ -783,7 +783,7 @@
getClassBinaryNameFromDescriptor(enclosingDescriptor)
+ DescriptorUtils.INNER_CLASS_SEPARATOR
+ name));
- return appView.graphLense().lookupType(type);
+ return appView.graphLens().lookupType(type);
}
//
diff --git a/src/main/java/com/android/tools/r8/graph/GraphLense.java b/src/main/java/com/android/tools/r8/graph/GraphLens.java
similarity index 84%
rename from src/main/java/com/android/tools/r8/graph/GraphLense.java
rename to src/main/java/com/android/tools/r8/graph/GraphLens.java
index 0bcbc76..bf6c5c8 100644
--- a/src/main/java/com/android/tools/r8/graph/GraphLense.java
+++ b/src/main/java/com/android/tools/r8/graph/GraphLens.java
@@ -22,32 +22,34 @@
import java.util.function.Supplier;
/**
- * A GraphLense implements a virtual view on top of the graph, used to delay global rewrites until
+ * A GraphLens implements a virtual view on top of the graph, used to delay global rewrites until
* later IR processing stages.
- * <p>
- * Valid remappings are limited to the following operations:
+ *
+ * <p>Valid remappings are limited to the following operations:
+ *
* <ul>
- * <li>Mapping a classes type to one of the super/subtypes.</li>
- * <li>Renaming private methods/fields.</li>
- * <li>Moving methods/fields to a super/subclass.</li>
- * <li>Replacing method/field references by the same method/field on a super/subtype</li>
- * <li>Moved methods might require changed invocation type at the call site</li>
+ * <li>Mapping a classes type to one of the super/subtypes.
+ * <li>Renaming private methods/fields.
+ * <li>Moving methods/fields to a super/subclass.
+ * <li>Replacing method/field references by the same method/field on a super/subtype
+ * <li>Moved methods might require changed invocation type at the call site
* </ul>
+ *
* Note that the latter two have to take visibility into account.
*/
-public abstract class GraphLense {
+public abstract class GraphLens {
/**
- * Result of a method lookup in a GraphLense.
+ * Result of a method lookup in a GraphLens.
*
- * This provide the new target and the invoke type to use.
+ * <p>This provide the new target and the invoke type to use.
*/
- public static class GraphLenseLookupResult {
+ public static class GraphLensLookupResult {
private final DexMethod method;
private final Type type;
- public GraphLenseLookupResult(DexMethod method, Type type) {
+ public GraphLensLookupResult(DexMethod method, Type type) {
this.method = method;
this.type = type;
}
@@ -109,21 +111,21 @@
originalFieldSignatures.put(to, from);
}
- public GraphLense build(DexItemFactory dexItemFactory) {
- return build(dexItemFactory, getIdentityLense());
+ public GraphLens build(DexItemFactory dexItemFactory) {
+ return build(dexItemFactory, getIdentityLens());
}
- public GraphLense build(DexItemFactory dexItemFactory, GraphLense previousLense) {
+ public GraphLens build(DexItemFactory dexItemFactory, GraphLens previousLens) {
if (typeMap.isEmpty() && methodMap.isEmpty() && fieldMap.isEmpty()) {
- return previousLense;
+ return previousLens;
}
- return new NestedGraphLense(
+ return new NestedGraphLens(
typeMap,
methodMap,
fieldMap,
originalFieldSignatures,
originalMethodSignatures,
- previousLense,
+ previousLens,
dexItemFactory);
}
}
@@ -144,7 +146,7 @@
return getRenamedMethodSignature(originalMethod, null);
}
- public abstract DexMethod getRenamedMethodSignature(DexMethod originalMethod, GraphLense applied);
+ public abstract DexMethod getRenamedMethodSignature(DexMethod originalMethod, GraphLens applied);
public DexEncodedMethod mapDexEncodedMethod(
DexEncodedMethod originalEncodedMethod, DexDefinitionSupplier definitions) {
@@ -154,7 +156,7 @@
public DexEncodedMethod mapDexEncodedMethod(
DexEncodedMethod originalEncodedMethod,
DexDefinitionSupplier definitions,
- GraphLense applied) {
+ GraphLens applied) {
assert originalEncodedMethod != DexEncodedMethod.SENTINEL;
DexMethod newMethod = getRenamedMethodSignature(originalEncodedMethod.method, applied);
// Note that:
@@ -178,13 +180,13 @@
public abstract DexType lookupType(DexType type);
- // This overload can be used when the graph lense is known to be context insensitive.
+ // This overload can be used when the graph lens is known to be context insensitive.
public DexMethod lookupMethod(DexMethod method) {
assert verifyIsContextFreeForMethod(method);
return lookupMethod(method, null, null).getMethod();
}
- public abstract GraphLenseLookupResult lookupMethod(
+ public abstract GraphLensLookupResult lookupMethod(
DexMethod method, DexMethod context, Type type);
public abstract RewrittenPrototypeDescription lookupPrototypeChanges(DexMethod method);
@@ -216,9 +218,9 @@
// example, used by the vertical class merger to translate invoke-super instructions that hit
// a method in the direct super class to invoke-direct instructions after class merging.
//
- // This method can be used to determine if a graph lense is context sensitive. If a graph lense
+ // This method can be used to determine if a graph lens is context sensitive. If a graph lens
// is context insensitive, it is safe to invoke lookupMethod() without a context (or to pass null
- // as context). Trying to invoke a context sensitive graph lense without a context will lead to
+ // as context). Trying to invoke a context sensitive graph lens without a context will lead to
// an assertion error.
public abstract boolean isContextFreeForMethods();
@@ -226,19 +228,19 @@
return isContextFreeForMethods();
}
- public static GraphLense getIdentityLense() {
- return IdentityGraphLense.getInstance();
+ public static GraphLens getIdentityLens() {
+ return IdentityGraphLens.getInstance();
}
public boolean hasCodeRewritings() {
return true;
}
- public final boolean isIdentityLense() {
- return this == getIdentityLense();
+ public final boolean isIdentityLens() {
+ return this == getIdentityLens();
}
- public GraphLense withCodeRewritingsApplied() {
+ public GraphLens withCodeRewritingsApplied() {
if (hasCodeRewritings()) {
return new ClearCodeRewritingGraphLens(this);
}
@@ -390,13 +392,13 @@
return true;
}
- private static class IdentityGraphLense extends GraphLense {
+ private static class IdentityGraphLens extends GraphLens {
- private static IdentityGraphLense INSTANCE = new IdentityGraphLense();
+ private static IdentityGraphLens INSTANCE = new IdentityGraphLens();
- private IdentityGraphLense() {}
+ private IdentityGraphLens() {}
- private static IdentityGraphLense getInstance() {
+ private static IdentityGraphLens getInstance() {
return INSTANCE;
}
@@ -421,7 +423,7 @@
}
@Override
- public DexMethod getRenamedMethodSignature(DexMethod originalMethod, GraphLense applied) {
+ public DexMethod getRenamedMethodSignature(DexMethod originalMethod, GraphLens applied) {
return originalMethod;
}
@@ -431,8 +433,8 @@
}
@Override
- public GraphLenseLookupResult lookupMethod(DexMethod method, DexMethod context, Type type) {
- return new GraphLenseLookupResult(method, type);
+ public GraphLensLookupResult lookupMethod(DexMethod method, DexMethod context, Type type) {
+ return new GraphLensLookupResult(method, type);
}
@Override
@@ -458,11 +460,11 @@
// This lens clears all code rewriting (lookup methods mimics identity lens behavior) but still
// relies on the previous lens for names (getRenamed/Original methods).
- public static class ClearCodeRewritingGraphLens extends IdentityGraphLense {
+ public static class ClearCodeRewritingGraphLens extends IdentityGraphLens {
- private final GraphLense previous;
+ private final GraphLens previous;
- public ClearCodeRewritingGraphLens(GraphLense previous) {
+ public ClearCodeRewritingGraphLens(GraphLens previous) {
this.previous = previous;
}
@@ -487,7 +489,7 @@
}
@Override
- public DexMethod getRenamedMethodSignature(DexMethod originalMethod, GraphLense applied) {
+ public DexMethod getRenamedMethodSignature(DexMethod originalMethod, GraphLens applied) {
return this != applied
? previous.getRenamedMethodSignature(originalMethod, applied)
: originalMethod;
@@ -500,7 +502,7 @@
}
/**
- * GraphLense implementation with a parent lense using a simple mapping for type, method and field
+ * GraphLens implementation with a parent lens using a simple mapping for type, method and field
* mapping.
*
* <p>Subclasses can override the lookup methods.
@@ -509,9 +511,9 @@
* #mapInvocationType(DexMethod, DexMethod, Type)} if the default name mapping applies, and only
* invocation type might need to change.
*/
- public static class NestedGraphLense extends GraphLense {
+ public static class NestedGraphLens extends GraphLens {
- protected GraphLense previousLense;
+ protected GraphLens previousLens;
protected final DexItemFactory dexItemFactory;
protected final Map<DexType, DexType> typeMap;
@@ -524,42 +526,44 @@
protected final BiMap<DexField, DexField> originalFieldSignatures;
protected final BiMap<DexMethod, DexMethod> originalMethodSignatures;
- // Overrides this if the sub type needs to be a nested lense while it doesn't have any mappings
- // at all, e.g., publicizer lense that changes invocation type only.
+ // Overrides this if the sub type needs to be a nested lens while it doesn't have any mappings
+ // at all, e.g., publicizer lens that changes invocation type only.
protected boolean isLegitimateToHaveEmptyMappings() {
return false;
}
- public NestedGraphLense(
+ public NestedGraphLens(
Map<DexType, DexType> typeMap,
Map<DexMethod, DexMethod> methodMap,
Map<DexField, DexField> fieldMap,
BiMap<DexField, DexField> originalFieldSignatures,
BiMap<DexMethod, DexMethod> originalMethodSignatures,
- GraphLense previousLense,
+ GraphLens previousLens,
DexItemFactory dexItemFactory) {
- assert !typeMap.isEmpty() || !methodMap.isEmpty() || !fieldMap.isEmpty()
+ assert !typeMap.isEmpty()
+ || !methodMap.isEmpty()
+ || !fieldMap.isEmpty()
|| isLegitimateToHaveEmptyMappings();
this.typeMap = typeMap.isEmpty() ? null : typeMap;
this.methodMap = methodMap;
this.fieldMap = fieldMap;
this.originalFieldSignatures = originalFieldSignatures;
this.originalMethodSignatures = originalMethodSignatures;
- this.previousLense = previousLense;
+ this.previousLens = previousLens;
this.dexItemFactory = dexItemFactory;
}
- public <T> T withAlternativeParentLens(GraphLense lens, Supplier<T> action) {
- GraphLense oldParent = previousLense;
- previousLense = lens;
+ public <T> T withAlternativeParentLens(GraphLens lens, Supplier<T> action) {
+ GraphLens oldParent = previousLens;
+ previousLens = lens;
T result = action.get();
- previousLense = oldParent;
+ previousLens = oldParent;
return result;
}
@Override
public DexType getOriginalType(DexType type) {
- return previousLense.getOriginalType(type);
+ return previousLens.getOriginalType(type);
}
@Override
@@ -568,7 +572,7 @@
originalFieldSignatures != null
? originalFieldSignatures.getOrDefault(field, field)
: field;
- return previousLense.getOriginalFieldSignature(originalField);
+ return previousLens.getOriginalFieldSignature(originalField);
}
@Override
@@ -577,23 +581,23 @@
originalMethodSignatures != null
? originalMethodSignatures.getOrDefault(method, method)
: method;
- return previousLense.getOriginalMethodSignature(originalMethod);
+ return previousLens.getOriginalMethodSignature(originalMethod);
}
@Override
public DexField getRenamedFieldSignature(DexField originalField) {
- DexField renamedField = previousLense.getRenamedFieldSignature(originalField);
+ DexField renamedField = previousLens.getRenamedFieldSignature(originalField);
return originalFieldSignatures != null
? originalFieldSignatures.inverse().getOrDefault(renamedField, renamedField)
: renamedField;
}
@Override
- public DexMethod getRenamedMethodSignature(DexMethod originalMethod, GraphLense applied) {
+ public DexMethod getRenamedMethodSignature(DexMethod originalMethod, GraphLens applied) {
if (this == applied) {
return originalMethod;
}
- DexMethod renamedMethod = previousLense.getRenamedMethodSignature(originalMethod, applied);
+ DexMethod renamedMethod = previousLens.getRenamedMethodSignature(originalMethod, applied);
return originalMethodSignatures != null
? originalMethodSignatures.inverse().getOrDefault(renamedMethod, renamedMethod)
: renamedMethod;
@@ -618,40 +622,40 @@
return result;
}
}
- DexType previous = previousLense.lookupType(type);
+ DexType previous = previousLens.lookupType(type);
return typeMap != null ? typeMap.getOrDefault(previous, previous) : previous;
}
@Override
- public GraphLenseLookupResult lookupMethod(DexMethod method, DexMethod context, Type type) {
+ public GraphLensLookupResult lookupMethod(DexMethod method, DexMethod context, Type type) {
DexMethod previousContext =
originalMethodSignatures != null
? originalMethodSignatures.getOrDefault(context, context)
: context;
- GraphLenseLookupResult previous = previousLense.lookupMethod(method, previousContext, type);
+ GraphLensLookupResult previous = previousLens.lookupMethod(method, previousContext, type);
DexMethod newMethod = methodMap.get(previous.getMethod());
if (newMethod == null) {
return previous;
}
// TODO(sgjesse): Should we always do interface to virtual mapping? Is it a performance win
// that only subclasses which are known to need it actually do it?
- return new GraphLenseLookupResult(
+ return new GraphLensLookupResult(
newMethod, mapInvocationType(newMethod, method, previous.getType()));
}
@Override
public RewrittenPrototypeDescription lookupPrototypeChanges(DexMethod method) {
- return previousLense.lookupPrototypeChanges(method);
+ return previousLens.lookupPrototypeChanges(method);
}
@Override
public DexMethod lookupGetFieldForMethod(DexField field, DexMethod context) {
- return previousLense.lookupGetFieldForMethod(field, context);
+ return previousLens.lookupGetFieldForMethod(field, context);
}
@Override
public DexMethod lookupPutFieldForMethod(DexField field, DexMethod context) {
- return previousLense.lookupPutFieldForMethod(field, context);
+ return previousLens.lookupPutFieldForMethod(field, context);
}
/**
@@ -694,18 +698,18 @@
@Override
public DexField lookupField(DexField field) {
- DexField previous = previousLense.lookupField(field);
+ DexField previous = previousLens.lookupField(field);
return fieldMap.getOrDefault(previous, previous);
}
@Override
public boolean isContextFreeForMethods() {
- return previousLense.isContextFreeForMethods();
+ return previousLens.isContextFreeForMethods();
}
@Override
public boolean verifyIsContextFreeForMethod(DexMethod method) {
- assert previousLense.verifyIsContextFreeForMethod(method);
+ assert previousLens.verifyIsContextFreeForMethod(method);
return true;
}
@@ -726,7 +730,7 @@
builder.append(entry.getKey().toSourceString()).append(" -> ");
builder.append(entry.getValue().toSourceString()).append(System.lineSeparator());
}
- builder.append(previousLense.toString());
+ builder.append(previousLens.toString());
return builder.toString();
}
}
diff --git a/src/main/java/com/android/tools/r8/graph/ObjectAllocationInfoCollection.java b/src/main/java/com/android/tools/r8/graph/ObjectAllocationInfoCollection.java
index 546bf90..60c06cc 100644
--- a/src/main/java/com/android/tools/r8/graph/ObjectAllocationInfoCollection.java
+++ b/src/main/java/com/android/tools/r8/graph/ObjectAllocationInfoCollection.java
@@ -27,5 +27,5 @@
boolean isImmediateInterfaceOfInstantiatedLambda(DexProgramClass clazz);
ObjectAllocationInfoCollection rewrittenWithLens(
- DexDefinitionSupplier definitions, GraphLense lens);
+ DexDefinitionSupplier definitions, GraphLens lens);
}
diff --git a/src/main/java/com/android/tools/r8/graph/ObjectAllocationInfoCollectionImpl.java b/src/main/java/com/android/tools/r8/graph/ObjectAllocationInfoCollectionImpl.java
index 1245da9..0997dc4 100644
--- a/src/main/java/com/android/tools/r8/graph/ObjectAllocationInfoCollectionImpl.java
+++ b/src/main/java/com/android/tools/r8/graph/ObjectAllocationInfoCollectionImpl.java
@@ -133,7 +133,7 @@
@Override
public ObjectAllocationInfoCollectionImpl rewrittenWithLens(
- DexDefinitionSupplier definitions, GraphLense lens) {
+ DexDefinitionSupplier definitions, GraphLens lens) {
return builder(true, null).rewrittenWithLens(this, definitions, lens).build(definitions);
}
@@ -368,7 +368,7 @@
Builder rewrittenWithLens(
ObjectAllocationInfoCollectionImpl objectAllocationInfos,
DexDefinitionSupplier definitions,
- GraphLense lens) {
+ GraphLens lens) {
instantiatedHierarchy = null;
objectAllocationInfos.classesWithAllocationSiteTracking.forEach(
(clazz, allocationSitesForClass) -> {
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/fieldvalueanalysis/AbstractFieldSet.java b/src/main/java/com/android/tools/r8/ir/analysis/fieldvalueanalysis/AbstractFieldSet.java
index c6e42b6..7d13544 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/fieldvalueanalysis/AbstractFieldSet.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/fieldvalueanalysis/AbstractFieldSet.java
@@ -6,7 +6,7 @@
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DexEncodedField;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
/**
* Implements a lifted subset lattice for fields.
@@ -70,5 +70,5 @@
return lessThanOrEqual(other) && !equals(other);
}
- public abstract AbstractFieldSet rewrittenWithLens(AppView<?> appView, GraphLense lens);
+ public abstract AbstractFieldSet rewrittenWithLens(AppView<?> appView, GraphLens lens);
}
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/fieldvalueanalysis/ConcreteMutableFieldSet.java b/src/main/java/com/android/tools/r8/ir/analysis/fieldvalueanalysis/ConcreteMutableFieldSet.java
index 9fe885d..5bf0c61 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/fieldvalueanalysis/ConcreteMutableFieldSet.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/fieldvalueanalysis/ConcreteMutableFieldSet.java
@@ -8,7 +8,7 @@
import com.android.tools.r8.graph.DexClass;
import com.android.tools.r8.graph.DexEncodedField;
import com.android.tools.r8.graph.DexField;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.utils.InternalOptions;
import com.android.tools.r8.utils.SetUtils;
import com.google.common.collect.Sets;
@@ -69,7 +69,7 @@
}
@Override
- public AbstractFieldSet rewrittenWithLens(AppView<?> appView, GraphLense lens) {
+ public AbstractFieldSet rewrittenWithLens(AppView<?> appView, GraphLens lens) {
assert !isEmpty();
ConcreteMutableFieldSet rewrittenSet = new ConcreteMutableFieldSet();
for (DexEncodedField field : fields) {
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/fieldvalueanalysis/EmptyFieldSet.java b/src/main/java/com/android/tools/r8/ir/analysis/fieldvalueanalysis/EmptyFieldSet.java
index 73559f3..9a7c7aa 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/fieldvalueanalysis/EmptyFieldSet.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/fieldvalueanalysis/EmptyFieldSet.java
@@ -6,7 +6,7 @@
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DexEncodedField;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
public class EmptyFieldSet extends AbstractFieldSet implements KnownFieldSet {
@@ -39,7 +39,7 @@
}
@Override
- public AbstractFieldSet rewrittenWithLens(AppView<?> appView, GraphLense lens) {
+ public AbstractFieldSet rewrittenWithLens(AppView<?> appView, GraphLens lens) {
return this;
}
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/fieldvalueanalysis/UnknownFieldSet.java b/src/main/java/com/android/tools/r8/ir/analysis/fieldvalueanalysis/UnknownFieldSet.java
index f083438..75a1bab 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/fieldvalueanalysis/UnknownFieldSet.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/fieldvalueanalysis/UnknownFieldSet.java
@@ -6,7 +6,7 @@
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DexEncodedField;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
public class UnknownFieldSet extends AbstractFieldSet {
@@ -34,7 +34,7 @@
}
@Override
- public AbstractFieldSet rewrittenWithLens(AppView<?> appView, GraphLense lens) {
+ public AbstractFieldSet rewrittenWithLens(AppView<?> appView, GraphLens lens) {
return this;
}
}
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/type/DestructivePhiTypeUpdater.java b/src/main/java/com/android/tools/r8/ir/analysis/type/DestructivePhiTypeUpdater.java
index 29ca247..a89c486 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/type/DestructivePhiTypeUpdater.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/type/DestructivePhiTypeUpdater.java
@@ -24,7 +24,7 @@
private final Function<DexType, DexType> mapping;
public DestructivePhiTypeUpdater(AppView<? extends AppInfoWithClassHierarchy> appView) {
- this(appView, appView.graphLense()::lookupType);
+ this(appView, appView.graphLens()::lookupType);
}
public DestructivePhiTypeUpdater(
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/value/AbstractValue.java b/src/main/java/com/android/tools/r8/ir/analysis/value/AbstractValue.java
index 9939980..c2ffda0 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/value/AbstractValue.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/value/AbstractValue.java
@@ -5,7 +5,7 @@
package com.android.tools.r8.ir.analysis.value;
import com.android.tools.r8.graph.AppView;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
public abstract class AbstractValue {
@@ -86,7 +86,7 @@
}
public abstract AbstractValue rewrittenWithLens(
- AppView<AppInfoWithLiveness> appView, GraphLense lens);
+ AppView<AppInfoWithLiveness> appView, GraphLens lens);
@Override
public abstract boolean equals(Object o);
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/value/BottomValue.java b/src/main/java/com/android/tools/r8/ir/analysis/value/BottomValue.java
index f5b27f7..c1afe58 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/value/BottomValue.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/value/BottomValue.java
@@ -5,7 +5,7 @@
package com.android.tools.r8.ir.analysis.value;
import com.android.tools.r8.graph.AppView;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
public class BottomValue extends AbstractValue {
@@ -24,7 +24,7 @@
}
@Override
- public AbstractValue rewrittenWithLens(AppView<AppInfoWithLiveness> appView, GraphLense lens) {
+ public AbstractValue rewrittenWithLens(AppView<AppInfoWithLiveness> appView, GraphLens lens) {
return this;
}
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/value/EmptyObjectState.java b/src/main/java/com/android/tools/r8/ir/analysis/value/EmptyObjectState.java
index 48b1d9c..db6be42 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/value/EmptyObjectState.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/value/EmptyObjectState.java
@@ -6,7 +6,7 @@
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DexEncodedField;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
public class EmptyObjectState extends ObjectState {
@@ -30,7 +30,7 @@
}
@Override
- public ObjectState rewrittenWithLens(AppView<AppInfoWithLiveness> appView, GraphLense lens) {
+ public ObjectState rewrittenWithLens(AppView<AppInfoWithLiveness> appView, GraphLens lens) {
return this;
}
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/value/NonEmptyObjectState.java b/src/main/java/com/android/tools/r8/ir/analysis/value/NonEmptyObjectState.java
index 0732b83..fad7303 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/value/NonEmptyObjectState.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/value/NonEmptyObjectState.java
@@ -7,7 +7,7 @@
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DexEncodedField;
import com.android.tools.r8.graph.DexField;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
import java.util.IdentityHashMap;
import java.util.Map;
@@ -34,7 +34,7 @@
}
@Override
- public ObjectState rewrittenWithLens(AppView<AppInfoWithLiveness> appView, GraphLense lens) {
+ public ObjectState rewrittenWithLens(AppView<AppInfoWithLiveness> appView, GraphLens lens) {
Map<DexField, AbstractValue> rewrittenState = new IdentityHashMap<>();
state.forEach(
(field, value) ->
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/value/ObjectState.java b/src/main/java/com/android/tools/r8/ir/analysis/value/ObjectState.java
index 066b305..b724858 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/value/ObjectState.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/value/ObjectState.java
@@ -7,7 +7,7 @@
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DexEncodedField;
import com.android.tools.r8.graph.DexField;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
import java.util.IdentityHashMap;
import java.util.Map;
@@ -27,7 +27,7 @@
public abstract boolean isEmpty();
public abstract ObjectState rewrittenWithLens(
- AppView<AppInfoWithLiveness> appView, GraphLense lens);
+ AppView<AppInfoWithLiveness> appView, GraphLens lens);
@Override
public abstract boolean equals(Object o);
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/value/SingleConstClassValue.java b/src/main/java/com/android/tools/r8/ir/analysis/value/SingleConstClassValue.java
index bcb5c0b..7240424 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/value/SingleConstClassValue.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/value/SingleConstClassValue.java
@@ -13,7 +13,7 @@
import com.android.tools.r8.graph.DebugLocalInfo;
import com.android.tools.r8.graph.DexClass;
import com.android.tools.r8.graph.DexType;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.ProgramMethod;
import com.android.tools.r8.ir.analysis.type.TypeElement;
import com.android.tools.r8.ir.code.ConstClass;
@@ -107,7 +107,7 @@
}
@Override
- public SingleValue rewrittenWithLens(AppView<AppInfoWithLiveness> appView, GraphLense lens) {
+ public SingleValue rewrittenWithLens(AppView<AppInfoWithLiveness> appView, GraphLens lens) {
assert lens.lookupType(type) == type;
return this;
}
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/value/SingleFieldValue.java b/src/main/java/com/android/tools/r8/ir/analysis/value/SingleFieldValue.java
index 7bdcc84..b7e359e 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/value/SingleFieldValue.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/value/SingleFieldValue.java
@@ -14,7 +14,7 @@
import com.android.tools.r8.graph.DexField;
import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.graph.EnumValueInfoMapCollection.EnumValueInfoMap;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.ProgramMethod;
import com.android.tools.r8.ir.analysis.type.ClassTypeElement;
import com.android.tools.r8.ir.analysis.type.TypeElement;
@@ -107,7 +107,7 @@
}
@Override
- public SingleValue rewrittenWithLens(AppView<AppInfoWithLiveness> appView, GraphLense lens) {
+ public SingleValue rewrittenWithLens(AppView<AppInfoWithLiveness> appView, GraphLens lens) {
AbstractValueFactory factory = appView.abstractValueFactory();
if (field.holder == field.type) {
EnumValueInfoMap unboxedEnumInfo = appView.unboxedEnums().getEnumValueInfoMap(field.type);
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/value/SingleNumberValue.java b/src/main/java/com/android/tools/r8/ir/analysis/value/SingleNumberValue.java
index e6b1ee6..0cb75c3 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/value/SingleNumberValue.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/value/SingleNumberValue.java
@@ -7,7 +7,7 @@
import com.android.tools.r8.graph.AppInfoWithClassHierarchy;
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DebugLocalInfo;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.ProgramMethod;
import com.android.tools.r8.ir.analysis.type.TypeElement;
import com.android.tools.r8.ir.code.ConstNumber;
@@ -91,7 +91,7 @@
}
@Override
- public SingleValue rewrittenWithLens(AppView<AppInfoWithLiveness> appView, GraphLense lens) {
+ public SingleValue rewrittenWithLens(AppView<AppInfoWithLiveness> appView, GraphLens lens) {
return this;
}
}
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/value/SingleStringValue.java b/src/main/java/com/android/tools/r8/ir/analysis/value/SingleStringValue.java
index ab7c218..e494c43 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/value/SingleStringValue.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/value/SingleStringValue.java
@@ -11,7 +11,7 @@
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DebugLocalInfo;
import com.android.tools.r8.graph.DexString;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.ProgramMethod;
import com.android.tools.r8.ir.analysis.type.TypeElement;
import com.android.tools.r8.ir.code.BasicBlock.ThrowingInfo;
@@ -92,7 +92,7 @@
}
@Override
- public SingleValue rewrittenWithLens(AppView<AppInfoWithLiveness> appView, GraphLense lens) {
+ public SingleValue rewrittenWithLens(AppView<AppInfoWithLiveness> appView, GraphLens lens) {
return this;
}
}
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/value/SingleValue.java b/src/main/java/com/android/tools/r8/ir/analysis/value/SingleValue.java
index 3ce27a0..4a3a11c 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/value/SingleValue.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/value/SingleValue.java
@@ -6,7 +6,7 @@
import com.android.tools.r8.graph.AppInfoWithClassHierarchy;
import com.android.tools.r8.graph.AppView;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.ProgramMethod;
import com.android.tools.r8.ir.code.IRCode;
import com.android.tools.r8.ir.code.Instruction;
@@ -47,5 +47,5 @@
@Override
public abstract SingleValue rewrittenWithLens(
- AppView<AppInfoWithLiveness> appView, GraphLense lens);
+ AppView<AppInfoWithLiveness> appView, GraphLens lens);
}
diff --git a/src/main/java/com/android/tools/r8/ir/analysis/value/UnknownValue.java b/src/main/java/com/android/tools/r8/ir/analysis/value/UnknownValue.java
index 2b4f841..8d4001f 100644
--- a/src/main/java/com/android/tools/r8/ir/analysis/value/UnknownValue.java
+++ b/src/main/java/com/android/tools/r8/ir/analysis/value/UnknownValue.java
@@ -5,7 +5,7 @@
package com.android.tools.r8.ir.analysis.value;
import com.android.tools.r8.graph.AppView;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
public class UnknownValue extends AbstractValue {
@@ -29,7 +29,7 @@
}
@Override
- public AbstractValue rewrittenWithLens(AppView<AppInfoWithLiveness> appView, GraphLense lens) {
+ public AbstractValue rewrittenWithLens(AppView<AppInfoWithLiveness> appView, GraphLens lens) {
return this;
}
diff --git a/src/main/java/com/android/tools/r8/ir/code/BasicBlock.java b/src/main/java/com/android/tools/r8/ir/code/BasicBlock.java
index b0ef472..0064ccb 100644
--- a/src/main/java/com/android/tools/r8/ir/code/BasicBlock.java
+++ b/src/main/java/com/android/tools/r8/ir/code/BasicBlock.java
@@ -11,7 +11,7 @@
import com.android.tools.r8.graph.DebugLocalInfo.PrintLevel;
import com.android.tools.r8.graph.DexItemFactory;
import com.android.tools.r8.graph.DexType;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.ir.analysis.type.Nullability;
import com.android.tools.r8.ir.analysis.type.TypeElement;
import com.android.tools.r8.ir.code.Phi.RegisterReadType;
@@ -998,17 +998,17 @@
/**
* Due to class merging, it is possible that two exception classes have been merged into one. This
- * function renames the guards according to the given graph lense.
+ * function renames the guards according to the given graph lens.
*
* @return true if any guards were renamed.
*/
- public boolean renameGuardsInCatchHandlers(GraphLense graphLense) {
+ public boolean renameGuardsInCatchHandlers(GraphLens graphLens) {
assert hasCatchHandlers();
boolean anyGuardsRenamed = false;
List<DexType> newGuards = new ArrayList<>(catchHandlers.getGuards().size());
for (DexType guard : catchHandlers.getGuards()) {
// The type may have changed due to class merging.
- DexType renamed = graphLense.lookupType(guard);
+ DexType renamed = graphLens.lookupType(guard);
newGuards.add(renamed);
anyGuardsRenamed |= renamed != guard;
}
diff --git a/src/main/java/com/android/tools/r8/ir/code/Instruction.java b/src/main/java/com/android/tools/r8/ir/code/Instruction.java
index be64578..b287f84 100644
--- a/src/main/java/com/android/tools/r8/ir/code/Instruction.java
+++ b/src/main/java/com/android/tools/r8/ir/code/Instruction.java
@@ -1397,10 +1397,10 @@
.asArrayType()
.toDexType(appView.dexItemFactory())
.toBaseType(appView.dexItemFactory());
- assert appView.graphLense().lookupType(outBaseType) == outBaseType;
+ assert appView.graphLens().lookupType(outBaseType) == outBaseType;
} else if (outTypeElement.isClassType()) {
DexType outType = outTypeElement.asClassType().getClassType();
- assert appView.graphLense().lookupType(outType) == outType;
+ assert appView.graphLens().lookupType(outType) == outType;
}
}
return true;
diff --git a/src/main/java/com/android/tools/r8/ir/code/Position.java b/src/main/java/com/android/tools/r8/ir/code/Position.java
index d11bf38..183d352 100644
--- a/src/main/java/com/android/tools/r8/ir/code/Position.java
+++ b/src/main/java/com/android/tools/r8/ir/code/Position.java
@@ -86,7 +86,7 @@
position = Position.noneWithMethod(context.getReference(), null);
}
assert position.getOutermostCaller().method
- == appView.graphLense().getOriginalMethodSignature(context.getReference());
+ == appView.graphLens().getOriginalMethodSignature(context.getReference());
return position;
}
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/CallGraphBuilderBase.java b/src/main/java/com/android/tools/r8/ir/conversion/CallGraphBuilderBase.java
index 9f57ac1..8119a9c 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/CallGraphBuilderBase.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/CallGraphBuilderBase.java
@@ -18,7 +18,7 @@
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.GraphLense.GraphLenseLookupResult;
+import com.android.tools.r8.graph.GraphLens.GraphLensLookupResult;
import com.android.tools.r8.graph.LookupResult;
import com.android.tools.r8.graph.ProgramMethod;
import com.android.tools.r8.graph.ResolutionResult;
@@ -166,8 +166,8 @@
private void processInvoke(Invoke.Type originalType, DexMethod originalMethod) {
ProgramMethod context = currentMethod.getProgramMethod();
- GraphLenseLookupResult result =
- appView.graphLense().lookupMethod(originalMethod, context.getReference(), originalType);
+ GraphLensLookupResult result =
+ appView.graphLens().lookupMethod(originalMethod, context.getReference(), originalType);
DexMethod method = result.getMethod();
Invoke.Type type = result.getType();
if (type == Invoke.Type.INTERFACE || type == Invoke.Type.VIRTUAL) {
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/IRBuilder.java b/src/main/java/com/android/tools/r8/ir/conversion/IRBuilder.java
index 60fcec2..292f069 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/IRBuilder.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/IRBuilder.java
@@ -456,7 +456,7 @@
private static RewrittenPrototypeDescription lookupPrototypeChanges(
AppView<?> appView, ProgramMethod method) {
RewrittenPrototypeDescription prototypeChanges =
- appView.graphLense().lookupPrototypeChanges(method.getReference());
+ appView.graphLens().lookupPrototypeChanges(method.getReference());
if (Log.ENABLED && prototypeChanges.getArgumentInfoCollection().hasRemovedArguments()) {
Log.info(
IRBuilder.class,
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/IRConverter.java b/src/main/java/com/android/tools/r8/ir/conversion/IRConverter.java
index 0809d00..3f74b74 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/IRConverter.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/IRConverter.java
@@ -22,7 +22,7 @@
import com.android.tools.r8.graph.DexString;
import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.graph.DexTypeList;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.ProgramMethod;
import com.android.tools.r8.ir.analysis.TypeChecker;
import com.android.tools.r8.ir.analysis.constant.SparseConditionalConstantPropagation;
@@ -191,7 +191,7 @@
*/
public IRConverter(
AppView<?> appView, Timing timing, CfgPrinter printer, MainDexClasses mainDexClasses) {
- assert appView.appInfo().hasLiveness() || appView.graphLense().isIdentityLense();
+ assert appView.appInfo().hasLiveness() || appView.graphLens().isIdentityLens();
assert appView.options() != null;
assert appView.options().programConsumer != null;
assert timing != null;
@@ -690,7 +690,7 @@
}
// Process the application identifying outlining candidates.
- GraphLense graphLenseForIR = appView.graphLense();
+ GraphLens graphLensForIR = appView.graphLens();
OptimizationFeedbackDelayed feedback = delayedOptimizationFeedback;
PostMethodProcessor.Builder postMethodProcessorBuilder =
new PostMethodProcessor.Builder(getOptimizationsForPostIRProcessing());
@@ -712,7 +712,7 @@
timing,
executorService);
timing.end();
- assert graphLenseForIR == appView.graphLense();
+ assert graphLensForIR == appView.graphLens();
}
// Assure that no more optimization feedback left after primary processing.
@@ -747,14 +747,14 @@
}
timing.begin("IR conversion phase 2");
- graphLenseForIR = appView.graphLense();
+ graphLensForIR = appView.graphLens();
PostMethodProcessor postMethodProcessor =
postMethodProcessorBuilder.build(appView.withLiveness(), executorService, timing);
if (postMethodProcessor != null) {
assert !options.debug;
postMethodProcessor.forEachWave(feedback, executorService);
feedback.updateVisibleOptimizationInfo();
- assert graphLenseForIR == appView.graphLense();
+ assert graphLensForIR == appView.graphLens();
}
timing.end();
@@ -1188,7 +1188,7 @@
codeRewriter.simplifyDebugLocals(code);
}
- if (appView.graphLense().hasCodeRewritings()) {
+ if (appView.graphLens().hasCodeRewritings()) {
assert lensCodeRewriter != null;
timing.begin("Lens rewrite");
lensCodeRewriter.rewrite(code, context);
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/LensCodeRewriter.java b/src/main/java/com/android/tools/r8/ir/conversion/LensCodeRewriter.java
index f83952c..6c9877c 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/LensCodeRewriter.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/LensCodeRewriter.java
@@ -47,8 +47,8 @@
import com.android.tools.r8.graph.DexValue.DexValueMethodHandle;
import com.android.tools.r8.graph.DexValue.DexValueMethodType;
import com.android.tools.r8.graph.DexValue.DexValueType;
-import com.android.tools.r8.graph.GraphLense;
-import com.android.tools.r8.graph.GraphLense.GraphLenseLookupResult;
+import com.android.tools.r8.graph.GraphLens;
+import com.android.tools.r8.graph.GraphLens.GraphLensLookupResult;
import com.android.tools.r8.graph.ProgramMethod;
import com.android.tools.r8.graph.RewrittenPrototypeDescription;
import com.android.tools.r8.graph.RewrittenPrototypeDescription.ArgumentInfo;
@@ -115,7 +115,7 @@
if (insn.outValue() != null) {
TypeElement oldType = insn.getOutType();
TypeElement newType =
- oldType.fixupClassTypeReferences(appView.graphLense()::lookupType, appView);
+ oldType.fixupClassTypeReferences(appView.graphLens()::lookupType, appView);
return code.createValue(newType, insn.getLocalInfo());
}
return null;
@@ -125,7 +125,7 @@
public void rewrite(IRCode code, ProgramMethod method) {
Set<Phi> affectedPhis =
enumUnboxer != null ? enumUnboxer.rewriteCode(code) : Sets.newIdentityHashSet();
- GraphLense graphLense = appView.graphLense();
+ GraphLens graphLens = appView.graphLens();
DexItemFactory factory = appView.dexItemFactory();
// Rewriting types that affects phi can cause us to compute TOP for cyclic phi's. To solve this
// we track all phi's that needs to be re-computed.
@@ -134,7 +134,7 @@
while (blocks.hasNext()) {
BasicBlock block = blocks.next();
if (block.hasCatchHandlers() && appView.options().enableVerticalClassMerging) {
- boolean anyGuardsRenamed = block.renameGuardsInCatchHandlers(graphLense);
+ boolean anyGuardsRenamed = block.renameGuardsInCatchHandlers(graphLens);
if (anyGuardsRenamed) {
mayHaveUnreachableBlocks |= unlinkDeadCatchHandlers(block);
}
@@ -217,13 +217,13 @@
if (invoke.isInvokeDirect()) {
checkInvokeDirect(method.getReference(), invoke.asInvokeDirect());
}
- GraphLenseLookupResult lenseLookup =
- graphLense.lookupMethod(invokedMethod, method.getReference(), invoke.getType());
- DexMethod actualTarget = lenseLookup.getMethod();
- Invoke.Type actualInvokeType = lenseLookup.getType();
+ GraphLensLookupResult lensLookup =
+ graphLens.lookupMethod(invokedMethod, method.getReference(), invoke.getType());
+ DexMethod actualTarget = lensLookup.getMethod();
+ Invoke.Type actualInvokeType = lensLookup.getType();
if (actualTarget != invokedMethod || invoke.getType() != actualInvokeType) {
RewrittenPrototypeDescription prototypeChanges =
- graphLense.lookupPrototypeChanges(actualTarget);
+ graphLens.lookupPrototypeChanges(actualTarget);
List<Value> newInValues;
ArgumentInfoCollection argumentInfoCollection =
@@ -272,7 +272,7 @@
.setLocalInfo(invoke.outValue().getLocalInfo());
}
invoke.outValue().replaceUsers(constantReturnMaterializingInstruction.outValue());
- if (graphLense.lookupType(invoke.getReturnType()) != invoke.getReturnType()) {
+ if (graphLens.lookupType(invoke.getReturnType()) != invoke.getReturnType()) {
affectedPhis.addAll(
constantReturnMaterializingInstruction.outValue().uniquePhiUsers());
}
@@ -324,7 +324,7 @@
}
DexType actualReturnType = actualTarget.proto.returnType;
- DexType expectedReturnType = graphLense.lookupType(invokedMethod.proto.returnType);
+ DexType expectedReturnType = graphLens.lookupType(invokedMethod.proto.returnType);
if (newInvoke.outValue() != null && actualReturnType != expectedReturnType) {
throw new Unreachable(
"Unexpected need to insert a cast. Possibly related to resolving"
@@ -343,9 +343,9 @@
{
InstanceGet instanceGet = current.asInstanceGet();
DexField field = instanceGet.getField();
- DexField actualField = graphLense.lookupField(field);
+ DexField actualField = graphLens.lookupField(field);
DexMethod replacementMethod =
- graphLense.lookupGetFieldForMethod(actualField, method.getReference());
+ graphLens.lookupGetFieldForMethod(actualField, method.getReference());
if (replacementMethod != null) {
Value newOutValue = makeOutValue(current, code);
iterator.replaceCurrentInstruction(
@@ -368,9 +368,9 @@
{
InstancePut instancePut = current.asInstancePut();
DexField field = instancePut.getField();
- DexField actualField = graphLense.lookupField(field);
+ DexField actualField = graphLens.lookupField(field);
DexMethod replacementMethod =
- graphLense.lookupPutFieldForMethod(actualField, method.getReference());
+ graphLens.lookupPutFieldForMethod(actualField, method.getReference());
if (replacementMethod != null) {
iterator.replaceCurrentInstruction(
new InvokeStatic(replacementMethod, null, current.inValues()));
@@ -390,9 +390,9 @@
{
StaticGet staticGet = current.asStaticGet();
DexField field = staticGet.getField();
- DexField actualField = graphLense.lookupField(field);
+ DexField actualField = graphLens.lookupField(field);
DexMethod replacementMethod =
- graphLense.lookupGetFieldForMethod(actualField, method.getReference());
+ graphLens.lookupGetFieldForMethod(actualField, method.getReference());
if (replacementMethod != null) {
Value newOutValue = makeOutValue(current, code);
iterator.replaceCurrentInstruction(
@@ -414,9 +414,9 @@
{
StaticPut staticPut = current.asStaticPut();
DexField field = staticPut.getField();
- DexField actualField = graphLense.lookupField(field);
+ DexField actualField = graphLens.lookupField(field);
DexMethod replacementMethod =
- graphLense.lookupPutFieldForMethod(actualField, method.getReference());
+ graphLens.lookupPutFieldForMethod(actualField, method.getReference());
if (replacementMethod != null) {
iterator.replaceCurrentInstruction(
new InvokeStatic(replacementMethod, current.outValue(), current.inValues()));
@@ -530,7 +530,7 @@
// For all other instructions, substitute any changed type.
TypeElement type = current.getOutType();
TypeElement substituted =
- type.fixupClassTypeReferences(graphLense::lookupType, appView);
+ type.fixupClassTypeReferences(graphLens::lookupType, appView);
if (substituted != type) {
current.outValue().setType(substituted);
affectedPhis.addAll(current.outValue().uniquePhiUsers());
@@ -597,7 +597,7 @@
DexItemFactory dexItemFactory = appView.dexItemFactory();
DexProto newMethodProto =
dexItemFactory.applyClassMappingToProto(
- callSite.methodProto, appView.graphLense()::lookupType, protoFixupCache);
+ callSite.methodProto, appView.graphLens()::lookupType, protoFixupCache);
DexMethodHandle newBootstrapMethod =
rewriteDexMethodHandle(
callSite.bootstrapMethod, context, NOT_ARGUMENT_TO_LAMBDA_METAFACTORY);
@@ -678,7 +678,7 @@
List<BasicBlock> deadCatchHandlers = new ArrayList<>();
for (int i = 0; i < guards.size(); i++) {
// The type may have changed due to class merging.
- DexType guard = appView.graphLense().lookupType(guards.get(i));
+ DexType guard = appView.graphLens().lookupType(guards.get(i));
boolean guardSeenBefore = !previouslySeenGuards.add(guard);
if (guardSeenBefore) {
deadCatchHandlers.add(targets.get(i));
@@ -708,7 +708,7 @@
break;
case TYPE:
DexType oldType = argument.asDexValueType().value;
- DexType newType = appView.graphLense().lookupType(oldType);
+ DexType newType = appView.graphLens().lookupType(oldType);
if (newType != oldType) {
newArgument = new DexValueType(newType);
}
@@ -741,18 +741,18 @@
if (methodHandle.isMethodHandle()) {
DexMethod invokedMethod = methodHandle.asMethod();
MethodHandleType oldType = methodHandle.type;
- GraphLenseLookupResult lenseLookup =
+ GraphLensLookupResult lensLookup =
appView
- .graphLense()
+ .graphLens()
.lookupMethod(invokedMethod, context.getReference(), oldType.toInvokeType());
- DexMethod rewrittenTarget = lenseLookup.getMethod();
+ DexMethod rewrittenTarget = lensLookup.getMethod();
DexMethod actualTarget;
MethodHandleType newType;
if (use == ARGUMENT_TO_LAMBDA_METAFACTORY) {
// Lambda metafactory arguments will be lambda desugared away and therefore cannot flow
// to a MethodHandle.invokeExact call. We can therefore member-rebind with no issues.
actualTarget = rewrittenTarget;
- newType = lenseLookup.getType().toMethodHandle(actualTarget);
+ newType = lensLookup.getType().toMethodHandle(actualTarget);
} else {
assert use == NOT_ARGUMENT_TO_LAMBDA_METAFACTORY;
// MethodHandles that are not arguments to a lambda metafactory will not be desugared
@@ -769,7 +769,7 @@
// If the method has changed from private to public we need to use virtual instead of
// direct.
assert rewrittenTarget.holder == actualTarget.holder;
- newType = lenseLookup.getType().toMethodHandle(actualTarget);
+ newType = lensLookup.getType().toMethodHandle(actualTarget);
assert newType == MethodHandleType.INVOKE_DIRECT
|| newType == MethodHandleType.INVOKE_INSTANCE;
}
@@ -785,7 +785,7 @@
}
} else {
DexField field = methodHandle.asField();
- DexField actualField = appView.graphLense().lookupField(field);
+ DexField actualField = appView.graphLens().lookupField(field);
if (actualField != field) {
return new DexMethodHandle(methodHandle.type, actualField, methodHandle.isInterface);
}
@@ -798,7 +798,7 @@
DexProto newProto =
appView
.dexItemFactory()
- .applyClassMappingToProto(oldProto, appView.graphLense()::lookupType, protoFixupCache);
+ .applyClassMappingToProto(oldProto, appView.graphLens()::lookupType, protoFixupCache);
return newProto != oldProto ? new DexValueMethodType(newProto) : type;
}
@@ -819,7 +819,7 @@
void replaceInstructionIfTypeChanged(
DexType type, BiFunction<DexType, Value, Instruction> constructor) {
- DexType newType = appView.graphLense().lookupType(type);
+ DexType newType = appView.graphLens().lookupType(type);
if (newType != type) {
Value newOutValue = makeOutValue(current, code);
Instruction newInstruction = constructor.apply(newType, newOutValue);
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/PostMethodProcessor.java b/src/main/java/com/android/tools/r8/ir/conversion/PostMethodProcessor.java
index f1c403b..bf8fd80 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/PostMethodProcessor.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/PostMethodProcessor.java
@@ -9,7 +9,7 @@
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DexEncodedMethod;
import com.android.tools.r8.graph.DexProgramClass;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.ProgramMethod;
import com.android.tools.r8.ir.code.IRCode;
import com.android.tools.r8.ir.conversion.MethodProcessingId.Factory.ReservedMethodProcessingIds;
@@ -105,14 +105,14 @@
// Some optimizations may change methods, creating new instances of the encoded methods with a
// new signature. The compiler needs to update the set of methods that must be reprocessed
// according to the graph lens.
- public void rewrittenWithLens(AppView<AppInfoWithLiveness> appView, GraphLense applied) {
+ public void rewrittenWithLens(AppView<AppInfoWithLiveness> appView, GraphLens applied) {
methodsToReprocess.rewrittenWithLens(appView, applied);
Map<DexEncodedMethod, Collection<CodeOptimization>> newOptimizationsMap =
new IdentityHashMap<>();
optimizationsMap.forEach(
(method, optimizations) ->
newOptimizationsMap.put(
- appView.graphLense().mapDexEncodedMethod(method, appView, applied),
+ appView.graphLens().mapDexEncodedMethod(method, appView, applied),
optimizations));
optimizationsMap.clear();
optimizationsMap.putAll(newOptimizationsMap);
@@ -143,7 +143,7 @@
}
CallGraph callGraph =
new PartialCallGraphBuilder(
- appView, methodsToReprocess.build(appView, appView.graphLense()))
+ appView, methodsToReprocess.build(appView, appView.graphLens()))
.build(executorService, timing);
return new PostMethodProcessor(appView, optimizationsMap, callGraph);
}
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/BackportedMethodRewriter.java b/src/main/java/com/android/tools/r8/ir/desugar/BackportedMethodRewriter.java
index fbf5a15..8c65c1e 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/BackportedMethodRewriter.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/BackportedMethodRewriter.java
@@ -282,9 +282,9 @@
}
return c -> method.method.hashCode();
}
-
+
private MethodProvider getMethodProviderOrNull(DexMethod method) {
- DexMethod original = appView.graphLense().getOriginalMethodSignature(method);
+ DexMethod original = appView.graphLens().getOriginalMethodSignature(method);
assert original != null;
return rewritableMethods.getProvider(original);
}
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/InterfaceMethodRewriter.java b/src/main/java/com/android/tools/r8/ir/desugar/InterfaceMethodRewriter.java
index f537a6f..88f6f04 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/InterfaceMethodRewriter.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/InterfaceMethodRewriter.java
@@ -26,7 +26,7 @@
import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.graph.DexTypeList;
import com.android.tools.r8.graph.DexValue;
-import com.android.tools.r8.graph.GraphLense.NestedGraphLense;
+import com.android.tools.r8.graph.GraphLens.NestedGraphLens;
import com.android.tools.r8.graph.ProgramMethod;
import com.android.tools.r8.ir.code.BasicBlock;
import com.android.tools.r8.ir.code.IRCode;
@@ -38,7 +38,7 @@
import com.android.tools.r8.ir.code.InvokeSuper;
import com.android.tools.r8.ir.conversion.IRConverter;
import com.android.tools.r8.ir.desugar.DefaultMethodsHelper.Collection;
-import com.android.tools.r8.ir.desugar.InterfaceProcessor.InterfaceProcessorNestedGraphLense;
+import com.android.tools.r8.ir.desugar.InterfaceProcessor.InterfaceProcessorNestedGraphLens;
import com.android.tools.r8.origin.Origin;
import com.android.tools.r8.origin.SynthesizedOrigin;
import com.android.tools.r8.position.MethodPosition;
@@ -1028,7 +1028,7 @@
}
private Map<DexType, DexProgramClass> processInterfaces(Builder<?> builder, Flavor flavour) {
- NestedGraphLense.Builder graphLensBuilder = InterfaceProcessorNestedGraphLense.builder();
+ NestedGraphLens.Builder graphLensBuilder = InterfaceProcessorNestedGraphLens.builder();
InterfaceProcessor processor = new InterfaceProcessor(appView, this);
for (DexProgramClass clazz : builder.getProgramClasses()) {
if (shouldProcess(clazz, flavour, true)) {
@@ -1040,7 +1040,7 @@
dispatchClass.forEachProgramMethod(synthesizedMethods::add);
}
if (appView.enableWholeProgramOptimizations()) {
- appView.setGraphLense(graphLensBuilder.build(appView.dexItemFactory(), appView.graphLense()));
+ appView.setGraphLens(graphLensBuilder.build(appView.dexItemFactory(), appView.graphLens()));
}
return processor.syntheticClasses;
}
@@ -1132,7 +1132,7 @@
if (shouldIgnoreFromReports(missing)) {
return;
}
- DexMethod method = appView.graphLense().getOriginalMethodSignature(referencedFrom);
+ DexMethod method = appView.graphLens().getOriginalMethodSignature(referencedFrom);
Origin origin = getMethodOrigin(method);
MethodPosition position = new MethodPosition(method.asMethodReference());
options.warningMissingTypeForDesugar(origin, position, missing, method);
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/InterfaceProcessor.java b/src/main/java/com/android/tools/r8/ir/desugar/InterfaceProcessor.java
index 2b8ce66..0b653f7 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/InterfaceProcessor.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/InterfaceProcessor.java
@@ -28,8 +28,8 @@
import com.android.tools.r8.graph.DexProgramClass.ChecksumSupplier;
import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.graph.DexTypeList;
-import com.android.tools.r8.graph.GraphLense;
-import com.android.tools.r8.graph.GraphLense.NestedGraphLense;
+import com.android.tools.r8.graph.GraphLens;
+import com.android.tools.r8.graph.GraphLens.NestedGraphLens;
import com.android.tools.r8.graph.MethodAccessFlags;
import com.android.tools.r8.graph.ParameterAnnotationsList;
import com.android.tools.r8.ir.code.Invoke.Type;
@@ -68,7 +68,7 @@
this.rewriter = rewriter;
}
- void process(DexProgramClass iface, NestedGraphLense.Builder graphLensBuilder) {
+ void process(DexProgramClass iface, NestedGraphLens.Builder graphLensBuilder) {
assert iface.isInterface();
// The list of methods to be created in companion class.
List<DexEncodedMethod> companionMethods = new ArrayList<>();
@@ -98,9 +98,9 @@
code, companionMethod.getArity(), appView);
if (!appView.options().isDesugaredLibraryCompilation()) {
setOriginalMethodPosition(
- code, appView.graphLense().getOriginalMethodSignature(virtual.method));
+ code, appView.graphLens().getOriginalMethodSignature(virtual.method));
} else {
- assert appView.graphLense().isIdentityLense();
+ assert appView.graphLens().isIdentityLens();
}
DexEncodedMethod implMethod =
new DexEncodedMethod(
@@ -144,9 +144,9 @@
DexMethod companionMethod = rewriter.staticAsMethodOfCompanionClass(oldMethod);
if (!appView.options().isDesugaredLibraryCompilation()) {
setOriginalMethodPosition(
- direct.getCode(), appView.graphLense().getOriginalMethodSignature(oldMethod));
+ direct.getCode(), appView.graphLens().getOriginalMethodSignature(oldMethod));
} else {
- assert appView.graphLense().isIdentityLense();
+ assert appView.graphLens().isIdentityLens();
}
DexEncodedMethod implMethod =
new DexEncodedMethod(
@@ -177,9 +177,9 @@
code, companionMethod.getArity(), appView);
if (!appView.options().isDesugaredLibraryCompilation()) {
setOriginalMethodPosition(
- code, appView.graphLense().getOriginalMethodSignature(oldMethod));
+ code, appView.graphLens().getOriginalMethodSignature(oldMethod));
} else {
- assert appView.graphLense().isIdentityLense();
+ assert appView.graphLens().isIdentityLens();
}
DexEncodedMethod implMethod =
new DexEncodedMethod(
@@ -400,15 +400,15 @@
// Specific lens which remaps invocation types to static since all rewrites performed here
// are to static companion methods.
- public static class InterfaceProcessorNestedGraphLense extends NestedGraphLense {
+ public static class InterfaceProcessorNestedGraphLens extends NestedGraphLens {
- public InterfaceProcessorNestedGraphLense(
+ public InterfaceProcessorNestedGraphLens(
Map<DexType, DexType> typeMap,
Map<DexMethod, DexMethod> methodMap,
Map<DexField, DexField> fieldMap,
BiMap<DexField, DexField> originalFieldSignatures,
BiMap<DexMethod, DexMethod> originalMethodSignatures,
- GraphLense previousLense,
+ GraphLens previousLens,
DexItemFactory dexItemFactory) {
super(
typeMap,
@@ -416,7 +416,7 @@
fieldMap,
originalFieldSignatures,
originalMethodSignatures,
- previousLense,
+ previousLens,
dexItemFactory);
}
@@ -425,23 +425,23 @@
return Type.STATIC;
}
- public static GraphLense.Builder builder() {
+ public static GraphLens.Builder builder() {
return new Builder();
}
- public static class Builder extends NestedGraphLense.Builder {
+ public static class Builder extends NestedGraphLens.Builder {
@Override
- public GraphLense build(DexItemFactory dexItemFactory, GraphLense previousLense) {
+ public GraphLens build(DexItemFactory dexItemFactory, GraphLens previousLens) {
if (originalFieldSignatures.isEmpty() && originalMethodSignatures.isEmpty()) {
- return previousLense;
+ return previousLens;
}
- return new InterfaceProcessorNestedGraphLense(
+ return new InterfaceProcessorNestedGraphLens(
typeMap,
methodMap,
fieldMap,
originalFieldSignatures,
originalMethodSignatures,
- previousLense,
+ previousLens,
dexItemFactory);
}
}
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/LambdaRewriter.java b/src/main/java/com/android/tools/r8/ir/desugar/LambdaRewriter.java
index fb66a2a..6e41b1a 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/LambdaRewriter.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/LambdaRewriter.java
@@ -12,8 +12,8 @@
import com.android.tools.r8.graph.DexProgramClass;
import com.android.tools.r8.graph.DexString;
import com.android.tools.r8.graph.DexType;
-import com.android.tools.r8.graph.GraphLense;
-import com.android.tools.r8.graph.GraphLense.NestedGraphLense;
+import com.android.tools.r8.graph.GraphLens;
+import com.android.tools.r8.graph.GraphLens.NestedGraphLens;
import com.android.tools.r8.graph.ProgramMethod;
import com.android.tools.r8.ir.analysis.type.Nullability;
import com.android.tools.r8.ir.analysis.type.TypeAnalysis;
@@ -347,19 +347,19 @@
return knownLambdaClasses;
}
- public GraphLense buildMappingLense(AppView<?> appView) {
+ public GraphLens buildMappingLens(AppView<?> appView) {
if (originalMethodSignatures.isEmpty()) {
- return appView.graphLense();
+ return appView.graphLens();
}
- return new LambdaRewriterLense(
- originalMethodSignatures, appView.graphLense(), appView.dexItemFactory());
+ return new LambdaRewriterLens(
+ originalMethodSignatures, appView.graphLens(), appView.dexItemFactory());
}
- static class LambdaRewriterLense extends NestedGraphLense {
+ static class LambdaRewriterLens extends NestedGraphLens {
- public LambdaRewriterLense(
+ public LambdaRewriterLens(
BiMap<DexMethod, DexMethod> originalMethodSignatures,
- GraphLense graphLense,
+ GraphLens graphLens,
DexItemFactory factory) {
super(
ImmutableMap.of(),
@@ -367,7 +367,7 @@
ImmutableMap.of(),
null,
originalMethodSignatures,
- graphLense,
+ graphLens,
factory);
}
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/NestBasedAccessDesugaring.java b/src/main/java/com/android/tools/r8/ir/desugar/NestBasedAccessDesugaring.java
index 58730b9..bbe2ae0 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/NestBasedAccessDesugaring.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/NestBasedAccessDesugaring.java
@@ -81,18 +81,18 @@
abstract void reportIncompleteNest(List<DexType> nest);
DexClass definitionFor(DexType type) {
- return appView.definitionFor(appView.graphLense().lookupType(type));
+ return appView.definitionFor(appView.graphLens().lookupType(type));
}
private DexEncodedMethod lookupOnHolder(
DexMethod method, DexClassAndMethod context, Invoke.Type invokeType) {
DexMethod rewritten =
- appView.graphLense().lookupMethod(method, context.getReference(), invokeType).getMethod();
+ appView.graphLens().lookupMethod(method, context.getReference(), invokeType).getMethod();
return rewritten.lookupOnClass(appView.definitionForHolder(rewritten));
}
private DexEncodedField lookupOnHolder(DexField field) {
- DexField rewritten = appView.graphLense().lookupField(field);
+ DexField rewritten = appView.graphLens().lookupField(field);
return rewritten.lookupOnClass(appView.definitionForHolder(rewritten));
}
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/NestedPrivateMethodLense.java b/src/main/java/com/android/tools/r8/ir/desugar/NestedPrivateMethodLens.java
similarity index 77%
rename from src/main/java/com/android/tools/r8/ir/desugar/NestedPrivateMethodLense.java
rename to src/main/java/com/android/tools/r8/ir/desugar/NestedPrivateMethodLens.java
index ded1538..cdca27a 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/NestedPrivateMethodLense.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/NestedPrivateMethodLens.java
@@ -8,35 +8,35 @@
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.GraphLense;
-import com.android.tools.r8.graph.GraphLense.NestedGraphLense;
+import com.android.tools.r8.graph.GraphLens;
+import com.android.tools.r8.graph.GraphLens.NestedGraphLens;
import com.android.tools.r8.graph.RewrittenPrototypeDescription;
import com.android.tools.r8.ir.code.Invoke;
import com.google.common.collect.ImmutableMap;
import java.util.IdentityHashMap;
import java.util.Map;
-public class NestedPrivateMethodLense extends NestedGraphLense {
+public class NestedPrivateMethodLens extends NestedGraphLens {
// Map from nestHost to nest members including nest hosts
private final DexType nestConstructorType;
private final Map<DexField, DexMethod> getFieldMap;
private final Map<DexField, DexMethod> putFieldMap;
- NestedPrivateMethodLense(
+ NestedPrivateMethodLens(
AppView<?> appView,
DexType nestConstructorType,
Map<DexMethod, DexMethod> methodMap,
Map<DexField, DexMethod> getFieldMap,
Map<DexField, DexMethod> putFieldMap,
- GraphLense previousLense) {
+ GraphLens previousLens) {
super(
ImmutableMap.of(),
methodMap,
ImmutableMap.of(),
null,
null,
- previousLense,
+ previousLens,
appView.dexItemFactory());
// No concurrent maps here, we do not want synchronization overhead.
assert methodMap instanceof IdentityHashMap;
@@ -59,13 +59,13 @@
@Override
public DexMethod lookupGetFieldForMethod(DexField field, DexMethod context) {
- assert previousLense.lookupGetFieldForMethod(field, context) == null;
+ assert previousLens.lookupGetFieldForMethod(field, context) == null;
return lookupFieldForMethod(field, context, getFieldMap);
}
@Override
public DexMethod lookupPutFieldForMethod(DexField field, DexMethod context) {
- assert previousLense.lookupPutFieldForMethod(field, context) == null;
+ assert previousLens.lookupPutFieldForMethod(field, context) == null;
return lookupFieldForMethod(field, context, putFieldMap);
}
@@ -76,7 +76,7 @@
@Override
public boolean verifyIsContextFreeForMethod(DexMethod method) {
- assert !methodMap.containsKey(previousLense.lookupMethod(method));
+ assert !methodMap.containsKey(previousLens.lookupMethod(method));
return true;
}
@@ -99,18 +99,17 @@
public RewrittenPrototypeDescription lookupPrototypeChanges(DexMethod method) {
if (isConstructorBridge(method)) {
// TODO (b/132767654): Try to write a test which breaks that assertion.
- assert previousLense.lookupPrototypeChanges(method).isEmpty();
+ assert previousLens.lookupPrototypeChanges(method).isEmpty();
return RewrittenPrototypeDescription.none().withExtraNullParameter();
} else {
- return previousLense.lookupPrototypeChanges(method);
+ return previousLens.lookupPrototypeChanges(method);
}
}
@Override
- public GraphLenseLookupResult lookupMethod(
- DexMethod method, DexMethod context, Invoke.Type type) {
+ public GraphLensLookupResult lookupMethod(DexMethod method, DexMethod context, Invoke.Type type) {
assert originalMethodSignatures == null;
- GraphLenseLookupResult previous = previousLense.lookupMethod(method, context, type);
+ GraphLensLookupResult previous = previousLens.lookupMethod(method, context, type);
DexMethod bridge = methodMap.get(previous.getMethod());
if (bridge == null) {
return previous;
@@ -120,16 +119,16 @@
return previous;
}
if (isConstructorBridge(bridge)) {
- return new GraphLenseLookupResult(bridge, Invoke.Type.DIRECT);
+ return new GraphLensLookupResult(bridge, Invoke.Type.DIRECT);
}
- return new GraphLenseLookupResult(bridge, Invoke.Type.STATIC);
+ return new GraphLensLookupResult(bridge, Invoke.Type.STATIC);
}
public static Builder builder() {
return new Builder();
}
- public static class Builder extends NestedGraphLense.Builder {
+ public static class Builder extends NestedGraphLens.Builder {
private Map<DexField, DexMethod> getFieldMap = new IdentityHashMap<>();
private Map<DexField, DexMethod> putFieldMap = new IdentityHashMap<>();
@@ -142,14 +141,14 @@
putFieldMap.put(from, to);
}
- public NestedPrivateMethodLense build(AppView<?> appView, DexType nestConstructorType) {
+ public NestedPrivateMethodLens build(AppView<?> appView, DexType nestConstructorType) {
assert typeMap.isEmpty();
assert fieldMap.isEmpty();
if (getFieldMap.isEmpty() && methodMap.isEmpty() && putFieldMap.isEmpty()) {
return null;
}
- return new NestedPrivateMethodLense(
- appView, nestConstructorType, methodMap, getFieldMap, putFieldMap, appView.graphLense());
+ return new NestedPrivateMethodLens(
+ appView, nestConstructorType, methodMap, getFieldMap, putFieldMap, appView.graphLens());
}
}
}
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/R8NestBasedAccessDesugaring.java b/src/main/java/com/android/tools/r8/ir/desugar/R8NestBasedAccessDesugaring.java
index b97888d..e9ac116 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/R8NestBasedAccessDesugaring.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/R8NestBasedAccessDesugaring.java
@@ -33,20 +33,20 @@
super(appView);
}
- public NestedPrivateMethodLense run(
+ public NestedPrivateMethodLens run(
ExecutorService executorService, DexApplication.Builder<?> appBuilder)
throws ExecutionException {
assert !appView.options().canUseNestBasedAccess()
|| appView.options().testing.enableForceNestBasedAccessDesugaringForTest;
computeAndProcessNestsConcurrently(executorService);
- NestedPrivateMethodLense.Builder lensBuilder = NestedPrivateMethodLense.builder();
+ NestedPrivateMethodLens.Builder lensBuilder = NestedPrivateMethodLens.builder();
addDeferredBridgesAndMapMethods(lensBuilder);
clearNestAttributes();
synthesizeNestConstructor(appBuilder);
return lensBuilder.build(appView, getNestConstructorType());
}
- private void addDeferredBridgesAndMapMethods(NestedPrivateMethodLense.Builder lensBuilder) {
+ private void addDeferredBridgesAndMapMethods(NestedPrivateMethodLens.Builder lensBuilder) {
// Here we add the bridges and we fill the lens map.
addDeferredBridgesAndMapMethods(bridges, lensBuilder::map);
addDeferredBridgesAndMapMethods(getFieldBridges, lensBuilder::mapGetField);
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/TwrCloseResourceRewriter.java b/src/main/java/com/android/tools/r8/ir/desugar/TwrCloseResourceRewriter.java
index 6f3aed5..4043023 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/TwrCloseResourceRewriter.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/TwrCloseResourceRewriter.java
@@ -104,7 +104,7 @@
}
public static boolean isSynthesizedCloseResourceMethod(DexMethod method, AppView<?> appView) {
- DexMethod original = appView.graphLense().getOriginalMethodSignature(method);
+ DexMethod original = appView.graphLens().getOriginalMethodSignature(method);
assert original != null;
// We consider all methods of *any* class with expected name and signature
// to be synthesized by java 9 compiler for try-with-resources, reasoning:
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/Inliner.java b/src/main/java/com/android/tools/r8/ir/optimize/Inliner.java
index 97dbb2e..cedf164 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/Inliner.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/Inliner.java
@@ -18,7 +18,7 @@
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.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.NestMemberClassAttribute;
import com.android.tools.r8.graph.ProgramMethod;
import com.android.tools.r8.graph.ResolutionResult.SingleResolutionResult;
@@ -136,7 +136,7 @@
return true;
}
- if (blacklist.contains(appView.graphLense().getOriginalMethodSignature(singleTargetReference))
+ if (blacklist.contains(appView.graphLens().getOriginalMethodSignature(singleTargetReference))
|| TwrCloseResourceRewriter.isSynthesizedCloseResourceMethod(
singleTargetReference, appView)) {
whyAreYouNotInliningReporter.reportBlacklisted();
@@ -183,7 +183,7 @@
ConstraintWithTarget result = ConstraintWithTarget.ALWAYS;
InliningConstraints inliningConstraints =
- new InliningConstraints(appView, GraphLense.getIdentityLense());
+ new InliningConstraints(appView, GraphLens.getIdentityLens());
for (Instruction instruction : code.instructions()) {
ConstraintWithTarget state =
instructionAllowedForInlining(instruction, inliningConstraints, context);
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/InliningConstraints.java b/src/main/java/com/android/tools/r8/ir/optimize/InliningConstraints.java
index 890a23e..1d32c0b 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/InliningConstraints.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/InliningConstraints.java
@@ -14,7 +14,7 @@
import com.android.tools.r8.graph.DexProgramClass;
import com.android.tools.r8.graph.DexReference;
import com.android.tools.r8.graph.DexType;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.ResolutionResult;
import com.android.tools.r8.graph.ResolutionResult.SingleResolutionResult;
import com.android.tools.r8.ir.code.Invoke.Type;
@@ -38,23 +38,23 @@
// being inlined into B.<init>() only because it is not declared in the same class as B (which
// it would be after merging A and B).
//
- // To circumvent this problem, the vertical class merger creates a graph lense that maps the
+ // To circumvent this problem, the vertical class merger creates a graph lens that maps the
// type A to B, to create a temporary view of what the world would look like after class merging.
- private GraphLense graphLense;
+ private GraphLens graphLens;
- public InliningConstraints(AppView<AppInfoWithLiveness> appView, GraphLense graphLense) {
- assert graphLense.isContextFreeForMethods();
- assert appView.graphLense() != graphLense || graphLense.isIdentityLense();
+ public InliningConstraints(AppView<AppInfoWithLiveness> appView, GraphLens graphLens) {
+ assert graphLens.isContextFreeForMethods();
+ assert appView.graphLens() != graphLens || graphLens.isIdentityLens();
this.appView = appView;
- this.graphLense = graphLense; // Note: Intentionally *not* appView.graphLense().
+ this.graphLens = graphLens; // Note: Intentionally *not* appView.graphLens().
}
public AppView<AppInfoWithLiveness> getAppView() {
return appView;
}
- public GraphLense getGraphLense() {
- return graphLense;
+ public GraphLens getGraphLens() {
+ return graphLens;
}
public void disallowStaticInterfaceMethodCalls() {
@@ -62,7 +62,7 @@
}
private boolean isVerticalClassMerging() {
- return !graphLense.isIdentityLense();
+ return !graphLens.isIdentityLens();
}
public ConstraintWithTarget forAlwaysMaterializingUser() {
@@ -131,7 +131,7 @@
}
public ConstraintWithTarget forInstanceGet(DexField field, DexProgramClass context) {
- DexField lookup = graphLense.lookupField(field);
+ DexField lookup = graphLens.lookupField(field);
return forFieldInstruction(lookup, appView.appInfo().lookupInstanceTarget(lookup), context);
}
@@ -140,7 +140,7 @@
}
public ConstraintWithTarget forInstancePut(DexField field, DexProgramClass context) {
- DexField lookup = graphLense.lookupField(field);
+ DexField lookup = graphLens.lookupField(field);
return forFieldInstruction(lookup, appView.appInfo().lookupInstanceTarget(lookup), context);
}
@@ -183,7 +183,7 @@
if (dexEncodedMethod != null) {
return dexEncodedMethod;
}
- assert graphLense.lookupType(context.superType) == context.type;
+ assert graphLens.lookupType(context.superType) == context.type;
DexProgramClass superContext = appView.definitionForProgramType(context.superType);
if (superContext == null) {
return null;
@@ -198,7 +198,7 @@
}
public ConstraintWithTarget forInvokeDirect(DexMethod method, DexProgramClass context) {
- DexMethod lookup = graphLense.lookupMethod(method);
+ DexMethod lookup = graphLens.lookupMethod(method);
DexEncodedMethod target =
isVerticalClassMerging()
? lookupWhileVerticalClassMerging(
@@ -210,7 +210,7 @@
}
public ConstraintWithTarget forInvokeInterface(DexMethod method, DexProgramClass context) {
- DexMethod lookup = graphLense.lookupMethod(method);
+ DexMethod lookup = graphLens.lookupMethod(method);
return forVirtualInvoke(lookup, context, true);
}
@@ -227,7 +227,7 @@
}
public ConstraintWithTarget forInvokeStatic(DexMethod method, DexProgramClass context) {
- DexMethod lookup = graphLense.lookupMethod(method);
+ DexMethod lookup = graphLens.lookupMethod(method);
DexEncodedMethod target =
isVerticalClassMerging()
? lookupWhileVerticalClassMerging(
@@ -244,7 +244,7 @@
}
public ConstraintWithTarget forInvokeVirtual(DexMethod method, DexProgramClass context) {
- DexMethod lookup = graphLense.lookupMethod(method);
+ DexMethod lookup = graphLens.lookupMethod(method);
return forVirtualInvoke(lookup, context, false);
}
@@ -293,12 +293,12 @@
}
public ConstraintWithTarget forStaticGet(DexField field, DexProgramClass context) {
- DexField lookup = graphLense.lookupField(field);
+ DexField lookup = graphLens.lookupField(field);
return forFieldInstruction(lookup, appView.appInfo().lookupStaticTarget(lookup), context);
}
public ConstraintWithTarget forStaticPut(DexField field, DexProgramClass context) {
- DexField lookup = graphLense.lookupField(field);
+ DexField lookup = graphLens.lookupField(field);
return forFieldInstruction(lookup, appView.appInfo().lookupStaticTarget(lookup), context);
}
@@ -329,7 +329,7 @@
private ConstraintWithTarget forFieldInstruction(
DexField field, DexEncodedField target, DexProgramClass context) {
// Resolve the field if possible and decide whether the instruction can inlined.
- DexType fieldHolder = graphLense.lookupType(field.holder);
+ DexType fieldHolder = graphLens.lookupType(field.holder);
DexClass fieldClass = appView.definitionFor(fieldHolder);
if (target != null && fieldClass != null) {
ConstraintWithTarget fieldConstraintWithTarget =
@@ -340,7 +340,7 @@
//
// See, for example, InlineNonReboundFieldTest (b/128604123).
if (field.holder != target.holder()) {
- DexType actualFieldHolder = graphLense.lookupType(target.holder());
+ DexType actualFieldHolder = graphLens.lookupType(target.holder());
fieldConstraintWithTarget =
ConstraintWithTarget.meet(
fieldConstraintWithTarget,
@@ -364,7 +364,7 @@
return ConstraintWithTarget.ALWAYS;
}
if (target != null) {
- DexType methodHolder = graphLense.lookupType(target.holder());
+ DexType methodHolder = graphLens.lookupType(target.holder());
DexClass methodClass = appView.definitionFor(methodHolder);
if (methodClass != null) {
if (!allowStaticInterfaceMethodCalls && methodClass.isInterface() && target.hasCode()) {
@@ -405,7 +405,7 @@
return ConstraintWithTarget.NEVER;
}
- DexType methodHolder = graphLense.lookupType(resolutionTarget.holder());
+ DexType methodHolder = graphLens.lookupType(resolutionTarget.holder());
DexClass methodClass = appView.definitionFor(methodHolder);
assert methodClass != null;
ConstraintWithTarget methodConstraintWithTarget =
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/NestReducer.java b/src/main/java/com/android/tools/r8/ir/optimize/NestReducer.java
index 715c936..6fa08c8 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/NestReducer.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/NestReducer.java
@@ -35,8 +35,8 @@
}
private DexClass definitionFor(DexType type) {
- assert appView.graphLense().lookupType(type) == type;
- return appView.definitionFor(appView.graphLense().lookupType(type));
+ assert appView.graphLens().lookupType(type) == type;
+ return appView.definitionFor(appView.graphLens().lookupType(type));
}
public void run(ExecutorService executorService) throws ExecutionException {
@@ -113,8 +113,7 @@
private void clearNestAttributes(DexClass nestHost) {
nestHost.getNestMembersClassAttributes().clear();
for (NestMemberClassAttribute attr : nestHost.getNestMembersClassAttributes()) {
- DexClass member =
- appView.definitionFor(appView.graphLense().lookupType(attr.getNestMember()));
+ DexClass member = appView.definitionFor(appView.graphLens().lookupType(attr.getNestMember()));
member.clearNestHost();
}
}
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/Outliner.java b/src/main/java/com/android/tools/r8/ir/optimize/Outliner.java
index d9eb7f2..c7e7b6b 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/Outliner.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/Outliner.java
@@ -25,7 +25,7 @@
import com.android.tools.r8.graph.DexString;
import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.graph.DexTypeList;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.MethodAccessFlags;
import com.android.tools.r8.graph.ParameterAnnotationsList;
import com.android.tools.r8.graph.ProgramMethod;
@@ -1268,7 +1268,7 @@
public Outliner(AppView<AppInfoWithLiveness> appView) {
this.appView = appView;
- this.inliningConstraints = new InliningConstraints(appView, GraphLense.getIdentityLense());
+ this.inliningConstraints = new InliningConstraints(appView, GraphLens.getIdentityLens());
}
public void createOutlineMethodIdentifierGenerator() {
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadElimination.java b/src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadElimination.java
index 5178020..eb6bddd 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadElimination.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/RedundantFieldLoadElimination.java
@@ -336,7 +336,7 @@
assert verticallyMergedClasses.isTarget(method.getHolderType());
assert appView
.dexItemFactory()
- .isConstructor(appView.graphLense().getOriginalMethodSignature(method.getReference()));
+ .isConstructor(appView.graphLens().getOriginalMethodSignature(method.getReference()));
assert method.getDefinition().getOptimizationInfo().forceInline();
return true;
}
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/UninstantiatedTypeOptimization.java b/src/main/java/com/android/tools/r8/ir/optimize/UninstantiatedTypeOptimization.java
index 6a8b6a5..885a1d0 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/UninstantiatedTypeOptimization.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/UninstantiatedTypeOptimization.java
@@ -16,7 +16,7 @@
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.GraphLense.NestedGraphLense;
+import com.android.tools.r8.graph.GraphLens.NestedGraphLens;
import com.android.tools.r8.graph.RewrittenPrototypeDescription;
import com.android.tools.r8.graph.RewrittenPrototypeDescription.ArgumentInfoCollection;
import com.android.tools.r8.graph.RewrittenPrototypeDescription.RemovedArgumentInfo;
@@ -48,12 +48,12 @@
DISALLOW_ARGUMENT_REMOVAL
}
- public static class UninstantiatedTypeOptimizationGraphLense extends NestedGraphLense {
+ public static class UninstantiatedTypeOptimizationGraphLens extends NestedGraphLens {
private final AppView<?> appView;
private final Map<DexMethod, ArgumentInfoCollection> removedArgumentsInfoPerMethod;
- UninstantiatedTypeOptimizationGraphLense(
+ UninstantiatedTypeOptimizationGraphLens(
BiMap<DexMethod, DexMethod> methodMap,
Map<DexMethod, ArgumentInfoCollection> removedArgumentsInfoPerMethod,
AppView<?> appView) {
@@ -63,7 +63,7 @@
ImmutableMap.of(),
null,
methodMap.inverse(),
- appView.graphLense(),
+ appView.graphLens(),
appView.dexItemFactory());
this.appView = appView;
this.removedArgumentsInfoPerMethod = removedArgumentsInfoPerMethod;
@@ -72,7 +72,7 @@
@Override
public RewrittenPrototypeDescription lookupPrototypeChanges(DexMethod method) {
DexMethod originalMethod = originalMethodSignatures.getOrDefault(method, method);
- RewrittenPrototypeDescription result = previousLense.lookupPrototypeChanges(originalMethod);
+ RewrittenPrototypeDescription result = previousLens.lookupPrototypeChanges(originalMethod);
if (originalMethod != method) {
if (method.proto.returnType.isVoidType() && !originalMethod.proto.returnType.isVoidType()) {
result = result.withConstantReturn(originalMethod.proto.returnType, appView);
@@ -123,7 +123,7 @@
return this;
}
- public UninstantiatedTypeOptimizationGraphLense run(
+ public UninstantiatedTypeOptimizationGraphLens run(
MethodPoolCollection methodPoolCollection, ExecutorService executorService, Timing timing) {
try {
methodPoolCollection.buildAll(executorService, timing);
@@ -147,7 +147,7 @@
removedArgumentsInfoPerMethod));
if (!methodMapping.isEmpty()) {
- return new UninstantiatedTypeOptimizationGraphLense(
+ return new UninstantiatedTypeOptimizationGraphLens(
methodMapping, removedArgumentsInfoPerMethod, appView);
}
return null;
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/UnusedArgumentsCollector.java b/src/main/java/com/android/tools/r8/ir/optimize/UnusedArgumentsCollector.java
index 7b60b90..e6bd21e 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/UnusedArgumentsCollector.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/UnusedArgumentsCollector.java
@@ -14,8 +14,8 @@
import com.android.tools.r8.graph.DexProto;
import com.android.tools.r8.graph.DexString;
import com.android.tools.r8.graph.DexType;
-import com.android.tools.r8.graph.GraphLense;
-import com.android.tools.r8.graph.GraphLense.NestedGraphLense;
+import com.android.tools.r8.graph.GraphLens;
+import com.android.tools.r8.graph.GraphLens.NestedGraphLens;
import com.android.tools.r8.graph.RewrittenPrototypeDescription;
import com.android.tools.r8.graph.RewrittenPrototypeDescription.ArgumentInfoCollection;
import com.android.tools.r8.graph.RewrittenPrototypeDescription.RemovedArgumentInfo;
@@ -51,17 +51,17 @@
private final BiMap<DexMethod, DexMethod> methodMapping = HashBiMap.create();
private final Map<DexMethod, ArgumentInfoCollection> removedArguments = new IdentityHashMap<>();
- public static class UnusedArgumentsGraphLense extends NestedGraphLense {
+ public static class UnusedArgumentsGraphLens extends NestedGraphLens {
private final Map<DexMethod, ArgumentInfoCollection> removedArguments;
- UnusedArgumentsGraphLense(
+ UnusedArgumentsGraphLens(
Map<DexType, DexType> typeMap,
Map<DexMethod, DexMethod> methodMap,
Map<DexField, DexField> fieldMap,
BiMap<DexField, DexField> originalFieldSignatures,
BiMap<DexMethod, DexMethod> originalMethodSignatures,
- GraphLense previousLense,
+ GraphLens previousLens,
DexItemFactory dexItemFactory,
Map<DexMethod, ArgumentInfoCollection> removedArguments) {
super(
@@ -70,7 +70,7 @@
fieldMap,
originalFieldSignatures,
originalMethodSignatures,
- previousLense,
+ previousLens,
dexItemFactory);
this.removedArguments = removedArguments;
}
@@ -81,7 +81,7 @@
originalMethodSignatures != null
? originalMethodSignatures.getOrDefault(method, method)
: method;
- RewrittenPrototypeDescription result = previousLense.lookupPrototypeChanges(originalMethod);
+ RewrittenPrototypeDescription result = previousLens.lookupPrototypeChanges(originalMethod);
ArgumentInfoCollection removedArguments = this.removedArguments.get(method);
return removedArguments != null ? result.withRemovedArguments(removedArguments) : result;
}
@@ -93,7 +93,7 @@
this.methodPoolCollection = methodPoolCollection;
}
- public UnusedArgumentsGraphLense run(ExecutorService executorService, Timing timing)
+ public UnusedArgumentsGraphLens run(ExecutorService executorService, Timing timing)
throws ExecutionException {
ThreadUtils.awaitFutures(
Streams.stream(appView.appInfo().classes())
@@ -110,13 +110,13 @@
appView.appInfo().classesWithDeterministicOrder().forEach(this::processVirtualMethods);
if (!methodMapping.isEmpty()) {
- return new UnusedArgumentsGraphLense(
+ return new UnusedArgumentsGraphLens(
ImmutableMap.of(),
methodMapping,
ImmutableMap.of(),
ImmutableBiMap.of(),
methodMapping.inverse(),
- appView.graphLense(),
+ appView.graphLens(),
appView.dexItemFactory(),
removedArguments);
}
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxer.java b/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxer.java
index 3be53b2..c902868 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxer.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/enums/EnumUnboxer.java
@@ -23,8 +23,8 @@
import com.android.tools.r8.graph.DexValue.DexValueInt;
import com.android.tools.r8.graph.DexValue.DexValueNull;
import com.android.tools.r8.graph.FieldResolutionResult;
-import com.android.tools.r8.graph.GraphLense;
-import com.android.tools.r8.graph.GraphLense.NestedGraphLense;
+import com.android.tools.r8.graph.GraphLens;
+import com.android.tools.r8.graph.GraphLens.NestedGraphLens;
import com.android.tools.r8.graph.ProgramMethod;
import com.android.tools.r8.graph.RewrittenPrototypeDescription;
import com.android.tools.r8.graph.RewrittenPrototypeDescription.ArgumentInfoCollection;
@@ -337,10 +337,10 @@
// Update keep info on any of the enum methods of the removed classes.
updatePinnedItems(enumsToUnbox);
enumUnboxerRewriter = new EnumUnboxingRewriter(appView, enumsToUnbox);
- NestedGraphLense enumUnboxingLens = new TreeFixer(enumsToUnbox).fixupTypeReferences();
+ NestedGraphLens enumUnboxingLens = new TreeFixer(enumsToUnbox).fixupTypeReferences();
appView.setUnboxedEnums(enumUnboxerRewriter.getEnumsToUnbox());
- GraphLense previousLens = appView.graphLense();
- appView.setGraphLense(enumUnboxingLens);
+ GraphLens previousLens = appView.graphLens();
+ appView.setGraphLens(enumUnboxingLens);
appView.setAppInfo(
appView.appInfo().rewrittenWithLens(appView.appInfo().app().asDirect(), enumUnboxingLens));
// Update optimization info.
@@ -354,8 +354,8 @@
if (optimizationInfo.isMutableFieldOptimizationInfo()) {
optimizationInfo
.asMutableFieldOptimizationInfo()
- .fixupClassTypeReferences(appView.graphLense()::lookupType, appView)
- .fixupAbstractValue(appView, appView.graphLense());
+ .fixupClassTypeReferences(appView.graphLens()::lookupType, appView)
+ .fixupAbstractValue(appView, appView.graphLens());
} else {
assert optimizationInfo.isDefaultFieldOptimizationInfo();
}
@@ -367,9 +367,9 @@
if (optimizationInfo.isUpdatableMethodOptimizationInfo()) {
optimizationInfo
.asUpdatableMethodOptimizationInfo()
- .fixupClassTypeReferences(appView.graphLense()::lookupType, appView)
- .fixupAbstractReturnValue(appView, appView.graphLense())
- .fixupInstanceInitializerInfo(appView, appView.graphLense());
+ .fixupClassTypeReferences(appView.graphLens()::lookupType, appView)
+ .fixupAbstractReturnValue(appView, appView.graphLens())
+ .fixupInstanceInitializerInfo(appView, appView.graphLens());
} else {
assert optimizationInfo.isDefaultMethodOptimizationInfo();
}
@@ -718,7 +718,7 @@
this.enumsToUnbox = enumsToUnbox;
}
- private NestedGraphLense fixupTypeReferences() {
+ private NestedGraphLens fixupTypeReferences() {
assert enumUnboxerRewriter != null;
// Fix all methods and fields using enums to unbox.
for (DexProgramClass clazz : appView.appInfo().classes()) {
@@ -752,7 +752,7 @@
appView.definitionForProgramType(factory.enumUnboxingUtilityType);
assert utilityClass != null : "Should have been synthesized upfront";
utilityClass.addDirectMethods(unboxedEnumsMethods);
- return lensBuilder.build(factory, appView.graphLense(), enumsToUnbox);
+ return lensBuilder.build(factory, appView.graphLens(), enumsToUnbox);
}
private void clearEnumToUnboxMethod(DexEncodedMethod enumMethod) {
@@ -857,7 +857,7 @@
}
}
- private static class EnumUnboxingLens extends NestedGraphLense {
+ private static class EnumUnboxingLens extends NestedGraphLens {
private final Map<DexMethod, RewrittenPrototypeDescription> prototypeChanges;
private final Set<DexType> unboxedEnums;
@@ -868,7 +868,7 @@
Map<DexField, DexField> fieldMap,
BiMap<DexField, DexField> originalFieldSignatures,
BiMap<DexMethod, DexMethod> originalMethodSignatures,
- GraphLense previousLense,
+ GraphLens previousLens,
DexItemFactory dexItemFactory,
Map<DexMethod, RewrittenPrototypeDescription> prototypeChanges,
Set<DexType> unboxedEnums) {
@@ -878,7 +878,7 @@
fieldMap,
originalFieldSignatures,
originalMethodSignatures,
- previousLense,
+ previousLens,
dexItemFactory);
this.prototypeChanges = prototypeChanges;
this.unboxedEnums = unboxedEnums;
@@ -889,7 +889,7 @@
// During the second IR processing enum unboxing is the only optimization rewriting
// prototype description, if this does not hold, remove the assertion and merge
// the two prototype changes.
- assert previousLense.lookupPrototypeChanges(method).isEmpty();
+ assert previousLens.lookupPrototypeChanges(method).isEmpty();
return prototypeChanges.getOrDefault(method, RewrittenPrototypeDescription.none());
}
@@ -908,7 +908,7 @@
return new Builder();
}
- private static class Builder extends NestedGraphLense.Builder {
+ private static class Builder extends NestedGraphLens.Builder {
private Map<DexMethod, RewrittenPrototypeDescription> prototypeChanges =
new IdentityHashMap<>();
@@ -941,7 +941,7 @@
}
public EnumUnboxingLens build(
- DexItemFactory dexItemFactory, GraphLense previousLense, Set<DexType> unboxedEnums) {
+ DexItemFactory dexItemFactory, GraphLens previousLens, Set<DexType> unboxedEnums) {
if (typeMap.isEmpty() && methodMap.isEmpty() && fieldMap.isEmpty()) {
return null;
}
@@ -951,7 +951,7 @@
fieldMap,
originalFieldSignatures,
originalMethodSignatures,
- previousLense,
+ previousLens,
dexItemFactory,
ImmutableMap.copyOf(prototypeChanges),
ImmutableSet.copyOf(unboxedEnums));
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/info/MethodOptimizationInfoCollector.java b/src/main/java/com/android/tools/r8/ir/optimize/info/MethodOptimizationInfoCollector.java
index d88f9d2..5542908 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/info/MethodOptimizationInfoCollector.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/info/MethodOptimizationInfoCollector.java
@@ -913,7 +913,7 @@
Wrapper<DexMethod> throwParamIsNullException =
wrapper.wrap(appView.dexItemFactory().kotlin.intrinsics.throwParameterIsNullException);
DexMethod invokedMethod =
- appView.graphLense().getOriginalMethodSignature(instr.asInvokeStatic().getInvokedMethod());
+ appView.graphLens().getOriginalMethodSignature(instr.asInvokeStatic().getInvokedMethod());
Wrapper<DexMethod> methodWrap = wrapper.wrap(invokedMethod);
if (methodWrap.equals(throwParamIsNullException)
|| (methodWrap.equals(checkParameterIsNotNull) && instr.inValues().get(0).equals(value))) {
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/info/MutableFieldOptimizationInfo.java b/src/main/java/com/android/tools/r8/ir/optimize/info/MutableFieldOptimizationInfo.java
index 3237c20..41ee658 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/info/MutableFieldOptimizationInfo.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/info/MutableFieldOptimizationInfo.java
@@ -7,7 +7,7 @@
import com.android.tools.r8.graph.AppInfoWithClassHierarchy;
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DexType;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.ir.analysis.type.ClassTypeElement;
import com.android.tools.r8.ir.analysis.type.TypeElement;
import com.android.tools.r8.ir.analysis.value.AbstractValue;
@@ -69,7 +69,7 @@
this.abstractValue = abstractValue;
}
- public void fixupAbstractValue(AppView<AppInfoWithLiveness> appView, GraphLense lens) {
+ public void fixupAbstractValue(AppView<AppInfoWithLiveness> appView, GraphLens lens) {
abstractValue = abstractValue.rewrittenWithLens(appView, lens);
}
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/info/UpdatableMethodOptimizationInfo.java b/src/main/java/com/android/tools/r8/ir/optimize/info/UpdatableMethodOptimizationInfo.java
index 3971c57..610bad0 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/info/UpdatableMethodOptimizationInfo.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/info/UpdatableMethodOptimizationInfo.java
@@ -7,7 +7,7 @@
import com.android.tools.r8.graph.AppInfoWithClassHierarchy;
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DexType;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.ir.analysis.type.ClassTypeElement;
import com.android.tools.r8.ir.analysis.type.TypeElement;
import com.android.tools.r8.ir.analysis.value.AbstractValue;
@@ -164,13 +164,13 @@
}
public UpdatableMethodOptimizationInfo fixupAbstractReturnValue(
- AppView<AppInfoWithLiveness> appView, GraphLense lens) {
+ AppView<AppInfoWithLiveness> appView, GraphLens lens) {
abstractReturnValue = abstractReturnValue.rewrittenWithLens(appView, lens);
return this;
}
public UpdatableMethodOptimizationInfo fixupInstanceInitializerInfo(
- AppView<AppInfoWithLiveness> appView, GraphLense lens) {
+ AppView<AppInfoWithLiveness> appView, GraphLens lens) {
if (instanceInitializerInfo != null) {
instanceInitializerInfo = instanceInitializerInfo.rewrittenWithLens(appView, lens);
}
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/info/field/EmptyInstanceFieldInitializationInfoCollection.java b/src/main/java/com/android/tools/r8/ir/optimize/info/field/EmptyInstanceFieldInitializationInfoCollection.java
index fd7a84f..4e45bac 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/info/field/EmptyInstanceFieldInitializationInfoCollection.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/info/field/EmptyInstanceFieldInitializationInfoCollection.java
@@ -7,7 +7,7 @@
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DexDefinitionSupplier;
import com.android.tools.r8.graph.DexEncodedField;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
import java.util.function.BiConsumer;
@@ -46,7 +46,7 @@
@Override
public InstanceFieldInitializationInfoCollection rewrittenWithLens(
- AppView<AppInfoWithLiveness> appView, GraphLense lens) {
+ AppView<AppInfoWithLiveness> appView, GraphLens lens) {
return this;
}
}
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/info/field/InstanceFieldArgumentInitializationInfo.java b/src/main/java/com/android/tools/r8/ir/optimize/info/field/InstanceFieldArgumentInitializationInfo.java
index 757eec8..0b87005 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/info/field/InstanceFieldArgumentInitializationInfo.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/info/field/InstanceFieldArgumentInitializationInfo.java
@@ -5,7 +5,7 @@
package com.android.tools.r8.ir.optimize.info.field;
import com.android.tools.r8.graph.AppView;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
/**
@@ -37,7 +37,7 @@
@Override
public InstanceFieldInitializationInfo rewrittenWithLens(
- AppView<AppInfoWithLiveness> appView, GraphLense lens) {
+ AppView<AppInfoWithLiveness> appView, GraphLens lens) {
// We don't have the context here to determine what should happen. It is the responsibility of
// optimizations that change the proto of instance initializers to update the argument
// initialization info.
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/info/field/InstanceFieldInitializationInfo.java b/src/main/java/com/android/tools/r8/ir/optimize/info/field/InstanceFieldInitializationInfo.java
index 37757f1..aa3ab9b 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/info/field/InstanceFieldInitializationInfo.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/info/field/InstanceFieldInitializationInfo.java
@@ -5,7 +5,7 @@
package com.android.tools.r8.ir.optimize.info.field;
import com.android.tools.r8.graph.AppView;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.ir.analysis.value.SingleValue;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
@@ -47,5 +47,5 @@
}
InstanceFieldInitializationInfo rewrittenWithLens(
- AppView<AppInfoWithLiveness> appView, GraphLense lens);
+ AppView<AppInfoWithLiveness> appView, GraphLens lens);
}
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/info/field/InstanceFieldInitializationInfoCollection.java b/src/main/java/com/android/tools/r8/ir/optimize/info/field/InstanceFieldInitializationInfoCollection.java
index 3ff1799..d26de6d 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/info/field/InstanceFieldInitializationInfoCollection.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/info/field/InstanceFieldInitializationInfoCollection.java
@@ -8,7 +8,7 @@
import com.android.tools.r8.graph.DexDefinitionSupplier;
import com.android.tools.r8.graph.DexEncodedField;
import com.android.tools.r8.graph.DexField;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
import java.util.IdentityHashMap;
import java.util.Map;
@@ -36,7 +36,7 @@
public abstract boolean isEmpty();
public abstract InstanceFieldInitializationInfoCollection rewrittenWithLens(
- AppView<AppInfoWithLiveness> appView, GraphLense lens);
+ AppView<AppInfoWithLiveness> appView, GraphLens lens);
public static class Builder {
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/info/field/InstanceFieldTypeInitializationInfo.java b/src/main/java/com/android/tools/r8/ir/optimize/info/field/InstanceFieldTypeInitializationInfo.java
index 3bfce16..fe09706 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/info/field/InstanceFieldTypeInitializationInfo.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/info/field/InstanceFieldTypeInitializationInfo.java
@@ -6,7 +6,7 @@
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.EnumValueInfoMapCollection;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.ir.analysis.type.ClassTypeElement;
import com.android.tools.r8.ir.analysis.type.TypeElement;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
@@ -48,7 +48,7 @@
@Override
public InstanceFieldInitializationInfo rewrittenWithLens(
- AppView<AppInfoWithLiveness> appView, GraphLense lens) {
+ AppView<AppInfoWithLiveness> appView, GraphLens lens) {
EnumValueInfoMapCollection unboxedEnums = appView.unboxedEnums();
if (dynamicLowerBoundType != null
&& unboxedEnums.containsEnum(dynamicLowerBoundType.getClassType())) {
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/info/field/NonTrivialInstanceFieldInitializationInfoCollection.java b/src/main/java/com/android/tools/r8/ir/optimize/info/field/NonTrivialInstanceFieldInitializationInfoCollection.java
index fe70918..e8daa83 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/info/field/NonTrivialInstanceFieldInitializationInfoCollection.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/info/field/NonTrivialInstanceFieldInitializationInfoCollection.java
@@ -10,7 +10,7 @@
import com.android.tools.r8.graph.DexDefinitionSupplier;
import com.android.tools.r8.graph.DexEncodedField;
import com.android.tools.r8.graph.DexField;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
import java.util.Map;
import java.util.function.BiConsumer;
@@ -56,7 +56,7 @@
@Override
public InstanceFieldInitializationInfoCollection rewrittenWithLens(
- AppView<AppInfoWithLiveness> appView, GraphLense lens) {
+ AppView<AppInfoWithLiveness> appView, GraphLens lens) {
Builder builder = InstanceFieldInitializationInfoCollection.builder();
infos.forEach(
(field, info) -> {
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/info/field/UnknownInstanceFieldInitializationInfo.java b/src/main/java/com/android/tools/r8/ir/optimize/info/field/UnknownInstanceFieldInitializationInfo.java
index b2b6ce9..ab4bbfe 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/info/field/UnknownInstanceFieldInitializationInfo.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/info/field/UnknownInstanceFieldInitializationInfo.java
@@ -5,7 +5,7 @@
package com.android.tools.r8.ir.optimize.info.field;
import com.android.tools.r8.graph.AppView;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
/**
@@ -30,7 +30,7 @@
@Override
public InstanceFieldInitializationInfo rewrittenWithLens(
- AppView<AppInfoWithLiveness> appView, GraphLense lens) {
+ AppView<AppInfoWithLiveness> appView, GraphLens lens) {
return this;
}
}
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/info/initializer/DefaultInstanceInitializerInfo.java b/src/main/java/com/android/tools/r8/ir/optimize/info/initializer/DefaultInstanceInitializerInfo.java
index 4065fb0..e4424ec 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/info/initializer/DefaultInstanceInitializerInfo.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/info/initializer/DefaultInstanceInitializerInfo.java
@@ -6,7 +6,7 @@
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DexMethod;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.ir.analysis.fieldvalueanalysis.AbstractFieldSet;
import com.android.tools.r8.ir.analysis.fieldvalueanalysis.UnknownFieldSet;
import com.android.tools.r8.ir.optimize.info.field.EmptyInstanceFieldInitializationInfoCollection;
@@ -56,7 +56,7 @@
@Override
public InstanceInitializerInfo rewrittenWithLens(
- AppView<AppInfoWithLiveness> appView, GraphLense lens) {
+ AppView<AppInfoWithLiveness> appView, GraphLens lens) {
return this;
}
}
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/info/initializer/InstanceInitializerInfo.java b/src/main/java/com/android/tools/r8/ir/optimize/info/initializer/InstanceInitializerInfo.java
index 1745e7d..1e36f40 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/info/initializer/InstanceInitializerInfo.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/info/initializer/InstanceInitializerInfo.java
@@ -6,7 +6,7 @@
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DexMethod;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.ir.analysis.fieldvalueanalysis.AbstractFieldSet;
import com.android.tools.r8.ir.optimize.info.field.InstanceFieldInitializationInfoCollection;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
@@ -57,5 +57,5 @@
}
public abstract InstanceInitializerInfo rewrittenWithLens(
- AppView<AppInfoWithLiveness> appView, GraphLense lens);
+ AppView<AppInfoWithLiveness> appView, GraphLens lens);
}
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/info/initializer/NonTrivialInstanceInitializerInfo.java b/src/main/java/com/android/tools/r8/ir/optimize/info/initializer/NonTrivialInstanceInitializerInfo.java
index f549927..84ce93f 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/info/initializer/NonTrivialInstanceInitializerInfo.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/info/initializer/NonTrivialInstanceInitializerInfo.java
@@ -7,7 +7,7 @@
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DexEncodedField;
import com.android.tools.r8.graph.DexMethod;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.ir.analysis.fieldvalueanalysis.AbstractFieldSet;
import com.android.tools.r8.ir.analysis.fieldvalueanalysis.ConcreteMutableFieldSet;
import com.android.tools.r8.ir.analysis.fieldvalueanalysis.EmptyFieldSet;
@@ -84,7 +84,7 @@
@Override
public NonTrivialInstanceInitializerInfo rewrittenWithLens(
- AppView<AppInfoWithLiveness> appView, GraphLense lens) {
+ AppView<AppInfoWithLiveness> appView, GraphLens lens) {
return new NonTrivialInstanceInitializerInfo(
data,
fieldInitializationInfos.rewrittenWithLens(appView, lens),
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/lambda/LambdaMerger.java b/src/main/java/com/android/tools/r8/ir/optimize/lambda/LambdaMerger.java
index 6e0805e..4cba255 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/lambda/LambdaMerger.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/lambda/LambdaMerger.java
@@ -372,11 +372,11 @@
// Eventually, we need to process synthesized methods in the lambda group.
// Otherwise, abstract SynthesizedCode will be flown to Enqueuer.
// But that process should not see the holder. Otherwise, lambda calls in the main dispatch
- // method became recursive calls via the lense rewriter. They should remain, then inliner
+ // method became recursive calls via the lens rewriter. They should remain, then inliner
// will inline methods from mergee lambdas to the main dispatch method.
// Then, there is a dilemma: other sub optimizations trigger subtype lookup that will throw
// NPE if it cannot find the holder for this synthesized lambda group.
- // One hack here is to mark those methods `processed` so that the lense rewriter is skipped.
+ // One hack here is to mark those methods `processed` so that the lens rewriter is skipped.
synthesizedClass.forEachMethod(
encodedMethod -> encodedMethod.markProcessed(ConstraintWithTarget.NEVER));
}
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/staticizer/ClassStaticizerGraphLense.java b/src/main/java/com/android/tools/r8/ir/optimize/staticizer/ClassStaticizerGraphLens.java
similarity index 86%
rename from src/main/java/com/android/tools/r8/ir/optimize/staticizer/ClassStaticizerGraphLense.java
rename to src/main/java/com/android/tools/r8/ir/optimize/staticizer/ClassStaticizerGraphLens.java
index 318aae5..6eeeb46 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/staticizer/ClassStaticizerGraphLense.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/staticizer/ClassStaticizerGraphLens.java
@@ -7,14 +7,14 @@
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DexField;
import com.android.tools.r8.graph.DexMethod;
-import com.android.tools.r8.graph.GraphLense.NestedGraphLense;
+import com.android.tools.r8.graph.GraphLens.NestedGraphLens;
import com.android.tools.r8.ir.code.Invoke.Type;
import com.google.common.collect.BiMap;
import com.google.common.collect.ImmutableMap;
-class ClassStaticizerGraphLense extends NestedGraphLense {
+class ClassStaticizerGraphLens extends NestedGraphLens {
- ClassStaticizerGraphLense(
+ ClassStaticizerGraphLens(
AppView<?> appView,
BiMap<DexField, DexField> fieldMapping,
BiMap<DexMethod, DexMethod> methodMapping) {
@@ -24,7 +24,7 @@
fieldMapping,
fieldMapping.inverse(),
methodMapping.inverse(),
- appView.graphLense(),
+ appView.graphLens(),
appView.dexItemFactory());
}
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/staticizer/StaticizingProcessor.java b/src/main/java/com/android/tools/r8/ir/optimize/staticizer/StaticizingProcessor.java
index 8dbb64a..6ad81c8 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/staticizer/StaticizingProcessor.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/staticizer/StaticizingProcessor.java
@@ -773,7 +773,7 @@
}
if (!methodMapping.isEmpty() || !fieldMapping.isEmpty()) {
- appView.setGraphLense(new ClassStaticizerGraphLense(appView, fieldMapping, methodMapping));
+ appView.setGraphLens(new ClassStaticizerGraphLens(appView, fieldMapping, methodMapping));
}
return staticizedMethods;
}
diff --git a/src/main/java/com/android/tools/r8/jar/CfApplicationWriter.java b/src/main/java/com/android/tools/r8/jar/CfApplicationWriter.java
index 01c3daa..7e98858 100644
--- a/src/main/java/com/android/tools/r8/jar/CfApplicationWriter.java
+++ b/src/main/java/com/android/tools/r8/jar/CfApplicationWriter.java
@@ -32,7 +32,7 @@
import com.android.tools.r8.graph.DexValue.DexValueEnum;
import com.android.tools.r8.graph.DexValue.DexValueInt;
import com.android.tools.r8.graph.DexValue.DexValueString;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.InnerClassAttribute;
import com.android.tools.r8.graph.NestMemberClassAttribute;
import com.android.tools.r8.graph.ParameterAnnotationsList;
@@ -70,7 +70,7 @@
private final DexApplication application;
private final AppView<?> appView;
- private final GraphLense graphLense;
+ private final GraphLens graphLens;
private final NamingLens namingLens;
private final InternalOptions options;
private final Marker marker;
@@ -82,12 +82,12 @@
AppView<?> appView,
InternalOptions options,
Marker marker,
- GraphLense graphLense,
+ GraphLens graphLens,
NamingLens namingLens,
ProguardMapSupplier proguardMapSupplier) {
this.application = application;
this.appView = appView;
- this.graphLense = graphLense;
+ this.graphLens = graphLens;
this.namingLens = namingLens;
this.options = options;
assert marker != null;
@@ -143,7 +143,7 @@
}
}
ApplicationWriter.supplyAdditionalConsumers(
- application, appView, graphLense, namingLens, options);
+ application, appView, graphLens, namingLens, options);
}
private void writeClass(
diff --git a/src/main/java/com/android/tools/r8/naming/ClassNameMinifier.java b/src/main/java/com/android/tools/r8/naming/ClassNameMinifier.java
index 9b659a0..998fad3 100644
--- a/src/main/java/com/android/tools/r8/naming/ClassNameMinifier.java
+++ b/src/main/java/com/android/tools/r8/naming/ClassNameMinifier.java
@@ -255,7 +255,7 @@
InnerClassAttribute attribute = clazz.getInnerClassAttributeForThisClass();
assert attribute != null;
// Note that, to be consistent with the way inner-class attribute is written via minifier
- // lense, we are using attribute's outer-class, not the live context.
+ // lens, we are using attribute's outer-class, not the live context.
String separator =
computeInnerClassSeparator(attribute.getOuter(), type, attribute.getInnerName());
if (separator == null) {
diff --git a/src/main/java/com/android/tools/r8/naming/NamingLens.java b/src/main/java/com/android/tools/r8/naming/NamingLens.java
index a142cbf..7aab96a 100644
--- a/src/main/java/com/android/tools/r8/naming/NamingLens.java
+++ b/src/main/java/com/android/tools/r8/naming/NamingLens.java
@@ -130,7 +130,7 @@
Class<T> clazz, Predicate<T> predicate, Function<T, String> namer);
/**
- * Checks whether the target will be translated properly by this lense.
+ * Checks whether the target will be translated properly by this lens.
*
* <p>Normally, this means that the target corresponds to an actual definition that has been
* renamed. For identity renamings, we are more relaxed, as no targets will be translated anyway.
diff --git a/src/main/java/com/android/tools/r8/naming/signature/GenericSignatureRewriter.java b/src/main/java/com/android/tools/r8/naming/signature/GenericSignatureRewriter.java
index 1f66108..92b4402 100644
--- a/src/main/java/com/android/tools/r8/naming/signature/GenericSignatureRewriter.java
+++ b/src/main/java/com/android/tools/r8/naming/signature/GenericSignatureRewriter.java
@@ -200,7 +200,7 @@
}
String originalDescriptor = getDescriptorFromClassBinaryName(name);
DexType type =
- appView.graphLense().lookupType(appView.dexItemFactory().createType(originalDescriptor));
+ appView.graphLens().lookupType(appView.dexItemFactory().createType(originalDescriptor));
if (appView.appInfo().hasLiveness() && appView.withLiveness().appInfo().wasPruned(type)) {
type = appView.dexItemFactory().objectType;
}
@@ -251,7 +251,7 @@
getClassBinaryNameFromDescriptor(enclosingDescriptor)
+ DescriptorUtils.INNER_CLASS_SEPARATOR
+ name));
- type = appView.graphLense().lookupType(type);
+ type = appView.graphLens().lookupType(type);
String renamedDescriptor = namingLens.lookupDescriptor(type).toString();
if (!renamedDescriptor.equals(type.toDescriptorString())) {
// TODO(b/147504070): If this is a merged class equal to the class context, do not add.
diff --git a/src/main/java/com/android/tools/r8/optimize/BridgeHoisting.java b/src/main/java/com/android/tools/r8/optimize/BridgeHoisting.java
index 1cfe21f..6e0168f 100644
--- a/src/main/java/com/android/tools/r8/optimize/BridgeHoisting.java
+++ b/src/main/java/com/android/tools/r8/optimize/BridgeHoisting.java
@@ -20,7 +20,7 @@
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.GraphLense.NestedGraphLense;
+import com.android.tools.r8.graph.GraphLens.NestedGraphLens;
import com.android.tools.r8.graph.ProgramMethod;
import com.android.tools.r8.graph.ResolutionResult;
import com.android.tools.r8.graph.SubtypingInfo;
@@ -87,7 +87,7 @@
.visit(appView.appInfo().classes(), clazz -> processClass(clazz, subtypingInfo));
if (!lensBuilder.isEmpty()) {
BridgeHoistingLens lens = lensBuilder.build(appView);
- boolean changed = appView.setGraphLense(lens);
+ boolean changed = appView.setGraphLens(lens);
assert changed;
appView.setAppInfo(
appView.appInfo().rewrittenWithLens(appView.appInfo().app().asDirect(), lens));
@@ -367,7 +367,7 @@
: code;
}
- static class BridgeHoistingLens extends NestedGraphLense {
+ static class BridgeHoistingLens extends NestedGraphLens {
public BridgeHoistingLens(
AppView<?> appView, BiMap<DexMethod, DexMethod> originalMethodSignatures) {
@@ -377,7 +377,7 @@
ImmutableMap.of(),
null,
originalMethodSignatures,
- appView.graphLense(),
+ appView.graphLens(),
appView.dexItemFactory());
}
diff --git a/src/main/java/com/android/tools/r8/optimize/ClassAndMemberPublicizer.java b/src/main/java/com/android/tools/r8/optimize/ClassAndMemberPublicizer.java
index db4613f..4edec01 100644
--- a/src/main/java/com/android/tools/r8/optimize/ClassAndMemberPublicizer.java
+++ b/src/main/java/com/android/tools/r8/optimize/ClassAndMemberPublicizer.java
@@ -14,12 +14,12 @@
import com.android.tools.r8.graph.DexEncodedMethod;
import com.android.tools.r8.graph.DexProgramClass;
import com.android.tools.r8.graph.DexType;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.InnerClassAttribute;
import com.android.tools.r8.graph.MethodAccessFlags;
import com.android.tools.r8.graph.SubtypingInfo;
import com.android.tools.r8.ir.optimize.MethodPoolCollection;
-import com.android.tools.r8.optimize.PublicizerLense.PublicizedLenseBuilder;
+import com.android.tools.r8.optimize.PublicizerLens.PublicizedLensBuilder;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
import com.android.tools.r8.utils.OptionalBool;
import com.android.tools.r8.utils.Timing;
@@ -35,7 +35,7 @@
private final SubtypingInfo subtypingInfo;
private final MethodPoolCollection methodPoolCollection;
- private final PublicizedLenseBuilder lenseBuilder = PublicizerLense.createBuilder();
+ private final PublicizedLensBuilder lensBuilder = PublicizerLens.createBuilder();
private ClassAndMemberPublicizer(
DexApplication application,
@@ -56,7 +56,7 @@
*
* <p>This will destructively update the DexApplication passed in as argument.
*/
- public static GraphLense run(
+ public static GraphLens run(
ExecutorService executorService,
Timing timing,
DexApplication application,
@@ -67,8 +67,7 @@
.run(executorService, timing);
}
- private GraphLense run(ExecutorService executorService, Timing timing)
- throws ExecutionException {
+ private GraphLens run(ExecutorService executorService, Timing timing) throws ExecutionException {
// Phase 1: Collect methods to check if private instance methods don't have conflicts.
methodPoolCollection.buildAll(executorService, timing);
@@ -80,7 +79,7 @@
publicizeType(appView.dexItemFactory().objectType);
timing.end();
- return lenseBuilder.build(appView);
+ return lensBuilder.build(appView);
}
private void publicizeType(DexType type) {
@@ -171,7 +170,7 @@
// TODO(b/111118390): Renaming will enable more private instance methods to be publicized.
return false;
}
- lenseBuilder.add(method.method);
+ lensBuilder.add(method.method);
accessFlags.promoteToFinal();
accessFlags.promoteToPublic();
// The method just became public and is therefore not a library override.
diff --git a/src/main/java/com/android/tools/r8/optimize/MemberRebindingAnalysis.java b/src/main/java/com/android/tools/r8/optimize/MemberRebindingAnalysis.java
index 1c1de57..dcd003c6 100644
--- a/src/main/java/com/android/tools/r8/optimize/MemberRebindingAnalysis.java
+++ b/src/main/java/com/android/tools/r8/optimize/MemberRebindingAnalysis.java
@@ -15,7 +15,7 @@
import com.android.tools.r8.graph.FieldAccessInfo;
import com.android.tools.r8.graph.FieldAccessInfoCollection;
import com.android.tools.r8.graph.FieldResolutionResult.SuccessfulFieldResolutionResult;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.ProgramMethod;
import com.android.tools.r8.ir.code.Invoke.Type;
import com.android.tools.r8.ir.optimize.Inliner.ConstraintWithTarget;
@@ -29,17 +29,17 @@
public class MemberRebindingAnalysis {
private final AppView<AppInfoWithLiveness> appView;
- private final GraphLense lense;
+ private final GraphLens lens;
private final InternalOptions options;
- private final MemberRebindingLense.Builder builder;
+ private final MemberRebindingLens.Builder builder;
public MemberRebindingAnalysis(AppView<AppInfoWithLiveness> appView) {
- assert appView.graphLense().isContextFreeForMethods();
+ assert appView.graphLens().isContextFreeForMethods();
this.appView = appView;
- this.lense = appView.graphLense();
+ this.lens = appView.graphLens();
this.options = appView.options();
- this.builder = MemberRebindingLense.builder(appView);
+ this.builder = MemberRebindingLens.builder(appView);
}
private DexMethod validTargetFor(DexMethod target, DexMethod original) {
@@ -168,7 +168,7 @@
method, target, originalClass, targetClass, lookupTarget);
}
}
- builder.map(method, lense.lookupMethod(validTargetFor(target.method, method)), invokeType);
+ builder.map(method, lens.lookupMethod(validTargetFor(target.method, method)), invokeType);
}
}
}
@@ -331,11 +331,11 @@
if (accessibleInAllContexts) {
builder.map(
field,
- lense.lookupField(validTargetFor(resolvedField.field, field, DexClass::lookupField)));
+ lens.lookupField(validTargetFor(resolvedField.field, field, DexClass::lookupField)));
}
}
- public GraphLense run() {
+ public GraphLens run() {
AppInfoWithLiveness appInfo = appView.appInfo();
// Virtual invokes are on classes, so use class resolution.
computeMethodRebinding(appInfo.virtualInvokes, this::classLookup, Type.VIRTUAL);
@@ -348,7 +348,7 @@
// Likewise static invokes.
computeMethodRebinding(appInfo.staticInvokes, this::anyLookup, Type.STATIC);
computeFieldRebinding();
- GraphLense lens = builder.build(lense);
+ GraphLens lens = builder.build(this.lens);
appInfo.getFieldAccessInfoCollection().flattenAccessContexts();
return lens;
}
diff --git a/src/main/java/com/android/tools/r8/optimize/MemberRebindingLense.java b/src/main/java/com/android/tools/r8/optimize/MemberRebindingLens.java
similarity index 80%
rename from src/main/java/com/android/tools/r8/optimize/MemberRebindingLense.java
rename to src/main/java/com/android/tools/r8/optimize/MemberRebindingLens.java
index 01c923d..8883f5b 100644
--- a/src/main/java/com/android/tools/r8/optimize/MemberRebindingLense.java
+++ b/src/main/java/com/android/tools/r8/optimize/MemberRebindingLens.java
@@ -7,8 +7,8 @@
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DexField;
import com.android.tools.r8.graph.DexMethod;
-import com.android.tools.r8.graph.GraphLense;
-import com.android.tools.r8.graph.GraphLense.NestedGraphLense;
+import com.android.tools.r8.graph.GraphLens;
+import com.android.tools.r8.graph.GraphLens.NestedGraphLens;
import com.android.tools.r8.ir.code.Invoke;
import com.android.tools.r8.ir.code.Invoke.Type;
import com.google.common.collect.ImmutableMap;
@@ -16,7 +16,7 @@
import java.util.IdentityHashMap;
import java.util.Map;
-public class MemberRebindingLense extends NestedGraphLense {
+public class MemberRebindingLens extends NestedGraphLens {
public static class Builder {
@@ -48,29 +48,29 @@
methodMap.put(from, to);
}
- public GraphLense build(GraphLense previousLense) {
+ public GraphLens build(GraphLens previousLens) {
if (fieldMap.isEmpty() && methodMaps.isEmpty()) {
- return previousLense;
+ return previousLens;
}
- return new MemberRebindingLense(appView, methodMaps, fieldMap, previousLense);
+ return new MemberRebindingLens(appView, methodMaps, fieldMap, previousLens);
}
}
private final AppView<?> appView;
private final Map<Invoke.Type, Map<DexMethod, DexMethod>> methodMaps;
- public MemberRebindingLense(
+ public MemberRebindingLens(
AppView<?> appView,
Map<Invoke.Type, Map<DexMethod, DexMethod>> methodMaps,
Map<DexField, DexField> fieldMap,
- GraphLense previousLense) {
+ GraphLens previousLens) {
super(
ImmutableMap.of(),
ImmutableMap.of(),
fieldMap,
null,
null,
- previousLense,
+ previousLens,
appView.dexItemFactory());
this.appView = appView;
this.methodMaps = methodMaps;
@@ -86,12 +86,12 @@
}
@Override
- public GraphLenseLookupResult lookupMethod(DexMethod method, DexMethod context, Type type) {
- GraphLenseLookupResult previous = previousLense.lookupMethod(method, context, type);
+ public GraphLensLookupResult lookupMethod(DexMethod method, DexMethod context, Type type) {
+ GraphLensLookupResult previous = previousLens.lookupMethod(method, context, type);
Map<DexMethod, DexMethod> methodMap = methodMaps.getOrDefault(type, Collections.emptyMap());
DexMethod newMethod = methodMap.get(previous.getMethod());
if (newMethod != null) {
- return new GraphLenseLookupResult(
+ return new GraphLensLookupResult(
newMethod, mapInvocationType(newMethod, method, previous.getType()));
}
return previous;
diff --git a/src/main/java/com/android/tools/r8/optimize/PublicizerLense.java b/src/main/java/com/android/tools/r8/optimize/PublicizerLens.java
similarity index 67%
rename from src/main/java/com/android/tools/r8/optimize/PublicizerLense.java
rename to src/main/java/com/android/tools/r8/optimize/PublicizerLens.java
index ab8999a..a2c44ce 100644
--- a/src/main/java/com/android/tools/r8/optimize/PublicizerLense.java
+++ b/src/main/java/com/android/tools/r8/optimize/PublicizerLens.java
@@ -7,26 +7,26 @@
import com.android.tools.r8.graph.DexClass;
import com.android.tools.r8.graph.DexEncodedMethod;
import com.android.tools.r8.graph.DexMethod;
-import com.android.tools.r8.graph.GraphLense;
-import com.android.tools.r8.graph.GraphLense.NestedGraphLense;
+import com.android.tools.r8.graph.GraphLens;
+import com.android.tools.r8.graph.GraphLens.NestedGraphLens;
import com.android.tools.r8.ir.code.Invoke.Type;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets;
import java.util.Set;
-final class PublicizerLense extends NestedGraphLense {
+final class PublicizerLens extends NestedGraphLens {
private final AppView appView;
private final Set<DexMethod> publicizedMethods;
- private PublicizerLense(AppView appView, Set<DexMethod> publicizedMethods) {
+ private PublicizerLens(AppView appView, Set<DexMethod> publicizedMethods) {
super(
ImmutableMap.of(),
ImmutableMap.of(),
ImmutableMap.of(),
null,
null,
- appView.graphLense(),
+ appView.graphLens(),
appView.dexItemFactory());
this.appView = appView;
this.publicizedMethods = publicizedMethods;
@@ -34,26 +34,25 @@
@Override
protected boolean isLegitimateToHaveEmptyMappings() {
- // This lense does not map any DexItem's at all.
+ // This lens does not map any DexItem's at all.
// It will just tweak invoke type for publicized methods from invoke-direct to invoke-virtual.
return true;
}
@Override
- public GraphLenseLookupResult lookupMethod(DexMethod method, DexMethod context, Type type) {
- GraphLenseLookupResult previous = previousLense.lookupMethod(method, context, type);
+ public GraphLensLookupResult lookupMethod(DexMethod method, DexMethod context, Type type) {
+ GraphLensLookupResult previous = previousLens.lookupMethod(method, context, type);
method = previous.getMethod();
type = previous.getType();
if (type == Type.DIRECT && publicizedMethods.contains(method)) {
assert publicizedMethodIsPresentOnHolder(method, context);
- return new GraphLenseLookupResult(method, Type.VIRTUAL);
+ return new GraphLensLookupResult(method, Type.VIRTUAL);
}
return super.lookupMethod(method, context, type);
}
private boolean publicizedMethodIsPresentOnHolder(DexMethod method, DexMethod context) {
- GraphLenseLookupResult lookup =
- appView.graphLense().lookupMethod(method, context, Type.VIRTUAL);
+ GraphLensLookupResult lookup = appView.graphLens().lookupMethod(method, context, Type.VIRTUAL);
DexMethod signatureInCurrentWorld = lookup.getMethod();
DexClass clazz = appView.definitionFor(signatureInCurrentWorld.holder);
assert clazz != null;
@@ -63,21 +62,20 @@
return true;
}
- static PublicizedLenseBuilder createBuilder() {
- return new PublicizedLenseBuilder();
+ static PublicizedLensBuilder createBuilder() {
+ return new PublicizedLensBuilder();
}
- static class PublicizedLenseBuilder {
+ static class PublicizedLensBuilder {
private final Set<DexMethod> publicizedMethods = Sets.newIdentityHashSet();
- private PublicizedLenseBuilder() {
- }
+ private PublicizedLensBuilder() {}
- public GraphLense build(AppView appView) {
+ public GraphLens build(AppView appView) {
if (publicizedMethods.isEmpty()) {
- return appView.graphLense();
+ return appView.graphLens();
}
- return new PublicizerLense(appView, publicizedMethods);
+ return new PublicizerLens(appView, publicizedMethods);
}
public void add(DexMethod publicizedMethod) {
diff --git a/src/main/java/com/android/tools/r8/relocator/Relocator.java b/src/main/java/com/android/tools/r8/relocator/Relocator.java
index 176e058..a33424b 100644
--- a/src/main/java/com/android/tools/r8/relocator/Relocator.java
+++ b/src/main/java/com/android/tools/r8/relocator/Relocator.java
@@ -15,7 +15,7 @@
import com.android.tools.r8.graph.AppServices;
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DexApplication;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.jar.CfApplicationWriter;
import com.android.tools.r8.naming.NamingLens;
import com.android.tools.r8.naming.signature.GenericSignatureRewriter;
@@ -94,7 +94,7 @@
appView,
options,
new Marker(Tool.Relocator),
- GraphLense.getIdentityLense(),
+ GraphLens.getIdentityLens(),
namingLens,
null)
.write(command.getConsumer());
diff --git a/src/main/java/com/android/tools/r8/shaking/AnnotationFixer.java b/src/main/java/com/android/tools/r8/shaking/AnnotationFixer.java
index 0fe561c..a67af38 100644
--- a/src/main/java/com/android/tools/r8/shaking/AnnotationFixer.java
+++ b/src/main/java/com/android/tools/r8/shaking/AnnotationFixer.java
@@ -14,15 +14,15 @@
import com.android.tools.r8.graph.DexValue;
import com.android.tools.r8.graph.DexValue.DexValueArray;
import com.android.tools.r8.graph.DexValue.DexValueType;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.utils.ArrayUtils;
public class AnnotationFixer {
- private final GraphLense lense;
+ private final GraphLens lens;
- public AnnotationFixer(GraphLense lense) {
- this.lense = lense;
+ public AnnotationFixer(GraphLens lens) {
+ this.lens = lens;
}
public void run(Iterable<DexProgramClass> classes) {
@@ -50,7 +50,7 @@
private DexEncodedAnnotation rewriteEncodedAnnotation(DexEncodedAnnotation original) {
DexEncodedAnnotation rewritten =
- original.rewrite(lense::lookupType, this::rewriteAnnotationElement);
+ original.rewrite(lens::lookupType, this::rewriteAnnotationElement);
assert rewritten != null;
return rewritten;
}
@@ -66,7 +66,7 @@
private DexValue rewriteValue(DexValue value) {
if (value.isDexValueType()) {
DexType originalType = value.asDexValueType().value;
- DexType rewrittenType = lense.lookupType(originalType);
+ DexType rewrittenType = lens.lookupType(originalType);
if (rewrittenType != originalType) {
return new DexValueType(rewrittenType);
}
diff --git a/src/main/java/com/android/tools/r8/shaking/AnnotationRemover.java b/src/main/java/com/android/tools/r8/shaking/AnnotationRemover.java
index 3c0d9dd..1a8d708 100644
--- a/src/main/java/com/android/tools/r8/shaking/AnnotationRemover.java
+++ b/src/main/java/com/android/tools/r8/shaking/AnnotationRemover.java
@@ -16,7 +16,7 @@
import com.android.tools.r8.graph.DexItemFactory;
import com.android.tools.r8.graph.DexProgramClass;
import com.android.tools.r8.graph.DexType;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.InnerClassAttribute;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Sets;
@@ -225,15 +225,15 @@
}
private DexEncodedAnnotation rewriteEncodedAnnotation(DexEncodedAnnotation original) {
- GraphLense graphLense = appView.graphLense();
+ GraphLens graphLens = appView.graphLens();
DexType annotationType = original.type.toBaseType(appView.dexItemFactory());
if (removedClasses.contains(annotationType)) {
return null;
}
- DexType rewrittenType = graphLense.lookupType(annotationType);
+ DexType rewrittenType = graphLens.lookupType(annotationType);
DexEncodedAnnotation rewrite =
original.rewrite(
- graphLense::lookupType, element -> rewriteAnnotationElement(rewrittenType, element));
+ graphLens::lookupType, element -> rewriteAnnotationElement(rewrittenType, element));
assert rewrite != null;
DexClass annotationClass = appView.appInfo().definitionFor(rewrittenType);
assert annotationClass == null
diff --git a/src/main/java/com/android/tools/r8/shaking/AppInfoWithLiveness.java b/src/main/java/com/android/tools/r8/shaking/AppInfoWithLiveness.java
index d3afad2..5f68d46 100644
--- a/src/main/java/com/android/tools/r8/shaking/AppInfoWithLiveness.java
+++ b/src/main/java/com/android/tools/r8/shaking/AppInfoWithLiveness.java
@@ -28,8 +28,8 @@
import com.android.tools.r8.graph.FieldAccessInfoCollectionImpl;
import com.android.tools.r8.graph.FieldAccessInfoImpl;
import com.android.tools.r8.graph.FieldResolutionResult;
-import com.android.tools.r8.graph.GraphLense;
-import com.android.tools.r8.graph.GraphLense.NestedGraphLense;
+import com.android.tools.r8.graph.GraphLens;
+import com.android.tools.r8.graph.GraphLens.NestedGraphLens;
import com.android.tools.r8.graph.InstantiatedSubTypeInfo;
import com.android.tools.r8.graph.LookupResult.LookupResultSuccess;
import com.android.tools.r8.graph.LookupTarget;
@@ -889,7 +889,7 @@
}
private static SortedMap<DexMethod, ProgramMethodSet> rewriteInvokesWithContexts(
- Map<DexMethod, ProgramMethodSet> invokes, GraphLense lens) {
+ Map<DexMethod, ProgramMethodSet> invokes, GraphLens lens) {
SortedMap<DexMethod, ProgramMethodSet> result = new TreeMap<>(PresortedComparable::slowCompare);
invokes.forEach(
(method, contexts) ->
@@ -966,17 +966,17 @@
}
public AppInfoWithLiveness rewrittenWithLens(
- DirectMappedDexApplication application, NestedGraphLense lens) {
+ DirectMappedDexApplication application, NestedGraphLens lens) {
assert checkIfObsolete();
// The application has already been rewritten with all of lens' parent lenses. Therefore, we
// temporarily replace lens' parent lens with an identity lens to avoid the overhead of
// traversing the entire lens chain upon each lookup during the rewriting.
return lens.withAlternativeParentLens(
- GraphLense.getIdentityLense(), () -> createRewrittenAppInfoWithLiveness(application, lens));
+ GraphLens.getIdentityLens(), () -> createRewrittenAppInfoWithLiveness(application, lens));
}
private AppInfoWithLiveness createRewrittenAppInfoWithLiveness(
- DirectMappedDexApplication application, NestedGraphLense lens) {
+ DirectMappedDexApplication application, NestedGraphLens lens) {
// Switchmap classes should never be affected by renaming.
assert lens.assertDefinitionsNotModified(
switchMaps.keySet().stream()
diff --git a/src/main/java/com/android/tools/r8/shaking/Enqueuer.java b/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
index c3f7a76..281561b 100644
--- a/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
+++ b/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
@@ -57,7 +57,7 @@
import com.android.tools.r8.graph.FieldAccessInfoCollectionImpl;
import com.android.tools.r8.graph.FieldAccessInfoImpl;
import com.android.tools.r8.graph.FieldResolutionResult;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.InnerClassAttribute;
import com.android.tools.r8.graph.LookupLambdaTarget;
import com.android.tools.r8.graph.LookupTarget;
@@ -2733,10 +2733,8 @@
return appInfoWithLiveness;
}
- public GraphLense buildGraphLense(AppView<?> appView) {
- return lambdaRewriter != null
- ? lambdaRewriter.buildMappingLense(appView)
- : appView.graphLense();
+ public GraphLens buildGraphLens(AppView<?> appView) {
+ return lambdaRewriter != null ? lambdaRewriter.buildMappingLens(appView) : appView.graphLens();
}
private void keepClassWithRules(DexProgramClass clazz, Set<ProguardKeepRuleBase> rules) {
diff --git a/src/main/java/com/android/tools/r8/shaking/IfRuleEvaluator.java b/src/main/java/com/android/tools/r8/shaking/IfRuleEvaluator.java
index 33aabd4..8841f15 100644
--- a/src/main/java/com/android/tools/r8/shaking/IfRuleEvaluator.java
+++ b/src/main/java/com/android/tools/r8/shaking/IfRuleEvaluator.java
@@ -233,7 +233,7 @@
(enqueuer.isFieldLive(f)
|| enqueuer.isFieldReferenced(f)
|| f.getOptimizationInfo().valueHasBeenPropagated())
- && appView.graphLense().getOriginalFieldSignature(f.field).holder
+ && appView.graphLens().getOriginalFieldSignature(f.field).holder
== sourceClass.type));
Iterables.addAll(
filteredMembers,
@@ -242,7 +242,7 @@
(enqueuer.isMethodLive(m)
|| enqueuer.isMethodTargeted(m)
|| m.getOptimizationInfo().returnValueHasBeenPropagated())
- && appView.graphLense().getOriginalMethodSignature(m.method).holder
+ && appView.graphLens().getOriginalMethodSignature(m.method).holder
== sourceClass.type));
// If the number of member rules to hold is more than live members, we can't make it.
diff --git a/src/main/java/com/android/tools/r8/shaking/KeepInfoCollection.java b/src/main/java/com/android/tools/r8/shaking/KeepInfoCollection.java
index 53af669..ee30fce 100644
--- a/src/main/java/com/android/tools/r8/shaking/KeepInfoCollection.java
+++ b/src/main/java/com/android/tools/r8/shaking/KeepInfoCollection.java
@@ -16,7 +16,7 @@
import com.android.tools.r8.graph.DexProgramClass;
import com.android.tools.r8.graph.DexReference;
import com.android.tools.r8.graph.DexType;
-import com.android.tools.r8.graph.GraphLense.NestedGraphLense;
+import com.android.tools.r8.graph.GraphLens.NestedGraphLens;
import com.android.tools.r8.graph.ProgramField;
import com.android.tools.r8.graph.ProgramMethod;
import com.android.tools.r8.shaking.KeepFieldInfo.Joiner;
@@ -160,7 +160,7 @@
@Deprecated
public abstract void forEachPinnedField(Consumer<DexField> consumer);
- public abstract KeepInfoCollection rewrite(NestedGraphLense lens);
+ public abstract KeepInfoCollection rewrite(NestedGraphLens lens);
public abstract KeepInfoCollection mutate(Consumer<MutableKeepInfoCollection> mutator);
@@ -196,7 +196,7 @@
}
@Override
- public KeepInfoCollection rewrite(NestedGraphLense lens) {
+ public KeepInfoCollection rewrite(NestedGraphLens lens) {
Map<DexType, KeepClassInfo> newClassInfo = new IdentityHashMap<>(keepClassInfo.size());
keepClassInfo.forEach(
(type, info) -> {
diff --git a/src/main/java/com/android/tools/r8/shaking/ProguardMemberRule.java b/src/main/java/com/android/tools/r8/shaking/ProguardMemberRule.java
index 3034f6d..5163a69 100644
--- a/src/main/java/com/android/tools/r8/shaking/ProguardMemberRule.java
+++ b/src/main/java/com/android/tools/r8/shaking/ProguardMemberRule.java
@@ -184,7 +184,7 @@
AppView<?> appView,
Consumer<AnnotationMatchResult> matchedAnnotationsConsumer,
DexStringCache stringCache) {
- DexField originalSignature = appView.graphLense().getOriginalFieldSignature(field.field);
+ DexField originalSignature = appView.graphLens().getOriginalFieldSignature(field.field);
switch (getRuleType()) {
case ALL:
case ALL_FIELDS:
@@ -235,7 +235,7 @@
AppView<?> appView,
Consumer<AnnotationMatchResult> matchedAnnotationsConsumer,
DexStringCache stringCache) {
- DexMethod originalSignature = appView.graphLense().getOriginalMethodSignature(method.method);
+ DexMethod originalSignature = appView.graphLens().getOriginalMethodSignature(method.method);
switch (getRuleType()) {
case ALL_METHODS:
if (method.isClassInitializer()) {
diff --git a/src/main/java/com/android/tools/r8/shaking/StaticClassMerger.java b/src/main/java/com/android/tools/r8/shaking/StaticClassMerger.java
index a96194f..ed87cff 100644
--- a/src/main/java/com/android/tools/r8/shaking/StaticClassMerger.java
+++ b/src/main/java/com/android/tools/r8/shaking/StaticClassMerger.java
@@ -12,7 +12,7 @@
import com.android.tools.r8.graph.DexMethod;
import com.android.tools.r8.graph.DexProgramClass;
import com.android.tools.r8.graph.DexString;
-import com.android.tools.r8.graph.GraphLense.NestedGraphLense;
+import com.android.tools.r8.graph.GraphLens.NestedGraphLens;
import com.android.tools.r8.logging.Log;
import com.android.tools.r8.shaking.VerticalClassMerger.IllegalAccessDetector;
import com.android.tools.r8.utils.FieldSignatureEquivalence;
@@ -226,7 +226,7 @@
this.mainDexClasses = mainDexClasses;
}
- public NestedGraphLense run() {
+ public NestedGraphLens run() {
for (DexProgramClass clazz : appView.appInfo().app().classesWithDeterministicOrder()) {
MergeGroup group = satisfiesMergeCriteria(clazz);
if (group != MergeGroup.DONT_MERGE) {
@@ -240,20 +240,20 @@
numberOfMergedClasses,
fieldMapping.size() + methodMapping.size());
}
- return buildGraphLense();
+ return buildGraphLens();
}
- private NestedGraphLense buildGraphLense() {
+ private NestedGraphLens buildGraphLens() {
if (!fieldMapping.isEmpty() || !methodMapping.isEmpty()) {
BiMap<DexField, DexField> originalFieldSignatures = fieldMapping.inverse();
BiMap<DexMethod, DexMethod> originalMethodSignatures = methodMapping.inverse();
- return new NestedGraphLense(
+ return new NestedGraphLens(
ImmutableMap.of(),
methodMapping,
fieldMapping,
originalFieldSignatures,
originalMethodSignatures,
- appView.graphLense(),
+ appView.graphLens(),
appView.dexItemFactory());
}
return null;
@@ -293,7 +293,7 @@
method ->
method.accessFlags.isNative()
|| appView.appInfo().isPinned(method.method)
- // TODO(christofferqa): Remove the invariant that the graph lense should not
+ // TODO(christofferqa): Remove the invariant that the graph lens should not
// modify any methods from the sets alwaysInline and noSideEffects.
|| appView.appInfo().alwaysInline.contains(method.method)
|| appView.appInfo().noSideEffects.keySet().contains(method.method))) {
@@ -343,7 +343,7 @@
return false;
}
if (appView.appInfo().constClassReferences.contains(clazz.type)) {
- // Since the type is const-class referenced (and the static merger does not create a lense
+ // Since the type is const-class referenced (and the static merger does not create a lens
// to map the merged type) the class will likely remain and there is no gain from merging.
return false;
}
diff --git a/src/main/java/com/android/tools/r8/shaking/VerticalClassMerger.java b/src/main/java/com/android/tools/r8/shaking/VerticalClassMerger.java
index 79d472d..c2b3627 100644
--- a/src/main/java/com/android/tools/r8/shaking/VerticalClassMerger.java
+++ b/src/main/java/com/android/tools/r8/shaking/VerticalClassMerger.java
@@ -27,8 +27,8 @@
import com.android.tools.r8.graph.DexString;
import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.graph.DexTypeList;
-import com.android.tools.r8.graph.GraphLense;
-import com.android.tools.r8.graph.GraphLense.GraphLenseLookupResult;
+import com.android.tools.r8.graph.GraphLens;
+import com.android.tools.r8.graph.GraphLens.GraphLensLookupResult;
import com.android.tools.r8.graph.LookupResult.LookupResultSuccess;
import com.android.tools.r8.graph.MethodAccessFlags;
import com.android.tools.r8.graph.ObjectAllocationInfoCollection;
@@ -89,7 +89,7 @@
* <p>A common use-case for this is to merge an interface into its single implementation.
*
* <p>The class merger only fixes the structure of the graph but leaves the actual instructions
- * untouched. Fixup of instructions is deferred via a {@link GraphLense} to the IR building phase.
+ * untouched. Fixup of instructions is deferred via a {@link GraphLens} to the IR building phase.
*/
public class VerticalClassMerger {
@@ -210,8 +210,8 @@
// Set of types that must not be merged into their subtype.
private final Set<DexType> pinnedTypes = Sets.newIdentityHashSet();
- // The resulting graph lense that should be used after class merging.
- private final VerticalClassMergerGraphLense.Builder renamedMembersLense;
+ // The resulting graph lens that should be used after class merging.
+ private final VerticalClassMergerGraphLens.Builder renamedMembersLens;
// All the bridge methods that have been synthesized during vertical class merging.
private final List<SynthesizedBridgeCode> synthesizedBridges = new ArrayList<>();
@@ -230,7 +230,7 @@
this.subtypingInfo = appInfo.computeSubtypingInfo();
this.executorService = executorService;
this.methodPoolCollection = new MethodPoolCollection(appView, subtypingInfo);
- this.renamedMembersLense = new VerticalClassMergerGraphLense.Builder(appView.dexItemFactory());
+ this.renamedMembersLens = new VerticalClassMergerGraphLens.Builder(appView.dexItemFactory());
this.timing = timing;
this.mainDexClasses = mainDexClasses;
@@ -629,7 +629,7 @@
}
}
- public VerticalClassMergerGraphLense run() {
+ public VerticalClassMergerGraphLens run() {
timing.begin("merge");
// Visit the program classes in a top-down order according to the class hierarchy.
TopDownClassHierarchyTraversal.forProgramClasses(appView)
@@ -639,13 +639,13 @@
}
timing.end();
timing.begin("fixup");
- VerticalClassMergerGraphLense lens = new TreeFixer().fixupTypeReferences();
+ VerticalClassMergerGraphLens lens = new TreeFixer().fixupTypeReferences();
timing.end();
assert lens == null || verifyGraphLens(lens);
return lens;
}
- private boolean verifyGraphLens(VerticalClassMergerGraphLense graphLense) {
+ private boolean verifyGraphLens(VerticalClassMergerGraphLens graphLens) {
// Note that the method assertReferencesNotModified() relies on getRenamedFieldSignature() and
// getRenamedMethodSignature() instead of lookupField() and lookupMethod(). This is important
// for this check to succeed, since it is not guaranteed that calling lookupMethod() with a
@@ -672,13 +672,13 @@
// that `invoke-super A.method` instructions, which are in one of the methods from C, needs to
// be rewritten to `invoke-direct C.method$B`. This is valid even though A.method() is actually
// pinned, because this rewriting does not affect A.method() in any way.
- assert graphLense.assertPinnedNotModified(appInfo.getKeepInfo());
+ assert graphLens.assertPinnedNotModified(appInfo.getKeepInfo());
for (DexProgramClass clazz : appInfo.classes()) {
for (DexEncodedMethod encodedMethod : clazz.methods()) {
DexMethod method = encodedMethod.method;
- DexMethod originalMethod = graphLense.getOriginalMethodSignature(method);
- DexMethod renamedMethod = graphLense.getRenamedMethodSignature(originalMethod);
+ DexMethod originalMethod = graphLens.getOriginalMethodSignature(method);
+ DexMethod renamedMethod = graphLens.getRenamedMethodSignature(originalMethod);
// Must be able to map back and forth.
if (encodedMethod.hasCode() && encodedMethod.getCode() instanceof SynthesizedBridgeCode) {
@@ -690,7 +690,7 @@
DexMethod implementationMethod =
((SynthesizedBridgeCode) encodedMethod.getCode()).invocationTarget;
DexMethod originalImplementationMethod =
- graphLense.getOriginalMethodSignature(implementationMethod);
+ graphLens.getOriginalMethodSignature(implementationMethod);
assert originalMethod == originalImplementationMethod;
assert implementationMethod == renamedMethod;
} else {
@@ -832,8 +832,8 @@
throw new RuntimeException(e);
}
if (merged) {
- // Commit the changes to the graph lense.
- renamedMembersLense.merge(merger.getRenamings());
+ // Commit the changes to the graph lens.
+ renamedMembersLens.merge(merger.getRenamings());
synthesizedBridges.addAll(merger.getSynthesizedBridges());
}
if (Log.ENABLED) {
@@ -888,8 +888,8 @@
private final DexProgramClass source;
private final DexProgramClass target;
- private final VerticalClassMergerGraphLense.Builder deferredRenamings =
- new VerticalClassMergerGraphLense.Builder(appView.dexItemFactory());
+ private final VerticalClassMergerGraphLens.Builder deferredRenamings =
+ new VerticalClassMergerGraphLens.Builder(appView.dexItemFactory());
private final List<SynthesizedBridgeCode> synthesizedBridges = new ArrayList<>();
private boolean abortMerge = false;
@@ -1120,7 +1120,7 @@
return true;
}
- public VerticalClassMergerGraphLense.Builder getRenamings() {
+ public VerticalClassMergerGraphLens.Builder getRenamings() {
return deferredRenamings;
}
@@ -1138,7 +1138,7 @@
// if I has a supertype J. This is due to the fact that invoke-super instructions that
// resolve to a method on an interface never hit an implementation below that interface.
deferredRenamings.mapVirtualMethodToDirectInType(
- oldTarget, new GraphLenseLookupResult(newTarget, STATIC), target.type);
+ oldTarget, new GraphLensLookupResult(newTarget, STATIC), target.type);
} else {
// If we merge class B into class C, and class C contains an invocation super.m(), then it
// is insufficient to rewrite "invoke-super B.m()" to "invoke-direct C.m$B()" (the method
@@ -1157,7 +1157,7 @@
|| appInfo.lookupSuperTarget(signatureInHolder, holder) != null;
if (resolutionSucceeds) {
deferredRenamings.mapVirtualMethodToDirectInType(
- signatureInHolder, new GraphLenseLookupResult(newTarget, DIRECT), target.type);
+ signatureInHolder, new GraphLensLookupResult(newTarget, DIRECT), target.type);
} else {
break;
}
@@ -1175,11 +1175,11 @@
// Resolution would have succeeded if the method used to be in [type], or if one of
// its super classes declared the method.
boolean resolutionSucceededBeforeMerge =
- renamedMembersLense.hasMappingForSignatureInContext(holder, signatureInType)
+ renamedMembersLens.hasMappingForSignatureInContext(holder, signatureInType)
|| appInfo.lookupSuperTarget(signatureInHolder, holder) != null;
if (resolutionSucceededBeforeMerge) {
deferredRenamings.mapVirtualMethodToDirectInType(
- signatureInType, new GraphLenseLookupResult(newTarget, DIRECT), target.type);
+ signatureInType, new GraphLensLookupResult(newTarget, DIRECT), target.type);
}
}
}
@@ -1226,7 +1226,7 @@
SynthesizedBridgeCode code =
new SynthesizedBridgeCode(
newMethod,
- appView.graphLense().getOriginalMethodSignature(method.method),
+ appView.graphLens().getOriginalMethodSignature(method.method),
invocationTarget.method,
invocationTarget.isPrivateMethod() ? DIRECT : STATIC,
target.isInterface());
@@ -1444,12 +1444,12 @@
private class TreeFixer {
- private final VerticalClassMergerGraphLense.Builder lensBuilder =
- VerticalClassMergerGraphLense.Builder.createBuilderForFixup(
- renamedMembersLense, mergedClasses);
+ private final VerticalClassMergerGraphLens.Builder lensBuilder =
+ VerticalClassMergerGraphLens.Builder.createBuilderForFixup(
+ renamedMembersLens, mergedClasses);
private final Map<DexProto, DexProto> protoFixupCache = new IdentityHashMap<>();
- private VerticalClassMergerGraphLense fixupTypeReferences() {
+ private VerticalClassMergerGraphLens fixupTypeReferences() {
// Globally substitute merged class types in protos and holders.
for (DexProgramClass clazz : appInfo.classes()) {
clazz.getMethodCollection().replaceMethods(this::fixupMethod);
@@ -1459,7 +1459,7 @@
for (SynthesizedBridgeCode synthesizedBridge : synthesizedBridges) {
synthesizedBridge.updateMethodSignatures(this::fixupMethod);
}
- VerticalClassMergerGraphLense lens = lensBuilder.build(appView, mergedClasses);
+ VerticalClassMergerGraphLens lens = lensBuilder.build(appView, mergedClasses);
if (lens != null) {
new AnnotationFixer(lens).run(appView.appInfo().classes());
}
@@ -1667,7 +1667,7 @@
cfCode.computeInliningConstraint(
method,
appView,
- new SingleTypeMapperGraphLense(method.getHolderType(), context),
+ new SingleTypeMapperGraphLens(method.getHolderType(), context),
context);
if (constraint == ConstraintWithTarget.NEVER) {
return AbortReason.UNSAFE_INLINING;
@@ -1686,12 +1686,12 @@
return AbortReason.UNSAFE_INLINING;
}
- private class SingleTypeMapperGraphLense extends GraphLense {
+ private class SingleTypeMapperGraphLens extends GraphLens {
private final DexType source;
private final DexProgramClass target;
- public SingleTypeMapperGraphLense(DexType source, DexProgramClass target) {
+ public SingleTypeMapperGraphLens(DexType source, DexProgramClass target) {
this.source = source;
this.target = target;
}
@@ -1717,7 +1717,7 @@
}
@Override
- public DexMethod getRenamedMethodSignature(DexMethod originalMethod, GraphLense applied) {
+ public DexMethod getRenamedMethodSignature(DexMethod originalMethod, GraphLens applied) {
throw new Unreachable();
}
@@ -1727,14 +1727,14 @@
}
@Override
- public GraphLenseLookupResult lookupMethod(DexMethod method, DexMethod context, Type type) {
- // First look up the method using the existing graph lense (for example, the type will have
+ public GraphLensLookupResult lookupMethod(DexMethod method, DexMethod context, Type type) {
+ // First look up the method using the existing graph lens (for example, the type will have
// changed if the method was publicized by ClassAndMemberPublicizer).
- GraphLenseLookupResult lookup = appView.graphLense().lookupMethod(method, context, type);
+ GraphLensLookupResult lookup = appView.graphLens().lookupMethod(method, context, type);
DexMethod previousMethod = lookup.getMethod();
Type previousType = lookup.getType();
// Then check if there is a renaming due to the vertical class merger.
- DexMethod newMethod = renamedMembersLense.methodMap.get(previousMethod);
+ DexMethod newMethod = renamedMembersLens.methodMap.get(previousMethod);
if (newMethod != null) {
if (previousType == Type.INTERFACE) {
// If an interface has been merged into a class, invoke-interface needs to be translated
@@ -1742,12 +1742,12 @@
DexClass clazz = appInfo.definitionFor(newMethod.holder);
if (clazz != null && !clazz.accessFlags.isInterface()) {
assert appInfo.definitionFor(method.holder).accessFlags.isInterface();
- return new GraphLenseLookupResult(newMethod, Type.VIRTUAL);
+ return new GraphLensLookupResult(newMethod, Type.VIRTUAL);
}
}
- return new GraphLenseLookupResult(newMethod, previousType);
+ return new GraphLensLookupResult(newMethod, previousType);
}
- return new GraphLenseLookupResult(previousMethod, previousType);
+ return new GraphLensLookupResult(previousMethod, previousType);
}
@Override
@@ -1757,7 +1757,7 @@
@Override
public DexField lookupField(DexField field) {
- return renamedMembersLense.fieldMap.getOrDefault(field, field);
+ return renamedMembersLens.fieldMap.getOrDefault(field, field);
}
@Override
@@ -1793,7 +1793,7 @@
private boolean checkFieldReference(DexField field) {
if (!foundIllegalAccess) {
DexType baseType =
- appView.graphLense().lookupType(field.holder.toBaseType(appView.dexItemFactory()));
+ appView.graphLens().lookupType(field.holder.toBaseType(appView.dexItemFactory()));
if (baseType.isClassType() && baseType.isSamePackage(source.type)) {
checkTypeReference(field.holder);
checkTypeReference(field.type);
@@ -1810,7 +1810,7 @@
private boolean checkMethodReference(DexMethod method, OptionalBool isInterface) {
if (!foundIllegalAccess) {
DexType baseType =
- appView.graphLense().lookupType(method.holder.toBaseType(appView.dexItemFactory()));
+ appView.graphLens().lookupType(method.holder.toBaseType(appView.dexItemFactory()));
if (baseType.isClassType() && baseType.isSamePackage(source.type)) {
checkTypeReference(method.holder);
checkTypeReference(method.proto.returnType);
@@ -1833,7 +1833,7 @@
private boolean checkTypeReference(DexType type) {
if (!foundIllegalAccess) {
DexType baseType =
- appView.graphLense().lookupType(type.toBaseType(appView.dexItemFactory()));
+ appView.graphLens().lookupType(type.toBaseType(appView.dexItemFactory()));
if (baseType.isClassType() && baseType.isSamePackage(source.type)) {
DexClass clazz = appView.definitionFor(baseType);
if (clazz == null || !clazz.accessFlags.isPublic()) {
@@ -1852,51 +1852,51 @@
@Override
public boolean registerInvokeVirtual(DexMethod method) {
assert context != null;
- GraphLenseLookupResult lookup =
- appView.graphLense().lookupMethod(method, context.getReference(), Type.VIRTUAL);
+ GraphLensLookupResult lookup =
+ appView.graphLens().lookupMethod(method, context.getReference(), Type.VIRTUAL);
return checkMethodReference(lookup.getMethod(), OptionalBool.FALSE);
}
@Override
public boolean registerInvokeDirect(DexMethod method) {
assert context != null;
- GraphLenseLookupResult lookup =
- appView.graphLense().lookupMethod(method, context.getReference(), Type.DIRECT);
+ GraphLensLookupResult lookup =
+ appView.graphLens().lookupMethod(method, context.getReference(), Type.DIRECT);
return checkMethodReference(lookup.getMethod(), OptionalBool.UNKNOWN);
}
@Override
public boolean registerInvokeStatic(DexMethod method) {
assert context != null;
- GraphLenseLookupResult lookup =
- appView.graphLense().lookupMethod(method, context.getReference(), Type.STATIC);
+ GraphLensLookupResult lookup =
+ appView.graphLens().lookupMethod(method, context.getReference(), Type.STATIC);
return checkMethodReference(lookup.getMethod(), OptionalBool.UNKNOWN);
}
@Override
public boolean registerInvokeInterface(DexMethod method) {
assert context != null;
- GraphLenseLookupResult lookup =
- appView.graphLense().lookupMethod(method, context.getReference(), Type.INTERFACE);
+ GraphLensLookupResult lookup =
+ appView.graphLens().lookupMethod(method, context.getReference(), Type.INTERFACE);
return checkMethodReference(lookup.getMethod(), OptionalBool.TRUE);
}
@Override
public boolean registerInvokeSuper(DexMethod method) {
assert context != null;
- GraphLenseLookupResult lookup =
- appView.graphLense().lookupMethod(method, context.getReference(), Type.SUPER);
+ GraphLensLookupResult lookup =
+ appView.graphLens().lookupMethod(method, context.getReference(), Type.SUPER);
return checkMethodReference(lookup.getMethod(), OptionalBool.UNKNOWN);
}
@Override
public boolean registerInstanceFieldWrite(DexField field) {
- return checkFieldReference(appView.graphLense().lookupField(field));
+ return checkFieldReference(appView.graphLens().lookupField(field));
}
@Override
public boolean registerInstanceFieldRead(DexField field) {
- return checkFieldReference(appView.graphLense().lookupField(field));
+ return checkFieldReference(appView.graphLens().lookupField(field));
}
@Override
@@ -1906,12 +1906,12 @@
@Override
public boolean registerStaticFieldRead(DexField field) {
- return checkFieldReference(appView.graphLense().lookupField(field));
+ return checkFieldReference(appView.graphLens().lookupField(field));
}
@Override
public boolean registerStaticFieldWrite(DexField field) {
- return checkFieldReference(appView.graphLense().lookupField(field));
+ return checkFieldReference(appView.graphLens().lookupField(field));
}
@Override
diff --git a/src/main/java/com/android/tools/r8/shaking/VerticalClassMergerGraphLense.java b/src/main/java/com/android/tools/r8/shaking/VerticalClassMergerGraphLens.java
similarity index 84%
rename from src/main/java/com/android/tools/r8/shaking/VerticalClassMergerGraphLense.java
rename to src/main/java/com/android/tools/r8/shaking/VerticalClassMergerGraphLens.java
index 2a0a843..db59152 100644
--- a/src/main/java/com/android/tools/r8/shaking/VerticalClassMergerGraphLense.java
+++ b/src/main/java/com/android/tools/r8/shaking/VerticalClassMergerGraphLens.java
@@ -11,8 +11,8 @@
import com.android.tools.r8.graph.DexProgramClass;
import com.android.tools.r8.graph.DexProto;
import com.android.tools.r8.graph.DexType;
-import com.android.tools.r8.graph.GraphLense;
-import com.android.tools.r8.graph.GraphLense.NestedGraphLense;
+import com.android.tools.r8.graph.GraphLens;
+import com.android.tools.r8.graph.GraphLens.NestedGraphLens;
import com.android.tools.r8.ir.code.Invoke.Type;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
@@ -21,7 +21,7 @@
import java.util.Map;
import java.util.Set;
-// This graph lense is instantiated during vertical class merging. The graph lense is context
+// This graph lens is instantiated during vertical class merging. The graph lens is context
// sensitive in the enclosing class of a given invoke *and* the type of the invoke (e.g., invoke-
// super vs invoke-virtual). This is illustrated by the following example.
//
@@ -40,38 +40,38 @@
// During this process, the method corresponding to A.m will be made private such that it can be
// called via an invoke-direct instruction.
//
-// For the invocation "invoke-super A.m()" in B.m, this graph lense will return the newly created,
+// For the invocation "invoke-super A.m()" in B.m, this graph lens will return the newly created,
// private method corresponding to A.m (that is now in B.m with a fresh name), such that the
// invocation will hit the same implementation as the original super.m() call.
//
-// For the invocation "invoke-virtual A.m()" in B.m2, this graph lense will return the method B.m.
-public class VerticalClassMergerGraphLense extends NestedGraphLense {
+// For the invocation "invoke-virtual A.m()" in B.m2, this graph lens will return the method B.m.
+public class VerticalClassMergerGraphLens extends NestedGraphLens {
private final AppView<?> appView;
- private final Map<DexType, Map<DexMethod, GraphLenseLookupResult>>
+ private final Map<DexType, Map<DexMethod, GraphLensLookupResult>>
contextualVirtualToDirectMethodMaps;
private Set<DexMethod> mergedMethods;
private final Map<DexMethod, DexMethod> originalMethodSignaturesForBridges;
- private VerticalClassMergerGraphLense(
+ private VerticalClassMergerGraphLens(
AppView<?> appView,
Map<DexType, DexType> typeMap,
Map<DexField, DexField> fieldMap,
Map<DexMethod, DexMethod> methodMap,
Set<DexMethod> mergedMethods,
- Map<DexType, Map<DexMethod, GraphLenseLookupResult>> contextualVirtualToDirectMethodMaps,
+ Map<DexType, Map<DexMethod, GraphLensLookupResult>> contextualVirtualToDirectMethodMaps,
BiMap<DexField, DexField> originalFieldSignatures,
BiMap<DexMethod, DexMethod> originalMethodSignatures,
Map<DexMethod, DexMethod> originalMethodSignaturesForBridges,
- GraphLense previousLense) {
+ GraphLens previousLens) {
super(
typeMap,
methodMap,
fieldMap,
originalFieldSignatures,
originalMethodSignatures,
- previousLense,
+ previousLens,
appView.dexItemFactory());
this.appView = appView;
this.contextualVirtualToDirectMethodMaps = contextualVirtualToDirectMethodMaps;
@@ -81,7 +81,7 @@
@Override
public DexType getOriginalType(DexType type) {
- return previousLense.getOriginalType(type);
+ return previousLens.getOriginalType(type);
}
@Override
@@ -91,19 +91,19 @@
}
@Override
- public GraphLenseLookupResult lookupMethod(DexMethod method, DexMethod context, Type type) {
+ public GraphLensLookupResult lookupMethod(DexMethod method, DexMethod context, Type type) {
assert context != null || verifyIsContextFreeForMethod(method);
assert context == null || type != null;
DexMethod previousContext =
originalMethodSignaturesForBridges.containsKey(context)
? originalMethodSignaturesForBridges.get(context)
: originalMethodSignatures.getOrDefault(context, context);
- GraphLenseLookupResult previous = previousLense.lookupMethod(method, previousContext, type);
+ GraphLensLookupResult previous = previousLens.lookupMethod(method, previousContext, type);
if (previous.getType() == Type.SUPER && !mergedMethods.contains(context)) {
- Map<DexMethod, GraphLenseLookupResult> virtualToDirectMethodMap =
+ Map<DexMethod, GraphLensLookupResult> virtualToDirectMethodMap =
contextualVirtualToDirectMethodMaps.get(context.holder);
if (virtualToDirectMethodMap != null) {
- GraphLenseLookupResult lookup = virtualToDirectMethodMap.get(previous.getMethod());
+ GraphLensLookupResult lookup = virtualToDirectMethodMap.get(previous.getMethod());
if (lookup != null) {
// If the super class A of the enclosing class B (i.e., context.holder())
// has been merged into B during vertical class merging, and this invoke-super instruction
@@ -125,13 +125,13 @@
@Override
public boolean isContextFreeForMethods() {
- return contextualVirtualToDirectMethodMaps.isEmpty() && previousLense.isContextFreeForMethods();
+ return contextualVirtualToDirectMethodMaps.isEmpty() && previousLens.isContextFreeForMethods();
}
@Override
public boolean verifyIsContextFreeForMethod(DexMethod method) {
- assert previousLense.verifyIsContextFreeForMethod(method);
- DexMethod previous = previousLense.lookupMethod(method);
+ assert previousLens.verifyIsContextFreeForMethod(method);
+ DexMethod previous = previousLens.lookupMethod(method);
assert contextualVirtualToDirectMethodMaps.values().stream()
.noneMatch(virtualToDirectMethodMap -> virtualToDirectMethodMap.containsKey(previous));
return true;
@@ -144,7 +144,7 @@
protected final BiMap<DexField, DexField> fieldMap = HashBiMap.create();
protected final Map<DexMethod, DexMethod> methodMap = new IdentityHashMap<>();
private final ImmutableSet.Builder<DexMethod> mergedMethodsBuilder = ImmutableSet.builder();
- private final Map<DexType, Map<DexMethod, GraphLenseLookupResult>>
+ private final Map<DexType, Map<DexMethod, GraphLensLookupResult>>
contextualVirtualToDirectMethodMaps = new IdentityHashMap<>();
private final BiMap<DexMethod, DexMethod> originalMethodSignatures = HashBiMap.create();
@@ -173,18 +173,17 @@
newBuilder.markMethodAsMerged(
builder.getMethodSignatureAfterClassMerging(method, mergedClasses));
}
- for (Map.Entry<DexType, Map<DexMethod, GraphLenseLookupResult>> entry :
+ for (Map.Entry<DexType, Map<DexMethod, GraphLensLookupResult>> entry :
builder.contextualVirtualToDirectMethodMaps.entrySet()) {
DexType context = entry.getKey();
assert context == builder.getTypeAfterClassMerging(context, mergedClasses);
- for (Map.Entry<DexMethod, GraphLenseLookupResult> innerEntry :
- entry.getValue().entrySet()) {
+ for (Map.Entry<DexMethod, GraphLensLookupResult> innerEntry : entry.getValue().entrySet()) {
DexMethod from = innerEntry.getKey();
- GraphLenseLookupResult rewriting = innerEntry.getValue();
+ GraphLensLookupResult rewriting = innerEntry.getValue();
DexMethod to =
builder.getMethodSignatureAfterClassMerging(rewriting.getMethod(), mergedClasses);
newBuilder.mapVirtualMethodToDirectInType(
- from, new GraphLenseLookupResult(to, rewriting.getType()), context);
+ from, new GraphLensLookupResult(to, rewriting.getType()), context);
}
}
for (Map.Entry<DexMethod, DexMethod> entry : builder.originalMethodSignatures.entrySet()) {
@@ -201,14 +200,14 @@
return newBuilder;
}
- public VerticalClassMergerGraphLense build(
+ public VerticalClassMergerGraphLens build(
AppView<?> appView, Map<DexType, DexType> mergedClasses) {
if (mergedClasses.isEmpty()) {
return null;
}
BiMap<DexField, DexField> originalFieldSignatures = fieldMap.inverse();
- // Build new graph lense.
- return new VerticalClassMergerGraphLense(
+ // Build new graph lens.
+ return new VerticalClassMergerGraphLens(
appView,
mergedClasses,
fieldMap,
@@ -218,7 +217,7 @@
originalFieldSignatures,
originalMethodSignatures,
originalMethodSignaturesForBridges,
- appView.graphLense());
+ appView.graphLens());
}
private DexField getFieldSignatureAfterClassMerging(
@@ -268,7 +267,7 @@
}
public boolean hasMappingForSignatureInContext(DexProgramClass context, DexMethod signature) {
- Map<DexMethod, GraphLenseLookupResult> virtualToDirectMethodMap =
+ Map<DexMethod, GraphLensLookupResult> virtualToDirectMethodMap =
contextualVirtualToDirectMethodMaps.get(context.type);
if (virtualToDirectMethodMap != null) {
return virtualToDirectMethodMap.containsKey(signature);
@@ -307,22 +306,22 @@
}
public void mapVirtualMethodToDirectInType(
- DexMethod from, GraphLenseLookupResult to, DexType type) {
- Map<DexMethod, GraphLenseLookupResult> virtualToDirectMethodMap =
+ DexMethod from, GraphLensLookupResult to, DexType type) {
+ Map<DexMethod, GraphLensLookupResult> virtualToDirectMethodMap =
contextualVirtualToDirectMethodMaps.computeIfAbsent(type, key -> new IdentityHashMap<>());
virtualToDirectMethodMap.put(from, to);
}
- public void merge(VerticalClassMergerGraphLense.Builder builder) {
+ public void merge(VerticalClassMergerGraphLens.Builder builder) {
fieldMap.putAll(builder.fieldMap);
methodMap.putAll(builder.methodMap);
mergedMethodsBuilder.addAll(builder.mergedMethodsBuilder.build());
originalMethodSignatures.putAll(builder.originalMethodSignatures);
originalMethodSignaturesForBridges.putAll(builder.originalMethodSignaturesForBridges);
for (DexType context : builder.contextualVirtualToDirectMethodMaps.keySet()) {
- Map<DexMethod, GraphLenseLookupResult> current =
+ Map<DexMethod, GraphLensLookupResult> current =
contextualVirtualToDirectMethodMaps.get(context);
- Map<DexMethod, GraphLenseLookupResult> other =
+ Map<DexMethod, GraphLensLookupResult> other =
builder.contextualVirtualToDirectMethodMaps.get(context);
if (current != null) {
current.putAll(other);
diff --git a/src/main/java/com/android/tools/r8/utils/InternalOptions.java b/src/main/java/com/android/tools/r8/utils/InternalOptions.java
index 6cc73f4..6d85a4e 100644
--- a/src/main/java/com/android/tools/r8/utils/InternalOptions.java
+++ b/src/main/java/com/android/tools/r8/utils/InternalOptions.java
@@ -819,7 +819,7 @@
List<String> classPathClasses = new ArrayList<>();
List<String> libraryClasses = new ArrayList<>();
for (DexType type : nest) {
- DexClass clazz = appView.definitionFor(appView.graphLense().lookupType(type));
+ DexClass clazz = appView.definitionFor(appView.graphLens().lookupType(type));
if (clazz == null) {
unavailableClasses.add(type.getName());
} else if (clazz.isLibraryClass()) {
diff --git a/src/main/java/com/android/tools/r8/utils/LensUtils.java b/src/main/java/com/android/tools/r8/utils/LensUtils.java
index 325d6fa..a039fb6 100644
--- a/src/main/java/com/android/tools/r8/utils/LensUtils.java
+++ b/src/main/java/com/android/tools/r8/utils/LensUtils.java
@@ -6,14 +6,14 @@
import com.android.tools.r8.graph.DexDefinitionSupplier;
import com.android.tools.r8.graph.DexEncodedMethod;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.google.common.collect.Sets;
import java.util.Set;
public class LensUtils {
public static Set<DexEncodedMethod> rewrittenWithRenamedSignature(
- Set<DexEncodedMethod> methods, DexDefinitionSupplier definitions, GraphLense lens) {
+ Set<DexEncodedMethod> methods, DexDefinitionSupplier definitions, GraphLens lens) {
Set<DexEncodedMethod> result = Sets.newIdentityHashSet();
for (DexEncodedMethod method : methods) {
result.add(lens.mapDexEncodedMethod(method, definitions));
diff --git a/src/main/java/com/android/tools/r8/utils/LineNumberOptimizer.java b/src/main/java/com/android/tools/r8/utils/LineNumberOptimizer.java
index 6907805..9c703e7 100644
--- a/src/main/java/com/android/tools/r8/utils/LineNumberOptimizer.java
+++ b/src/main/java/com/android/tools/r8/utils/LineNumberOptimizer.java
@@ -35,7 +35,7 @@
import com.android.tools.r8.graph.DexString;
import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.graph.DexValue.DexValueString;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.ir.code.Position;
import com.android.tools.r8.kotlin.KotlinSourceDebugExtensionParser;
import com.android.tools.r8.kotlin.KotlinSourceDebugExtensionParser.Result;
@@ -274,12 +274,12 @@
// Collect which files contain which classes that need to have their line numbers optimized.
for (DexProgramClass clazz : application.classes()) {
IdentityHashMap<DexString, List<DexEncodedMethod>> methodsByRenamedName =
- groupMethodsByRenamedName(appView.graphLense(), namingLens, clazz);
+ groupMethodsByRenamedName(appView.graphLens(), namingLens, clazz);
// At this point we don't know if we really need to add this class to the builder.
// It depends on whether any methods/fields are renamed or some methods contain positions.
// Create a supplier which creates a new, cached ClassNaming.Builder on-demand.
- DexType originalType = appView.graphLense().getOriginalType(clazz.type);
+ DexType originalType = appView.graphLens().getOriginalType(clazz.type);
DexString renamedClassName = namingLens.lookupDescriptor(clazz.getType());
Supplier<ClassNaming.Builder> onDemandClassNamingBuilder =
Suppliers.memoize(
@@ -302,7 +302,7 @@
addClassToClassNaming(originalType, renamedClassName, onDemandClassNamingBuilder);
// First transfer renamed fields to classNamingBuilder.
- addFieldsToClassNaming(appView.graphLense(), namingLens, clazz, onDemandClassNamingBuilder);
+ addFieldsToClassNaming(appView.graphLens(), namingLens, clazz, onDemandClassNamingBuilder);
// Then process the methods, ordered by renamed name.
List<DexString> renamedMethodNames = new ArrayList<>(methodsByRenamedName.keySet());
@@ -355,7 +355,7 @@
}
}
- DexMethod originalMethod = appView.graphLense().getOriginalMethodSignature(method.method);
+ DexMethod originalMethod = appView.graphLens().getOriginalMethodSignature(method.method);
MethodSignature originalSignature =
MethodSignature.fromDexMethod(originalMethod, originalMethod.holder != clazz.type);
@@ -536,14 +536,14 @@
}
private static void addFieldsToClassNaming(
- GraphLense graphLense,
+ GraphLens graphLens,
NamingLens namingLens,
DexProgramClass clazz,
Supplier<Builder> onDemandClassNamingBuilder) {
clazz.forEachField(
dexEncodedField -> {
DexField dexField = dexEncodedField.field;
- DexField originalField = graphLense.getOriginalFieldSignature(dexField);
+ DexField originalField = graphLens.getOriginalFieldSignature(dexField);
DexString renamedName = namingLens.lookupName(dexField);
if (renamedName != originalField.name || originalField.holder != clazz.type) {
FieldSignature originalSignature =
@@ -555,7 +555,7 @@
}
private static IdentityHashMap<DexString, List<DexEncodedMethod>> groupMethodsByRenamedName(
- GraphLense graphLens, NamingLens namingLens, DexProgramClass clazz) {
+ GraphLens graphLens, NamingLens namingLens, DexProgramClass clazz) {
IdentityHashMap<DexString, List<DexEncodedMethod>> methodsByRenamedName =
new IdentityHashMap<>(clazz.getMethodCollection().size());
for (DexEncodedMethod encodedMethod : clazz.methods()) {
diff --git a/src/main/java/com/android/tools/r8/utils/collections/LongLivedProgramMethodMultisetBuilder.java b/src/main/java/com/android/tools/r8/utils/collections/LongLivedProgramMethodMultisetBuilder.java
index f3ba06b..765f373 100644
--- a/src/main/java/com/android/tools/r8/utils/collections/LongLivedProgramMethodMultisetBuilder.java
+++ b/src/main/java/com/android/tools/r8/utils/collections/LongLivedProgramMethodMultisetBuilder.java
@@ -34,7 +34,7 @@
ProgramMethodMultiset result = ProgramMethodMultiset.createHash();
backing.forEachEntry(
(oldMethod, occurrences) -> {
- DexMethod method = appView.graphLense().getRenamedMethodSignature(oldMethod);
+ DexMethod method = appView.graphLens().getRenamedMethodSignature(oldMethod);
DexProgramClass holder = appView.definitionForHolder(method).asProgramClass();
result.createAndAdd(holder, holder.lookupMethod(method), occurrences);
});
diff --git a/src/main/java/com/android/tools/r8/utils/collections/LongLivedProgramMethodSetBuilder.java b/src/main/java/com/android/tools/r8/utils/collections/LongLivedProgramMethodSetBuilder.java
index 1c6d63a..4b4eccb 100644
--- a/src/main/java/com/android/tools/r8/utils/collections/LongLivedProgramMethodSetBuilder.java
+++ b/src/main/java/com/android/tools/r8/utils/collections/LongLivedProgramMethodSetBuilder.java
@@ -7,7 +7,7 @@
import com.android.tools.r8.graph.AppView;
import com.android.tools.r8.graph.DexMethod;
import com.android.tools.r8.graph.DexProgramClass;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.ProgramMethod;
import com.android.tools.r8.shaking.AppInfoWithLiveness;
import com.google.common.collect.Sets;
@@ -39,10 +39,10 @@
methods.forEach(this::add);
}
- public void rewrittenWithLens(AppView<AppInfoWithLiveness> appView, GraphLense applied) {
+ public void rewrittenWithLens(AppView<AppInfoWithLiveness> appView, GraphLens applied) {
Set<DexMethod> newMethods = Sets.newIdentityHashSet();
for (DexMethod method : methods) {
- newMethods.add(appView.graphLense().getRenamedMethodSignature(method, applied));
+ newMethods.add(appView.graphLens().getRenamedMethodSignature(method, applied));
}
methods.clear();
methods.addAll(newMethods);
@@ -52,10 +52,10 @@
return build(appView, null);
}
- public T build(AppView<AppInfoWithLiveness> appView, GraphLense applied) {
+ public T build(AppView<AppInfoWithLiveness> appView, GraphLens applied) {
T result = factory.apply(methods.size());
for (DexMethod oldMethod : methods) {
- DexMethod method = appView.graphLense().getRenamedMethodSignature(oldMethod, applied);
+ DexMethod method = appView.graphLens().getRenamedMethodSignature(oldMethod, applied);
DexProgramClass holder = appView.definitionForHolder(method).asProgramClass();
result.createAndAdd(holder, holder.lookupMethod(method));
}
diff --git a/src/test/examples/classmerging/RewritePinnedMethodTest.java b/src/test/examples/classmerging/RewritePinnedMethodTest.java
index 3d25805..81f6c5f 100644
--- a/src/test/examples/classmerging/RewritePinnedMethodTest.java
+++ b/src/test/examples/classmerging/RewritePinnedMethodTest.java
@@ -32,7 +32,7 @@
public void m() {
System.out.println("In C.m");
// This invocation is changed from invoke-super to invoke-direct. It would be valid for this
- // instruction to be on the form "invoke-super A.m". Therefore, the graph lense contains a
+ // instruction to be on the form "invoke-super A.m". Therefore, the graph lens contains a
// mapping for "A.m" from (context: "C.m", type: SUPER) to C.m$B, where the method C.m$B is
// the direct method that gets created for B.m during vertical class merging.
super.m();
diff --git a/src/test/java/com/android/tools/r8/ToolHelper.java b/src/test/java/com/android/tools/r8/ToolHelper.java
index 31150c4..9b83a88fa2 100644
--- a/src/test/java/com/android/tools/r8/ToolHelper.java
+++ b/src/test/java/com/android/tools/r8/ToolHelper.java
@@ -20,7 +20,7 @@
import com.android.tools.r8.graph.DexApplication;
import com.android.tools.r8.graph.DexItemFactory;
import com.android.tools.r8.graph.DirectMappedDexApplication;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.InitClassLens;
import com.android.tools.r8.naming.NamingLens;
import com.android.tools.r8.origin.Origin;
@@ -2092,7 +2092,7 @@
Executors.newSingleThreadExecutor(),
application,
null,
- GraphLense.getIdentityLense(),
+ GraphLens.getIdentityLens(),
InitClassLens.getDefault(),
NamingLens.getIdentityLens(),
options,
diff --git a/src/test/java/com/android/tools/r8/accessrelaxation/InvokeTypeConversionTest.java b/src/test/java/com/android/tools/r8/accessrelaxation/InvokeTypeConversionTest.java
index 5c04f51..8c2adf3 100644
--- a/src/test/java/com/android/tools/r8/accessrelaxation/InvokeTypeConversionTest.java
+++ b/src/test/java/com/android/tools/r8/accessrelaxation/InvokeTypeConversionTest.java
@@ -64,12 +64,13 @@
String expectedException,
Consumer<CodeInspector> inspectorConsumer) throws Exception {
AndroidApp app = buildApplication(builder);
- List<String> pgConfigs = ImmutableList.of(
- keepMainProguardConfiguration(CLASS_NAME),
- // We're testing lense-based invocation type conversions.
- "-dontoptimize",
- "-dontobfuscate",
- "-allowaccessmodification");
+ List<String> pgConfigs =
+ ImmutableList.of(
+ keepMainProguardConfiguration(CLASS_NAME),
+ // We're testing lens-based invocation type conversions.
+ "-dontoptimize",
+ "-dontobfuscate",
+ "-allowaccessmodification");
R8Command.Builder command = ToolHelper.prepareR8CommandBuilder(app);
command.addProguardConfiguration(pgConfigs, Origin.unknown());
AndroidApp processedApp = ToolHelper.runR8(command.build(), o -> {
@@ -88,7 +89,7 @@
}
// The following test checks invoke-direct, which refers to the private static method, is *not*
- // rewritten by publicizer lense, resulting in IncompatibleClassChangeError, which is expected.
+ // rewritten by publicizer lens, resulting in IncompatibleClassChangeError, which is expected.
//
// class Example {
// private int foo() { return 0; }
@@ -118,7 +119,7 @@
}
// The following test checks invoke-direct, which refers to the private instance method, *is*
- // rewritten by publicizer lense, as the target method will be publicized.
+ // rewritten by publicizer lens, as the target method will be publicized.
//
// class Example {
// private int foo() { return 0; }
diff --git a/src/test/java/com/android/tools/r8/dex/SharedClassWritingTest.java b/src/test/java/com/android/tools/r8/dex/SharedClassWritingTest.java
index 817abcd..49e7256 100644
--- a/src/test/java/com/android/tools/r8/dex/SharedClassWritingTest.java
+++ b/src/test/java/com/android/tools/r8/dex/SharedClassWritingTest.java
@@ -23,7 +23,7 @@
import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.graph.DexTypeList;
import com.android.tools.r8.graph.DirectMappedDexApplication;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.InitClassLens;
import com.android.tools.r8.graph.MethodAccessFlags;
import com.android.tools.r8.graph.ParameterAnnotationsList;
@@ -155,7 +155,7 @@
null,
options,
null,
- GraphLense.getIdentityLense(),
+ GraphLens.getIdentityLens(),
InitClassLens.getDefault(),
NamingLens.getIdentityLens(),
null);
diff --git a/src/test/java/com/android/tools/r8/ir/optimize/staticizer/movetohost/MoveToHostFieldOnlyTestClass.java b/src/test/java/com/android/tools/r8/ir/optimize/staticizer/movetohost/MoveToHostFieldOnlyTestClass.java
index eb8e6a4..0ec6935 100644
--- a/src/test/java/com/android/tools/r8/ir/optimize/staticizer/movetohost/MoveToHostFieldOnlyTestClass.java
+++ b/src/test/java/com/android/tools/r8/ir/optimize/staticizer/movetohost/MoveToHostFieldOnlyTestClass.java
@@ -23,7 +23,7 @@
// Any other uses other than invoke-virtual or invoke-direct (to either <init> or private) are
// not allowed, e.g., System.out.println(INSTANCE), null check, or static-put to somewhere else.
// Therefore, it's merely dead code, and thus it has not been harmful to forget to create a
- // staticizer lense when there is no method mapping (for instance methods to staticized ones)
+ // staticizer lens when there is no method mapping (for instance methods to staticized ones)
// while there are field mappings as shown in this example.
Object x = HostOkFieldOnly.INSTANCE;
}
diff --git a/src/test/java/com/android/tools/r8/maindexlist/MainDexListTests.java b/src/test/java/com/android/tools/r8/maindexlist/MainDexListTests.java
index b3cbe0e..984d813 100644
--- a/src/test/java/com/android/tools/r8/maindexlist/MainDexListTests.java
+++ b/src/test/java/com/android/tools/r8/maindexlist/MainDexListTests.java
@@ -46,7 +46,7 @@
import com.android.tools.r8.graph.DexType;
import com.android.tools.r8.graph.DexTypeList;
import com.android.tools.r8.graph.DirectMappedDexApplication;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.InitClassLens;
import com.android.tools.r8.graph.MethodAccessFlags;
import com.android.tools.r8.graph.ParameterAnnotationsList;
@@ -871,7 +871,7 @@
null,
options,
null,
- GraphLense.getIdentityLense(),
+ GraphLens.getIdentityLens(),
InitClassLens.getDefault(),
NamingLens.getIdentityLens(),
null);
diff --git a/src/test/java/com/android/tools/r8/utils/Smali.java b/src/test/java/com/android/tools/r8/utils/Smali.java
index cb9ace0..2bb72cd 100644
--- a/src/test/java/com/android/tools/r8/utils/Smali.java
+++ b/src/test/java/com/android/tools/r8/utils/Smali.java
@@ -9,7 +9,7 @@
import com.android.tools.r8.dex.ApplicationReader;
import com.android.tools.r8.dex.ApplicationWriter;
import com.android.tools.r8.graph.DexApplication;
-import com.android.tools.r8.graph.GraphLense;
+import com.android.tools.r8.graph.GraphLens;
import com.android.tools.r8.graph.InitClassLens;
import com.android.tools.r8.naming.NamingLens;
import com.android.tools.r8.origin.Origin;
@@ -117,7 +117,7 @@
null,
options,
null,
- GraphLense.getIdentityLense(),
+ GraphLens.getIdentityLens(),
InitClassLens.getDefault(),
NamingLens.getIdentityLens(),
null);