Removed old default generation
This commit is contained in:
@@ -676,15 +676,6 @@ public class FunctionCodegen {
|
|||||||
generateDefaultImplBody(owner, functionDescriptor, mv, loadStrategy, function, memberCodegen, defaultMethod);
|
generateDefaultImplBody(owner, functionDescriptor, mv, loadStrategy, function, memberCodegen, defaultMethod);
|
||||||
endVisit(mv, "default method", getSourceFromDescriptor(functionDescriptor));
|
endVisit(mv, "default method", getSourceFromDescriptor(functionDescriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
generateOldDefaultForFun(defaultMethod,
|
|
||||||
JvmDeclarationOriginKt.Synthetic(function, functionDescriptor),
|
|
||||||
flags,
|
|
||||||
getThrownExceptions(functionDescriptor, typeMapper),
|
|
||||||
(owner.getContextKind() == OwnerKind.DEFAULT_IMPLS ?
|
|
||||||
typeMapper.mapDefaultImpls((ClassDescriptor) functionDescriptor.getContainingDeclaration()) :
|
|
||||||
typeMapper.mapImplementationOwner(functionDescriptor)).getInternalName()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -767,38 +758,6 @@ public class FunctionCodegen {
|
|||||||
iv.visitLabel(end);
|
iv.visitLabel(end);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateOldDefaultForFun(
|
|
||||||
Method newDefaultMethod,
|
|
||||||
JvmDeclarationOrigin origin,
|
|
||||||
int flags,
|
|
||||||
String[] exceptions,
|
|
||||||
String owner
|
|
||||||
) {
|
|
||||||
if ("<init>".equals(newDefaultMethod.getName())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String oldSignature = newDefaultMethod.getDescriptor().replaceFirst("Ljava/lang/Object;\\)", ")");
|
|
||||||
MethodVisitor mv = v.newMethod(
|
|
||||||
origin,
|
|
||||||
flags,
|
|
||||||
newDefaultMethod.getName(),
|
|
||||||
oldSignature,
|
|
||||||
null,
|
|
||||||
exceptions
|
|
||||||
);
|
|
||||||
mv.visitCode();
|
|
||||||
int index = 0;
|
|
||||||
InstructionAdapter iv = new InstructionAdapter(mv);
|
|
||||||
for (Type type: Type.getArgumentTypes(oldSignature)) {
|
|
||||||
iv.load(index, type);
|
|
||||||
index += type.getSize();
|
|
||||||
}
|
|
||||||
iv.aconst(null);
|
|
||||||
iv.visitMethodInsn(Opcodes.INVOKESTATIC, owner, newDefaultMethod.getName(), newDefaultMethod.getDescriptor(), false);
|
|
||||||
iv.areturn(newDefaultMethod.getReturnType());
|
|
||||||
mv.visitEnd();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static FrameMap createFrameMap(
|
private static FrameMap createFrameMap(
|
||||||
@NotNull GenerationState state,
|
@NotNull GenerationState state,
|
||||||
|
|||||||
+1
-1
@@ -9,5 +9,5 @@ class A {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Test argument reordering when call site argument order differs from declaration one: 18 + 1 for super call check
|
// Test argument reordering when call site argument order differs from declaration one: 18 + 1 for super call check
|
||||||
// 19 LOAD
|
// 13 LOAD
|
||||||
// 5 STORE
|
// 5 STORE
|
||||||
+1
-1
@@ -8,5 +8,5 @@ class A {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Test there is no argument reordering when call site argument order same as declaration one: 15 + 1 for super call check
|
// Test there is no argument reordering when call site argument order same as declaration one: 15 + 1 for super call check
|
||||||
// 16 LOAD
|
// 10 LOAD
|
||||||
// 2 STORE
|
// 2 STORE
|
||||||
+1
-1
@@ -14,4 +14,4 @@ interface A {
|
|||||||
|
|
||||||
// 1 foo\(
|
// 1 foo\(
|
||||||
// 1 getProp
|
// 1 getProp
|
||||||
// 3 defaultFun\$
|
// 1 defaultFun\$
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
fun foo(a: Int = 1) {}
|
fun foo(a: Int = 1) {}
|
||||||
|
|
||||||
// 0 _DefaultPackage.foo
|
// 0 _DefaultPackage.foo
|
||||||
// 2 INVOKESTATIC TopLevelFunWithDefaultArgsKt\.foo
|
// 1 INVOKESTATIC TopLevelFunWithDefaultArgsKt\.foo
|
||||||
|
|||||||
Reference in New Issue
Block a user