Removed all hack for old inliner + test
Fixes https://github.com/JetBrains/kotlin-native/issues/3275
This commit is contained in:
+1
-1
@@ -589,7 +589,7 @@ internal class ModuleDFGBuilder(val context: Context, val irModule: IrModuleFrag
|
||||
DataFlowIR.Node.NewObject(
|
||||
symbolTable.mapFunction(callee),
|
||||
arguments,
|
||||
symbolTable.mapClassReferenceType(callee.constructedClass, false),
|
||||
symbolTable.mapClassReferenceType(callee.constructedClass),
|
||||
value
|
||||
)
|
||||
}
|
||||
|
||||
+3
-6
@@ -500,14 +500,11 @@ internal object DataFlowIR {
|
||||
|
||||
private fun IrClass.isFinal() = modality == Modality.FINAL
|
||||
|
||||
fun mapClassReferenceType(irClass: IrClass, eraseLocalObjects: Boolean = true): Type {
|
||||
fun mapClassReferenceType(irClass: IrClass): Type {
|
||||
// Do not try to devirtualize ObjC classes.
|
||||
if (irClass.module.name == Name.special("<forward declarations>") || irClass.isObjCClass())
|
||||
return Type.Virtual
|
||||
|
||||
if (eraseLocalObjects && irClass.isAnonymousObject)
|
||||
return mapClassReferenceType(irClass.getSuperClassNotAny() ?: context.irBuiltIns.anyClass.owner)
|
||||
|
||||
val isFinal = irClass.isFinal()
|
||||
val isAbstract = irClass.isAbstract()
|
||||
val name = irClass.fqNameForIrSerialization.asString()
|
||||
@@ -556,11 +553,11 @@ internal object DataFlowIR {
|
||||
)
|
||||
}
|
||||
|
||||
fun mapType(type: IrType, eraseLocalObjects: Boolean = true): Type {
|
||||
fun mapType(type: IrType): Type {
|
||||
val binaryType = type.computeBinaryType()
|
||||
return when (binaryType) {
|
||||
is BinaryType.Primitive -> mapPrimitiveBinaryType(binaryType.type)
|
||||
is BinaryType.Reference -> mapClassReferenceType(choosePrimary(binaryType.types.toList()), eraseLocalObjects)
|
||||
is BinaryType.Reference -> mapClassReferenceType(choosePrimary(binaryType.types.toList()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2396,6 +2396,12 @@ standaloneTest("devirtualization_getter_looking_as_box_function") {
|
||||
source = "codegen/devirtualization/getter_looking_as_box_function.kt"
|
||||
}
|
||||
|
||||
standaloneTest("devirtualization_anonymousObject") {
|
||||
goldValue = "zzz\n"
|
||||
flags = ["-opt"]
|
||||
source = "codegen/devirtualization/anonymousObject.kt"
|
||||
}
|
||||
|
||||
standaloneTest("multiargs") {
|
||||
arguments = ["AAA", "BB", "C"]
|
||||
multiRuns = true
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
interface I {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val impl = object : I {
|
||||
override fun foo() { println("zzz") }
|
||||
}
|
||||
|
||||
val delegating = object: I by impl { }
|
||||
|
||||
delegating.foo()
|
||||
}
|
||||
|
||||
fun main() {
|
||||
test()
|
||||
}
|
||||
Reference in New Issue
Block a user