Psi2ir: do not sort descriptors for fake override generation

Descriptors are already supposed to be sorted in scopes. The problem is
that rendering descriptors for sorting takes a lot of time (~1.5% of
total compilation time of intellij with JVM IR), and simple heuristics,
like comparing by names first, don't fully help with it.

 #KT-48233
This commit is contained in:
Alexander Udalov
2021-08-26 00:11:00 +02:00
parent cc52832943
commit ffe0d9de70
59 changed files with 2205 additions and 2242 deletions
@@ -1,9 +1,9 @@
interface IBase<T : Any?> {
abstract fun foo(x: Int)
abstract fun foo(x: Int)
abstract val bar: Int
abstract get
abstract fun <X : Any?> qux(t: T, x: X)
abstract fun <X : Any?> qux(t: T, x: X)
}
@@ -15,18 +15,17 @@ class Test<TT : Any?> : IBase<TT> {
}
private /* final field */ val $$delegate_0: IBase<TT> = impl
override fun <X : Any?> qux(t: TT, x: X) {
<this>.#$$delegate_0.qux<X>(t = t, x = x)
}
override fun foo(x: Int) {
<this>.#$$delegate_0.foo(x = x)
}
override val bar: Int
override get(): Int {
return <this>.#$$delegate_0.<get-bar>()
}
}
override fun foo(x: Int) {
<this>.#$$delegate_0.foo(x = x)
}
override fun <X : Any?> qux(t: TT, x: X) {
<this>.#$$delegate_0.qux<X>(t = t, x = x)
}
}
@@ -38,6 +38,29 @@ FILE fqName:<root> fileName:/delegatedMembers.kt
FIELD DELEGATE name:$$delegate_0 type:<root>.IBase<TT of <root>.Test> visibility:private [final]
EXPRESSION_BODY
GET_VAR 'impl: <root>.IBase<TT of <root>.Test> declared in <root>.Test.<init>' type=<root>.IBase<TT of <root>.Test> origin=null
PROPERTY DELEGATED_MEMBER name:bar visibility:public modality:OPEN [val]
overridden:
public abstract bar: kotlin.Int [val]
FUN DELEGATED_MEMBER name:<get-bar> visibility:public modality:OPEN <> ($this:<root>.Test<TT of <root>.Test>) returnType:kotlin.Int
correspondingProperty: PROPERTY DELEGATED_MEMBER name:bar visibility:public modality:OPEN [val]
overridden:
public abstract fun <get-bar> (): kotlin.Int declared in <root>.IBase
$this: VALUE_PARAMETER name:<this> type:<root>.Test<TT of <root>.Test>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun <get-bar> (): kotlin.Int declared in <root>.Test'
CALL 'public abstract fun <get-bar> (): kotlin.Int declared in <root>.IBase' type=kotlin.Int origin=null
$this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.IBase<TT of <root>.Test> visibility:private [final]' type=<root>.IBase<TT of <root>.Test> origin=null
receiver: GET_VAR '<this>: <root>.Test<TT of <root>.Test> declared in <root>.Test.<get-bar>' type=<root>.Test<TT of <root>.Test> origin=null
FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:<root>.Test<TT of <root>.Test>, x:kotlin.Int) returnType:kotlin.Unit
overridden:
public abstract fun foo (x: kotlin.Int): kotlin.Unit declared in <root>.IBase
$this: VALUE_PARAMETER name:<this> type:<root>.Test<TT of <root>.Test>
VALUE_PARAMETER name:x index:0 type:kotlin.Int
BLOCK_BODY
CALL 'public abstract fun foo (x: kotlin.Int): kotlin.Unit declared in <root>.IBase' type=kotlin.Unit origin=null
$this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.IBase<TT of <root>.Test> visibility:private [final]' type=<root>.IBase<TT of <root>.Test> origin=null
receiver: GET_VAR '<this>: <root>.Test<TT of <root>.Test> declared in <root>.Test.foo' type=<root>.Test<TT of <root>.Test> origin=null
x: GET_VAR 'x: kotlin.Int declared in <root>.Test.foo' type=kotlin.Int origin=null
FUN DELEGATED_MEMBER name:qux visibility:public modality:OPEN <X> ($this:<root>.Test<TT of <root>.Test>, t:TT of <root>.Test, x:X of <root>.Test.qux) returnType:kotlin.Unit
overridden:
public abstract fun qux <X> (t: T of <root>.IBase, x: X of <root>.IBase.qux): kotlin.Unit declared in <root>.IBase
@@ -52,29 +75,6 @@ FILE fqName:<root> fileName:/delegatedMembers.kt
receiver: GET_VAR '<this>: <root>.Test<TT of <root>.Test> declared in <root>.Test.qux' type=<root>.Test<TT of <root>.Test> origin=null
t: GET_VAR 't: TT of <root>.Test declared in <root>.Test.qux' type=TT of <root>.Test origin=null
x: GET_VAR 'x: X of <root>.Test.qux declared in <root>.Test.qux' type=X of <root>.Test.qux origin=null
FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:<root>.Test<TT of <root>.Test>, x:kotlin.Int) returnType:kotlin.Unit
overridden:
public abstract fun foo (x: kotlin.Int): kotlin.Unit declared in <root>.IBase
$this: VALUE_PARAMETER name:<this> type:<root>.Test<TT of <root>.Test>
VALUE_PARAMETER name:x index:0 type:kotlin.Int
BLOCK_BODY
CALL 'public abstract fun foo (x: kotlin.Int): kotlin.Unit declared in <root>.IBase' type=kotlin.Unit origin=null
$this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.IBase<TT of <root>.Test> visibility:private [final]' type=<root>.IBase<TT of <root>.Test> origin=null
receiver: GET_VAR '<this>: <root>.Test<TT of <root>.Test> declared in <root>.Test.foo' type=<root>.Test<TT of <root>.Test> origin=null
x: GET_VAR 'x: kotlin.Int declared in <root>.Test.foo' type=kotlin.Int origin=null
PROPERTY DELEGATED_MEMBER name:bar visibility:public modality:OPEN [val]
overridden:
public abstract bar: kotlin.Int [val]
FUN DELEGATED_MEMBER name:<get-bar> visibility:public modality:OPEN <> ($this:<root>.Test<TT of <root>.Test>) returnType:kotlin.Int
correspondingProperty: PROPERTY DELEGATED_MEMBER name:bar visibility:public modality:OPEN [val]
overridden:
public abstract fun <get-bar> (): kotlin.Int declared in <root>.IBase
$this: VALUE_PARAMETER name:<this> type:<root>.Test<TT of <root>.Test>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public open fun <get-bar> (): kotlin.Int declared in <root>.Test'
CALL 'public abstract fun <get-bar> (): kotlin.Int declared in <root>.IBase' type=kotlin.Int origin=null
$this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.IBase<TT of <root>.Test> visibility:private [final]' type=<root>.IBase<TT of <root>.Test> origin=null
receiver: GET_VAR '<this>: <root>.Test<TT of <root>.Test> declared in <root>.Test.<get-bar>' type=<root>.Test<TT of <root>.Test> origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.IBase