Reland "Remove uses of definitionFor(DexMethod) from desugaring"
This reverts commit fd7d0f154ef3186ddff3edcce13f731aa0df0da1.
Change-Id: I24fbcb8035d94d1589e99a3c6f3bfa590718fac3
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 670344c..74a31bf 100644
--- a/src/main/java/com/android/tools/r8/graph/DexEncodedMethod.java
+++ b/src/main/java/com/android/tools/r8/graph/DexEncodedMethod.java
@@ -258,6 +258,10 @@
return getReference().name;
}
+ public DexProto getProto() {
+ return getReference().proto;
+ }
+
public DexMethod getReference() {
return method;
}
diff --git a/src/main/java/com/android/tools/r8/graph/DexItemFactory.java b/src/main/java/com/android/tools/r8/graph/DexItemFactory.java
index d61746d..e0beea9 100644
--- a/src/main/java/com/android/tools/r8/graph/DexItemFactory.java
+++ b/src/main/java/com/android/tools/r8/graph/DexItemFactory.java
@@ -1887,6 +1887,10 @@
return createProto(proto.returnType, parameterTypes);
}
+ public DexProto prependHolderToProto(DexMethod method) {
+ return prependTypeToProto(method.holder, method.proto);
+ }
+
public DexProto prependTypeToProto(DexType extraFirstType, DexProto initialProto) {
DexType[] parameterTypes = new DexType[initialProto.parameters.size() + 1];
parameterTypes[0] = extraFirstType;
diff --git a/src/main/java/com/android/tools/r8/ir/code/BasicBlockInstructionListIterator.java b/src/main/java/com/android/tools/r8/ir/code/BasicBlockInstructionListIterator.java
index 50cec6e..57d52df 100644
--- a/src/main/java/com/android/tools/r8/ir/code/BasicBlockInstructionListIterator.java
+++ b/src/main/java/com/android/tools/r8/ir/code/BasicBlockInstructionListIterator.java
@@ -12,6 +12,7 @@
import com.android.tools.r8.graph.DexField;
import com.android.tools.r8.graph.DexString;
import com.android.tools.r8.graph.DexType;
+import com.android.tools.r8.graph.ProgramMethod;
import com.android.tools.r8.ir.analysis.type.TypeAnalysis;
import com.android.tools.r8.ir.analysis.type.TypeElement;
import com.android.tools.r8.ir.code.Phi.RegisterReadType;
@@ -544,12 +545,14 @@
Set<BasicBlock> blocksToRemove,
DexType downcast) {
assert blocksToRemove != null;
- DexType codeHolder = code.method().holder();
- DexType inlineeHolder = inlinee.method().holder();
- if (codeHolder != inlineeHolder && inlinee.method().isOnlyInlinedIntoNestMembers()) {
+ ProgramMethod callerContext = code.context();
+ ProgramMethod calleeContext = inlinee.context();
+ if (callerContext.getHolder() != calleeContext.getHolder()
+ && calleeContext.getDefinition().isOnlyInlinedIntoNestMembers()) {
// Should rewrite private calls to virtual calls.
- assert NestUtils.sameNest(codeHolder, inlineeHolder, appView);
- NestUtils.rewriteNestCallsForInlining(inlinee, codeHolder, appView);
+ assert NestUtils.sameNest(
+ callerContext.getHolderType(), calleeContext.getHolderType(), appView);
+ NestUtils.rewriteNestCallsForInlining(inlinee, callerContext, appView);
}
boolean inlineeCanThrow = canThrow(inlinee);
// Split the block with the invocation into three blocks, where the first block contains all
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/ClassProcessor.java b/src/main/java/com/android/tools/r8/ir/desugar/ClassProcessor.java
index 4737d39..3971c88 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/ClassProcessor.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/ClassProcessor.java
@@ -337,8 +337,7 @@
if (method.isFinal()) {
return false;
}
- return appView.options().desugaredLibraryConfiguration.retargetMethod(method.method, appView)
- != null;
+ return appView.options().desugaredLibraryConfiguration.retargetMethod(method, appView) != null;
}
private boolean dontRewrite(DexClass clazz, DexEncodedMethod method) {
@@ -396,7 +395,7 @@
DexMethod forwardMethod =
targetHolder.isInterface()
? rewriter.defaultAsMethodOfCompanionClass(method)
- : appView.options().desugaredLibraryConfiguration.retargetMethod(method, appView);
+ : appView.options().desugaredLibraryConfiguration.retargetMethod(target, appView);
DexEncodedMethod desugaringForwardingMethod =
DexEncodedMethod.createDesugaringForwardingMethod(
target, clazz, forwardMethod, dexItemFactory);
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/D8NestBasedAccessDesugaring.java b/src/main/java/com/android/tools/r8/ir/desugar/D8NestBasedAccessDesugaring.java
index ba49fc0..bd468b0 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/D8NestBasedAccessDesugaring.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/D8NestBasedAccessDesugaring.java
@@ -65,12 +65,18 @@
Instruction instruction = instructions.next();
if (instruction.isInvokeMethod()) {
InvokeMethod invokeMethod = instruction.asInvokeMethod();
- DexMethod methodCalled = invokeMethod.getInvokedMethod();
- DexEncodedMethod encodedMethodCalled =
- methodCalled.holder.isClassType() ? appView.definitionFor(methodCalled) : null;
- if (encodedMethodCalled != null && invokeRequiresRewriting(encodedMethodCalled, method)) {
- DexMethod bridge = ensureInvokeBridge(encodedMethodCalled);
- if (encodedMethodCalled.isInstanceInitializer()) {
+ DexMethod invokedMethod = invokeMethod.getInvokedMethod();
+ if (!invokedMethod.holder.isClassType()) {
+ continue;
+ }
+ // Since we only need to desugar accesses to private methods, and all accesses to private
+ // methods must be accessing the private method directly on its holder, we can lookup the
+ // method on the holder instead of resolving the method.
+ DexClass holder = appView.definitionForHolder(invokedMethod);
+ DexEncodedMethod definition = invokedMethod.lookupOnClass(holder);
+ if (definition != null && invokeRequiresRewriting(definition, method)) {
+ DexMethod bridge = ensureInvokeBridge(definition);
+ if (definition.isInstanceInitializer()) {
instructions.previous();
Value extraNullValue =
instructions.insertConstNullInstruction(code, appView.options());
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/DesugaredLibraryConfiguration.java b/src/main/java/com/android/tools/r8/ir/desugar/DesugaredLibraryConfiguration.java
index 1590484..a7d5252 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/DesugaredLibraryConfiguration.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/DesugaredLibraryConfiguration.java
@@ -6,6 +6,7 @@
import com.android.tools.r8.errors.CompilationError;
import com.android.tools.r8.graph.AppView;
+import com.android.tools.r8.graph.DexEncodedMethod;
import com.android.tools.r8.graph.DexItemFactory;
import com.android.tools.r8.graph.DexMethod;
import com.android.tools.r8.graph.DexString;
@@ -132,15 +133,15 @@
}
// If the method is retargeted, answers the retargeted method, else null.
- public DexMethod retargetMethod(DexMethod method, AppView<?> appView) {
- Map<DexType, DexType> typeMap = retargetCoreLibMember.get(method.name);
- if (typeMap != null && typeMap.containsKey(method.holder)) {
+ public DexMethod retargetMethod(DexEncodedMethod method, AppView<?> appView) {
+ Map<DexType, DexType> typeMap = retargetCoreLibMember.get(method.getName());
+ if (typeMap != null && typeMap.containsKey(method.getHolderType())) {
return appView
.dexItemFactory()
.createMethod(
- typeMap.get(method.holder),
- appView.dexItemFactory().prependTypeToProto(method.holder, method.proto),
- method.name);
+ typeMap.get(method.getHolderType()),
+ appView.dexItemFactory().prependHolderToProto(method.getReference()),
+ method.getName());
}
return null;
}
diff --git a/src/main/java/com/android/tools/r8/ir/desugar/DesugaredLibraryRetargeter.java b/src/main/java/com/android/tools/r8/ir/desugar/DesugaredLibraryRetargeter.java
index 53ff67e..cfb48f2 100644
--- a/src/main/java/com/android/tools/r8/ir/desugar/DesugaredLibraryRetargeter.java
+++ b/src/main/java/com/android/tools/r8/ir/desugar/DesugaredLibraryRetargeter.java
@@ -55,7 +55,7 @@
// d8 needs to force resolution of given methods to see if the invoke needs to be rewritten.
private final Map<DexString, List<DexMethod>> virtualRewrites = new IdentityHashMap<>();
// Non final virtual library methods requiring generation of emulated dispatch.
- private final Set<DexMethod> emulatedDispatchMethods = Sets.newHashSet();
+ private final Set<DexEncodedMethod> emulatedDispatchMethods = Sets.newIdentityHashSet();
public DesugaredLibraryRetargeter(AppView<?> appView) {
this.appView = appView;
@@ -139,7 +139,7 @@
appView
.options()
.desugaredLibraryConfiguration
- .retargetMethod(dexEncodedMethod.method, appView);
+ .retargetMethod(dexEncodedMethod, appView);
if (retargetMethod != null) {
iterator.replaceCurrentInstruction(
new InvokeStatic(retargetMethod, invoke.outValue(), invoke.arguments()));
@@ -197,8 +197,8 @@
} else if (!encodedMethod.isFinal()) {
// Virtual rewrites require emulated dispatch for inheritance.
// The call is rewritten to the dispatch holder class instead.
- handleEmulateDispatch(appView, encodedMethod.method);
- newHolder = dispatchHolderTypeFor(encodedMethod.method);
+ handleEmulateDispatch(appView, encodedMethod);
+ newHolder = dispatchHolderTypeFor(encodedMethod);
}
}
DexProto proto = encodedMethod.method.proto;
@@ -213,8 +213,7 @@
private DexMethod computeRetargetMethod(DexMethod method, boolean isStatic, DexType newHolder) {
DexItemFactory factory = appView.dexItemFactory();
- DexProto newProto =
- isStatic ? method.proto : factory.prependTypeToProto(method.holder, method.proto);
+ DexProto newProto = isStatic ? method.proto : factory.prependHolderToProto(method);
return factory.createMethod(newHolder, newProto, method.name);
}
@@ -230,7 +229,7 @@
return found;
}
- private void handleEmulateDispatch(AppView<?> appView, DexMethod method) {
+ private void handleEmulateDispatch(AppView<?> appView, DexEncodedMethod method) {
emulatedDispatchMethods.add(method);
if (!appView.options().isDesugaredLibraryCompilation()) {
// Add rewrite rules so keeps rules are correctly generated in the program.
@@ -266,10 +265,10 @@
private void addInterfacesAndForwardingMethods(
ExecutorService executorService, IRConverter converter) throws ExecutionException {
assert !appView.options().isDesugaredLibraryCompilation();
- Map<DexType, List<DexMethod>> map = Maps.newIdentityHashMap();
- for (DexMethod emulatedDispatchMethod : emulatedDispatchMethods) {
- map.putIfAbsent(emulatedDispatchMethod.holder, new ArrayList<>(1));
- map.get(emulatedDispatchMethod.holder).add(emulatedDispatchMethod);
+ Map<DexType, List<DexEncodedMethod>> map = Maps.newIdentityHashMap();
+ for (DexEncodedMethod emulatedDispatchMethod : emulatedDispatchMethods) {
+ map.putIfAbsent(emulatedDispatchMethod.getHolderType(), new ArrayList<>(1));
+ map.get(emulatedDispatchMethod.getHolderType()).add(emulatedDispatchMethod);
}
SortedProgramMethodSet addedMethods = SortedProgramMethodSet.create();
for (DexProgramClass clazz : appView.appInfo().classes()) {
@@ -295,7 +294,8 @@
converter.processMethodsConcurrently(addedMethods, executorService);
}
- private boolean inherit(DexLibraryClass clazz, DexType typeToInherit, Set<DexMethod> retarget) {
+ private boolean inherit(
+ DexLibraryClass clazz, DexType typeToInherit, Set<DexEncodedMethod> retarget) {
DexLibraryClass current = clazz;
while (current.type != appView.dexItemFactory().objectType) {
if (current.type == typeToInherit) {
@@ -316,36 +316,35 @@
private void addInterfacesAndForwardingMethods(
DexProgramClass clazz,
- List<DexMethod> methods,
+ List<DexEncodedMethod> methods,
Consumer<DexEncodedMethod> newForwardingMethodsConsumer) {
// DesugaredLibraryRetargeter emulate dispatch: insertion of a marker interface & forwarding
// methods.
// We cannot use the ClassProcessor since this applies up to 26, while the ClassProcessor
// applies up to 24.
- for (DexMethod dexMethod : methods) {
+ for (DexEncodedMethod method : methods) {
DexType[] newInterfaces =
Arrays.copyOf(clazz.interfaces.values, clazz.interfaces.size() + 1);
- newInterfaces[newInterfaces.length - 1] = dispatchInterfaceTypeFor(dexMethod);
+ newInterfaces[newInterfaces.length - 1] = dispatchInterfaceTypeFor(method);
clazz.interfaces = new DexTypeList(newInterfaces);
- DexEncodedMethod dexEncodedMethod = clazz.lookupVirtualMethod(dexMethod);
- if (dexEncodedMethod == null) {
- DexEncodedMethod newMethod = createForwardingMethod(dexMethod, clazz);
+ if (clazz.lookupVirtualMethod(method.getReference()) == null) {
+ DexEncodedMethod newMethod = createForwardingMethod(method, clazz);
clazz.addVirtualMethod(newMethod);
newForwardingMethodsConsumer.accept(newMethod);
}
}
}
- private DexEncodedMethod createForwardingMethod(DexMethod target, DexClass clazz) {
+ private DexEncodedMethod createForwardingMethod(DexEncodedMethod target, DexClass clazz) {
// NOTE: Never add a forwarding method to methods of classes unknown or coming from
// android.jar
// even if this results in invalid code, these classes are never desugared.
// In desugared library, emulated interface methods can be overridden by retarget lib members.
DexMethod forwardMethod =
appView.options().desugaredLibraryConfiguration.retargetMethod(target, appView);
- assert forwardMethod != null && forwardMethod != target;
+ assert forwardMethod != null && forwardMethod != target.getReference();
return DexEncodedMethod.createDesugaringForwardingMethod(
- appView.definitionFor(target), clazz, forwardMethod, appView.dexItemFactory());
+ target, clazz, forwardMethod, appView.dexItemFactory());
}
private void synthesizeEmulatedDispatchMethods(DexApplication.Builder<?> builder) {
@@ -361,7 +360,7 @@
| Constants.ACC_INTERFACE);
ClassAccessFlags holderAccessFlags =
ClassAccessFlags.fromSharedAccessFlags(Constants.ACC_PUBLIC | Constants.ACC_SYNTHETIC);
- for (DexMethod emulatedDispatchMethod : emulatedDispatchMethods) {
+ for (DexEncodedMethod emulatedDispatchMethod : emulatedDispatchMethods) {
// Dispatch interface.
DexType interfaceType = dispatchInterfaceTypeFor(emulatedDispatchMethod);
DexEncodedMethod itfMethod =
@@ -390,7 +389,7 @@
}
private DexEncodedMethod generateInterfaceDispatchMethod(
- DexMethod emulatedDispatchMethod, DexType interfaceType) {
+ DexEncodedMethod emulatedDispatchMethod, DexType interfaceType) {
MethodAccessFlags flags =
MethodAccessFlags.fromSharedAccessFlags(
Constants.ACC_PUBLIC | Constants.ACC_ABSTRACT | Constants.ACC_SYNTHETIC, false);
@@ -398,13 +397,15 @@
appView
.dexItemFactory()
.createMethod(
- interfaceType, emulatedDispatchMethod.proto, emulatedDispatchMethod.name);
+ interfaceType,
+ emulatedDispatchMethod.getProto(),
+ emulatedDispatchMethod.getName());
return new DexEncodedMethod(
newMethod, flags, DexAnnotationSet.empty(), ParameterAnnotationsList.empty(), null, true);
}
private DexEncodedMethod generateHolderDispatchMethod(
- DexMethod emulatedDispatchMethod, DexType dispatchHolder, DexMethod itfMethod) {
+ DexEncodedMethod emulatedDispatchMethod, DexType dispatchHolder, DexMethod itfMethod) {
// The method should look like:
// static foo(rcvr, arg0, arg1) {
// if (rcvr instanceof interfaceType) {
@@ -423,9 +424,9 @@
DexMethod newMethod =
appView
.dexItemFactory()
- .createMethod(dispatchHolder, desugarMethod.proto, emulatedDispatchMethod.name);
+ .createMethod(dispatchHolder, desugarMethod.proto, emulatedDispatchMethod.getName());
return DexEncodedMethod.toEmulateDispatchLibraryMethod(
- emulatedDispatchMethod.holder,
+ emulatedDispatchMethod.getHolderType(),
newMethod,
desugarMethod,
itfMethod,
@@ -435,7 +436,7 @@
}
private void reportInvalidLibrarySupertype(
- DexLibraryClass libraryClass, Set<DexMethod> retarget) {
+ DexLibraryClass libraryClass, Set<DexEncodedMethod> retarget) {
DexClass dexClass = appView.definitionFor(libraryClass.superType);
String message;
if (dexClass == null) {
@@ -456,15 +457,15 @@
retarget);
}
- private DexType dispatchInterfaceTypeFor(DexMethod method) {
+ private DexType dispatchInterfaceTypeFor(DexEncodedMethod method) {
return dispatchTypeFor(method, "dispatchInterface");
}
- private DexType dispatchHolderTypeFor(DexMethod method) {
+ private DexType dispatchHolderTypeFor(DexEncodedMethod method) {
return dispatchTypeFor(method, "dispatchHolder");
}
- private DexType dispatchTypeFor(DexMethod method, String suffix) {
+ private DexType dispatchTypeFor(DexEncodedMethod method, String suffix) {
String descriptor =
"L"
+ appView
@@ -473,9 +474,9 @@
.getSynthesizedLibraryClassesPackagePrefix()
+ DESUGAR_LIB_RETARGET_CLASS_NAME_PREFIX
+ '$'
- + method.holder.getName()
+ + method.getHolderType().getName()
+ '$'
- + method.name
+ + method.getName()
+ '$'
+ suffix
+ ';';
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 98078c5..27a5224 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
@@ -340,7 +340,7 @@
// retarget or if it just calls a companion class method and rewrite.
DexMethod retargetMethod =
options.desugaredLibraryConfiguration.retargetMethod(
- dexEncodedMethod.method, appView);
+ dexEncodedMethod, appView);
if (retargetMethod == null) {
DexMethod originalCompanionMethod =
instanceAsMethodOfCompanionClass(
@@ -373,7 +373,7 @@
continue;
}
- DexClass clazz = appInfo.definitionFor(method.holder);
+ DexClass clazz = appInfo.definitionForHolder(method);
if (clazz == null) {
// Report missing class since we don't know if it is an interface.
warnMissingType(encodedMethod.method, method.holder);
@@ -383,7 +383,7 @@
"defined in library class " + clazz.toSourceString(),
getMethodOrigin(encodedMethod.method));
}
- DexEncodedMethod directTarget = appView.definitionFor(method);
+ DexEncodedMethod directTarget = clazz.lookupMethod(method);
if (directTarget != null) {
// This can be a private instance method call. Note that the referenced
// method is expected to be in the current class since it is private, but desugaring
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 2586141..58730b9 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
@@ -86,8 +86,9 @@
private DexEncodedMethod lookupOnHolder(
DexMethod method, DexClassAndMethod context, Invoke.Type invokeType) {
- return appView.definitionFor(
- appView.graphLense().lookupMethod(method, context.getReference(), invokeType).getMethod());
+ DexMethod rewritten =
+ appView.graphLense().lookupMethod(method, context.getReference(), invokeType).getMethod();
+ return rewritten.lookupOnClass(appView.definitionForHolder(rewritten));
}
private DexEncodedField lookupOnHolder(DexField field) {
@@ -235,7 +236,7 @@
DexProto proto =
encodedMethod.accessFlags.isStatic()
? method.proto
- : appView.dexItemFactory().prependTypeToProto(method.holder, method.proto);
+ : appView.dexItemFactory().prependHolderToProto(method);
return appView
.dexItemFactory()
.createMethod(method.holder, proto, computeMethodBridgeName(encodedMethod));
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/NestUtils.java b/src/main/java/com/android/tools/r8/ir/optimize/NestUtils.java
index 9db947a..5ee91d0 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/NestUtils.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/NestUtils.java
@@ -10,6 +10,7 @@
import com.android.tools.r8.graph.DexEncodedMethod;
import com.android.tools.r8.graph.DexMethod;
import com.android.tools.r8.graph.DexType;
+import com.android.tools.r8.graph.ProgramMethod;
import com.android.tools.r8.ir.code.IRCode;
import com.android.tools.r8.ir.code.Instruction;
import com.android.tools.r8.ir.code.InstructionListIterator;
@@ -41,42 +42,45 @@
}
public static void rewriteNestCallsForInlining(
- IRCode code, DexType callerHolder, AppView<?> appView) {
+ IRCode code, ProgramMethod callerContext, AppView<?> appView) {
// This method is called when inlining code into the nest member callerHolder.
InstructionListIterator iterator = code.instructionListIterator();
- DexClass callerHolderClass = appView.definitionFor(callerHolder);
- assert callerHolderClass != null;
- assert code.method().holder() != callerHolder;
+ assert code.context().getHolder() != callerContext.getHolder();
while (iterator.hasNext()) {
Instruction instruction = iterator.next();
if (instruction.isInvokeDirect()) {
InvokeDirect invoke = instruction.asInvokeDirect();
DexMethod method = invoke.getInvokedMethod();
- DexEncodedMethod encodedMethod = appView.definitionFor(method);
+ DexClass holder = appView.definitionForHolder(method);
+ DexEncodedMethod encodedMethod = method.lookupOnClass(holder);
if (encodedMethod != null && !encodedMethod.isInstanceInitializer()) {
assert encodedMethod.isPrivateMethod();
// Call to private method which has now to be interface/virtual
// (Now call to nest member private method).
if (invoke.getInterfaceBit()) {
iterator.replaceCurrentInstruction(
- new InvokeInterface(method, invoke.outValue(), invoke.inValues()));
+ new InvokeInterface(method, invoke.outValue(), invoke.arguments()));
} else {
iterator.replaceCurrentInstruction(
- new InvokeVirtual(method, invoke.outValue(), invoke.inValues()));
+ new InvokeVirtual(method, invoke.outValue(), invoke.arguments()));
}
}
} else if (instruction.isInvokeInterface() || instruction.isInvokeVirtual()) {
InvokeMethod invoke = instruction.asInvokeMethod();
DexMethod method = invoke.getInvokedMethod();
- if (method.holder == callerHolder) {
- DexEncodedMethod encodedMethod = appView.definitionFor(method);
+ if (method.holder == callerContext.getHolderType()) {
+ DexClass holder = appView.definitionForHolder(method);
+ DexEncodedMethod encodedMethod = method.lookupOnClass(holder);
if (encodedMethod != null && encodedMethod.isPrivateMethod()) {
// Interface/virtual nest member call to private method,
// which has now to be a direct call
// (Now call to same class private method).
iterator.replaceCurrentInstruction(
new InvokeDirect(
- method, invoke.outValue(), invoke.inValues(), callerHolderClass.isInterface()));
+ method,
+ invoke.outValue(),
+ invoke.arguments(),
+ callerContext.getHolder().isInterface()));
}
}
}
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 c5cd89d..e03bc6b 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
@@ -768,9 +768,7 @@
+ "$"
+ method.name.toString());
DexProto proto =
- encodedMethod.isStatic()
- ? method.proto
- : factory.prependTypeToProto(method.holder, method.proto);
+ encodedMethod.isStatic() ? method.proto : factory.prependHolderToProto(method);
DexMethod newMethod = factory.createMethod(newHolder, fixupProto(proto), newMethodName);
lensBuilder.move(method, encodedMethod.isStatic(), newMethod, true);
encodedMethod.accessFlags.promoteToPublic();
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 bd3b4f8..79d472d 100644
--- a/src/main/java/com/android/tools/r8/shaking/VerticalClassMerger.java
+++ b/src/main/java/com/android/tools/r8/shaking/VerticalClassMerger.java
@@ -997,9 +997,7 @@
&& !methodPoolForTarget.hasSeen(
MethodSignatureEquivalence.get().wrap(method)),
Rename.ALWAYS,
- appView
- .dexItemFactory()
- .prependTypeToProto(virtualMethod.holder(), virtualMethod.method.proto));
+ appView.dexItemFactory().prependHolderToProto(virtualMethod.getReference()));
makeStatic(resultingDirectMethod);
// Update method pool collection now that we are adding a new public method.
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 b42920e..35e4614 100644
--- a/src/main/java/com/android/tools/r8/utils/InternalOptions.java
+++ b/src/main/java/com/android/tools/r8/utils/InternalOptions.java
@@ -867,7 +867,7 @@
DexType libraryType,
DexType invalidSuperType,
String message,
- Set<DexMethod> retarget) {
+ Set<DexEncodedMethod> retarget) {
if (invalidLibraryClasses.add(invalidSuperType)) {
reporter.warning(
new InvalidLibrarySuperclassDiagnostic(
@@ -875,7 +875,7 @@
Reference.classFromDescriptor(libraryType.toDescriptorString()),
Reference.classFromDescriptor(invalidSuperType.toDescriptorString()),
message,
- ListUtils.map(retarget, DexMethod::asMethodReference)));
+ ListUtils.map(retarget, method -> method.getReference().asMethodReference())));
}
}