[JS IR] Fix IC invalidation for fake override inline functions

The patch enables the direct dependency between
 fake override inline function and its implementation from the base class.

 Because klibs do not keep a signature of fake override implementation,
 incremental cache can not use the signature index,
 therefore the signature is serialized to a cache file as is.

^KT-51896 Fixed
This commit is contained in:
Alexander Korepanov
2022-06-14 14:56:10 +02:00
committed by Space
parent c6299ee277
commit 644447db84
43 changed files with 524 additions and 36 deletions
@@ -0,0 +1,3 @@
abstract class AbstractClassA {
inline fun funA() = "a-0"
}
@@ -0,0 +1,3 @@
abstract class AbstractClassA {
inline fun funA() = "a-1"
}
@@ -0,0 +1,3 @@
abstract class AbstractClassB : AbstractClassA() {
inline fun funB() = "b-0 ${funA()}"
}
@@ -0,0 +1,3 @@
abstract class AbstractClassB : AbstractClassA() {
inline fun funB() = "b-2"
}
@@ -0,0 +1,3 @@
abstract class AbstractClassC : AbstractClassB() {
inline fun funC() = "c-0 ${funB()}"
}
@@ -0,0 +1,30 @@
STEP 0:
modifications:
U : A.0.kt -> A.kt
U : B.0.kt -> B.kt
U : C.0.kt -> C.kt
added file: A.kt, B.kt, C.kt
STEP 1:
modifications:
U : A.1.kt -> A.kt
modified ir: A.kt
updated inline imports: B.kt, C.kt
STEP 2:
modifications:
U : B.2.kt -> B.kt
modified ir: B.kt
updated inline imports: C.kt
STEP 3:
modifications:
U : A.0.kt -> A.kt
modified ir: A.kt
STEP 4:
modifications:
U : B.0.kt -> B.kt
modified ir: B.kt
updated inline imports: C.kt
STEP 5:
modifications:
U : A.1.kt -> A.kt
modified ir: A.kt
updated inline imports: B.kt, C.kt
@@ -0,0 +1,5 @@
class ClassABC: AbstractClassC() {
inline fun testA() = funA()
inline fun testB() = funB()
inline fun testC() = funC()
}
@@ -0,0 +1,27 @@
fun box(stepId: Int): String {
val a = ClassABC()
when (stepId) {
0, 4 -> {
if (a.testA() != "a-0") return "Fail testA()"
if (a.testB() != "b-0 a-0") return "Fail testB()"
if (a.testC() != "c-0 b-0 a-0") return "Fail testC()"
}
1, 5 -> {
if (a.testA() != "a-1") return "Fail testA()"
if (a.testB() != "b-0 a-1") return "Fail testB()"
if (a.testC() != "c-0 b-0 a-1") return "Fail testC()"
}
2 -> {
if (a.testA() != "a-1") return "Fail testA()"
if (a.testB() != "b-2") return "Fail testB()"
if (a.testC() != "c-0 b-2") return "Fail testC()"
}
3 -> {
if (a.testA() != "a-0") return "Fail testA()"
if (a.testB() != "b-2") return "Fail testB()"
if (a.testC() != "c-0 b-2") return "Fail testC()"
}
else -> return "Unknown"
}
return "OK"
}
@@ -0,0 +1,6 @@
STEP 0:
dependencies: lib1
added file: m.kt, classABC.kt
STEP 1..5:
dependencies: lib1
updated inline imports: m.kt, classABC.kt
@@ -0,0 +1,8 @@
MODULES: lib1, main
STEP 0:
libs: lib1, main
dirty js: lib1, main
STEP 1..5:
libs: lib1, main
dirty js: lib1, main